Beispiel #1
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();
			}
		}
Beispiel #2
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);
            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);
            decompiler.WriteCommentEnd(output, true);
            output.WriteLine();
        }
Beispiel #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();
 }
Beispiel #4
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();
            }
        }
Beispiel #5
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();
        }
Beispiel #6
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);
        }
Beispiel #7
0
 public void WriteCommentEnd(IDecompilerOutput output, bool addSpace) => implementation.WriteCommentEnd(output, addSpace);
		/// <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();
		}
Beispiel #9
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);
		}