public DataSegment CreateRawMethodBody() { using (var stream = new MemoryStream()) { var writer = new BinaryStreamWriter(stream); var assembler = new X86Assembler(writer); foreach (var instruction in Instructions) { assembler.Write(instruction); } return(new DataSegment(stream.ToArray())); } }
private static void TestAssembler(IReadOnlyList<X86Instruction> instructions) { var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "test.bin"); using (var stream = File.Create(path)) { var writer = new BinaryStreamWriter(stream); var assembler = new X86Assembler(writer); foreach (var instruction in instructions) assembler.Write(instruction); } ValidateCode(instructions, File.ReadAllBytes(path)); }
public override void Write(WritingContext context) { var assembler = new X86Assembler(context.Writer); foreach (var instruction in Instructions) assembler.Write(instruction); }