I just finished the script! But I am still interested if I can change
existing swf files, though.
The source code of the Ruby script is below, it basically scans
recursively through the source-directory
for as files and tries to find the trace(-statement and replaces it my
the logger statement instead. One that
works with logviewer which can except incoming stuff from xmlsocket and
telnet. Really net for client
and server debugging/logging ;)
require 'fileutils'
TRACE_STATEMENT = "trace("
LOGGER_STATEMENT = "com.innerfuse.logging.Loggger.log("
Dir.glob("source/**/*.as").each do |file|
puts "Modifying file: #{file}..."
# make copy of the original file and .bak
replace_file = file
backup_file = file + ".bak"
FileUtils.copy_file( file, backup_file, true)
FileUtils.remove_file( file )
# open the file
File.open( replace_file, "w+" ) do |rf|
replace_count = 0
File.open( backup_file ) do |of|
of.each_line do |line|
rf << line.gsub( TRACE_STATEMENT ) { replace_count+=1;
LOGGER_STATEMENT }
end
end
puts "File replace count: #{replace_count}"
end
end
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org