本帖最后由 Sion 于 2014-5-6 11:50 编辑
output_directory = "ScriptTexts" # 输出目录 Dir.mkdir(output_directory) unless File.directory?(output_directory) load_data("Data/Scripts.rvdata2").each_with_index {|script, index| tag = script[1] unless tag.empty? contents = Zlib::Inflate.inflate(script[2].force_encoding("utf-8")) unless contents.empty? tag = tag.gsub(/[\\\/\:\"\?\*\<\>\|]/) {'_'} name = sprintf("#{output_directory}/[%04d]#{tag}.txt", index) txt = File.open(name, "wb") txt.write(contents) txt.close end end }
output_directory = "ScriptTexts" # 输出目录
Dir.mkdir(output_directory) unless File.directory?(output_directory)
load_data("Data/Scripts.rvdata2").each_with_index {|script, index|
tag = script[1]
unless tag.empty?
contents = Zlib::Inflate.inflate(script[2].force_encoding("utf-8"))
unless contents.empty?
tag = tag.gsub(/[\\\/\:\"\?\*\<\>\|]/) {'_'}
name = sprintf("#{output_directory}/[%04d]#{tag}.txt", index)
txt = File.open(name, "wb")
txt.write(contents)
txt.close
end
end
}
靠,居然有人先弄了。
我觉得我花在写这段代码上的时间,已经足够手工把它们复制出来几十次了。 |