本文整理汇总了C#中dnSpy.Tabs.DecompileTabState类的典型用法代码示例。如果您正苦于以下问题:C# DecompileTabState类的具体用法?C# DecompileTabState怎么用?C# DecompileTabState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecompileTabState类属于dnSpy.Tabs命名空间,在下文中一共展示了DecompileTabState类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SelectTreeViewNodes
void SelectTreeViewNodes(DecompileTabState tabState, ILSpyTreeNode[] nodes)
{
if (!IsActiveTab(tabState))
return;
// This isn't perfect, but let's assume the TE has focus if the treeview doesn't.
// We should normally check for:
// Keyboard.FocusedElement == tabState.TextView.TextEditor.TextArea
// but a menu could be open in the text editor, and then the above expression fails.
bool hasKeyboardFocus = !(Keyboard.FocusedElement is SharpTreeViewItem);
var old = tabState.ignoreDecompilationRequests;
try {
tabState.ignoreDecompilationRequests = true;
treeView.SelectedItems.Clear();
if (nodes.Length > 0) {
treeView.FocusNode(nodes[0]);
// This can happen when pressing Ctrl+Shift+Tab when the treeview has keyboard focus
if (treeView.SelectedItems.Count != 0)
treeView.SelectedItems.Clear();
treeView.SelectedItem = nodes[0];
// FocusNode() should already call ScrollIntoView() but for some reason,
// the ScrollIntoView() does nothing so add another call.
// Background priority won't work, we need ContextIdle prio
this.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(delegate {
var item = treeView.SelectedItem as SharpTreeNode;
if (item != null)
treeView.ScrollIntoView(item);
}));
}
foreach (var node in nodes)
treeView.SelectedItems.Add(node);
}
finally {
tabState.ignoreDecompilationRequests = old;
}
// The treeview stole the focus; get it back
if (hasKeyboardFocus)
DelaySetFocus(tabState);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:40,代码来源:MainWindow.xaml.cs
示例2: RecordHistory
void RecordHistory(DecompileTabState tabState)
{
if (tabState == null)
return;
var dtState = tabState.TextView.GetState(tabState.DecompiledNodes);
if (dtState != null)
tabState.History.UpdateCurrent(new NavigationState(dtState, tabState.Language));
tabState.History.Record(new NavigationState(tabState.DecompiledNodes, tabState.Language));
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:9,代码来源:MainWindow.xaml.cs
示例3: SaveCode
void SaveCode(DecompileTabState tabState)
{
if (tabState == null)
return;
var textView = tabState.TextView;
if (tabState.DecompiledNodes.Length == 1) {
if (tabState.DecompiledNodes[0].Save(textView))
return;
}
textView.SaveToDisk(tabState.Language,
tabState.DecompiledNodes,
new DecompilationOptions() { FullDecompilation = true });
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:13,代码来源:MainWindow.xaml.cs
示例4: JumpToReferenceAsyncInternal
// Returns true if we could decompile the reference
bool JumpToReferenceAsyncInternal(DecompileTabState tabState, bool canLoad, object reference, Func<bool, bool, bool> onDecompileFinished)
{
ILSpyTreeNode treeNode = FindTreeNode(reference);
if (treeNode != null) {
var nodes = new[] { treeNode };
DecompileNodes(tabState, nodes, false, onDecompileFinished);
SelectTreeViewNodes(tabState, nodes);
return true;
} else if (reference is dnlib.DotNet.Emit.OpCode) {
string link = "http://msdn.microsoft.com/library/system.reflection.emit.opcodes." + ((dnlib.DotNet.Emit.OpCode)reference).Code.ToString().ToLowerInvariant() + ".aspx";
try {
Process.Start(link);
} catch {
}
return true;
} else if (canLoad && reference is IMemberDef) {
// Here if the module was removed. It's possible that the user has re-added it.
var member = (IMemberDef)reference;
var module = member.Module;
if (module == null) // Check if it has been deleted
return false;
var mainModule = module;
if (module.Assembly != null)
mainModule = module.Assembly.ManifestModule;
if (!string.IsNullOrEmpty(mainModule.Location) && !string.IsNullOrEmpty(module.Location)) {
// Check if the module was removed and then added again
foreach (var m in assemblyList.GetAllModules()) {
if (mainModule.Location.Equals(m.Location, StringComparison.OrdinalIgnoreCase)) {
foreach (var asmMod in GetAssemblyModules(m)) {
if (!module.Location.Equals(asmMod.Location, StringComparison.OrdinalIgnoreCase))
continue;
// Found the module
var modDef = asmMod as ModuleDefMD;
if (modDef != null) {
member = modDef.ResolveToken(member.MDToken) as IMemberDef;
if (member != null) // should never fail
return JumpToReferenceAsyncInternal(tabState, false, member, onDecompileFinished);
}
break;
}
return false;
}
}
}
// The module has been removed. Add it again
var loadedAsm = new LoadedAssembly(assemblyList, mainModule);
loadedAsm.IsAutoLoaded = true;
assemblyList.AddAssembly(loadedAsm, true, false, false);
return JumpToReferenceAsyncInternal(tabState, false, reference, onDecompileFinished);
}
else
return false;
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:60,代码来源:MainWindow.xaml.cs
示例5: NavigateHistory
void NavigateHistory(DecompileTabState tabState, bool forward)
{
var dtState = tabState.TextView.GetState(tabState.DecompiledNodes);
if(dtState != null)
tabState.History.UpdateCurrent(new NavigationState(dtState, tabState.Language));
var newState = forward ? tabState.History.GoForward() : tabState.History.GoBack();
var nodes = newState.TreeNodes.Cast<ILSpyTreeNode>().ToArray();
SelectTreeViewNodes(tabState, nodes);
DecompileNodes(tabState, newState.ViewState, false, newState.Language, nodes);
SetLanguage(newState.Language);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:11,代码来源:MainWindow.xaml.cs
示例6: GetResolver
static ITokenResolver GetResolver(out DecompileTabState tabState) {
tabState = MainWindow.Instance.GetActiveDecompileTabState();
if (tabState == null)
return null;
return ILSpyTreeNode.GetModule(tabState.DecompiledNodes) as ITokenResolver;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:6,代码来源:GoToTokenContextMenuEntry.cs
示例7: ForceDecompile
void ForceDecompile(DecompileTabState tabState)
{
DecompileRestoreLocation(tabState, tabState.DecompiledNodes, null, true);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:4,代码来源:MainWindow.xaml.cs
示例8: DecompileNodes
void DecompileNodes(DecompileTabState tabState, ILSpyTreeNode[] nodes, bool recordHistory, Language language, Func<bool, bool, bool> onDecompileFinished, bool forceDecompile = false)
{
var helper = new OnShowOutputHelper(tabState.TextView, onDecompileFinished, nodes);
bool? decompiled = DecompileNodes(tabState, null, recordHistory, language, nodes, forceDecompile);
if (decompiled == false) {
helper.Abort();
onDecompileFinished(true, false);
}
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:9,代码来源:MainWindow.xaml.cs
示例9: CreateNewDecompileTabState
DecompileTabState CreateNewDecompileTabState(TabManager<TabState> tabManager, Language language = null)
{
var tabState = new DecompileTabState(language ?? sessionSettings.FilterSettings.Language);
return (DecompileTabState)tabManager.AddNewTabState(tabState);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:5,代码来源:MainWindow.xaml.cs
示例10: CreateDecompileTabState
DecompileTabState CreateDecompileTabState(DecompileTabState tabState, SavedDecompileTabState savedState, IList<ILSpyTreeNode> newNodes = null, bool decompile = true)
{
var nodes = new List<ILSpyTreeNode>(savedState.Paths.Count);
if (newNodes != null)
nodes.AddRange(newNodes);
else {
foreach (var asm in savedState.ActiveAutoLoadedAssemblies)
this.assemblyList.OpenAssembly(asm, true);
foreach (var path in savedState.Paths) {
var node = assemblyListTreeNode.FindNodeByPath(path);
if (node == null) {
nodes = null;
break;
}
nodes.Add(node);
}
}
if (decompile) {
if (nodes != null) {
var tmpNodes = nodes.ToArray();
DecompileNodes(tabState, tmpNodes, false, (success, hasMovedCaret) => decompilerTextView_OnShowOutput(success, hasMovedCaret, tabState.TextView, savedState));
}
else
AboutPage.Display(tabState.TextView);
}
return tabState;
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:28,代码来源:MainWindow.xaml.cs
示例11: BackCommand
bool BackCommand(DecompileTabState tabState)
{
if (tabState == null)
return false;
if (tabState.History.CanNavigateBack) {
NavigateHistory(tabState, false);
return true;
}
return false;
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:10,代码来源:MainWindow.xaml.cs
示例12: MustRefresh
static bool MustRefresh(DecompileTabState tabState, LoadedAssembly asm)
{
var asms = new HashSet<LoadedAssembly>();
asms.Add(asm);
return DecompileCache.IsInModifiedAssembly(asms, tabState.DecompiledNodes) ||
DecompileCache.IsInModifiedAssembly(asms, tabState.TextView.References);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:7,代码来源:MainWindow.xaml.cs
示例13: GetModule
static ModuleDefMD GetModule(out DecompileTabState tabState)
{
tabState = MainWindow.Instance.GetActiveDecompileTabState();
if (tabState == null)
return null;
return ILSpyTreeNode.GetModule(tabState.DecompiledNodes) as ModuleDefMD;
}
开发者ID:4058665,项目名称:dnSpy,代码行数:7,代码来源:GoToTokenContextMenuEntry.cs
示例14: DecompileRestoreLocation
void DecompileRestoreLocation(DecompileTabState tabState, ILSpyTreeNode[] nodes, Language language = null, bool forceDecompile = false)
{
var pos = tabState.TextView.GetRefPos();
DecompileNodes(tabState, nodes, false, language ?? tabState.Language, (a, b) => tabState.TextView.GoTo(pos), forceDecompile);
}
开发者ID:DeepSkyFire,项目名称:dnSpy,代码行数:5,代码来源:MainWindow.xaml.cs
示例15: GetModule
static ModuleDefMD GetModule(ContextMenuEntryContext context, out DecompileTabState tabState)
{
tabState = null;
if (context == null)
return null;
var textView = context.Element as DecompilerTextView;
if (textView != null) {
tabState = DecompileTabState.GetDecompileTabState(textView);
if (tabState != null)
return ILSpyTreeNode.GetModule(tabState.DecompiledNodes) as ModuleDefMD;
}
if (context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length == 1)
return ILSpyTreeNode.GetModule(context.SelectedTreeNodes[0]) as ModuleDefMD;
return null;
}
开发者ID:kenwilcox,项目名称:dnSpy,代码行数:18,代码来源:ContextMenuCommands.cs
示例16: MustRefresh
static bool MustRefresh(DecompileTabState tabState, DnSpyFile mod) {
var asms = new HashSet<DnSpyFile>();
asms.Add(mod);
return DecompileCache.IsInModifiedModule(asms, tabState.DecompiledNodes) ||
DecompileCache.IsInModifiedModule(asms, tabState.TextView.References);
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:6,代码来源:MainWindow.xaml.cs
注:本文中的dnSpy.Tabs.DecompileTabState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论