赞 | 0 |
VIP | 298 |
好人卡 | 70 |
积分 | 8 |
经验 | 135648 |
最后登录 | 2018-10-11 |
在线时间 | 6267 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 799
- 在线时间
- 6267 小时
- 注册时间
- 2006-6-7
- 帖子
- 8462
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- def self.next_file(path)
- Dir.chdir(@old_dir)
- Dir.chdir(path) if path != ""
- for f in Dir["*"]
- if FileTest.directory?(f)
- @path = @path + f + "/"
- self.next_file(@path)
- else
- if @resource_type.include? f.split(/\./)[1]
- @dump_filenames.push @path + f
- end
- end
- end
- path_a = path.split(/\//)
- @path = ""
- for i in 0...path_a.size - 1
- @path += path_a[i] + "/"
- end
- Dir.chdir(@old_dir)
- Dir.chdir(@path) if @path != ""
- end
-
- #--------------------------------------------------------------------------
- # ● 包的生成
- #--------------------------------------------------------------------------
- def self.make(filenames)
- database = File.open("data_package.dat","wb")
- resource_list = "resource_list = {\n"
- begin
- for name in filenames
- begin
- fr = File.open(name,"rb")
- code = fr.read
- posop = database.pos
- database.write Zlib::Deflate.deflate(code,9)
- posed = database.pos
- resource_list += sprintf("%s=>[%d,%d],\n","\"#{name.split(/\./)[0]}\"",posop,posed)
- rescue
- print "\"#{name}\" can't open"
- ensure
- fr.close
- end
- end
- ensure
- resource_list.slice!(resource_list.size-2,1)
- resource_list += "}\n"
- eval resource_list
- save_data(resource_list,"resource_list.inf")
- database.close
- p 'make done'
- exit
- end
- end
-
- end
- #测试完毕
复制代码 |
|