コード例 #1
0
		public bool IsEnabled(TextViewContext context)
		{
			if (context.SelectedTreeNodes == null)
				return false;

			foreach (var node in context.SelectedTreeNodes)
			{
				var typeNode = node as TypeTreeNode;
				if (typeNode != null && !typeNode.IsPublicAPI)
					return false;

				var eventNode = node as EventTreeNode;
				if (eventNode != null && (!eventNode.IsPublicAPI || !eventNode.EventDefinition.DeclaringType.IsPublic))
					return false;

				var fieldNode = node as FieldTreeNode;
				if (fieldNode != null && (!fieldNode.IsPublicAPI || !fieldNode.FieldDefinition.DeclaringType.IsPublic))
					return false;

				var propertyNode = node as PropertyTreeNode;
				if (propertyNode != null && (!propertyNode.IsPublicAPI || !propertyNode.PropertyDefinition.DeclaringType.IsPublic))
					return false;

				var methodNode = node as MethodTreeNode;
				if (methodNode != null && (!methodNode.IsPublicAPI || !methodNode.MethodDefinition.DeclaringType.IsPublic))
					return false;

				var namespaceNode = node as NamespaceTreeNode;
				if (namespaceNode != null && string.IsNullOrEmpty(namespaceNode.Name))
					return false;
			}

			return true;
		}
コード例 #2
0
ファイル: EntryPointCommands.cs プロジェクト: gsong2014/dnSpy
 static bool TreeView_IsVisible(TextViewContext context)
 {
     ModuleDef module;
     return context.TreeView == MainWindow.Instance.treeView &&
         ((module = ILSpyTreeNode.GetModule(context.SelectedTreeNodes)) != null) &&
         module.EntryPoint is MethodDef;
 }
コード例 #3
0
ファイル: EntryPointCommands.cs プロジェクト: gsong2014/dnSpy
 public void Execute(TextViewContext context)
 {
     if (TreeView_IsVisible(context))
         MainWindow.Instance.JumpToReference(ILSpyTreeNode.GetModule(context.SelectedTreeNodes).EntryPoint);
     else if (TextEditor_IsVisible(context))
         MainWindow.Instance.JumpToReference(GetModule().EntryPoint);
 }
コード例 #4
0
 public bool IsVisible(TextViewContext context)
 {
     return context.SelectedTreeNodes != null &&
         context.SelectedTreeNodes.Length == 1 &&
         context.SelectedTreeNodes[0] is AssemblyTreeNode &&
         !string.IsNullOrWhiteSpace(((AssemblyTreeNode)context.SelectedTreeNodes[0]).LoadedAssembly.FileName);
 }
コード例 #5
0
ファイル: EntryPointCommands.cs プロジェクト: gsong2014/dnSpy
 public void Execute(TextViewContext context)
 {
     if (TreeView_IsVisible(context))
         MainWindow.Instance.JumpToReference(ILSpyTreeNode.GetModule(context.SelectedTreeNodes).GlobalType.FindStaticConstructor());
     else if (TextEditor_IsVisible(context))
         MainWindow.Instance.JumpToReference(GoToEntryPointCommand.GetModule().GlobalType.FindStaticConstructor());
 }
コード例 #6
0
ファイル: EntryPointCommands.cs プロジェクト: gsong2014/dnSpy
 static bool TextEditor_IsVisible(TextViewContext context)
 {
     ModuleDef module;
     return context.TextView != null &&
         (module = GetModule()) != null &&
         module.EntryPoint is MethodDef;
 }
コード例 #7
0
		public void Execute(TextViewContext context)
		{
			if (context.SelectedTreeNodes != null) {
				foreach (ILSpyTreeNode node in context.SelectedTreeNodes) {
					SearchMsdn(node);
				}
			}
		}
コード例 #8
0
 public void Execute(TextViewContext context)
 {
     if (context.SelectedTreeNodes != null) {
         foreach (var node in context.SelectedTreeNodes) {
             node.Parent.Children.Remove(node);
         }
     }
 }
コード例 #9
0
		public bool IsVisible(TextViewContext context)
		{
			if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
				return false;
			if (context.SelectedTreeNodes == null)
				return context.Reference != null && context.Reference.Reference is MemberReference;
			return context.SelectedTreeNodes.All(n => n is IMemberTreeNode);
		}
コード例 #10
0
ファイル: MethodBodyCommands.cs プロジェクト: BahNahNah/dnSpy
 public bool IsVisible(TextViewContext context)
 {
     var list = GetMappings(context);
     return list != null &&
         list.Count != 0 &&
         list[0].MemberMapping.MethodDefinition != null &&
         list[0].MemberMapping.MethodDefinition.Body != null &&
         list[0].MemberMapping.MethodDefinition.Body.Instructions.Count > 0;
 }
