本文整理汇总了C#中ICSharpCode.ILSpy.TextView.AvalonEditTextOutput.GetDocument方法的典型用法代码示例。如果您正苦于以下问题:C# AvalonEditTextOutput.GetDocument方法的具体用法?C# AvalonEditTextOutput.GetDocument怎么用?C# AvalonEditTextOutput.GetDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.ILSpy.TextView.AvalonEditTextOutput
的用法示例。
在下文中一共展示了AvalonEditTextOutput.GetDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TreeView_SelectionChanged
void TreeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.textEditor.Clear();
AvalonEditTextOutput textOutput = new AvalonEditTextOutput();
//_humDisassembler = new HumanizerDisassembler(textOutput, token);
foreach (var item in MainWindow.Instance.SelectedNodes)
{
var typeTreeNode = item as TypeTreeNode;
if (typeTreeNode != null)
{
ToolSetSettings.Instance.Language.DecompileType(typeTreeNode.TypeDefinition, textOutput, new DecompilationOptions());
//_humDisassembler.DisassembleType(typeTreeNode.TypeDefinition);
}
}
this.textEditor.SyntaxHighlighting = ToolSetSettings.Instance.Language.SyntaxHighlighting;
this.textEditor.AppendText(textOutput.GetDocument().Text);
textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new ICSharpCode.AvalonEdit.Search.SearchInputHandler(textEditor.TextArea));
}
示例2: Decompile
public ICSharpCode.AvalonEdit.Document.TextDocument Decompile(object obj)
{
AvalonEditTextOutput aeto = new AvalonEditTextOutput();
AstBuilder ast = new AstBuilder(new DecompilerContext(ModuleDefinition.CreateModule("ash", ModuleKind.NetModule)));
switch (obj.GetType().Name)
{
case "AssemblyDefinition":
ast = new AstBuilder(new DecompilerContext((obj as AssemblyDefinition).MainModule) { Settings = new DecompilerSettings() });
try { ast.AddAssembly(obj as AssemblyDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.FullName); }
break;
case "TypeDefinition":
ast = CreateAstBuilder((obj as TypeDefinition), true);
try { ast.AddType(obj as TypeDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.FullName); }
break;
case "MethodDefinition":
MethodDefinition method = (obj as MethodDefinition);
ast = CreateAstBuilder(method.DeclaringType, true);
if (method.IsConstructor && !method.IsStatic && !method.DeclaringType.IsValueType)
{
foreach (var field in method.DeclaringType.Fields)
if (field.IsStatic == method.IsStatic)
{
try { ast.AddField(field); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
}
foreach (var ctor in method.DeclaringType.Methods)
if (ctor.IsConstructor && ctor.IsStatic == method.IsStatic)
{
try { ast.AddMethod(ctor); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
}
}
else
{
try { ast.AddMethod(obj as MethodDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
}
break;
case "PropertyDefinition":
ast = CreateAstBuilder((obj as PropertyDefinition).DeclaringType, true);
try { ast.AddProperty(obj as PropertyDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
break;
case "FieldDefinition":
ast = CreateAstBuilder((obj as FieldDefinition).DeclaringType, true);
try { ast.AddField(obj as FieldDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
break;
case "EventDefinition":
ast = CreateAstBuilder((obj as EventDefinition).DeclaringType, true);
try { ast.AddEvent(obj as EventDefinition); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly " + e.AssemblyReference.Name); }
break;
default:
return new ICSharpCode.AvalonEdit.Document.TextDocument();
}
try { ast.GenerateCode(aeto); }
catch (AssemblyResolutionException e) { MessageBox.Show("Could not load assembly upon code generation:\r" + e.AssemblyReference.FullName); }
return aeto.GetDocument();
}