class OpenRAReplay::Sanitize::ReplaySanitizer
Attributes
in_file[R]
out_file[R]
packet_sanitizer[R]
Public Class Methods
new(in_name, out_name, opts = {})
click to toggle source
# File lib/openrareplay/sanitize/replay_sanitizer.rb, line 29 def initialize(in_name, out_name, opts = {}) @in_file = in_name @out_file = out_name @packet_sanitizer = OpenRAReplay::Sanitize::PacketSanitizer.new opts end
Public Instance Methods
sanitize()
click to toggle source
# File lib/openrareplay/sanitize/replay_sanitizer.rb, line 35 def sanitize File.open(out_file, 'wb') do |output_file| File.open(in_file, 'rb') do |input_file| packet_parser = OpenRAReplay::PacketParser.new(input_file) until packet_parser.eof? packet_parser.read_packet do |packet| next if packet.unknown? np = packet_sanitizer.sanitize_packet packet output_file.write np.byte_array end end end end end