本文整理汇总了C#中ICSharpCode.ILSpy.TextView.DecompilerTextView.ShowNode方法的典型用法代码示例。如果您正苦于以下问题:C# DecompilerTextView.ShowNode方法的具体用法?C# DecompilerTextView.ShowNode怎么用?C# DecompilerTextView.ShowNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.ILSpy.TextView.DecompilerTextView
的用法示例。
在下文中一共展示了DecompilerTextView.ShowNode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: View
public override bool View(DecompilerTextView textView)
{
AvalonEditTextOutput output = new AvalonEditTextOutput();
IHighlightingDefinition highlighting = null;
textView.RunWithCancellation(
token => Task.Factory.StartNew(
() => {
try {
// cache read XAML because stream will be closed after first read
if (xaml == null) {
using (var reader = new StreamReader(Data)) {
xaml = reader.ReadToEnd();
}
}
output.Write(xaml);
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
} catch (Exception ex) {
output.Write(ex.ToString());
}
return output;
}, token),
t => textView.ShowNode(t.Result, this, highlighting)
);
return true;
}
示例2: View
public override bool View(DecompilerTextView textView)
{
try
{
AvalonEditTextOutput output = new AvalonEditTextOutput();
Data.Position = 0;
IconBitmapDecoder decoder = new IconBitmapDecoder(Data, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.None);
foreach (var frame in decoder.Frames)
{
output.Write(String.Format("{0}x{1}, {2} bit: ", frame.PixelHeight, frame.PixelWidth, frame.Thumbnail.Format.BitsPerPixel));
AddIcon(output, frame);
output.WriteLine();
}
output.AddButton(Images.Save, "Save", delegate
{
Save(null);
});
textView.ShowNode(output, this);
return true;
}
catch (Exception)
{
return false;
}
}
示例3: View
public override bool View(DecompilerTextView textView) {
if (resElem.ResourceData.Code == ResourceTypeCode.String) {
var output = new AvalonEditTextOutput();
output.Write((string)((BuiltInResourceData)resElem.ResourceData).Data, TextTokenType.Text);
textView.ShowNode(output, this, null);
return true;
}
if (resElem.ResourceData.Code == ResourceTypeCode.ByteArray || resElem.ResourceData.Code == ResourceTypeCode.Stream) {
var data = (byte[])((BuiltInResourceData)resElem.ResourceData).Data;
return ResourceTreeNode.View(this, textView, new MemoryStream(data), Name);
}
return base.View(textView);
}
示例4: View
public override bool View(DecompilerTextView textView)
{
AvalonEditTextOutput output = new AvalonEditTextOutput();
IHighlightingDefinition highlighting = null;
textView.RunWithCancellation(
token => Task.Factory.StartNew(
() => {
try {
if (LoadBaml(output))
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
} catch (Exception ex) {
output.Write(ex.ToString());
}
return output;
}),
t => textView.ShowNode(t.Result, this, highlighting)
);
return true;
}
示例5: View
public override bool View(DecompilerTextView textView)
{
try {
AvalonEditTextOutput output = new AvalonEditTextOutput();
Data.Position = 0;
BitmapImage image = new BitmapImage();
image.BeginInit();
image.StreamSource = Data;
image.EndInit();
output.AddUIElement(() => new Image { Source = image });
output.WriteLine();
output.AddButton(ImageCache.Instance.GetImage("Save", BackgroundType.Button), "Save", delegate {
Save(null);
});
textView.ShowNode(output, this);
return true;
}
catch (Exception) {
return false;
}
}
示例6: View
public override bool View(DecompilerTextView textView)
{
EmbeddedResource er = r as EmbeddedResource;
if (er != null) {
Stream s = er.GetResourceStream();
if (s != null && s.Length < DecompilerTextView.DefaultOutputLengthLimit) {
s.Position = 0;
FileType type = GuessFileType.DetectFileType(s);
if (type != FileType.Binary) {
s.Position = 0;
AvalonEditTextOutput output = new AvalonEditTextOutput();
output.Write(FileReader.OpenStream(s, Encoding.UTF8).ReadToEnd());
string ext;
if (type == FileType.Xml)
ext = ".xml";
else
ext = Path.GetExtension(DecompilerTextView.CleanUpName(er.Name));
textView.ShowNode(output, this, HighlightingManager.Instance.GetDefinitionByExtension(ext));
return true;
}
}
}
return false;
}
示例7: View
internal static bool View(ILSpyTreeNode node, DecompilerTextView textView, Stream stream, string name) {
if (stream == null || stream.Length >= DecompilerTextView.DefaultOutputLengthLimit)
return false;
stream.Position = 0;
FileType type = GuessFileType.DetectFileType(stream);
if (type == FileType.Binary)
return false;
stream.Position = 0;
AvalonEditTextOutput output = new AvalonEditTextOutput();
output.Write(FileReader.OpenStream(stream, Encoding.UTF8).ReadToEnd(), TextTokenType.Text);
string ext;
if (type == FileType.Xml)
ext = ".xml";
else {
try {
ext = Path.GetExtension(DecompilerTextView.CleanUpName(name));
}
catch (ArgumentException) {
ext = ".txt";
}
}
textView.ShowNode(output, node, HighlightingManager.Instance.GetDefinitionByExtension(ext));
return true;
}
示例8: View
public override bool View(DecompilerTextView textView) {
AvalonEditTextOutput output = new AvalonEditTextOutput();
IHighlightingDefinition highlighting = null;
var lang = MainWindow.Instance.CurrentLanguage;
textView.RunWithCancellation(
token => Task.Factory.StartNew(
() => {
try {
bamlData.Position = 0;
var document = BamlReader.ReadDocument(bamlData, token);
if (BamlSettings.Instance.DisassembleBaml)
Disassemble(module, document, lang, output, out highlighting, token);
else
Decompile(module, document, lang, output, out highlighting, token);
}
catch (Exception ex) {
output.Write(ex.ToString(), TextTokenType.Text);
}
return output;
}, token)
).Then(t => textView.ShowNode(t, this, highlighting)).HandleExceptions();
return true;
}