Inheritance: Mono.Cecil.Metadata.BaseMetadataRowVisitor
Exemplo n.º 1
0
		public MetadataTableWriter (MetadataWriter mrv, MemoryBinaryWriter writer)
		{
			m_root = mrv.GetMetadataRoot ();
			m_heap = m_root.Streams.TablesHeap;
			m_binaryWriter = writer;
			m_mrrw = new MetadataRowWriter (this);
		}
Exemplo n.º 2
0
 public MetadataTableWriter(MetadataWriter mrv, MemoryBinaryWriter writer)
 {
     m_root         = mrv.GetMetadataRoot();
     m_heap         = m_root.Streams.TablesHeap;
     m_binaryWriter = writer;
     m_mrrw         = new MetadataRowWriter(this);
 }
Exemplo n.º 3
0
		public override void VisitAssemblyDefinition (AssemblyDefinition asm)
		{
			if (asm.Kind != AssemblyKind.Dll && asm.EntryPoint == null)
				throw new ReflectionException ("Assembly does not have an entry point defined");

			if ((asm.MainModule.Image.CLIHeader.Flags & RuntimeImage.ILOnly) == 0)
				throw new NotSupportedException ("Can not write a mixed mode assembly");

			foreach (ModuleDefinition module in asm.Modules)
				if (module.Image.CLIHeader.Metadata.VirtualAddress != RVA.Zero)
					ResetImage (module);

			asm.MetadataToken = new MetadataToken (TokenType.Assembly, 1);
			ReflectionWriter rw = asm.MainModule.Controller.Writer;
			rw.StructureWriter = this;

			m_mdWriter = rw.MetadataWriter;
			m_tableWriter = rw.MetadataTableWriter;
			m_rowWriter = rw.MetadataRowWriter;

			if (!rw.SaveSymbols)
				return;

			FileStream fs = m_binaryWriter.BaseStream as FileStream;
			if (fs != null)
				rw.OutputFile = fs.Name;
		}
Exemplo n.º 4
0
		public override void VisitAssemblyDefinition (AssemblyDefinition asm)
		{
			if (asm.Kind != AssemblyKind.Dll && asm.EntryPoint == null)
				throw new ReflectionException ("Assembly does not have an entry point defined");

			if ((asm.MainModule.Image.CLIHeader.Flags & RuntimeImage.ILOnly) == 0)
				throw new NotImplementedException ("Can not write a mixed mode assembly");

			foreach (ModuleDefinition module in asm.Modules)
				if (module.Image.CLIHeader.Metadata.VirtualAddress != RVA.Zero)
					ResetImage (module);

			ReflectionWriter rw = asm.MainModule.Controller.Writer;
			rw.StructureWriter = this;

			m_mdWriter = rw.MetadataWriter;
			m_tableWriter = rw.MetadataTableWriter;
			m_rowWriter = rw.MetadataRowWriter;
		}
Exemplo n.º 5
0
        void Initialize()
        {
            m_mdWriter = new MetadataWriter (
                m_mod.Assembly,
                m_mod.Image.MetadataRoot,
                m_structureWriter.Assembly.Kind,
                m_mod.Assembly.Runtime,
                m_structureWriter.GetWriter ());
            m_tableWriter = m_mdWriter.GetTableVisitor ();
            m_rowWriter = m_tableWriter.GetRowVisitor () as MetadataRowWriter;
            m_sigWriter = new SignatureWriter (m_mdWriter);
            m_codeWriter = new CodeWriter (this, m_mdWriter.CilWriter);

            m_typeDefStack = new ArrayList ();
            m_methodStack = new ArrayList ();
            m_fieldStack = new ArrayList ();
            m_genericParamStack = new ArrayList ();
            m_typeSpecCache = new Hashtable ();

            m_methodIndex = 1;
            m_fieldIndex = 1;
            m_paramIndex = 1;
            m_eventIndex = 1;
            m_propertyIndex = 1;

            m_constWriter = new MemoryBinaryWriter ();
        }