Browse Source

Fix build of TestPlugin

pull/1198/head
Siegfried Pammer 7 years ago
parent
commit
8b1dce4aef
  1. 17
      TestPlugin/CustomLanguage.cs

17
TestPlugin/CustomLanguage.cs

@ -2,9 +2,10 @@
// This code is distributed under MIT X11 license (for details please see \doc\license.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Reflection.Metadata;
using System.Windows.Controls; using System.Windows.Controls;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Dom; using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.ILSpy; using ICSharpCode.ILSpy;
namespace TestPlugin namespace TestPlugin
@ -27,14 +28,15 @@ namespace TestPlugin
return ".txt"; return ".txt";
} }
} }
// There are several methods available to override; in this sample, we deal with methods only // There are several methods available to override; in this sample, we deal with methods only
public override void DecompileMethod(ICSharpCode.Decompiler.Metadata.MethodDefinition method, ITextOutput output, DecompilationOptions options)
public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
{ {
#if false var metadata = method.Module.GetMetadataReader();
if (method.Body != null) { var methodDef = metadata.GetMethodDefinition(method.Handle);
output.WriteLine("Size of method: {0} bytes", method.Body.CodeSize); if (methodDef.HasBody()) {
var methodBody = method.Module.Reader.GetMethodBody(methodDef.RelativeVirtualAddress);
output.WriteLine("Size of method: {0} bytes", methodBody.GetCodeSize());
ISmartTextOutput smartOutput = output as ISmartTextOutput; ISmartTextOutput smartOutput = output as ISmartTextOutput;
if (smartOutput != null) { if (smartOutput != null) {
@ -55,7 +57,6 @@ namespace TestPlugin
syntaxTree.AcceptVisitor(visitor); syntaxTree.AcceptVisitor(visitor);
*/ */
} }
#endif
} }
} }
} }

Loading…
Cancel
Save