public TreeNode CreatePointer()
        {
            TreeNodePointer obj = new TreeNodePointer(_xmlNode);

            if (this.IsShortcut)
            {
                bool      loaded = false;
                TreeViewX tvx    = this.TreeView as TreeViewX;
                if (tvx != null)
                {
                    TreeNodeX tnx = tvx.GetCategoryNodeById(this.TreeNodeId);
                    if (tnx != null)
                    {
                        VPLUtil.CopyProperties(tnx, obj);
                        loaded = true;
                    }
                }
                if (!loaded)
                {
                    ObjectXmlReader oxr = new ObjectXmlReader();
                    oxr.ReadProperties(_xmlNode, obj);
                }
            }
            else
            {
                VPLUtil.CopyProperties(this, obj);
            }
            return(obj);
        }
Exemple #2
0
        public static void ShowMember(TreeViewX treeView, IMemberDef member)
        {
            var declTypes = new HashSet <TypeDef>();
            var declType  = member.DeclaringType;
            var ns        = (member is TypeDef) ? ((TypeDef)member).Namespace : null;

            while (declType != null)
            {
                ns = declType.Namespace;
                declTypes.Add(declType);
                declType = declType.DeclaringType;
            }

            TreeNavigator.Create()
            .Path <dnModuleModel>(m => m.Module.ModuleDef == member.Module ? NavigationState.In : NavigationState.Next)
            .Path <ModuleModel>(m => NavigationState.In)
            .Path <NamespaceModel>(m => m.Namespace == ns ? NavigationState.In : NavigationState.Next)
            .Path <TypeModel>(
                m =>
                m.Type == member ? NavigationState.Done : (declTypes.Contains(m.Type) ? NavigationState.In : NavigationState.Next))
            .Path <MethodModel>(m => m.Method == member ? NavigationState.Done : NavigationState.Next)
            .Path <FieldModel>(m => m.Field == member ? NavigationState.Done : NavigationState.Next)
            .Path <PropertyModel>(
                m =>
                m.Property == member
                                                        ? NavigationState.Done
                                                        : (m.Property.GetAccessors().Contains(member) ? NavigationState.In : NavigationState.Next))
            .Path <EventModel>(
                m =>
                m.Event == member
                                                        ? NavigationState.Done
                                                        : (m.Event.GetAccessors().Contains(member) ? NavigationState.In : NavigationState.Next))
            .Goto(treeView);
        }
