Ruby jad file generation
- Posted on January 6th, 2011 filed in Uncategorized
- Comment now »
Jad bylų generavimas su ruby.
require 'rubygems' require 'zip/zip' filename = "game.jar" res = [ "MIDlet-Jar-URL: #{filename}", "MIDlet-Jar-Size: #{File.size(filename)}" ] valid_params = [ /MIDlet-Name:/, /MIDlet-Version:/, /MIDlet-Vendor:/, /MicroEdition-Profile:/, /MicroEdition-Configuration:/, /MIDlet-\d:/ ] Zip::ZipFile.open(filename) do |fs| fs.read("META-INF/MANIFEST.MF").split("\r\n").each do |line| valid_params.each do |vp| res << line if line =~ vp end end end File.open("#{File.basename(filename, ".jar")}.jad", "wb") do |f| f.write res.join("\r\n") end
Leave a Comment