Merge branch 'master' of github.com:glenux/xtm-utils
This commit is contained in:
commit
c14a4e64a5
2 changed files with 26 additions and 14 deletions
|
@ -3,6 +3,7 @@ require 'rubygems'
|
||||||
gem 'bindata', '~> 1.2.1'
|
gem 'bindata', '~> 1.2.1'
|
||||||
require 'bindata'
|
require 'bindata'
|
||||||
|
|
||||||
|
# FIXME: set default values for header fields
|
||||||
module XtmFile
|
module XtmFile
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,16 +1,27 @@
|
||||||
|
|
||||||
|
require 'xtmfile/header'
|
||||||
|
|
||||||
module XtmFile
|
module XtmFile
|
||||||
class Splitter
|
class Splitter
|
||||||
attr_reader :parts, :parts_size
|
attr_reader :parts_size
|
||||||
def initialize input_filename
|
def initialize input_filename
|
||||||
@input_filename = input_filename
|
@input_filename = input_filename
|
||||||
@parts = 0
|
|
||||||
@parts_size = 0
|
# create and initialize header
|
||||||
|
@header = Header.new
|
||||||
|
@header.filename_str = @input_filename
|
||||||
end
|
end
|
||||||
|
|
||||||
def parts= count
|
def parts= count
|
||||||
|
@header.filecount = count
|
||||||
|
@parts_size = @header.filesize / count
|
||||||
end
|
end
|
||||||
|
|
||||||
def parts_size= size
|
def parts_size= size
|
||||||
|
count = @header.filesize / size
|
||||||
|
remain = @header.filesize % size
|
||||||
|
count += 1 if remain > 0
|
||||||
|
@header.filecount = count
|
||||||
end
|
end
|
||||||
|
|
||||||
def start
|
def start
|
||||||
|
|
Loading…
Reference in a new issue