Exemple #3
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         TreeViewX tvx = context.Instance as TreeViewX;
         if (tvx != null)
         {
             IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
             if (edSvc != null)
             {
                 DlgTreeViewXEditor dlg = new DlgTreeViewXEditor();
                 dlg.LoadData(tvx);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(tvx);
                     foreach (PropertyDescriptor p in ps)
                     {
                         if (string.CompareOrdinal(p.Name, "XmlString") == 0)
                         {
                             p.SetValue(tvx, dlg.XmlString);
                             break;
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }
Exemple #4
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         TreeViewX tvx = context.Instance as TreeViewX;
         if (tvx != null)
         {
             IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
             if (edSvc != null)
             {
                 DlgTreeNodeTemp dlg = new DlgTreeNodeTemp();
                 dlg.LoadData(tvx);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     XmlNode templatesNode = dlg.GetTemplatesNode();
                     tvx.UpdateNodeTemplates(templatesNode);
                     PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(tvx);
                     PropertyDescriptor           p  = ps["Reserved"];
                     if (p != null)
                     {
                         p.SetValue(tvx, Guid.NewGuid().GetHashCode());
                     }
                 }
             }
         }
     }
     return(value);
 }
 private void checkLoadValues()
 {
     if (_data == null && _xmlNode != null)
     {
         XmlNodeList     nds = _xmlNode.SelectNodes(TreeViewX.XML_Value);
         ObjectXmlReader xr  = new ObjectXmlReader();
         foreach (XmlNode nd in nds)
         {
             TreeNodeValue tnv = new TreeNodeValue(nd, xr);
             tnv.IsShortcut = IsShortcut;
             if (!tnv.IsShortcut)
             {
                 AddValue(tnv.Name, tnv.Value);
             }
         }
         if (!IsShortcut)
         {
             TreeViewX tvx = TreeView as TreeViewX;
             if (tvx != null)
             {
                 tvx.OnValueListLoaded(this);
             }
         }
     }
 }
 public virtual void LoadNextLevelNodes()
 {
     if (_xmlNode != null)
     {
         TreeViewX tv = TreeView as TreeViewX;
         if (tv != null)
         {
             string err = tv.LoadNextLevelNodes(Nodes, _xmlNode, this);
             if (!string.IsNullOrEmpty(err))
             {
                 throw new TreeViewXException("Error loading next level. {0}", err);
             }
         }
         else
         {
             throw new TreeViewXException("Calling LoadNextLevelNodes when the node is not added to a TreeViewX. Node name:{0}", Name);
         }
     }
     if (this.IsLoadedByDataBinding)
     {
         TreeViewX tv = TreeView as TreeViewX;
         if (tv != null)
         {
             tv.LoadNodesByQuery(this);
         }
     }
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public EntityTreeView()
 {
     SelectionManager = new SelectionManager();
     treeView         = new TreeViewX {
         Dock = DockStyle.Fill, HideSelection = false
     };
     Controls.Add(treeView);
     treeView.AfterExpand     += (s, x) => ExpandStateChanged.Fire(this);
     treeView.AfterCollapse   += (s, x) => ExpandStateChanged.Fire(this);
     treeView.AfterSelect     += OnTreeViewAfterSelect;
     treeView.ContextMenuStrip = contextMenuStrip;
 }
 public void LoadData(TreeViewX treeView)
 {
     if (treeView.ImageList != null)
     {
         for (int i = 0; i < treeView.ImageList.Images.Count; i++)
         {
             imageList1.Images.Add(treeView.ImageList.Images[i]);
         }
     }
     treeView1.XmlString = treeView.XmlString;
     treeView1.SetEditMenu();
 }
        public ModuleManager(IApp app)
        {
            this.app = app;

            Text               = "Modules";
            Height             = 600;
            CloseButtonVisible = false;
            CloseButton        = false;

            var split = new SplitContainer {
                Orientation = Orientation.Horizontal,
                Dock        = DockStyle.Fill
            };

            Controls.Add(split);

            treeView = new TreeViewX(app)
            {
                Dock        = DockStyle.Fill,
                BorderStyle = BorderStyle.None
            };
            treeView.AfterSelect += OnNodeSelected;
            treeView.KeyDown     += OnTreeViewKeyDown;
            split.Panel1.Controls.Add(treeView);

            infos = new InfoPanel {
                Dock = DockStyle.Fill
            };
            split.Panel2.Controls.Add(infos);

            split.SplitterDistance = 400;
            Icon = null;

            history.Navigated += (sender, e) => {
                navCount++;
                try {
                    if (history.Current.Model.Node != null &&
                        history.Current.Model.Node.TreeView != null)
                    {
                        treeView.SelectedNode = history.Current.Model.Node;
                    }
                    else
                    {
                        NavigateModel(history.Current.Model);
                    }
                }
                finally {
                    navCount--;
                }
            };
            resolver = new ModuleResolver(this);
        }
        public MDTableHeapView()
        {
            var split1 = new SplitContainer {
                Orientation = Orientation.Vertical,
                Dock        = DockStyle.Fill
            };

            Controls.Add(split1);

            // Since App property isn't initialized in this moment,
            // a callback is setup to initialize treeview later.
            initTreeView = () => {
                treeView = new TreeViewX(App)
                {
                    Dock = DockStyle.Fill
                };
                treeView.AfterSelect     += OnNodeSelected;
                treeView.ContextMenuStrip = GetContextMenu();
                split1.Panel1.Controls.Add(treeView);
            };

            var split2 = new SplitContainer {
                Orientation = Orientation.Horizontal,
                Dock        = DockStyle.Fill
            };

            split1.Panel2.Controls.Add(split2);

            gridView = new GridView();
            gridView.AddColumn(new GridView.Column("Field", true, 120));
            gridView.AddColumn(new GridView.Column("Type", true, 130));
            gridView.AddColumn(new GridView.Column("Offset", true));
            gridView.AddColumn(new GridView.Column("Value", false));
            gridView.AddColumn(new GridView.Column("Description", false, 200));
            split2.Panel1.Controls.Add(gridView);

            hexView = new HexViewer();
            split2.Panel2.Controls.Add(hexView);

            PerformLayout();

            hls = new Dictionary <Table, HexViewer.HighLight[]>();

            hexView.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            var nav = new ToolStripMenuItem("Show in Raw Data");

            nav.Click += OnShowData;
            hexView.ContextMenuStrip.Items.Add(nav);

            followInHex = false;
        }
Exemple #11
0
        public override TreeNodeX CreateDuplicatedNode(TreeViewX targetHolder)
        {
            XmlDocument docTarget = targetHolder.GetXmlDocument();

            if (docTarget != _pointerXmlNode.OwnerDocument)
            {
                throw new TreeViewXException("Cannot duplicate shortcut bewteen different tree views");
            }
            ObjectXmlReader  oxr        = new ObjectXmlReader();
            XmlNode          pointerXml = _pointerXmlNode.Clone();
            TreeNodeShortcut tns        = new TreeNodeShortcut(pointerXml, oxr);

            return(tns);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         TreeViewX tvx = context.Instance as TreeViewX;
         if (tvx != null)
         {
             IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
             if (edSvc != null)
             {
             }
         }
     }
     return(base.EditValue(context, provider, value));
 }
 public void PrepareCurrentNode()
 {
     if (_fields != null)
     {
         TreeViewX tv = this.TreeView as TreeViewX;
         if (tv != null)
         {
             int       level = this.Level + 1;               //for query loading the next level
             DataQuery dq    = tv.GetDataQuery(level);
             if (dq != null)
             {
                 FieldList fs = dq.Fields;
                 if (fs != null)
                 {
                     for (int i = 0; i < _fields.Count; i++)
                     {
                         EPField f = fs[_fields[i].Name];
                         if (f != null)
                         {
                             f.Value = _fields[i].Value;
                         }
                     }
                 }
             }
         }
         if (_template != null)
         {
             FieldList fs = _template.Fields;
             if (fs != null)
             {
                 for (int i = 0; i < _fields.Count; i++)
                 {
                     EPField f = fs[_fields[i].Name];
                     if (f != null)
                     {
                         f.Value = _fields[i].Value;
                     }
                 }
             }
         }
         TreeNodeX tx = this.Parent as TreeNodeX;
         if (tx != null)
         {
             tx.PrepareCurrentNode();
         }
     }
 }
 public virtual TreeNodeX CreateDuplicatedNode(TreeViewX targetHolder)
 {
     if (_xmlNode == null)
     {
         TreeNodeX tnx = (TreeNodeX)this.Clone();
         return(tnx);
     }
     else
     {
         XmlNode     dataXml;
         XmlDocument docTarget = targetHolder.GetXmlDocument();
         if (docTarget == _xmlNode.OwnerDocument)
         {
             dataXml = _xmlNode.CloneNode(true);
         }
         else
         {
             dataXml = docTarget.ImportNode(_xmlNode, true);
         }
         XmlUtil.SetLibTypeAttribute(dataXml, this.GetType());
         XmlNodeList ndLst = dataXml.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                               "..//*[@{0}]", TreeViewX.XMLATT_Guid));
         Dictionary <Guid, Guid> idMaps = new Dictionary <Guid, Guid>();
         foreach (XmlNode nd in ndLst)
         {
             Guid id = XmlUtil.GetAttributeGuid(nd, TreeViewX.XMLATT_Guid);
             if (id == Guid.Empty)
             {
                 throw new TreeViewXException("Guid not found");
             }
             else
             {
                 Guid id2;
                 if (!idMaps.TryGetValue(id, out id2))
                 {
                     id2 = Guid.NewGuid();
                     idMaps.Add(id, id2);
                 }
             }
             XmlUtil.SetAttribute(nd, TreeViewX.XMLATT_Guid, Guid.NewGuid().ToString("D"));
         }
         TreeNodeX tnx = new TreeNodeX(dataXml);
         VPLUtil.CopyProperties(this, tnx);
         return(tnx);
     }
 }