コード例 #11
0
		public void Execute(TextViewContext context)
		{
			if (context.SelectedTreeNodes != null) {
				foreach (IMemberTreeNode node in context.SelectedTreeNodes) {
					Analyze(node.Member);
				}
			} else if (context.Reference != null && context.Reference.Reference is IMemberRef) {
				if (context.Reference.Reference is IMemberRef)
					Analyze((IMemberRef)context.Reference.Reference);
			}
		}
コード例 #12
0
 public override void Execute(TextViewContext context)
 {
     var obj = GetReference(context);
     if (obj != null) {
         var member = MainWindow.ResolveReference(obj);
         if (member == null)
             MainWindow.Instance.ShowMessageBox("Could not resolve member definition");
         else
             Execute(member);
     }
 }
コード例 #13
0
		public bool IsEnabled(TextViewContext context)
		{
			if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length > 0 && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
				return false;
			if (context.SelectedTreeNodes == null)
				return context.Reference != null && MainWindow.ResolveReference(context.Reference.Reference) != null;
			foreach (IMemberTreeNode node in context.SelectedTreeNodes) {
				if (CanAnalyze(node.Member))
					return true;
			}
			return false;
		}
コード例 #14
0
 public void Execute(TextViewContext context)
 {
     if (context.SelectedTreeNodes != null) {
         foreach (IMemberTreeNode node in context.SelectedTreeNodes) {
             Analyze(node.Member);
         }
     } else if (context.Reference != null && context.Reference.Reference is MemberReference) {
         if (context.Reference.Reference is MemberReference)
             Analyze((MemberReference)context.Reference.Reference);
         // TODO: implement support for other references: ParameterReference, etc.
     }
 }
コード例 #15
0
 public void Execute(TextViewContext context)
 {
     if (context.SelectedTreeNodes != null) {
         foreach (var node in context.SelectedTreeNodes) {
             var mr = node as IMemberTreeNode;
             if (mr != null)
                 Analyze(mr.Member);
         }
     } else if (context.Reference != null && context.Reference.Reference is IMemberRef) {
         if (context.Reference.Reference is IMemberRef)
             Analyze((IMemberRef)context.Reference.Reference);
     }
 }
コード例 #16
0
ファイル: AssemblyCommands.cs プロジェクト: cynecx/dnSpy
		public void Execute(TextViewContext context)
		{
			if (context.TreeView != MainWindow.Instance.treeView)
				return;
			var asms = new List<LoadedAssembly>();
			foreach (var node in context.SelectedTreeNodes) {
				var loadedAsm = GetLoadedAssembly(node);
				if (loadedAsm != null)
					asms.Add(loadedAsm);
			}
			if (asms.Count > 0)
				MainWindow.Instance.DisableMemoryMappedIO(asms);
		}
コード例 #17
0
		public bool IsVisible(TextViewContext context)
		{
			if (context.SelectedTreeNodes == null)
				return false;

			return context.SelectedTreeNodes.All(
				n => n is NamespaceTreeNode
				|| n is TypeTreeNode
				|| n is EventTreeNode
				|| n is FieldTreeNode
				|| n is PropertyTreeNode
				|| n is MethodTreeNode);
		}
コード例 #18
0
 public void Execute(TextViewContext context)
 {
     // Known problem: explorer can't show files in the .NET 2.0 GAC.
     var asmNode = (AssemblyTreeNode)context.SelectedTreeNodes[0];
     var filename = asmNode.LoadedAssembly.FileName;
     var args = string.Format("/select,{0}", filename);
     try {
         Process.Start(new ProcessStartInfo("explorer.exe", args));
     }
     catch (IOException) {
     }
     catch (Win32Exception) {
     }
 }
コード例 #19
0
		public bool IsVisible(TextViewContext context)
		{
			if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
				return false;
			if (context.SelectedTreeNodes == null)
				return context.Reference != null && context.Reference.Reference is MemberReference;
			var allMembersSelected = context.SelectedTreeNodes.All(n => n is IMemberTreeNode);
            if (context.TreeView is AnalyzerTreeView)
            {
                return allMembersSelected && context.SelectedTreeNodes.All(_ => _.Level > 1);
            }

            return allMembersSelected;
		}
コード例 #20
0
ファイル: MethodBodyCommands.cs プロジェクト: BahNahNah/dnSpy
        public void Execute(TextViewContext context)
        {
            var list = GetMappings(context);
            if (list == null)
                return;

            var method = list[0].MemberMapping.MethodDefinition;
            var methodNode = MainWindow.Instance.AssemblyListTreeNode.FindMethodNode(method);
            if (methodNode == null) {
                MainWindow.Instance.ShowMessageBox(string.Format("Could not find method: {0}", method));
                return;
            }

            MethodBodySettingsCommand.Execute(new ILSpyTreeNode[] { methodNode }, GetInstructionOffsets(method, list));
        }
