• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TreeNodes.ILSpyTreeNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICSharpCode.ILSpy.TreeNodes.ILSpyTreeNode的典型用法代码示例。如果您正苦于以下问题:C# ILSpyTreeNode类的具体用法?C# ILSpyTreeNode怎么用?C# ILSpyTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ILSpyTreeNode类属于ICSharpCode.ILSpy.TreeNodes命名空间,在下文中一共展示了ILSpyTreeNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialize

			protected override void Initialize(ILSpyTreeNode[] nodes, MenuItem menuItem)
			{
				if (nodes.Length == 1)
					menuItem.Header = string.Format("Remove {0}", UIUtils.EscapeMenuItemHeader(nodes[0].ToString()));
				else
					menuItem.Header = string.Format("Remove {0} assemblies", nodes.Length);
			}
开发者ID:lisong521,项目名称:dnSpy,代码行数:7,代码来源:AssemblyCommands.cs


示例2: Execute

		internal static void Execute(ILSpyTreeNode[] nodes, uint[] offsets = null)
		{
			if (!CanExecute(nodes))
				return;

			var methodNode = (MethodTreeNode)nodes[0];

			var module = ILSpyTreeNode.GetModule(nodes[0]);
			Debug.Assert(module != null);
			if (module == null)
				throw new InvalidOperationException();

			var data = new MethodBodyVM(new MethodBodyOptions(methodNode.MethodDefinition), module, MainWindow.Instance.CurrentLanguage, methodNode.MethodDefinition.DeclaringType, methodNode.MethodDefinition);
			var win = new MethodBodyDlg();
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			win.Title = string.Format("{0} - {1}", win.Title, methodNode.ToString());

			if (data.IsCilBody && offsets != null)
				data.CilBodyVM.Select(offsets);

			if (win.ShowDialog() != true)
				return;

			UndoCommandManager.Instance.Add(new MethodBodySettingsCommand(methodNode, data.CreateMethodBodyOptions()));
		}
开发者ID:lisong521,项目名称:dnSpy,代码行数:26,代码来源:MethodBodyCommands.cs


示例3: SearchMsdn

        public static void SearchMsdn(ILSpyTreeNode node)
        {
            var address = string.Empty;

            var namespaceNode = node as NamespaceTreeNode;
            if (namespaceNode != null)
                address = string.Format(msdnAddress, namespaceNode.Name);

            var memberNode = node as IMemberTreeNode;
            if (memberNode != null)
            {
                var member = memberNode.Member;
                var memberName = string.Empty;

                if (member.DeclaringType == null)
                    memberName = member.FullName;
                else
                    memberName = string.Format("{0}.{1}", member.DeclaringType.FullName, member.Name);

                address = string.Format(msdnAddress, memberName);
            }

            address = address.ToLower();
            if (!string.IsNullOrEmpty(address))
                Process.Start(address);
        }
开发者ID:Zvirja,项目名称:ILSpy,代码行数:26,代码来源:SearchMsdnContextMenuEntry.cs


示例4: Execute

        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!AddNetModuleToAssemblyCommand.CanExecute(nodes))
                return;

            var dialog = new System.Windows.Forms.OpenFileDialog() {
                Filter = ".NET NetModules (*.netmodule)|*.netmodule|All files (*.*)|*.*",
                RestoreDirectory = true,
            };
            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;
            if (string.IsNullOrEmpty(dialog.FileName))
                return;

            var asm = new LoadedAssembly(MainWindow.Instance.CurrentAssemblyList, dialog.FileName);
            if (asm.ModuleDefinition == null || asm.AssemblyDefinition != null) {
                MainWindow.Instance.ShowMessageBox(string.Format("{0} is not a NetModule", asm.FileName), System.Windows.MessageBoxButton.OK);
                asm.TheLoadedFile.Dispose();
                return;
            }

            var cmd = new AddExistingNetModuleToAssemblyCommand((AssemblyTreeNode)nodes[0], asm);
            UndoCommandManager.Instance.Add(cmd);
            MainWindow.Instance.JumpToReference(cmd.modNode);
        }
开发者ID:4058665,项目名称:dnSpy,代码行数:25,代码来源:ModuleCommands.cs