Exemple #15
0
        public Analyzer(IApp app)
        {
            Text        = "Analyzer";
            HideOnClose = true;

            treeView = new TreeViewX(app)
            {
                Dock        = DockStyle.Fill,
                BorderStyle = BorderStyle.None
            };
            treeView.KeyDown += OnTreeViewKeyDown;
            Controls.Add(treeView);

            app.DockArea.DockWindows[DockState.DockBottom].BringToFront();
            Show(app.DockArea, DockState.DockBottom);
            Hide();
        }
Exemple #16
0
        void _data_AfterNameChange(object sender, EventArgs e)
        {
            string oldName = Name;

            Name = _data.Name;
            showText();
            if (_xmlNode != null)
            {
                XmlUtil.SetNameAttribute(_xmlNode, _data.Name);
            }
            TreeViewX tvx = TreeView as TreeViewX;

            if (tvx != null)
            {
                TreeNodeX tnx = this.Parent as TreeNodeX;
                if (tnx != null)
                {
                    tvx.OnValueNameChanged(tnx.TreeNodeId, oldName, _data.Name);
                }
            }
        }
 public void SetOwner(TreeViewX owner)
 {
     _owner = owner;
 }
Exemple #18
0
 public override TreeNodeX CreateDuplicatedNode(TreeViewX targetHolder)
 {
     throw new TreeViewXException("Cannot duplicate a pointer node");
 }