コード例 #21
0
        public bool IsEnabled(TextViewContext context)
        {
            if (context.SelectedTreeNodes == null)
                return context.Reference != null && context.Reference.Reference is MemberReference;
            foreach (IMemberTreeNode node in context.SelectedTreeNodes) {
                if (!(node.Member is TypeDefinition
                      || node.Member is FieldDefinition
                      || node.Member is MethodDefinition
                      || AnalyzedPropertyTreeNode.CanShow(node.Member)
                      || AnalyzedEventTreeNode.CanShow(node.Member)))
                    return false;
            }

            return true;
        }
コード例 #22
0
ファイル: FoldingCommands.cs プロジェクト: nakijun/dnSpy
		public void Execute(TextViewContext context)
		{
			if (null == context.TextView)
				return;
			FoldingManager foldingManager = context.TextView.FoldingManager;
			if (null == foldingManager)
				return;
			bool doFold = true;
			foreach (FoldingSection fm in foldingManager.AllFoldings) {
				if (fm.IsFolded) {
					doFold = false;
					break;
				}
			}
			foreach (FoldingSection fm in foldingManager.AllFoldings) {
				fm.IsFolded = doFold;
			}
		}
コード例 #23
0
        public bool IsEnabled(TextViewContext context)
        {
            if (context.SelectedTreeNodes != null) {
                foreach (var node in context.SelectedTreeNodes) {
                    var mrNode = node as IMemberTreeNode;
                    if (mrNode != null && !IsPublic(mrNode.Member))
                        return false;

                    var namespaceNode = node as NamespaceTreeNode;
                    if (namespaceNode != null && string.IsNullOrEmpty(namespaceNode.Name))
                        return false;
                }

                return true;
            }

            return context.Reference != null && context.Reference.Reference is IMemberRef;
        }
コード例 #24
0
        public void Execute(TextViewContext context)
        {
            if (context.SelectedTreeNodes != null) {
                foreach (var node in context.SelectedTreeNodes) {
                    var nsNode = node as NamespaceTreeNode;
                    if (nsNode != null) {
                        SearchMsdn(string.Format(msdnAddress, nsNode.Name));
                        continue;
                    }

                    var mrNode = node as IMemberTreeNode;
                    if (mrNode != null) {
                        SearchMsdn(mrNode.Member);
                        continue;
                    }
                }
            }

            if (context.Reference != null)
                SearchMsdn(context.Reference.Reference as IMemberRef);
        }
コード例 #25
0
ファイル: FoldingCommands.cs プロジェクト: nakijun/dnSpy
		public void Execute(TextViewContext context)
		{
			var textView = context.TextView;
			if (null == textView)
				return;
			var editor = textView.textEditor;
			FoldingManager foldingManager = context.TextView.FoldingManager;
			if (null == foldingManager)
				return;
			// TODO: or use Caret if position is not given?
			var posBox = context.Position;
			if (null == posBox)
				return;
			TextViewPosition pos = posBox.Value;
			// look for folding on this line:
			FoldingSection folding = foldingManager.GetNextFolding(editor.Document.GetOffset(pos.Line, 1));
			if (folding == null || editor.Document.GetLineByOffset(folding.StartOffset).LineNumber != pos.Line) {
				// no folding found on current line: find innermost folding containing the mouse position
				folding = foldingManager.GetFoldingsContaining(editor.Document.GetOffset(pos.Line, pos.Column)).LastOrDefault();
			}
			if (folding != null) {
				folding.IsFolded = !folding.IsFolded;
			}
		}
コード例 #26
0
 public bool IsVisible(TextViewContext context)
 {
     return(context.TextView != null);
 }
コード例 #27
0
 public bool IsVisible(TextViewContext context)
 {
     return(context.SelectedTreeNodes != null &&
            context.SelectedTreeNodes.Length > 0 &&
            context.TreeView == MainWindow.Instance.treeView);
 }
コード例 #28
0
 public void Execute(TextViewContext context)
 {
     MainWindow.Instance.CloneActiveTab();
 }
コード例 #29
0
 public void Execute(TextViewContext context)
 {
     MainWindow.Instance.OpenReferenceInNewTab(context.TextView, context.Reference);
 }
コード例 #30
0
 public bool IsVisible(TextViewContext context)
 {
     return(GetReference(context) != null);
 }
