Ejemplo n.º 1
0
		public CodeWriter (ReflectionWriter reflectWriter, MemoryBinaryWriter writer)
		{
			m_reflectWriter = reflectWriter;
			m_binaryWriter = writer;
			m_codeWriter = new MemoryBinaryWriter ();

			m_localSigCache = new Hashtable ();
		}
Ejemplo n.º 2
0
 public ReflectionController(ModuleDefinition module)
 {
     m_reader = new AggressiveReflectionReader (module);
     m_writer = new ReflectionWriter (module);
     m_helper = new ReflectionHelper (module);
 }
Ejemplo n.º 3
0
		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 ();
		}