static ImageReader Read(Image img, Stream stream) { ImageReader reader = new ImageReader(img, new BinaryReader(stream)); img.Accept(reader); return(reader); }
public static Image CreateImage() { Image img = new Image(); ImageInitializer init = new ImageInitializer(img); img.Accept(init); return(img); }
public static Image CreateImage () { Image img = new Image (); ImageInitializer init = new ImageInitializer (img); img.Accept (init); return img; }
static ImageReader Read(Image img, Stream stream) { ImageReader reader = new ImageReader (img, new BinaryReader (stream)); img.Accept (reader); return reader; }
void CopyOriginalImage () { original = assembly.MainModule.Image; stripped = Image.CreateImage(); stripped.Accept (new CopyImageVisitor (original)); assembly.MainModule.Image = stripped; original_tables = original.MetadataRoot.Streams.TablesHeap; stripped_tables = stripped.MetadataRoot.Streams.TablesHeap; TableCollection tables = original_tables.Tables; foreach (IMetadataTable table in tables) stripped_tables.Tables.Add(table); stripped_tables.Valid = original_tables.Valid; stripped_tables.Sorted = original_tables.Sorted; reflection_writer = new ReflectionWriter (assembly.MainModule); reflection_writer.StructureWriter = new StructureWriter (assembly, writer); reflection_writer.CodeWriter.Stripped = true; metadata_writer = reflection_writer.MetadataWriter; PatchHeap (metadata_writer.StringWriter, original.MetadataRoot.Streams.StringsHeap); PatchHeap (metadata_writer.GuidWriter, original.MetadataRoot.Streams.GuidHeap); PatchHeap (metadata_writer.UserStringWriter, original.MetadataRoot.Streams.UserStringsHeap); PatchHeap (metadata_writer.BlobWriter, original.MetadataRoot.Streams.BlobHeap); if (assembly.EntryPoint != null) metadata_writer.EntryPointToken = assembly.EntryPoint.MetadataToken.ToUInt (); }