Class: Resedit::CodePatch

Inherits:
Object
  • Object
show all
Defined in:
lib/resedit/convert/codepatch.rb

Defined Under Namespace

Classes: Chunk

Constant Summary collapse

FMT_BINARY =
0
FMT_HEXSTRING =
1

Class Method Summary collapse

Class Method Details

.loadPatch(fname, format = FMT_HEXSTRING, chunksplit = "\x90\x90\x90\x90\x90") ⇒ Object



59
60
61
62
63
# File 'lib/resedit/convert/codepatch.rb', line 59

def self.loadPatch(fname, format = FMT_HEXSTRING, chunksplit="\x90\x90\x90\x90\x90")
    chunksplit.force_encoding(Encoding::ASCII_8BIT)
    bytes = File.read(fname, encoding:Encoding::ASCII_8BIT)
    return bytes.split(chunksplit).each.map{|data| CodePatch::Chunk.new(data, format)}
end