コード例 #31
0
 public bool IsEnabled(TextViewContext context)
 {
     return(MainWindow.Instance.IsDecompilerTabControl(context.TabControl) &&
            IsEnabledInternal());
 }
コード例 #32
0
 public void Execute(TextViewContext context)
 {
     DecompileNodes(GetNodes(context).ToArray());
 }
コード例 #33
0
 public bool IsEnabled(TextViewContext context)
 {
     return true;
 }
コード例 #34
0
 public override void Execute(TextViewContext context)
 {
     PreserveNodeSelection(context, () => base.Execute(context));
 }
コード例 #35
0
 public void Execute(TextViewContext context)
 {
     Execute();
 }
コード例 #36
0
 public bool IsVisible(TextViewContext context)
 {
     return(CanExecute() &&
            (context.SelectedTreeNodes != null || context.TextView != null));
 }
コード例 #37
0
 public bool IsEnabled(TextViewContext context)
 {
     return(context.TextView != null && context.TextView.FoldingManager != null);
 }
 public bool IsEnabled(TextViewContext context)
 {
     return(IsTypeNodeSelected(context));
 }
コード例 #39
0
 public abstract void Execute(TextViewContext context);
コード例 #40
0
 public bool IsEnabled(TextViewContext context) => true;
コード例 #41
0
 public bool IsVisible(TextViewContext context)
 {
     return(OpenReferenceContextMenuEntry.GetReference(context) != null);
 }
コード例 #42
0
 public bool IsEnabled(TextViewContext context)
 {
     return(GetNodes(context).Any());
 }
コード例 #43
0
 public void Initialize(TextViewContext context, MenuItem menuItem)
 {
     menuItem.InputGestureText = context.OpenedFromKeyboard ? "Ctrl+F12" : "Ctrl+Click";
 }
コード例 #44
0
 public bool IsVisible(TextViewContext context)
 {
     return(context.SelectedTreeNodes != null || context.Reference?.Reference is IEntity);
 }
コード例 #45
0
 public bool IsVisible(TextViewContext context)
 {
     return(context.TextView != null &&
            context.Reference != null);
 }
コード例 #46
0
 public bool IsVisible(TextViewContext context)
 {
     return(MainWindow.Instance.IsDecompilerTabControl(context.TabControl) &&
            MainWindow.Instance.ActiveTabState != null);
 }
コード例 #47
0
 public void Execute(TextViewContext context)
 {
     MainWindow.Instance.OpenNewTab();
 }
コード例 #48
0
 public void Execute(TextViewContext context)
 {
     MainWindow.Instance.CloseAllTabs();
 }
コード例 #49
0
 public bool IsEnabled(TextViewContext context)
 {
     return(MainWindow.Instance.IsDecompilerTabControl(context.TabControl) &&
            MainWindow.Instance.CloseAllButActiveTabCanExecute());
 }
コード例 #50
0
ファイル: DebuggerCommands.cs プロジェクト: gsong2014/dnSpy
 public void Initialize(TextViewContext context, MenuItem menuItem)
 {
 }
コード例 #51
0
ファイル: DebuggerCommands.cs プロジェクト: gsong2014/dnSpy
 public bool IsVisible(TextViewContext context)
 {
     return (context == null || context.TextView != null) &&
         DebuggerPlugin.DebugShowNextStatementCanExecute();
 }
 public virtual void Execute(TextViewContext context)
 {
     Execute(context, false);
 }
コード例 #53
0
ファイル: DebuggerCommands.cs プロジェクト: gsong2014/dnSpy
 public bool IsEnabled(TextViewContext context)
 {
     return IsVisible(context);
 }
コード例 #54
0
 public bool IsVisible(TextViewContext context)
 {
     return(MainWindow.Instance.IsDecompilerTabControl(context.TabControl) &&
            MainWindow.Instance.CloseAllTabsCanExecute());
 }
コード例 #55
0
 public bool IsEnabled(TextViewContext context)
 {
     return(context.SelectedTreeNodes != null && context.SelectedTreeNodes.Length == 1);
 }
コード例 #56
0
 public void Execute(TextViewContext context)
 {
     ExecuteInternal();
 }
コード例 #57
0
 public bool IsEnabled(TextViewContext context)
 {
     return(true);
 }
コード例 #58
0
 public virtual bool IsVisible(TextViewContext context)
 {
     return(true);
 }
コード例 #59
0
 public bool IsVisible(TextViewContext context)
 {
     if (context.TreeView is AnalyzerTreeView && context.SelectedTreeNodes != null && context.SelectedTreeNodes.All(n => n.Parent.IsRoot))
         return true;
     return false;
 }
コード例 #60
0
 public void Execute(TextViewContext context)
 {
     Execute(context.SelectedTreeNodes);
 }