示例5:

		SharpTreeNode IRenamerContextMenu.FindRenamedNode(ILSpyTreeNode oldNode, string[] path, string oldName, object targetObject)
		{
			var newName = RenameHelper.GetName(targetObject);
			RenamePath(oldNode, path, oldName, newName);

			return MainWindow.Instance.FindNodeByPath(path, true);
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:7,代码来源:RenameContextMenu.cs


示例6: SearchMsdn

        public static void SearchMsdn(ILSpyTreeNode node)
        {
            var address = string.Empty;

            var namespaceNode = node as NamespaceTreeNode;
            if (namespaceNode != null)
                address = string.Format(msdnAddress, namespaceNode.Name);

            var memberNode = node as IMemberTreeNode;
            if (memberNode != null)
            {
                var member = memberNode.Member;
                var memberName = string.Empty;

                ITypeDefOrRef declType = null;
                if (member is IDefinition)
                    declType = ((IDefinition)member).DeclaringType;
                else if (declType is IField)
                    declType = ((IField)member).DeclaringType;
                else if (declType is IMethod)
                    declType = ((IMethod)member).DeclaringType;

                if (declType == null)
                    memberName = member.FullName;
                else
                    memberName = string.Format("{0}.{1}", declType.FullName, member.Name);

                address = string.Format(msdnAddress, memberName);
            }

            address = address.ToLower();
            if (!string.IsNullOrEmpty(address))
                Process.Start(address);
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:34,代码来源:SearchMsdnContextMenuEntry.cs


示例7: Execute

		static void Execute(ILSpyTreeNode[] nodes) {
			if (!CanExecute(nodes))
				return;

			var nsNodes = nodes.Select(a => (NamespaceTreeNode)a).ToArray();
			UndoCommandManager.Instance.Add(new DeleteNamespaceCommand(nsNodes));
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:NamespaceCommands.cs


示例8: GetDnSpyFileList

		static DnSpyFileList GetDnSpyFileList(ILSpyTreeNode node) {
			if (node == null)
				return null;
			var asmNode = GetNode<AssemblyTreeNode>(node);
			if (asmNode == null)
				return null;
			return asmNode.DnSpyFileList;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:PropertyTreeNode.cs


示例9: Execute

		static void Execute(ILSpyTreeNode[] nodes) {
			if (!CanExecute(nodes))
				return;

			var win = new NetModuleOptionsDlg();
			var data = new NetModuleOptionsVM();
			win.DataContext = data;
			win.Owner = MainWindow.Instance;
			if (win.ShowDialog() != true)
				return;

			var cmd = new CreateNetModuleCommand(data.CreateNetModuleOptions());
			UndoCommandManager.Instance.Add(cmd);
			MainWindow.Instance.JumpToReference(cmd.asmNodeCreator.AssemblyTreeNode);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:15,代码来源:ModuleCommands.cs


示例10: RenamePath

		private static void RenamePath(ILSpyTreeNode node, string[] path, string oldName, string newName)
		{
			if (node is TypeTreeNode)
			{
				string oldns;
				TypeParts(oldName, out oldns, out oldName);

				string newns;
				TypeParts(newName, out newns, out newName);

				if (path.Length > 1)
					path[path.Length - 2] = path[path.Length - 2].Replace(oldns, newns);
			}

			if (path.Length > 0)
				path[path.Length - 1] = path[path.Length - 1].Replace(oldName, newName);
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:17,代码来源:RenameContextMenu.cs


示例11: PropertyTreeNode

		public PropertyTreeNode(PropertyDef property, ILSpyTreeNode owner) {
			if (property == null)
				throw new ArgumentNullException("property");
			this.property = property;
			var list = GetDnSpyFileList(owner ?? this);
			using (list == null ? null : list.DisableAssemblyLoad()) {
				this.isIndexer = property.IsIndexer();
			}

			if (property.GetMethod != null)
				this.Children.Add(new MethodTreeNode(property.GetMethod));
			if (property.SetMethod != null)
				this.Children.Add(new MethodTreeNode(property.SetMethod));
			if (property.HasOtherMethods) {
				foreach (var m in property.OtherMethods)
					this.Children.Add(new MethodTreeNode(m));
			}

		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:19,代码来源:PropertyTreeNode.cs


示例12: GetAssemblyNodes

		HashSet<IUndoObject> GetAssemblyNodes(ILSpyTreeNode[] nodes) {
			var hash = new HashSet<IUndoObject>();

			if (nodes.Length == 0) {
				var hex = MainWindow.Instance.ActiveTabState as HexTabState;
				if (hex != null) {
					var doc = hex.HexBox.Document as AsmEdHexDocument;
					if (doc != null)
						hash.Add(UndoCommandManager.Instance.GetUndoObject(doc));
				}
			}

			foreach (var node in nodes) {
				var asmNode = ILSpyTreeNode.GetNode<AssemblyTreeNode>(node);
				if (asmNode == null)
					continue;

				bool added = false;

				if (asmNode.DnSpyFile.ModuleDef != null) {
					var uo = UndoCommandManager.Instance.GetUndoObject(asmNode.DnSpyFile);
					if (UndoCommandManager.Instance.IsModified(uo)) {
						hash.Add(uo);
						added = true;
					}
				}

				var doc = HexDocumentManager.Instance.TryGet(asmNode.DnSpyFile.Filename);
				if (doc != null) {
					var uo = UndoCommandManager.Instance.GetUndoObject(doc);
					if (UndoCommandManager.Instance.IsModified(uo)) {
						hash.Add(uo);
						added = true;
					}
				}

				// If nothing was modified, just include the selected module
				if (!added && asmNode.DnSpyFile.ModuleDef != null)
					hash.Add(UndoCommandManager.Instance.GetUndoObject(asmNode.DnSpyFile));
			}
			return hash;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:42,代码来源:SaveModuleCommand.cs


示例13:

		SharpTreeNode IRenamerContextMenu.FindRenamedNode(ILSpyTreeNode oldNode, string[] path, string oldName, object targetObject)
		{
			// After renaming an assembly, ILSpy is still using the filename to display node text, even if assembly name changed
			var newNode = MainWindow.Instance.FindNodeByPath(path, true);
			if (newNode == null)
				return null;

			// Hack, so we have to change the shortname, without changing the filename, so that the user can reload the previous state
			var adef = targetObject as AssemblyDefinition;
			if (!(newNode is AssemblyTreeNode) || adef == null) 
				return newNode;

			var la = (newNode as AssemblyTreeNode).LoadedAssembly;
			var pInfo = la.GetType().GetField("shortName", BindingFlags.Instance | BindingFlags.NonPublic);
			if (pInfo == null) 
				return newNode;

			pInfo.SetValue(la, adef.Name.Name);
			newNode.RaisePropertyChanged("Text");

			return newNode;
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:22,代码来源:RenameAssemblyContextMenu.cs


示例14: InjectWindowViewModel

        public InjectWindowViewModel(ILSpyTreeNode node, Window window, bool canInjectExisting)
        {
            //Stores the given parameters
            _node = node;
            _window = window;
            InjectExistingEnabled = canInjectExisting;

            //Loads the injectors
            Injectors = GlobalContainer.Injectors.Where(x => x.CanInjectInNode(node)).ToArray();

            //Writes data for the header
            InjectInIcon = (ImageSource)node.Icon;
            InjectInContent = node.Text;

            //Finds the module
            var moduleNode = Helpers.Tree.GetModuleNode(node);
            DestinationModule = moduleNode == null ? null : moduleNode.Module;

            //Finds the enclosing type (if any)
            EnclosingType = Helpers.Tree.GetType(node);

            //Prepares the filters for the inject existing part
            if (canInjectExisting)
            {
                ExistingMemberFilter = node is ModuleTreeNode ? MemberFilters.Types : null;
                ExistingSelectableMembers = node is ModuleTreeNode ? new[] { TokenType.TypeDef } : new[] { TokenType.TypeDef, TokenType.Field, TokenType.Property, TokenType.Method, TokenType.Event };
            }

            //Prepares the commands
            _InjectCommand = new RelayCommand(InjectCommandImpl);

            //Loads from the settings the values of the properties of the 'existing' part
            var settings = GlobalContainer.InjectionSettings.Element("InjectExistingSettings");
            ExistingPreview = bool.Parse(settings.Attribute("Preview").Value);
            ExistingImportAsNestedTypesEnabled = !(node is ModuleTreeNode);
            ExistingImportAsNestedTypes = ExistingImportAsNestedTypesEnabled && bool.Parse(settings.Attribute("ImportAsNestedTypes").Value);
        }
开发者ID:95ulisse,项目名称:ILEdit,代码行数:37,代码来源:InjectWindowViewModel.cs


示例15: Initialize

 static void Initialize(ILSpyTreeNode[] nodes, MenuItem menuItem)
 {
     if (nodes.Length == 1)
         menuItem.Header = string.Format("Delete {0}", UIUtils.EscapeMenuItemHeader(nodes[0].ToString()));
     else
         menuItem.Header = string.Format("Delete {0} properties", nodes.Length);
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:7,代码来源:PropertyDefCommands.cs


示例16: Execute

        internal static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
                return;

            var propNodes = nodes.Select(a => (PropertyTreeNode)a).ToArray();
            UndoCommandManager.Instance.Add(new DeletePropertyDefCommand(propNodes));
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:8,代码来源:PropertyDefCommands.cs


示例17: CanExecute

 internal static bool CanExecute(ILSpyTreeNode[] nodes)
 {
     return nodes.Length > 0 &&
         nodes.All(n => n is PropertyTreeNode);
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:5,代码来源:PropertyDefCommands.cs


示例18: GetAssemblyNodes

 HashSet<LoadedAssembly> GetAssemblyNodes(ILSpyTreeNode[] nodes)
 {
     var hash = new HashSet<LoadedAssembly>();
     foreach (var node in nodes) {
         var asmNode = ILSpyTreeNode.GetNode<AssemblyTreeNode>(node);
         if (asmNode != null && asmNode.LoadedAssembly.ModuleDefinition != null)
             hash.Add(asmNode.LoadedAssembly);
     }
     return hash;
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:10,代码来源:SaveModuleCommand.cs


示例19: CanExecuteInternal

 protected override bool CanExecuteInternal(ILSpyTreeNode[] nodes)
 {
     return DeletePropertyDefCommand.CanExecute(nodes);
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:4,代码来源:PropertyDefCommands.cs


示例20: ExecuteInternal

 protected override void ExecuteInternal(ILSpyTreeNode[] nodes)
 {
     DeletePropertyDefCommand.Execute(nodes);
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:4,代码来源:PropertyDefCommands.cs



注:本文中的ICSharpCode.ILSpy.TreeNodes.ILSpyTreeNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NRefactory.Ast类代码示例发布时间:2022-05-26
下一篇:
C# TreeNodes.AssemblyTreeNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap