Project1
标题:
测试
[打印本页]
作者:
小传子
时间:
2012-7-5 13:46
标题:
测试
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
#测试完毕
复制代码
作者:
yangff
时间:
2012-7-5 22:25
这脚本好熟啊,你从哪里抄的?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1