예제 #1
0
        private void WriteAssemblyDefinition(CilAssembly assembly)
        {
            WriteIndentation();
            _writer.Write(".assembly ");
            _writer.Write(assembly.Flags);
            _writer.WriteLine(assembly.Name);
            WriteIndentation();
            _writer.WriteLine('{');
            Indent();

            foreach (var attribute in assembly.CustomAttributes)
            {
                attribute.Accept(this);
            }
            _writer.WriteLine();
            _writer.WriteLine();

            WriteIndentation();
            _writer.Write(".hash algorithm ");
            _writer.WriteLine(assembly.GetFormattedHashAlgorithm());

            if (assembly.HasPublicKey)
            {
                WriteIndentation();
                _writer.Write(".publickey = ");
                _writer.WriteLine(assembly.GetPublicKeyString());
            }

            if (assembly.HasCulture)
            {
                WriteIndentation();
                _writer.Write(".locale ");
                _writer.WriteLine("'{0}'", assembly.Culture);
            }

            WriteIndentation();
            _writer.WriteLine(string.Format(".ver {0}", assembly.GetFormattedVersion()));
            Unindent();
            WriteIndentation();
            _writer.WriteLine('}');
            WriteIndentation();
            _writer.Write(".module ");
            _writer.WriteLine(assembly.ModuleDefinition.Name);
            WriteIndentation();
            _writer.WriteLine(string.Format(".imagebase 0x{0:X8}", assembly.HeaderOptions.ImageBase));
            WriteIndentation();
            _writer.WriteLine(string.Format(".file alignment 0x{0:X8}", assembly.HeaderOptions.FileAlignment));
            WriteIndentation();
            _writer.WriteLine(string.Format(".stackreserve 0x{0:X8}", assembly.HeaderOptions.StackReserve));
            WriteIndentation();
            _writer.WriteLine(string.Format(".subsystem 0x{0:X}", assembly.HeaderOptions.SubSystem));
            WriteIndentation();
            _writer.WriteLine(string.Format(".corflags 0x{0:X}", assembly.HeaderOptions.Corflags));
        }
예제 #2
0
        private void WriteAssemblyDefinition(CilAssembly assembly)
        {
            WriteIndentation();
            _writer.Write(".assembly ");
            _writer.Write(assembly.Flags);
            _writer.WriteLine(assembly.Name);
            WriteIndentation();
            _writer.WriteLine('{');
            Indent();

            foreach (var attribute in assembly.CustomAttributes)
            {
                attribute.Accept(this);
            }
            _writer.WriteLine();
            _writer.WriteLine();

            WriteIndentation();
            _writer.Write(".hash algorithm ");
            _writer.WriteLine(assembly.GetFormattedHashAlgorithm());

            if (assembly.HasPublicKey)
            {
                WriteIndentation();
                _writer.Write(".publickey = ");
                _writer.WriteLine(assembly.GetPublicKeyString());
            }

            if (assembly.HasCulture)
            {
                WriteIndentation();
                _writer.Write(".locale ");
                _writer.WriteLine("'{0}'", assembly.Culture);
            }

            WriteIndentation();
            _writer.WriteLine(string.Format(".ver {0}", assembly.GetFormattedVersion()));
            Unindent();
            WriteIndentation();
            _writer.WriteLine('}');
            WriteIndentation();
            _writer.Write(".module ");
            _writer.WriteLine(assembly.ModuleDefinition.Name);
            WriteIndentation();
            _writer.WriteLine(string.Format(".imagebase 0x{0:X8}", assembly.HeaderOptions.ImageBase));
            WriteIndentation();
            _writer.WriteLine(string.Format(".file alignment 0x{0:X8}", assembly.HeaderOptions.FileAlignment));
            WriteIndentation();
            _writer.WriteLine(string.Format(".stackreserve 0x{0:X8}", assembly.HeaderOptions.StackReserve));
            WriteIndentation();
            _writer.WriteLine(string.Format(".subsystem 0x{0:X}", assembly.HeaderOptions.SubSystem));
            WriteIndentation();
            _writer.WriteLine(string.Format(".corflags 0x{0:X}", assembly.HeaderOptions.Corflags));
        }