本文整理汇总了C#中ICSharpCode.ILSpy.TextView.DecompilerTextView类的典型用法代码示例。如果您正苦于以下问题:C# DecompilerTextView类的具体用法?C# DecompilerTextView怎么用?C# DecompilerTextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecompilerTextView类属于ICSharpCode.ILSpy.TextView命名空间,在下文中一共展示了DecompilerTextView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetViewObject
public sealed override object GetViewObject(DecompilerTextView textView) {
var obj = uiObjRef == null ? null : (FrameworkElement)uiObjRef.Target;
// The element is cached but could be opened in two different tab groups. Only return
// the cached one if it's not in use.
if (obj != null && obj.Parent == null)
return obj;
FrameworkElement newObj;
if (IsVirtualizingCollectionVM)
newObj = new ContentPresenter() { Content = ViewObject, Focusable = true };
else {
newObj = new ScrollViewer {
CanContentScroll = true,
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
Content = ViewObject,
Focusable = true,
};
};
if (uiObjRef == null)
uiObjRef = new WeakReference(newObj);
else
uiObjRef.Target = newObj;
return newObj;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:26,代码来源:HexTreeNode.cs
示例2: 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 (xml == null) {
using (var reader = new StreamReader(Data)) {
xml = reader.ReadToEnd();
}
}
output.Write(xml);
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
}
catch (Exception ex) {
output.Write(ex.ToString());
}
return output;
}, token)
).Then(t => textView.ShowNode(t, this, highlighting)).HandleExceptions();
return true;
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:26,代码来源:XmlResourceNode.cs
示例3: 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;
}
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:25,代码来源:IconResourceEntryNode.cs
示例4: JumpToStatement
static bool JumpToStatement(MethodDef method, uint ilOffset, DecompilerTextView textView) {
if (method == null)
return false;
var serMod = method.Module.ToSerializedDnSpyModule();
var key = new SerializedDnSpyToken(serMod, method.MDToken);
if (textView == null)
textView = MainWindow.Instance.SafeActiveTextView;
bool found = MainWindow.Instance.DnSpyFileListTreeNode.FindModuleNode(method.Module) != null;
if (found) {
return MainWindow.Instance.JumpToReference(textView, method, (success, hasMovedCaret) => {
if (success)
return MoveCaretTo(textView, key, ilOffset);
return false;
});
}
MainWindow.Instance.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
MainWindow.Instance.JumpToReference(textView, method, (success, hasMovedCaret) => {
if (success)
return MoveCaretTo(textView, key, ilOffset);
return false;
});
}));
return true;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:26,代码来源:DebugUtils.cs
示例5: Save
// yuehan start: 保存 baml 到 xaml 文件
public override bool Save(DecompilerTextView textView)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = Path.GetFileName(DecompilerTextView.CleanUpName(base.Text as string));
dlg.FileName = Regex.Replace(dlg.FileName, @"\.baml$", ".xaml", RegexOptions.IgnoreCase);
if (dlg.ShowDialog() == true)
{
// 反编译 baml 文件
var baml = this.Data;
var asm = this.Ancestors().OfType<AssemblyTreeNode>().FirstOrDefault().LoadedAssembly;
baml.Position = 0;
var doc = LoadIntoDocument(asm.GetAssemblyResolver(), asm.AssemblyDefinition, baml);
var xaml = doc.ToString();
// 保存 xaml
FileInfo fi = new FileInfo(dlg.FileName);
if (fi.Exists) fi.Delete();
using (var fs = fi.OpenWrite())
using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
{
sw.BaseStream.Seek(0, SeekOrigin.Begin);
sw.Write(xaml);
sw.Flush();
sw.Close();
}
}
return true;
}
开发者ID:DKeeper1523,项目名称:ilspy_yh,代码行数:30,代码来源:BamlResourceEntryNode.cs
示例6: View
public override bool View(DecompilerTextView textView)
{
try {
AvalonEditTextOutput output = new AvalonEditTextOutput();
Data.Position = 0;
BitmapImage image = new BitmapImage();
//HACK: windows imaging does not understand that .cur files have the same layout as .ico
// so load to data, and modify the ResourceType in the header to make look like an icon...
byte[] curData = ((MemoryStream)Data).ToArray();
curData[2] = 1;
using (Stream stream = new MemoryStream(curData)) {
image.BeginInit();
image.StreamSource = stream;
image.EndInit();
}
output.AddUIElement(() => new Image { Source = image });
output.WriteLine();
output.AddButton(Images.Save, "Save", delegate {
Save(null);
});
textView.ShowNode(output, this, null);
return true;
}
catch (Exception) {
return false;
}
}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:29,代码来源:CursorResourceEntryNode.cs
示例7: GetLineNumber
public static int GetLineNumber(IBookmark b, DecompilerTextView textView)
{
var bm = b as BookmarkBase;
if (bm != null)
return bm.GetLineNumber(textView);
return b.LineNumber;
}
开发者ID:lisong521,项目名称:dnSpy,代码行数:7,代码来源:BookmarkBase.cs
示例8: GetMemberRef
static IMemberRef GetMemberRef(DecompilerTextView textView)
{
if (textView == null)
return null;
var refSeg = textView.GetCurrentReferenceSegment();
return refSeg == null ? null : refSeg.Reference as IMemberRef;
}
开发者ID:cynecx,项目名称:dnSpy,代码行数:8,代码来源:AnalyzeContextMenuEntry.cs
示例9: JumpTo
public static bool JumpTo(DecompilerTextView textView, IMemberRef mr, MethodKey key, int ilOffset)
{
return MainWindow.Instance.JumpToReference(textView, mr, (success, hasMovedCaret) => {
if (success)
return MoveCaretTo(textView, key, ilOffset);
return false;
});
}
开发者ID:4058665,项目名称:dnSpy,代码行数:8,代码来源:DebugUtils.cs
示例10: CreateMarker
public ITextMarker CreateMarker(DecompilerTextView textView, ITextMarkerService markerService) {
var marker = CreateMarkerInternal(markerService, textView);
var cm = textView == null ? null : textView.CodeMappings;
marker.ZOrder = ZOrder;
marker.IsVisible = b => cm != null && cm.ContainsKey(MethodKey);
marker.TextMarkerObject = this;
Initialize(textView, markerService, marker);
return marker;
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:9,代码来源:MarkedTextLine.cs
示例11: IsVisible
public override bool IsVisible(DecompilerTextView textView) {
TextLocation location, endLocation;
var cm = textView == null ? null : textView.CodeMappings;
if (cm == null || !cm.ContainsKey(MethodKey))
return false;
if (!cm[MethodKey].GetInstructionByTokenAndOffset(ILOffset, out location, out endLocation))
return false;
return true;
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:10,代码来源:ILCodeBreakpoint.cs
示例12: JumpToReference
public static bool JumpToReference(DecompilerTextView textView, IMemberRef mr, Func<TextLocation> getLocation)
{
bool retVal = MainWindow.Instance.JumpToReference(textView, mr, getLocation);
if (!retVal) {
MainWindow.Instance.ShowMessageBox(
string.Format("Could not find {0}\n" +
"Make sure that it's visible in the treeview and not a hidden method or part of a hidden class. You could also try to debug the method in IL mode.", mr));
}
return retVal;
}
开发者ID:4058665,项目名称:dnSpy,代码行数:10,代码来源:DebugUtils.cs
示例13: Create
public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null)
{
var reference = textView != null ? textView.GetReferenceSegmentAtMousePosition() : null;
var selectedTreeNodes = treeView != null ? treeView.GetTopLevelSelection().ToArray() : null;
return new TextViewContext {
TreeView = treeView,
SelectedTreeNodes = selectedTreeNodes,
TextView = textView,
Reference = reference
};
}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:11,代码来源:ContextMenuEntry.cs
示例14: Save
public override bool Save(DecompilerTextView textView)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = Path.GetFileName(DecompilerTextView.CleanUpName(key));
if (dlg.ShowDialog() == true) {
data.Position = 0;
using (var fs = dlg.OpenFile()) {
data.CopyTo(fs);
}
}
return true;
}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:12,代码来源:ResourceEntryNode.cs
示例15: TextMarkerService
public TextMarkerService(DecompilerTextView textView) {
if (textView == null)
throw new ArgumentNullException("textView");
this.textView = textView;
TextView.DocumentChanged += OnDocumentChanged;
TextLineObjectManager.Instance.OnListModified += TextLineObjectManager_OnListModified;
MainWindow.Instance.ExecuteWhenLoaded(() => {
MainWindow.Instance.OnTabStateRemoved += OnTabStateRemoved;
this.textView.OnShowOutput += textView_OnShowOutput;
RecreateMarkers();
});
OnDocumentChanged(null, null);
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:TextMarkerService.cs
示例16: JumpToCurrentStatement
public static bool JumpToCurrentStatement(DecompilerTextView textView)
{
if (textView == null)
return false;
var info = DebugInformation.DebugStepInformation;
if (info == null)
return false;
return MainWindow.Instance.JumpToReference(textView, info.Item3, (success, hasMovedCaret) => {
if (success)
return MoveCaretToCurrentStatement(textView);
return false;
});
}
开发者ID:4058665,项目名称:dnSpy,代码行数:13,代码来源:DebugUtils.cs
示例17: IconBarMargin
public IconBarMargin(IconBarManager manager, DecompilerTextView decompilerTextView)
{
this.decompilerTextView = decompilerTextView;
BookmarkManager.Added += OnBookmarkAdded;
BookmarkManager.Removed += OnBookmarkRemoved;
decompilerTextView.OnShowOutput += decompilerTextView_OnShowOutput;
MainWindow.Instance.ExecuteWhenLoaded(() => {
MainWindow.Instance.OnTabStateRemoved += OnTabStateRemoved;
});
this.manager = manager;
SyncBookmarks();
}
开发者ID:4058665,项目名称:dnSpy,代码行数:13,代码来源:IconBarMargin.cs
示例18: 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);
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:14,代码来源:BuiltInResourceElementTreeNode.cs
示例19: Initialize
protected override void Initialize(DecompilerTextView textView, ITextMarkerService markerService, ITextMarker marker) {
marker.HighlightingColor = () => {
switch (type) {
case StackFrameLineType.CurrentStatement:
return DebuggerColors.StackFrameCurrentHighlightingColor;
case StackFrameLineType.SelectedReturnStatement:
return DebuggerColors.StackFrameSelectedHighlightingColor;
case StackFrameLineType.ReturnStatement:
return DebuggerColors.StackFrameReturnHighlightingColor;
default:
throw new InvalidOperationException();
}
};
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:14,代码来源:StackFrameLine.cs
示例20: JumpToStatement
public static bool JumpToStatement(MethodDef method, uint ilOffset, DecompilerTextView textView = null) {
if (method == null)
return false;
var key = MethodKey.Create(method);
if (key == null)
return false;
if (textView == null)
textView = MainWindow.Instance.SafeActiveTextView;
return MainWindow.Instance.JumpToReference(textView, method, (success, hasMovedCaret) => {
if (success)
return MoveCaretTo(textView, key.Value, ilOffset);
return false;
});
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:14,代码来源:DebugUtils.cs
注:本文中的ICSharpCode.ILSpy.TextView.DecompilerTextView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论