Ejemplo n.º 1
0
        /// <inheritdoc/>
        public virtual void WriteShort(IDecompilerOutput output, ILanguage language, bool showOffset)
        {
            language.WriteCommentBegin(output, true);
            output.WriteOffsetComment(this, showOffset);
            const string LTR = "\u200E";

            output.Write(NameUtilities.CleanName(Name) + LTR, this, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
            string extra = null;

            switch (Resource.ResourceType)
            {
            case ResourceType.AssemblyLinked:
                extra = ((AssemblyLinkedResource)Resource).Assembly.FullName;
                break;

            case ResourceType.Linked:
                var file = ((LinkedResource)Resource).File;
                extra = string.Format("{0}, {1}, {2}", file.Name, file.ContainsNoMetaData ? "ContainsNoMetaData" : "ContainsMetaData", SimpleTypeConverter.ByteArrayToString(file.HashValue));
                break;

            case ResourceType.Embedded:
                extra = string.Format(dnSpy_Contracts_DnSpy_Resources.NumberOfBytes, ((EmbeddedResource)Resource).Data.Length);
                break;
            }
            output.Write(string.Format(" ({0}{1}, {2})", extra == null ? string.Empty : string.Format("{0}, ", extra), Resource.ResourceType, Resource.Attributes), BoxedTextColor.Comment);
            language.WriteCommentEnd(output, true);
            output.WriteLine();
        }
Ejemplo n.º 2
0
 protected void WriteCommentLineDeclaringType(IDecompilerOutput output, IMemberDef member)
 {
     WriteCommentBegin(output, true);
     output.Write(TypeToString(member.DeclaringType, includeNamespace: true), member.DeclaringType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
     WriteCommentEnd(output, true);
     output.WriteLine();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Writes a comment and a new line
 /// </summary>
 /// <param name="self">This</param>
 /// <param name="output">Output</param>
 /// <param name="comment">Comment</param>
 public static void WriteCommentLine(this IDecompiler self, IDecompilerOutput output, string comment)
 {
     self.WriteCommentBegin(output, true);
     output.Write(comment, BoxedTextColor.Comment);
     self.WriteCommentEnd(output, true);
     output.WriteLine();
 }
Ejemplo n.º 4
0
		public override void Decompile(MethodDef method, IDecompilerOutput output, DecompilationContext ctx) {
			WriteCommentBegin(output, true);
			output.Write("Method: ", BoxedTextColor.Comment);
			output.Write(IdentifierEscaper.Escape(method.FullName), method, DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
			WriteCommentEnd(output, true);
			output.WriteLine();

			if (!method.HasBody) {
				return;
			}

			StartKeywordBlock(output, ".body", method);

			ILAstBuilder astBuilder = new ILAstBuilder();
			ILBlock ilMethod = new ILBlock();
			DecompilerContext context = new DecompilerContext(method.Module, MetadataTextColorProvider) { CurrentType = method.DeclaringType, CurrentMethod = method };
			ilMethod.Body = astBuilder.Build(method, inlineVariables, context);

			if (abortBeforeStep != null) {
				new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
			}

			if (context.CurrentMethodIsAsync) {
				output.Write("async", BoxedTextColor.Keyword);
				output.Write("/", BoxedTextColor.Punctuation);
				output.WriteLine("await", BoxedTextColor.Keyword);
			}

			var allVariables = ilMethod.GetSelfAndChildrenRecursive<ILExpression>().Select(e => e.Operand as ILVariable)
				.Where(v => v != null && !v.IsParameter).Distinct();
			foreach (ILVariable v in allVariables) {
				output.Write(IdentifierEscaper.Escape(v.Name), v, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, v.IsParameter ? BoxedTextColor.Parameter : BoxedTextColor.Local);
				if (v.Type != null) {
					output.Write(" ", BoxedTextColor.Text);
					output.Write(":", BoxedTextColor.Punctuation);
					output.Write(" ", BoxedTextColor.Text);
					if (v.IsPinned) {
						output.Write("pinned", BoxedTextColor.Keyword);
						output.Write(" ", BoxedTextColor.Text);
					}
					v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
				}
				if (v.GeneratedByDecompiler) {
					output.Write(" ", BoxedTextColor.Text);
					output.Write("[", BoxedTextColor.Punctuation);
					output.Write("generated", BoxedTextColor.Keyword);
					output.Write("]", BoxedTextColor.Punctuation);
				}
				output.WriteLine();
			}

			var builder = new MethodDebugInfoBuilder(method);
			foreach (ILNode node in ilMethod.Body) {
				node.WriteTo(output, builder);
				if (!node.WritesNewLine)
					output.WriteLine();
			}
			output.AddDebugInfo(builder.Create());
			EndKeywordBlock(output);
		}
Ejemplo n.º 5
0
        protected override void DecompileFields(IDecompiler decompiler, IDecompilerOutput output)
        {
            decompiler.WriteCommentLine(output, string.Empty);
            decompiler.WriteCommentBegin(output, true);
            WriteHeader(output);
            decompiler.WriteCommentEnd(output, true);
            output.WriteLine();

            for (int i = 0; i < (int)MetadataTableVM.Rows; i++)
            {
                var obj = MetadataTableVM.Get(i);
                decompiler.WriteCommentBegin(output, true);
                Write(output, obj);
                decompiler.WriteCommentEnd(output, true);
                output.WriteLine();
            }
        }
Ejemplo n.º 6
0
        public void Disassemble(ModuleDef module, BamlDocument document)
        {
            WriteText("Signature:      \t");
            WriteString(document.Signature);
            output.WriteLine();

            WriteText("Reader Version: \t");
            WriteVersion(document.ReaderVersion);
            output.WriteLine();

            WriteText("Updater Version:\t");
            WriteVersion(document.UpdaterVersion);
            output.WriteLine();

            WriteText("Writer Version: \t");
            WriteVersion(document.WriterVersion);
            output.WriteLine();

            WriteText("Record #:       \t");
            output.Write(document.Count.ToString(CultureInfo.InvariantCulture), BoxedTextColor.Number);
            output.WriteLine();

            output.WriteLine();

            var ctx = BamlContext.ConstructContext(module, document, token);

            scopeStack.Clear();
            foreach (var record in document)
            {
                token.ThrowIfCancellationRequested();
                DisassembleRecord(ctx, record);
            }
        }
Ejemplo n.º 7
0
 void WriteResourceFile(IDecompilerOutput output, string name, bool addNewLine = true)
 {
     if (addNewLine)
     {
         output.WriteLine();
     }
     using (var stream = GetType().Assembly.GetManifestResourceStream(name))
         using (var streamReader = new StreamReader(stream, Encoding.UTF8)) {
             for (;;)
             {
                 var line = streamReader.ReadLine();
                 if (line == null)
                 {
                     break;
                 }
                 output.WriteLine(line, BoxedTextColor.Text);
             }
         }
 }
Ejemplo n.º 8
0
 void StartKeywordBlock(IDecompilerOutput output, string keyword, IMemberDef member)
 {
     output.Write(keyword, BoxedTextColor.Keyword);
     output.Write(" ", BoxedTextColor.Text);
     output.Write(IdentifierEscaper.Escape(member.Name), member, DecompilerReferenceFlags.Definition, TextColorHelper.GetColor(member));
     output.Write(" ", BoxedTextColor.Text);
     output.Write("{", BoxedTextColor.Punctuation);
     output.WriteLine();
     output.IncreaseIndent();
 }
Ejemplo n.º 9
0
        protected void WriteAssembly(AssemblyDef asm, IDecompilerOutput output, DecompilationContext ctx)
        {
            DecompileInternal(asm, output, ctx);
            output.WriteLine();
            this.PrintEntryPoint(asm.ManifestModule, output);
            var peImage = TryGetPEImage(asm.ManifestModule);

            if (peImage != null)
            {
                this.WriteCommentBegin(output, true);
                uint ts         = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;
                var  date       = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ts);
                var  dateString = date.ToString(CultureInfo.CurrentUICulture.DateTimeFormat);
                output.Write(string.Format(dnSpy_Languages_Resources.Decompile_Timestamp, ts, dateString), BoxedTextColor.Comment);
                this.WriteCommentEnd(output, true);
                output.WriteLine();
            }
            output.WriteLine();
        }
Ejemplo n.º 10
0
        /// <inheritdoc/>
        public virtual void WriteShort(IDecompilerOutput output, IDecompiler decompiler, bool showOffset)
        {
            decompiler.WriteCommentBegin(output, true);
            output.WriteOffsetComment(this, showOffset);
            const string LTR = "\u200E";

            output.Write(NameUtilities.CleanName(Name) + LTR, this, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
            output.Write($" = {ValueString}", BoxedTextColor.Comment);
            decompiler.WriteCommentEnd(output, true);
            output.WriteLine();
        }
Ejemplo n.º 11
0
        public override void Decompile(EventDef ev, IDecompilerOutput output, DecompilationContext ctx)
        {
            ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, ev);

            rd.DisassembleEvent(ev, addLineSep: true);
            if (ev.AddMethod != null)
            {
                output.WriteLine();
                rd.DisassembleMethod(ev.AddMethod, true);
            }
            if (ev.RemoveMethod != null)
            {
                output.WriteLine();
                rd.DisassembleMethod(ev.RemoveMethod, true);
            }
            foreach (var m in ev.OtherMethods)
            {
                output.WriteLine();
                rd.DisassembleMethod(m, true);
            }
        }
Ejemplo n.º 12
0
		public virtual void DecompileNamespace(string @namespace, IEnumerable<TypeDef> types, IDecompilerOutput output, DecompilationContext ctx) {
			this.WriteCommentLine(output, string.IsNullOrEmpty(@namespace) ? string.Empty : IdentifierEscaper.Escape(@namespace));
			this.WriteCommentLine(output, string.Empty);
			this.WriteCommentLine(output, dnSpy_Decompiler_Resources.Decompile_Namespace_Types);
			this.WriteCommentLine(output, string.Empty);
			foreach (var type in types) {
				WriteCommentBegin(output, true);
				output.Write(IdentifierEscaper.Escape(type.Name), type, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
				WriteCommentEnd(output, true);
				output.WriteLine();
			}
		}
Ejemplo n.º 13
0
        public override void Decompile(PropertyDef property, IDecompilerOutput output, DecompilationContext ctx)
        {
            ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, property);

            rd.DisassembleProperty(property, addLineSep: true);
            if (property.GetMethod != null)
            {
                output.WriteLine();
                rd.DisassembleMethod(property.GetMethod, true);
            }
            if (property.SetMethod != null)
            {
                output.WriteLine();
                rd.DisassembleMethod(property.SetMethod, true);
            }
            foreach (var m in property.OtherMethods)
            {
                output.WriteLine();
                rd.DisassembleMethod(m, true);
            }
        }
Ejemplo n.º 14
0
        void EndKeywordBlock(IDecompilerOutput output, BraceInfo info, CodeBracesRangeFlags flags, bool addLineSeparator = false)
        {
            output.DecreaseIndent();
            var end = output.NextPosition;

            output.Write("}", BoxedTextColor.Punctuation);
            output.AddBracePair(new TextSpan(info.Start, 1), new TextSpan(end, 1), flags);
            if (addLineSeparator)
            {
                output.AddLineSeparator(end);
            }
            output.WriteLine();
        }
Ejemplo n.º 15
0
        BraceInfo StartKeywordBlock(IDecompilerOutput output, string keyword, IMemberDef member)
        {
            output.Write(keyword, BoxedTextColor.Keyword);
            output.Write(" ", BoxedTextColor.Text);
            output.Write(IdentifierEscaper.Escape(member.Name), member, DecompilerReferenceFlags.Definition, MetadataTextColorProvider.GetColor(member));
            output.Write(" ", BoxedTextColor.Text);
            var start = output.NextPosition;

            output.Write("{", BoxedTextColor.Punctuation);
            output.WriteLine();
            output.IncreaseIndent();
            return(new BraceInfo(start));
        }
Ejemplo n.º 16
0
 public virtual void DecompileNamespace(string @namespace, IEnumerable <TypeDef> types, IDecompilerOutput output, DecompilationContext ctx)
 {
     this.WriteCommentLine(output, string.IsNullOrEmpty(@namespace) ? string.Empty : IdentifierEscaper.Escape(@namespace));
     this.WriteCommentLine(output, string.Empty);
     this.WriteCommentLine(output, dnSpy_Decompiler_Resources.Decompile_Namespace_Types);
     this.WriteCommentLine(output, string.Empty);
     foreach (var type in types)
     {
         WriteCommentBegin(output, true);
         output.Write(IdentifierEscaper.Escape(type.Name), type, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
         WriteCommentEnd(output, true);
         output.WriteLine();
     }
 }
Ejemplo n.º 17
0
        void WriteShortInfo(IDecompilerOutput output, string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return;
            }
            const int MAX_SHORT_LEN = 128;

            if (s.Length > MAX_SHORT_LEN)
            {
                s = s.Substring(0, MAX_SHORT_LEN) + "[...]";
            }
            output.WriteLine(string.Format("\t{0}", s), BoxedTextColor.Text);
        }
Ejemplo n.º 18
0
        protected void WriteModule(ModuleDef mod, IDecompilerOutput output, DecompilationContext ctx)
        {
            DecompileInternal(mod, output, ctx);
            output.WriteLine();
            if (mod.Types.Count > 0)
            {
                this.WriteCommentBegin(output, true);
                output.Write(dnSpy_Languages_Resources.Decompile_GlobalType + " ", BoxedTextColor.Comment);
                output.Write(IdentifierEscaper.Escape(mod.GlobalType.FullName), mod.GlobalType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
                output.WriteLine();
            }
            this.PrintEntryPoint(mod, output);
            this.WriteCommentLine(output, dnSpy_Languages_Resources.Decompile_Architecture + " " + GetPlatformDisplayName(mod));
            if (!mod.IsILOnly)
            {
                this.WriteCommentLine(output, dnSpy_Languages_Resources.Decompile_ThisAssemblyContainsUnmanagedCode);
            }
            string runtimeName = GetRuntimeDisplayName(mod);

            if (runtimeName != null)
            {
                this.WriteCommentLine(output, dnSpy_Languages_Resources.Decompile_Runtime + " " + runtimeName);
            }
            var peImage = TryGetPEImage(mod);

            if (peImage != null)
            {
                this.WriteCommentBegin(output, true);
                uint ts         = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;
                var  date       = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ts);
                var  dateString = date.ToString(CultureInfo.CurrentUICulture.DateTimeFormat);
                output.Write(string.Format(dnSpy_Languages_Resources.Decompile_Timestamp, ts, dateString), BoxedTextColor.Comment);
                this.WriteCommentEnd(output, true);
                output.WriteLine();
            }
            output.WriteLine();
        }
Ejemplo n.º 19
0
		protected override void DecompileFields(IDecompiler decompiler, IDecompilerOutput output) {
			decompiler.WriteCommentLine(output, string.Empty);
			decompiler.WriteCommentBegin(output, true);
			WriteHeader(output);
			decompiler.WriteCommentEnd(output, true);
			output.WriteLine();

			for (int i = 0; i < (int)MetaDataTableVM.Rows; i++) {
				var obj = MetaDataTableVM.Get(i);
				decompiler.WriteCommentBegin(output, true);
				Write(output, obj);
				decompiler.WriteCommentEnd(output, true);
				output.WriteLine();
			}
		}
Ejemplo n.º 20
0
		protected void WriteAssembly(AssemblyDef asm, IDecompilerOutput output, DecompilationContext ctx) {
			DecompileInternal(asm, output, ctx);
			output.WriteLine();
			PrintEntryPoint(asm.ManifestModule, output);
			var peImage = TryGetPEImage(asm.ManifestModule);
			if (peImage != null) {
				WriteCommentBegin(output, true);
				uint ts = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;
				var date = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ts);
				var dateString = date.ToString(CultureInfo.CurrentUICulture.DateTimeFormat);
				output.Write(string.Format(dnSpy_Decompiler_Resources.Decompile_Timestamp, ts, dateString), BoxedTextColor.Comment);
				WriteCommentEnd(output, true);
				output.WriteLine();
			}
			output.WriteLine();
		}
Ejemplo n.º 21
0
        public override void Decompile(TypeDef type, IDecompilerOutput output, DecompilationContext ctx)
        {
            this.WriteCommentLine(output, $"Type: {type.FullName}");
            if (type.BaseType != null)
            {
                WriteCommentBegin(output, true);
                output.Write("Base type: ", BoxedTextColor.Comment);
                output.Write(IdentifierEscaper.Escape(type.BaseType.FullName), type.BaseType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
                WriteCommentEnd(output, true);
                output.WriteLine();
            }
            foreach (var nested in type.NestedTypes)
            {
                Decompile(nested, output, ctx);
                output.WriteLine();
            }

            int lastFieldPos = -1;

            foreach (var field in type.Fields)
            {
                Decompile(field, output, ctx);
                lastFieldPos = output.NextPosition;
                output.WriteLine();
            }
            if (lastFieldPos >= 0)
            {
                output.AddLineSeparator(lastFieldPos);
                output.WriteLine();
            }

            foreach (var property in type.Properties)
            {
                Decompile(property, output, ctx);
                output.WriteLine();
            }

            foreach (var @event in type.Events)
            {
                Decompile(@event, output, ctx);
                output.WriteLine();
            }

            foreach (var method in type.Methods)
            {
                Decompile(method, output, ctx);
                output.WriteLine();
            }
        }
Ejemplo n.º 22
0
        public void WriteHeader(IDecompilerOutput output)
        {
            var cols = MetadataTableVM.TableInfo.Columns;

            output.Write($"{dnSpy_AsmEditor_Resources.RowIdentifier}\t{dnSpy_AsmEditor_Resources.Token}\t{dnSpy_AsmEditor_Resources.Offset}", BoxedTextColor.Comment);
            for (int i = 0; i < cols.Count; i++)
            {
                output.Write("\t", BoxedTextColor.Comment);
                output.Write(MetadataTableVM.GetColumnName(i), BoxedTextColor.Comment);
            }
            if (MetadataTableVM.HasInfo)
            {
                output.Write("\t", BoxedTextColor.Comment);
                output.Write(MetadataTableVM.InfoName, BoxedTextColor.Comment);
            }
            output.WriteLine();
        }
Ejemplo n.º 23
0
 void Write(IDecompilerOutput output)
 {
     output.WriteLine(string.Format("dnSpy {0}", appWindow.AssemblyInformationalVersion), BoxedTextColor.Text);
     output.WriteLine();
     output.WriteLine(dnSpy_Resources.AboutScreen_LicenseInfo, BoxedTextColor.Text);
     output.WriteLine();
     output.WriteLine(dnSpy_Resources.AboutScreen_LoadedFiles, BoxedTextColor.Text);
     foreach (var info in GetInfos())
     {
         output.WriteLine();
         WriteShortInfo(output, info.NameAndVersion);
         WriteShortInfo(output, info.Copyright);
         WriteShortInfo(output, info.ShortDescription);
     }
     output.WriteLine();
     WriteResourceFile(output, "dnSpy.CREDITS.txt");
 }
Ejemplo n.º 24
0
        public void Write(IDecompilerOutput output, MetadataTableRecordVM mdVM)
        {
            var cols = MetadataTableVM.TableInfo.Columns;

            output.Write(mdVM.RidString, BoxedTextColor.Comment);
            output.Write("\t", BoxedTextColor.Comment);
            output.Write(mdVM.TokenString, BoxedTextColor.Comment);
            output.Write("\t", BoxedTextColor.Comment);
            output.Write(mdVM.OffsetString, BoxedTextColor.Comment);
            for (int j = 0; j < cols.Count; j++)
            {
                output.Write("\t", BoxedTextColor.Comment);
                output.Write(mdVM.GetField(j).DataFieldVM.StringValue, BoxedTextColor.Comment);
            }
            if (MetadataTableVM.HasInfo)
            {
                output.Write("\t", BoxedTextColor.Comment);
                output.Write(mdVM.Info, BoxedTextColor.Comment);
            }
            output.WriteLine();
        }
Ejemplo n.º 25
0
        void WriteTimestampComment(IDecompilerOutput output, IPEImage peImage)
        {
            WriteCommentBegin(output, true);
            output.Write(dnSpy_Decompiler_Resources.Decompile_Timestamp, BoxedTextColor.Comment);
            output.Write(" ", BoxedTextColor.Comment);
            uint ts = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;

            if ((int)ts > 0)
            {
                var date       = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ts).ToLocalTime();
                var dateString = date.ToString(CultureInfo.CurrentUICulture.DateTimeFormat);
                output.Write($"{ts:X8} ({dateString})", BoxedTextColor.Comment);
            }
            else
            {
                output.Write(dnSpy_Decompiler_Resources.UnknownValue, BoxedTextColor.Comment);
                output.Write($" ({ts:X8})", BoxedTextColor.Comment);
            }
            WriteCommentEnd(output, true);
            output.WriteLine();
        }
Ejemplo n.º 26
0
        public override void WriteShort(IDecompilerOutput output, IDecompiler decompiler, bool showOffset)
        {
            if (output is IDocumentViewerOutput documentViewerOutput)
            {
                decompiler.WriteCommentBegin(output, true);
                output.WriteOffsetComment(this, showOffset);
                documentViewerOutput.AddUIElement(() => {
                    return(new System.Windows.Controls.Image {
                        Source = imageSource,
                    });
                });
                output.Write(" = ", BoxedTextColor.Comment);
                const string LTR = "\u200E";
                output.Write(NameUtilities.CleanName(Name) + LTR, this, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
                decompiler.WriteCommentEnd(output, true);
                output.WriteLine();
                return;
            }

            base.WriteShort(output, decompiler, showOffset);
        }
Ejemplo n.º 27
0
        protected void PrintEntryPoint(ModuleDef mod, IDecompilerOutput output)
        {
            var ep = GetEntryPoint(mod);

            if (ep is uint)
            {
                this.WriteCommentLine(output, string.Format(dnSpy_Decompiler_Resources.Decompile_NativeEntryPoint, (uint)ep));
            }
            else if (ep is MethodDef epMethod)
            {
                WriteCommentBegin(output, true);
                output.Write(dnSpy_Decompiler_Resources.Decompile_EntryPoint + " ", BoxedTextColor.Comment);
                if (epMethod.DeclaringType != null)
                {
                    output.Write(IdentifierEscaper.Escape(epMethod.DeclaringType.FullName), epMethod.DeclaringType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
                    output.Write(".", BoxedTextColor.Comment);
                }
                output.Write(IdentifierEscaper.Escape(epMethod.Name), epMethod, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
                WriteCommentEnd(output, true);
                output.WriteLine();
            }
        }
Ejemplo n.º 28
0
        void Write(IDecompilerOutput output)
        {
#if NETFRAMEWORK
            const string frameworkName = ".NET Framework";
#elif NET
            const string frameworkName = ".NET";
#else
#error Unknown target framework
#endif
            output.WriteLine($"{Constants.DnSpy} {appWindow.AssemblyInformationalVersion} ({frameworkName})", BoxedTextColor.Text);
            output.WriteLine();
            output.WriteLine(dnSpy_Resources.AboutScreen_LicenseInfo, BoxedTextColor.Text);
            output.WriteLine();
            output.WriteLine(dnSpy_Resources.AboutScreen_LoadedFiles, BoxedTextColor.Text);
            foreach (var info in GetInfos())
            {
                output.WriteLine();
                WriteShortInfo(output, info.NameAndVersion);
                WriteShortInfo(output, info.Copyright);
                WriteShortInfo(output, info.ShortDescription);
            }
            output.WriteLine();
            WriteResourceFile(output, "dnSpy.LicenseInfo.CREDITS.txt");
        }
Ejemplo n.º 29
0
		protected void WriteModule(ModuleDef mod, IDecompilerOutput output, DecompilationContext ctx) {
			DecompileInternal(mod, output, ctx);
			output.WriteLine();
			if (mod.Types.Count > 0) {
				WriteCommentBegin(output, true);
				output.Write(dnSpy_Decompiler_Resources.Decompile_GlobalType + " ", BoxedTextColor.Comment);
				output.Write(IdentifierEscaper.Escape(mod.GlobalType.FullName), mod.GlobalType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
				output.WriteLine();
			}
			PrintEntryPoint(mod, output);
			this.WriteCommentLine(output, dnSpy_Decompiler_Resources.Decompile_Architecture + " " + GetPlatformDisplayName(mod));
			if (!mod.IsILOnly) {
				this.WriteCommentLine(output, dnSpy_Decompiler_Resources.Decompile_ThisAssemblyContainsUnmanagedCode);
			}
			string runtimeName = GetRuntimeDisplayName(mod);
			if (runtimeName != null) {
				this.WriteCommentLine(output, dnSpy_Decompiler_Resources.Decompile_Runtime + " " + runtimeName);
			}
			var peImage = TryGetPEImage(mod);
			if (peImage != null) {
				WriteCommentBegin(output, true);
				uint ts = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;
				var date = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ts);
				var dateString = date.ToString(CultureInfo.CurrentUICulture.DateTimeFormat);
				output.Write(string.Format(dnSpy_Decompiler_Resources.Decompile_Timestamp, ts, dateString), BoxedTextColor.Comment);
				WriteCommentEnd(output, true);
				output.WriteLine();
			}
			output.WriteLine();
		}
Ejemplo n.º 30
0
		public override void Decompile(AssemblyDef asm, IDecompilerOutput output, DecompilationContext ctx) {
			output.WriteLine("// " + asm.ManifestModule.Location, BoxedTextColor.Comment);
			PrintEntryPoint(asm.ManifestModule, output);
			output.WriteLine();

			ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, asm.ManifestModule);
			rd.WriteAssemblyHeader(asm);
		}
Ejemplo n.º 31
0
		void WriteResourceFile(IDecompilerOutput output, string name, bool addNewLine = true) {
			if (addNewLine)
				output.WriteLine();
			using (var stream = GetType().Assembly.GetManifestResourceStream(name))
			using (var streamReader = new StreamReader(stream, Encoding.UTF8)) {
				for (;;) {
					var line = streamReader.ReadLine();
					if (line == null)
						break;
					output.WriteLine(line, BoxedTextColor.Text);
				}
			}
		}
Ejemplo n.º 32
0
		protected void WriteCommentLineDeclaringType(IDecompilerOutput output, IMemberDef member) {
			WriteCommentBegin(output, true);
			output.Write(TypeToString(member.DeclaringType, includeNamespace: true), member.DeclaringType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
			WriteCommentEnd(output, true);
			output.WriteLine();
		}
Ejemplo n.º 33
0
		protected void PrintEntryPoint(ModuleDef mod, IDecompilerOutput output) {
			var ep = GetEntryPoint(mod);
			if (ep is uint)
				this.WriteCommentLine(output, string.Format(dnSpy_Decompiler_Resources.Decompile_NativeEntryPoint, (uint)ep));
			else if (ep is MethodDef) {
				var epMethod = (MethodDef)ep;
				WriteCommentBegin(output, true);
				output.Write(dnSpy_Decompiler_Resources.Decompile_EntryPoint + " ", BoxedTextColor.Comment);
				if (epMethod.DeclaringType != null) {
					output.Write(IdentifierEscaper.Escape(epMethod.DeclaringType.FullName), epMethod.DeclaringType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
					output.Write(".", BoxedTextColor.Comment);
				}
				output.Write(IdentifierEscaper.Escape(epMethod.Name), epMethod, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
				WriteCommentEnd(output, true);
				output.WriteLine();
			}
		}
Ejemplo n.º 34
0
		void StartKeywordBlock(IDecompilerOutput output, string keyword, IMemberDef member) {
			output.Write(keyword, BoxedTextColor.Keyword);
			output.Write(" ", BoxedTextColor.Text);
			output.Write(IdentifierEscaper.Escape(member.Name), member, DecompilerReferenceFlags.Definition, MetadataTextColorProvider.GetColor(member));
			output.Write(" ", BoxedTextColor.Text);
			output.Write("{", BoxedTextColor.Punctuation);
			output.WriteLine();
			output.IncreaseIndent();
		}
 public void WriteLine() => implementation.WriteLine();
Ejemplo n.º 36
0
		void WriteShortInfo(IDecompilerOutput output, string s) {
			if (string.IsNullOrEmpty(s))
				return;
			const int MAX_SHORT_LEN = 128;
			if (s.Length > MAX_SHORT_LEN)
				s = s.Substring(0, MAX_SHORT_LEN) + "[...]";
			output.WriteLine(string.Format("\t{0}", s), BoxedTextColor.Text);
		}
Ejemplo n.º 37
0
		public override void Decompile(ModuleDef mod, IDecompilerOutput output, DecompilationContext ctx) {
			output.WriteLine("// " + mod.Location, BoxedTextColor.Comment);
			PrintEntryPoint(mod, output);
			output.WriteLine();

			ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, mod);
			output.WriteLine();
			rd.WriteModuleHeader(mod);
		}
Ejemplo n.º 38
0
 public void NewLine() => output.WriteLine();
Ejemplo n.º 39
0
		/// <inheritdoc/>
		public virtual void WriteShort(IDecompilerOutput output, IDecompiler decompiler, bool showOffset) {
			decompiler.WriteCommentBegin(output, true);
			output.WriteOffsetComment(this, showOffset);
			const string LTR = "\u200E";
			output.Write(NameUtilities.CleanName(Name) + LTR, this, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
			output.Write($" = {ValueString}", BoxedTextColor.Comment);
			decompiler.WriteCommentEnd(output, true);
			output.WriteLine();
		}
Ejemplo n.º 40
0
		void Write(IDecompilerOutput output) {
			output.WriteLine(string.Format("dnSpy {0}", appWindow.AssemblyInformationalVersion), BoxedTextColor.Text);
			output.WriteLine();
			output.WriteLine(dnSpy_Resources.AboutScreen_LicenseInfo, BoxedTextColor.Text);
			output.WriteLine();
			output.WriteLine(dnSpy_Resources.AboutScreen_LoadedFiles, BoxedTextColor.Text);
			foreach (var info in GetInfos()) {
				output.WriteLine();
				WriteShortInfo(output, info.NameAndVersion);
				WriteShortInfo(output, info.Copyright);
				WriteShortInfo(output, info.ShortDescription);
			}
			output.WriteLine();
			WriteResourceFile(output, "dnSpy.LicenseInfo.CREDITS.txt");
		}
Ejemplo n.º 41
0
		public override void Decompile(EventDef ev, IDecompilerOutput output, DecompilationContext ctx) {
			ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, ev);
			rd.DisassembleEvent(ev, addLineSep: true);
			if (ev.AddMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(ev.AddMethod, true);
			}
			if (ev.RemoveMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(ev.RemoveMethod, true);
			}
			foreach (var m in ev.OtherMethods) {
				output.WriteLine();
				rd.DisassembleMethod(m, true);
			}
		}
Ejemplo n.º 42
0
 void EndKeywordBlock(IDecompilerOutput output)
 {
     output.DecreaseIndent();
     output.Write("}", BoxedTextColor.Punctuation);
     output.WriteLine();
 }
Ejemplo n.º 43
0
        public override void Decompile(MethodDef method, IDecompilerOutput output, DecompilationContext ctx)
        {
            WriteCommentBegin(output, true);
            output.Write("Method: ", BoxedTextColor.Comment);
            output.Write(IdentifierEscaper.Escape(method.FullName), method, DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
            WriteCommentEnd(output, true);
            output.WriteLine();

            if (!method.HasBody)
            {
                return;
            }

            StartKeywordBlock(output, ".body", method);

            ILAstBuilder      astBuilder = new ILAstBuilder();
            ILBlock           ilMethod   = new ILBlock();
            DecompilerContext context    = new DecompilerContext(method.Module)
            {
                CurrentType = method.DeclaringType, CurrentMethod = method
            };

            ilMethod.Body = astBuilder.Build(method, inlineVariables, context);

            if (abortBeforeStep != null)
            {
                new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
            }

            if (context.CurrentMethodIsAsync)
            {
                output.Write("async", BoxedTextColor.Keyword);
                output.Write("/", BoxedTextColor.Punctuation);
                output.WriteLine("await", BoxedTextColor.Keyword);
            }

            var allVariables = ilMethod.GetSelfAndChildrenRecursive <ILExpression>().Select(e => e.Operand as ILVariable)
                               .Where(v => v != null && !v.IsParameter).Distinct();

            foreach (ILVariable v in allVariables)
            {
                output.Write(IdentifierEscaper.Escape(v.Name), v, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, v.IsParameter ? BoxedTextColor.Parameter : BoxedTextColor.Local);
                if (v.Type != null)
                {
                    output.Write(" ", BoxedTextColor.Text);
                    output.Write(":", BoxedTextColor.Punctuation);
                    output.Write(" ", BoxedTextColor.Text);
                    if (v.IsPinned)
                    {
                        output.Write("pinned", BoxedTextColor.Keyword);
                        output.Write(" ", BoxedTextColor.Text);
                    }
                    v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
                }
                if (v.GeneratedByDecompiler)
                {
                    output.Write(" ", BoxedTextColor.Text);
                    output.Write("[", BoxedTextColor.Punctuation);
                    output.Write("generated", BoxedTextColor.Keyword);
                    output.Write("]", BoxedTextColor.Punctuation);
                }
                output.WriteLine();
            }

            var builder = new MethodDebugInfoBuilder(method);

            foreach (ILNode node in ilMethod.Body)
            {
                node.WriteTo(output, builder);
                if (!node.WritesNewLine)
                {
                    output.WriteLine();
                }
            }
            output.AddDebugInfo(builder.Create());
            EndKeywordBlock(output);
        }
Ejemplo n.º 44
0
		void EndKeywordBlock(IDecompilerOutput output) {
			output.DecreaseIndent();
			output.Write("}", BoxedTextColor.Punctuation);
			output.WriteLine();
		}
Ejemplo n.º 45
0
        public override void Decompile(MethodDef method, IDecompilerOutput output, DecompilationContext ctx)
        {
            WriteCommentBegin(output, true);
            output.Write("Method: ", BoxedTextColor.Comment);
            output.Write(IdentifierEscaper.Escape(method.FullName), method, DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
            WriteCommentEnd(output, true);
            output.WriteLine();

            if (!method.HasBody)
            {
                return;
            }

            var bodyInfo = StartKeywordBlock(output, ".body", method);

            ILAstBuilder      astBuilder = new ILAstBuilder();
            ILBlock           ilMethod   = new ILBlock(CodeBracesRangeFlags.MethodBraces);
            DecompilerContext context    = new DecompilerContext(method.Module, MetadataTextColorProvider)
            {
                CurrentType       = method.DeclaringType,
                CurrentMethod     = method,
                CalculateBinSpans = ctx.CalculateBinSpans,
            };

            ilMethod.Body = astBuilder.Build(method, inlineVariables, context);

            if (abortBeforeStep != null)
            {
                new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
            }

            if (context.CurrentMethodIsYieldReturn)
            {
                output.Write("yield", BoxedTextColor.Keyword);
                output.Write(" ", BoxedTextColor.Text);
                output.WriteLine("return", BoxedTextColor.Keyword);
            }
            if (context.CurrentMethodIsAsync)
            {
                output.Write("async", BoxedTextColor.Keyword);
                output.Write("/", BoxedTextColor.Punctuation);
                output.WriteLine("await", BoxedTextColor.Keyword);
            }

            var allVariables = ilMethod.GetSelfAndChildrenRecursive <ILExpression>().Select(e => e.Operand as ILVariable)
                               .Where(v => v != null && !v.IsParameter).Distinct();

            foreach (ILVariable v in allVariables)
            {
                output.Write(IdentifierEscaper.Escape(v.Name), (object)v.OriginalVariable ?? (object)v.OriginalParameter ?? v.Id, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, v.IsParameter ? BoxedTextColor.Parameter : BoxedTextColor.Local);
                if (v.Type != null)
                {
                    output.Write(" ", BoxedTextColor.Text);
                    output.Write(":", BoxedTextColor.Punctuation);
                    output.Write(" ", BoxedTextColor.Text);
                    if (v.IsPinned)
                    {
                        output.Write("pinned", BoxedTextColor.Keyword);
                        output.Write(" ", BoxedTextColor.Text);
                    }
                    v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
                }
                if (v.GeneratedByDecompiler)
                {
                    output.Write(" ", BoxedTextColor.Text);
                    var start = output.NextPosition;
                    output.Write("[", BoxedTextColor.Punctuation);
                    output.Write("generated", BoxedTextColor.Keyword);
                    var end = output.NextPosition;
                    output.Write("]", BoxedTextColor.Punctuation);
                    output.AddBracePair(new TextSpan(start, 1), new TextSpan(end, 1), CodeBracesRangeFlags.SquareBrackets);
                }
                output.WriteLine();
            }

            var builder = new MethodDebugInfoBuilder(method);

            foreach (ILNode node in ilMethod.Body)
            {
                node.WriteTo(output, builder);
                if (!node.WritesNewLine)
                {
                    output.WriteLine();
                }
            }
            output.AddDebugInfo(builder.Create());
            EndKeywordBlock(output, bodyInfo, CodeBracesRangeFlags.MethodBraces, addLineSeparator: true);
        }
Ejemplo n.º 46
0
		public override void Decompile(PropertyDef property, IDecompilerOutput output, DecompilationContext ctx) {
			ReflectionDisassembler rd = CreateReflectionDisassembler(output, ctx, property);
			rd.DisassembleProperty(property, addLineSep: true);
			if (property.GetMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(property.GetMethod, true);
			}
			if (property.SetMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(property.SetMethod, true);
			}
			foreach (var m in property.OtherMethods) {
				output.WriteLine();
				rd.DisassembleMethod(m, true);
			}
		}
Ejemplo n.º 47
0
		public override void Decompile(TypeDef type, IDecompilerOutput output, DecompilationContext ctx) {
			this.WriteCommentLine(output, $"Type: {type.FullName}");
			if (type.BaseType != null) {
				WriteCommentBegin(output, true);
				output.Write("Base type: ", BoxedTextColor.Comment);
				output.Write(IdentifierEscaper.Escape(type.BaseType.FullName), type.BaseType, DecompilerReferenceFlags.None, BoxedTextColor.Comment);
				WriteCommentEnd(output, true);
				output.WriteLine();
			}
			foreach (var nested in type.NestedTypes) {
				Decompile(nested, output, ctx);
				output.WriteLine();
			}

			foreach (var field in type.Fields) {
				Decompile(field, output, ctx);
				output.WriteLine();
			}

			foreach (var property in type.Properties) {
				Decompile(property, output, ctx);
				output.WriteLine();
			}

			foreach (var @event in type.Events) {
				Decompile(@event, output, ctx);
				output.WriteLine();
			}

			foreach (var method in type.Methods) {
				Decompile(method, output, ctx);
				output.WriteLine();
			}
		}
Ejemplo n.º 48
0
		/// <summary>
		/// Writes a comment and a new line
		/// </summary>
		/// <param name="self">This</param>
		/// <param name="output">Output</param>
		/// <param name="comment">Comment</param>
		public static void WriteCommentLine(this IDecompiler self, IDecompilerOutput output, string comment) {
			self.WriteCommentBegin(output, true);
			output.Write(comment, BoxedTextColor.Comment);
			self.WriteCommentEnd(output, true);
			output.WriteLine();
		}
Ejemplo n.º 49
0
		public void Write(IDecompilerOutput output, MetaDataTableRecordVM mdVM) {
			var cols = MetaDataTableVM.TableInfo.Columns;

			output.Write(mdVM.RidString, BoxedTextColor.Comment);
			output.Write("\t", BoxedTextColor.Comment);
			output.Write(mdVM.TokenString, BoxedTextColor.Comment);
			output.Write("\t", BoxedTextColor.Comment);
			output.Write(mdVM.OffsetString, BoxedTextColor.Comment);
			for (int j = 0; j < cols.Count; j++) {
				output.Write("\t", BoxedTextColor.Comment);
				output.Write(mdVM.GetField(j).DataFieldVM.StringValue, BoxedTextColor.Comment);
			}
			if (MetaDataTableVM.HasInfo) {
				output.Write("\t", BoxedTextColor.Comment);
				output.Write(mdVM.Info, BoxedTextColor.Comment);
			}
			output.WriteLine();
		}
Ejemplo n.º 50
0
        public override void Decompile(MethodDef method, IDecompilerOutput output, DecompilationContext ctx)
        {
            WriteCommentBegin(output, true);
            output.Write("Method: ", BoxedTextColor.Comment);
            output.Write(IdentifierEscaper.Escape(method.FullName), method, DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
            WriteCommentEnd(output, true);
            output.WriteLine();

            if (!method.HasBody)
            {
                return;
            }

            var bodyInfo = StartKeywordBlock(output, ".body", method);

            ILAstBuilder      astBuilder = new ILAstBuilder();
            ILBlock           ilMethod   = new ILBlock(CodeBracesRangeFlags.MethodBraces);
            DecompilerContext context    = new DecompilerContext(settingsVersion, method.Module, MetadataTextColorProvider)
            {
                CurrentType      = method.DeclaringType,
                CurrentMethod    = method,
                CalculateILSpans = ctx.CalculateILSpans,
            };

            ilMethod.Body = astBuilder.Build(method, inlineVariables, context);

            var                  stateMachineKind = StateMachineKind.None;
            MethodDef?           inlinedMethod    = null;
            AsyncMethodDebugInfo?asyncInfo        = null;
            string?              compilerName     = null;

            if (!(abortBeforeStep is null))
            {
                var optimizer = new ILAstOptimizer();
                optimizer.Optimize(context, ilMethod, out stateMachineKind, out inlinedMethod, out asyncInfo, abortBeforeStep.Value);
                compilerName = optimizer.CompilerName;
            }

            if (context.CurrentMethodIsYieldReturn)
            {
                output.Write("yield", BoxedTextColor.Keyword);
                output.Write(" ", BoxedTextColor.Text);
                output.WriteLine("return", BoxedTextColor.Keyword);
            }
            if (context.CurrentMethodIsAsync)
            {
                output.Write("async", BoxedTextColor.Keyword);
                output.Write("/", BoxedTextColor.Punctuation);
                output.WriteLine("await", BoxedTextColor.Keyword);
            }

            var allVariables = ilMethod.GetSelfAndChildrenRecursive <ILExpression>().Select(e => e.Operand as ILVariable)
                               .Where(v => !(v is null) && !v.IsParameter).Distinct();

            foreach (ILVariable v in allVariables)
            {
                output.Write(IdentifierEscaper.Escape(v.Name), v.GetTextReferenceObject(), DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, v.IsParameter ? BoxedTextColor.Parameter : BoxedTextColor.Local);
                if (!(v.Type is null))
                {
                    output.Write(" ", BoxedTextColor.Text);
                    output.Write(":", BoxedTextColor.Punctuation);
                    output.Write(" ", BoxedTextColor.Text);
                    if (v.IsPinned)
                    {
                        output.Write("pinned", BoxedTextColor.Keyword);
                        output.Write(" ", BoxedTextColor.Text);
                    }
                    v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
                }
                if (v.GeneratedByDecompiler)
                {
                    output.Write(" ", BoxedTextColor.Text);
                    var start = output.NextPosition;
                    output.Write("[", BoxedTextColor.Punctuation);
                    output.Write("generated", BoxedTextColor.Keyword);
                    var end = output.NextPosition;
                    output.Write("]", BoxedTextColor.Punctuation);
                    output.AddBracePair(new TextSpan(start, 1), new TextSpan(end, 1), CodeBracesRangeFlags.SquareBrackets);
                }
                output.WriteLine();
            }

            var localVariables = new HashSet <ILVariable>(GetVariables(ilMethod));
            var builder        = new MethodDebugInfoBuilder(settingsVersion, stateMachineKind, inlinedMethod ?? method, !(inlinedMethod is null) ? method : null, CreateSourceLocals(localVariables), CreateSourceParameters(localVariables), asyncInfo);

            builder.CompilerName = compilerName;
            foreach (ILNode node in ilMethod.Body)
            {
                node.WriteTo(output, builder);
                if (!node.WritesNewLine)
                {
                    output.WriteLine();
                }
            }
            output.AddDebugInfo(builder.Create());
            EndKeywordBlock(output, bodyInfo, CodeBracesRangeFlags.MethodBraces, addLineSeparator: true);
        }
Ejemplo n.º 51
0
		public void WriteHeader(IDecompilerOutput output) {
			var cols = MetaDataTableVM.TableInfo.Columns;

			output.Write(string.Format("{0}\t{1}\t{2}", dnSpy_AsmEditor_Resources.RowIdentifier, dnSpy_AsmEditor_Resources.Token, dnSpy_AsmEditor_Resources.Offset), BoxedTextColor.Comment);
			for (int i = 0; i < cols.Count; i++) {
				output.Write("\t", BoxedTextColor.Comment);
				output.Write(MetaDataTableVM.GetColumnName(i), BoxedTextColor.Comment);
			}
			if (MetaDataTableVM.HasInfo) {
				output.Write("\t", BoxedTextColor.Comment);
				output.Write(MetaDataTableVM.InfoName, BoxedTextColor.Comment);
			}
			output.WriteLine();
		}
Ejemplo n.º 52
0
		public override void WriteShort(IDecompilerOutput output, IDecompiler decompiler, bool showOffset) {
			var documentViewerOutput = output as IDocumentViewerOutput;
			if (documentViewerOutput != null) {
				decompiler.WriteCommentBegin(output, true);
				output.WriteOffsetComment(this, showOffset);
				documentViewerOutput.AddUIElement(() => {
					return new System.Windows.Controls.Image {
						Source = imageSource,
					};
				});
				output.Write(" = ", BoxedTextColor.Comment);
				const string LTR = "\u200E";
				output.Write(NameUtilities.CleanName(Name) + LTR, this, DecompilerReferenceFlags.Local | DecompilerReferenceFlags.Definition, BoxedTextColor.Comment);
				decompiler.WriteCommentEnd(output, true);
				output.WriteLine();
				return;
			}

			base.WriteShort(output, decompiler, showOffset);
		}