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

C# ILSpy.TextViewContext类代码示例

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

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



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

示例1: TreeView_IsVisible

 static bool TreeView_IsVisible(TextViewContext context)
 {
     ModuleDef module;
     return context.TreeView == MainWindow.Instance.treeView &&
         ((module = ILSpyTreeNode.GetModule(context.SelectedTreeNodes)) != null) &&
         module.EntryPoint is MethodDef;
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:EntryPointCommands.cs


示例2: PreserveNodeSelection

		protected static void PreserveNodeSelection(TextViewContext context, Action action)
		{
			var treeView = context.TreeView;
			if (treeView == null)
				return;
	
			var instance = MainWindow.Instance;
			var oldNode = treeView.SelectedItem as SharpTreeNode;
			var path = MainWindow.GetPathForNode(oldNode);

			action();

			var newNode = instance.FindNodeByPath(path, false);

			// If not found let's try parent node
			if (newNode == null && path.Length > 1)
			{
				newNode = instance.FindNodeByPath(path.Take(path.Length - 1).ToArray(), false);
				if (oldNode != null)
					oldNode = oldNode.Parent;
			}

			if (newNode == null)
				return;

			instance.SelectNode(newNode);
			newNode.IsExpanded = oldNode != null && oldNode.IsExpanded;
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:28,代码来源:BaseContextMenu.cs


示例3: RenameSelectedNode

		internal static void RenameSelectedNode(this IRenamerContextMenu item, TextViewContext context, Action<TextViewContext> action)
		{
			var treeView = context.TreeView;
			var activeHandler = BaseContextMenu.ILSpyPackage.ActiveHandler;
			if (treeView == null || activeHandler == null)
				return;

			var targetObject = activeHandler.TargetObject;
			if (targetObject == null)
				return;

			var instance = MainWindow.Instance;
			var oldNode = treeView.SelectedItem as ILSpyTreeNode;
			var path = instance.GetPathForNode(oldNode);
			var oldName = RenameHelper.GetName(targetObject);

			action(context);

			var newNode = item.FindRenamedNode(oldNode, path, oldName, targetObject);
			if (newNode == null) 
				return;

			instance.SelectNode(newNode);
			newNode.IsExpanded = oldNode != null && oldNode.IsExpanded;
		}
开发者ID:hoangduit,项目名称:Reflexil,代码行数:25,代码来源:IRenamerContextMenu.cs


示例4: TextEditor_IsVisible

 static bool TextEditor_IsVisible(TextViewContext context)
 {
     ModuleDef module;
     return context.TextView != null &&
         (module = GetModule()) != null &&
         module.EntryPoint is MethodDef;
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:EntryPointCommands.cs


示例5: Execute

 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);
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:EntryPointCommands.cs


示例6: IsVisible

 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);
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:OpenContainingFolderContextMenuEntry.cs


示例7: Execute

        public override void Execute(TextViewContext context)
        {
            if (context.SelectedTreeNodes.Length != 1)
            {
                throw new Exception("SelectedTreeNodes = " + context.SelectedTreeNodes.Length);
            }
            var xCurrentField = context.SelectedTreeNodes[0] as FieldTreeNode;
            if (xCurrentField == null)
            {
                throw new Exception("Current TreeNode is not a Field!");
            }

            if (MessageBox.Show("Do you want to generate FieldAccess code to your clipboard?", "Cosmos Plug tool", MessageBoxButton.YesNo) == MessageBoxResult.No)
            {
                return;
            }


            Clipboard.SetText(String.Format("[FieldAccess(Name = \"{0} {1}.{2}\")] ref {3} field{2}",
                                            xCurrentField.FieldDefinition.FieldType.FullName,
                                            xCurrentField.FieldDefinition.DeclaringType.FullName,
                                            xCurrentField.FieldDefinition.Name,
                                            Utilities.GetCSharpTypeName(xCurrentField.FieldDefinition.FieldType)));
            MessageBox.Show("Done", "Cosmos Plug tool");
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:25,代码来源:GenerateFieldAccessParameterEntry.cs


示例8: Execute

        public override void Execute(TextViewContext context)
        {
            if (context.SelectedTreeNodes.Length != 1)
            {
                throw new Exception("SelectedTreeNodes = " + context.SelectedTreeNodes.Length);
            }
            var xCurrentProperty = context.SelectedTreeNodes[0] as PropertyTreeNode;
            if (xCurrentProperty == null)
            {
                throw new Exception("Current TreeNode is not a Property!");
            }

            if (MessageBox.Show("Do you want to generate plug code to your clipboard?", "Cosmos Plug tool", MessageBoxButton.YesNo) == MessageBoxResult.No)
            {
                return;
            }

            var xProp = xCurrentProperty.PropertyDefinition;
            var xSB = new StringBuilder();
            if (xProp.GetMethod != null)
            {
                xSB.AppendLine(GenerateMethodPlugEntry.GenerateMethod(xProp.GetMethod));
                xSB.AppendLine();
            }
            if (xProp.SetMethod != null)
            {
                xSB.AppendLine(GenerateMethodPlugEntry.GenerateMethod(xProp.SetMethod));
                xSB.AppendLine();
            }

            Clipboard.SetText(xSB.ToString().Trim());

            MessageBox.Show("Done", "Cosmos Plug tool");
        }
开发者ID:Orvid,项目名称:Cosmos,代码行数:34,代码来源:GeneratePropertyAccessorsPlugEntry.cs


示例9: IsVisible

 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;
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:9,代码来源:MethodBodyCommands.cs


示例10: Execute

        public void Execute(TextViewContext context)
        {
            var types = context.SelectedTreeNodes
                .OfType<TypeTreeNode>()
                .Select(n => HAL.Converter.Type(n.TypeDefinition))
                .ToArray();

            Services.BrowseInteractions(types, true);
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:9,代码来源:BrowseInteractionsContextMenuEntry.cs


示例11: Execute

        public void Execute(TextViewContext context)
        {
            var assemblyDefinitions = context.SelectedTreeNodes
                .OfType<AssemblyTreeNode>()
                .Select(n => Converter.Assembly(n.LoadedAssembly.AssemblyDefinition))
                .ToList();

            Services.BrowseAssemblies(assemblyDefinitions);
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:9,代码来源:BrowseAssemblyContextMenuEntry.cs


示例12: IsVisible

        public bool IsVisible(TextViewContext context)
        {
            if (context.SelectedTreeNodes == null)
            {
                return false;
            }

            return context.SelectedTreeNodes.OfType<AssemblyTreeNode>().Count() > 0;
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:9,代码来源:BrowseDependenciesContextMenuEntry.cs


示例13: IsVisible

        public bool IsVisible(TextViewContext context)
        {
            if (context.SelectedTreeNodes == null)
            {
                return false;
            }

            return context.SelectedTreeNodes.All(n => n is AssemblyTreeNode);
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:9,代码来源:BrowseAssemblyContextMenuEntry.cs


示例14: Execute

        public void Execute(TextViewContext context)
        {
            var assemblyDefinitions = context.SelectedTreeNodes
                .OfType<AssemblyTreeNode>()
                .Select(n => HAL.Converter.Assembly(n.LoadedAssembly.AssemblyDefinition))
                .ToList();

            var window = WindowManager.AssemblyBrowsers.Single();
            window.ViewModel.AddAssemblies(assemblyDefinitions);
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:10,代码来源:AddAssemblyContextMenuEntry.cs


示例15: IsVisible

        public bool IsVisible(TextViewContext context)
        {
            if (context.SelectedTreeNodes == null)
            {
                return false;
            }

            return (context.SelectedTreeNodes.Count() == 1)
                   && (context.SelectedTreeNodes.Single() is TypeTreeNode);
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:10,代码来源:VisualizeDescendantsContextMenuEntry.cs


示例16: GetMappings

 internal static IList<SourceCodeMapping> GetMappings(TextViewContext context)
 {
     if (context.TextView == null || context.Position == null)
         return null;
     var list = SourceCodeMappingUtils.Find(context.TextView, context.Position.Value.Line, context.Position.Value.Column);
     if (list.Count == 0)
         return null;
     if (!(list[0].StartLocation.Line <= context.Position.Value.Line && context.Position.Value.Line <= list[0].EndLocation.Line))
         return null;
     return list;
 }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:11,代码来源:MethodBodyCommands.cs


示例17: Execute

 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);
     }
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:11,代码来源:CopyTokenContextMenuEntry.cs


示例18: Execute

        public void Execute(TextViewContext context)
        {
            var assemblyDefinitions = context.SelectedTreeNodes
                .OfType<AssemblyTreeNode>()
                .Select(n => n.LoadedAssembly.AssemblyDefinition);

            var window = new DependencyBrowserWindow(assemblyDefinitions.Select(HAL.Converter.Assembly))
            {
                Owner = Services.MainWindow
            };
            window.Show();
        }
开发者ID:GREYFOXRGR,项目名称:AssemblyVisualizer,代码行数:12,代码来源:BrowseDependenciesContextMenuEntry.cs


示例19: Execute

        public void Execute(TextViewContext context)
        {
            var typeDefinition = context.SelectedTreeNodes
                .OfType<TypeTreeNode>()
                .Single().TypeDefinition;

            var window = new AncestryBrowserWindow(HAL.Converter.Type(typeDefinition))
                         	{
                         		Owner = MainWindow.Instance
                         	};
            window.Show();
        }
开发者ID:cohenw,项目名称:AssemblyVisualizer,代码行数:12,代码来源:BrowseAncestryContextMenuEntry.cs


示例20: IsVisible

 public override bool IsVisible(TextViewContext context)
 {
     if (context.SelectedTreeNodes.Length != 1)
     {
         return false;
     }
     var xCurrentType = context.SelectedTreeNodes[0] as TypeTreeNode;
     if (xCurrentType == null)
     {
         return false;
     }
     return true;
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:13,代码来源:GenerateTypePlugEntry.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TextView.AvalonEditTextOutput类代码示例发布时间:2022-05-26
下一篇:
C# ILSpy.LoadedAssembly类代码示例发布时间: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