Exemple #19
0
    private static void addOtherTypes()
    {
        XmlUtil.AddKnownType("CodeArgumentReferenceExpression", typeof(CodeArgumentReferenceExpression));
        XmlUtil.AddKnownType("CodeArrayCreateExpression", typeof(CodeArrayCreateExpression));
        XmlUtil.AddKnownType("CodeArrayIndexerExpression", typeof(CodeArrayIndexerExpression));
        XmlUtil.AddKnownType("CodeBaseReferenceExpression", typeof(CodeBaseReferenceExpression));
        XmlUtil.AddKnownType("CodeBinaryOperatorExpression", typeof(CodeBinaryOperatorExpression));
        XmlUtil.AddKnownType("CodeCastExpression", typeof(CodeCastExpression));
        XmlUtil.AddKnownType("CodeDefaultValueExpression", typeof(CodeDefaultValueExpression));
        XmlUtil.AddKnownType("CodeDelegateCreateExpression", typeof(CodeDelegateCreateExpression));
        XmlUtil.AddKnownType("CodeDelegateInvokeExpression", typeof(CodeDelegateInvokeExpression));
        XmlUtil.AddKnownType("CodeDirectionExpression", typeof(CodeDirectionExpression));
        XmlUtil.AddKnownType("CodeEventReferenceExpression", typeof(CodeEventReferenceExpression));
        XmlUtil.AddKnownType("CodeFieldReferenceExpression", typeof(CodeFieldReferenceExpression));
        XmlUtil.AddKnownType("CodeIndexerExpression", typeof(CodeIndexerExpression));
        XmlUtil.AddKnownType("CodeMethodInvokeExpression", typeof(CodeMethodInvokeExpression));
        XmlUtil.AddKnownType("CodeMethodReferenceExpression", typeof(CodeMethodReferenceExpression));
        XmlUtil.AddKnownType("CodeObjectCreateExpression", typeof(CodeObjectCreateExpression));
        XmlUtil.AddKnownType("CodeParameterDeclarationExpression", typeof(CodeParameterDeclarationExpression));
        XmlUtil.AddKnownType("CodePrimitiveExpression", typeof(CodePrimitiveExpression));
        XmlUtil.AddKnownType("CodePropertyReferenceExpression", typeof(CodePropertyReferenceExpression));
        XmlUtil.AddKnownType("CodePropertySetValueReferenceExpression", typeof(CodePropertySetValueReferenceExpression));
        XmlUtil.AddKnownType("CodeSnippetExpression", typeof(CodeSnippetExpression));
        XmlUtil.AddKnownType("CodeThisReferenceExpression", typeof(CodeThisReferenceExpression));
        XmlUtil.AddKnownType("CodeTypeOfExpression", typeof(CodeTypeOfExpression));
        XmlUtil.AddKnownType("CodeTypeReferenceExpression", typeof(CodeTypeReferenceExpression));
        XmlUtil.AddKnownType("CodeVariableReferenceExpression", typeof(CodeVariableReferenceExpression));
        //
        XmlUtil.AddKnownType("CodeAssignStatement", typeof(CodeAssignStatement));
        XmlUtil.AddKnownType("CodeAttachEventStatement", typeof(CodeAttachEventStatement));
        XmlUtil.AddKnownType("CodeCommentStatement", typeof(CodeCommentStatement));
        XmlUtil.AddKnownType("CodeConditionStatement", typeof(CodeConditionStatement));
        XmlUtil.AddKnownType("CodeExpressionStatement", typeof(CodeExpressionStatement));
        XmlUtil.AddKnownType("CodeGotoStatement", typeof(CodeGotoStatement));
        XmlUtil.AddKnownType("CodeIterationStatement", typeof(CodeIterationStatement));
        XmlUtil.AddKnownType("CodeLabeledStatement", typeof(CodeLabeledStatement));
        XmlUtil.AddKnownType("CodeMethodReturnStatement", typeof(CodeMethodReturnStatement));
        XmlUtil.AddKnownType("CodeRemoveEventStatement", typeof(CodeRemoveEventStatement));
        XmlUtil.AddKnownType("CodeSnippetStatement", typeof(CodeSnippetStatement));
        XmlUtil.AddKnownType("CodeThrowExceptionStatement", typeof(CodeThrowExceptionStatement));
        XmlUtil.AddKnownType("CodeTryCatchFinallyStatement", typeof(CodeTryCatchFinallyStatement));
        XmlUtil.AddKnownType("CodeVariableDeclarationStatement", typeof(CodeVariableDeclarationStatement));

        //
        XmlUtil.AddKnownType("ProjectResources", typeof(ProjectResources));
        XmlUtil.AddKnownType("ResourceCodePointer", typeof(ResourceCodePointer));
        XmlUtil.AddKnownType("ResourcePointerString", typeof(ResourcePointerString));
        XmlUtil.AddKnownType("ResourcePointerImage", typeof(ResourcePointerImage));
        XmlUtil.AddKnownType("ResourcePointerIcon", typeof(ResourcePointerIcon));
        XmlUtil.AddKnownType("ResourcePointerAudio", typeof(ResourcePointerAudio));
        XmlUtil.AddKnownType("ResourcePointerFile", typeof(ResourcePointerFile));
        XmlUtil.AddKnownType("ResourcePointerFilePath", typeof(ResourcePointerFilePath));
        //
        XmlUtil.AddKnownType("MousePointer", typeof(MousePointer));
        XmlUtil.AddKnownType("Keyboard", typeof(Keyboard));
        XmlUtil.AddKnownType("HotKeyList", typeof(HotKeyList));
        XmlUtil.AddKnownType("WindowsManager", typeof(WindowsManager));
        XmlUtil.AddKnownType("WindowsRegistry", typeof(WindowsRegistry));
        XmlUtil.AddKnownType("ExecuteFile", typeof(ExecuteFile));
        XmlUtil.AddKnownType("ApplicationConfiguration", typeof(ApplicationConfiguration));
        XmlUtil.AddKnownType("CategoryList", typeof(CategoryList));
        XmlUtil.AddKnownType("MathematicExpression", typeof(MathematicExpression));
        XmlUtil.AddKnownType("ServiceBase", typeof(ServiceBase));
        XmlUtil.AddKnownType("Environment", typeof(Environment));
        XmlUtil.AddKnownType("MailSender", typeof(MailSender));
        XmlUtil.AddKnownType("OperationFailEventArgs", typeof(OperationFailEventArgs));
        XmlUtil.AddKnownType("OperationFailHandler", typeof(OperationFailHandler));
        XmlUtil.AddKnownType("EnumCharEncode", typeof(EnumCharEncode));
        XmlUtil.AddKnownType("FtpClient", typeof(FtpClient));
        XmlUtil.AddKnownType("FtpTransferEventArgs", typeof(FtpTransferEventArgs));
        XmlUtil.AddKnownType("FtpFileInfo", typeof(FtpFileInfo));
        XmlUtil.AddKnownType("TextBoxNumber", typeof(TextBoxNumber));
        XmlUtil.AddKnownType("LabelNumber", typeof(LabelNumber));
        XmlUtil.AddKnownType("ButtonKey", typeof(ButtonKey));
        XmlUtil.AddKnownType("KeyPairList", typeof(KeyPairList));
        XmlUtil.AddKnownType("KeyPair", typeof(KeyPair));
        XmlUtil.AddKnownType("StringTool", typeof(StringTool));
        XmlUtil.AddKnownType("Capturer", typeof(Capturer));
        XmlUtil.AddKnownType("CopyProtector", typeof(CopyProtector));
        XmlUtil.AddKnownType("OskWindow", typeof(OskWindow));
        XmlUtil.AddKnownType("PrinterManager", typeof(PrinterManager));
        XmlUtil.AddKnownType("RS232", typeof(RS232));
        XmlUtil.AddKnownType("ScheduleTimer", typeof(ScheduleTimer));
        XmlUtil.AddKnownType("Scheduler", typeof(Scheduler));
        XmlUtil.AddKnownType("EnumScheduleType", typeof(EnumScheduleType));
        XmlUtil.AddKnownType("DialogStringCollection", typeof(DialogStringCollection));
        XmlUtil.AddKnownType("StringCollectionEditor", typeof(StringCollectionEditor));
        XmlUtil.AddKnownType("MciMediaPlayer", typeof(MciMediaPlayer));
        XmlUtil.AddKnownType("RemotingHost", typeof(RemotingHost));
        XmlUtil.AddKnownType("EventArgsSchedule", typeof(EventArgsSchedule));
        XmlUtil.AddKnownType("MonthCalendar", typeof(MonthCalendar));
        XmlUtil.AddKnownType("PropertyClassWebClient", typeof(PropertyClassWebClient));
        XmlUtil.AddKnownType("PropertyClassWebServer", typeof(PropertyClassWebServer));
        XmlUtil.AddKnownType("SessionVariableCollection", typeof(SessionVariableCollection));
        XmlUtil.AddKnownType("SessionVariable", typeof(SessionVariable));
        //activate TreeViewX.AddKnownTypes()
        ///////
        XmlUtil.AddKnownType("PointFX", typeof(PointFX));
        TreeViewX.Init();
        //========
        XmlUtil.AddKnownType("WebBrowserControl", typeof(WebBrowserControl));
        XmlUtil.AddKnownType("RichTextBoxEx", typeof(RichTextBoxEx));
        //
        string sDir       = Path.GetDirectoryName(typeof(DesignService).Assembly.Location);
        string toolboxCfg = Path.Combine(sDir, "LimnorToolbox.xml");

        toolboxCfg = Path.Combine(sDir, "LimnorWebToolbox.xml");
        XmlUtil.AddKnownTypes(toolboxCfg);
    }
Exemple #20
0
 public static void ShowModule(TreeViewX treeView, ModuleDef module)
 {
     TreeNavigator.Create()
     .Path <dnModuleModel>(m => m.Module.ModuleDef == module ? NavigationState.Done : NavigationState.Next)
     .Goto(treeView);
 }