Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="ExceptionControl"/> class.</summary>
        public ExceptionControl()
        {
            this.InitializeComponent();

            if (!this.DesignMode)
            {
                this.exceptionTree = this.CreateExceptionTree(new ThrownException[] { });
                this.callStackList = this.exceptionTree.CallStackList;

                this.Controller = new ExceptionExplorerController(this.classTree, this.exceptionTree, this.callStackList, this.sourceViewer);
                this.Controller.CreateExceptionTree = this.CreateExceptionTree;
                this.Controller.Settings.ShowSource.Set += val => this.sourceSplit.Panel2Collapsed = !(this.sourceViewer.Enabled = val);

                this.Controller.Settings.AnalysisOptions.XmlDocumentation.Value = Config.XmlDocumentationUsage.Combine;

                this.exceptionTree.ObjectChanged += new EventHandler<MethodContainerEventArgs>(exceptionTree_ObjectChanged);
                this.callStackList.ObjectChanged += new EventHandler<MethodContainerEventArgs>(callStackList_ObjectChanged);
                this.sourceViewer.MethodChanged += new EventHandler(sourceViewer_MethodChanged);
                this.sourceViewer.ProgressChanged += new EventHandler<Decompiler.ProgressChangedEventArgs>(sourceViewer_ProgressChanged);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionExplorerController"/> class.
        /// </summary>
        /// <param name="classTree">The class tree.</param>
        /// <param name="exceptionTree">The exception tree.</param>
        /// <param name="callStackList">The exception list.</param>
        internal ExceptionExplorerController(ClassTree classTree, ExceptionTree exceptionTree, CallStackList callStackList, SourceViewer sourceViewer)
        {
            this.History = new History();
            this.History.Changed += new EventHandler(HistoryChanged);

            this.CreateExceptionTree = (IEnumerable<ThrownException> list) => { return new ExceptionTree(); };

            this.ClassTree = classTree;
            this.ExceptionTree = exceptionTree;
            this.CallStackList = callStackList;
            this.SourceViewer = sourceViewer;

            this.ClassTree.Controller = this.ExceptionTree.Controller = this.CallStackList.Controller = this;

            this.Settings = Options.Current;

            this.ExceptionFinder = ExceptionFinder.Instance;
            this.ExceptionFinder.DocumentedExceptionsCallback = Decompiler.Extensions.XmlDocumentation.GetDocumentedExceptions;
            this.ExceptionFinder.SynchronizeInvoke = this.ClassTree;

            this.ClassTree.PathSeparator = "\a";
            this.ExceptionTree.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(ExceptionTree_BeforeSelect);
            this.ClassTree.AfterSelect += new TreeViewEventHandler(ClassTree_AfterSelect);

            this.CallStackList.MethodSelected += new EventHandler<UI.CallStackList.MethodEventArgs>(callStackList_MethodSelected);

            this.ClassTree.AllowDrop = true;
            this.ClassTree.DragEnter += new DragEventHandler(ClassTree_DragEnter);
            this.ClassTree.DragDrop += new DragEventHandler(ClassTree_DragDrop);

            this.ExceptionFinder.Settings.Changed += new EventHandler<SettingChangedEventArgs>(SettingsChangeReload);
            this.Settings.InheritedMemberFullname.Changed += new EventHandler<SettingChangedEventArgs>(SettingsChangeUpdate);
            this.Settings.MemberFullname.Changed += new EventHandler<SettingChangedEventArgs>(SettingsChangeUpdate);
            this.Settings.SeparateBaseClassItem.Changed += new EventHandler<SettingChangedEventArgs>(SettingsChangeUpdate);

            this.Settings.BulkChange += new EventHandler<EventArgs>(Settings_BulkChange);

            this.Settings.Source.Changed += new EventHandler<SettingChangedEventArgs>(Source_Changed);
            this.Settings.ShowSource.Changed += new EventHandler<SettingChangedEventArgs>(Source_Changed);

            this.UpdateSourceViewerSettings();

            // context menus
            ContextActionCallbacks callbacks = new ContextActionCallbacks(this);

            this.NodeActions = new ContextActionController();
            ContextAction[] a =
            {
                new ContextAction("Show Call") {
                    Controls = { this.CallStackList },
                    Callback = callbacks.ShowSource,
                    Predicate = (nodeInfo) =>
                    {
                        return !this.Settings.Source.AutoDecompile.Value || !this.Settings.ShowSource.Value;
                    }
                },

                new ContextAction("Load declaring assembly", ~NodeType.Assembly) {
                    Controls = { this.CallStackList, this.ClassTree },
                    Callback = callbacks.LoadAssembly,
                    Predicate = (nodeInfo) =>
                    {
                        return this.ClassTree.GetAssemblyNode(nodeInfo.AnalysisObject.GetAssembly()) == null;
                    }
                },

                new ContextAction("Show Source", ~(NodeType.Assembly | NodeType.Namespace)) {
                    Controls = { this.ClassTree },
                    Callback = callbacks.ShowSource,
                    Predicate = (nodeInfo) =>
                    {
                        return !this.Settings.Source.AutoDecompile.Value || !this.Settings.ShowSource.Value;
                    }
                },

                new ContextAction("Unload", NodeType.Assembly) {
                    Callback = callbacks.UnloadAssembly,
                    Controls = { this.ClassTree },
                },

                new ContextAction("Copy name") {
                    Callback = callbacks.CopyFullName
                }
            };

            this.NodeActions.AddRange(a);
            this.NodeActions.AddControl(this.ClassTree);
            this.NodeActions.AddControl(this.ExceptionTree);
            this.NodeActions.AddControl(this.CallStackList);
        }
Пример #3
0
 void callStackList_MethodSelected(object sender, CallStackList.MethodEventArgs e)
 {
     if (this.Settings.Source.AutoDecompile.Value || (sender == this))
     {
         Job job = Job.SourceView.NewJob(this.SourceViewer, (cancelToken) =>
         {
             // show the call to the selected method
             if (e.Method != null)
             {
                 this.ShowMethodCall(e.CallingMethod, e.Method);
             }
             else
             {
                 this.ShowExceptionThrow(e.CallingMethod, e.Exception);
             }
             //this.SourceViewer.SetSource(e.Method.MethodBase);
         }).Execute();
     }
 }
Пример #4
0
        /// <summary>Creates a new exception tree. Currently, only one is used.</summary>
        /// <param name="list">The list.</param>
        /// <returns>An exception tree</returns>
        public ExceptionTree CreateExceptionTree(IEnumerable<ThrownException> list)
        {
            if (this.exceptionTree != null)
            {
                return this.exceptionTree;
            }

            ExceptionTree tree = new ExceptionTree();
            CallStackList callStackList = new CallStackList();
            TitleBar treeTitle = new TitleBar();
            TitleBar callStackTitle = new TitleBar();
            SplitContainer split = new SplitContainer();

            tree.SuspendLayout();
            callStackList.SuspendLayout();
            treeTitle.SuspendLayout();
            callStackTitle.SuspendLayout();
            split.SuspendLayout();

            tree.CallStackList = callStackList;

            int titleHeight = 18;
            int width = this.splitContainerMaster.Panel1.ClientRectangle.Width;

            //treeTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            treeTitle.Dock = DockStyle.Top;
            treeTitle.BackColor = System.Drawing.SystemColors.Control;
            treeTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            //treeTitle.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Height);
            treeTitle.Name = "exceptionTreeTitle";
            treeTitle.Size = new System.Drawing.Size(width, titleHeight);
            treeTitle.TabIndex = 1;
            treeTitle.Text = "Exception Tree";
            treeTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            tree.BackColor = System.Drawing.SystemColors.Window;
            tree.Controller = null;
            tree.Dock = System.Windows.Forms.DockStyle.Fill;
            tree.FullRowSelect = true;
            tree.Location = new System.Drawing.Point(0, titleHeight);
            tree.Margin = new System.Windows.Forms.Padding(0);
            tree.Name = "exceptionTree";
            tree.ImageList = this.classTree.ImageList;
            tree.Size = new System.Drawing.Size(558, 154);
            tree.TabIndex = 2;

            callStackTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            callStackTitle.BackColor = System.Drawing.SystemColors.Control;
            callStackTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            callStackTitle.Location = new System.Drawing.Point(0, 0);
            callStackTitle.Name = "callStackTitle";
            callStackTitle.Size = new System.Drawing.Size(width, titleHeight);
            callStackTitle.TabIndex = 1;
            callStackTitle.Text = "Call stack";
            callStackTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            callStackList.BackColor = System.Drawing.SystemColors.Window;
            callStackList.Controller = null;
            callStackList.Dock = System.Windows.Forms.DockStyle.Fill;
            callStackList.FullRowSelect = true;
            callStackList.GroupByType = false;
            callStackList.Location = new System.Drawing.Point(0, titleHeight);
            callStackList.Margin = new System.Windows.Forms.Padding(0);
            callStackList.Name = "callStackList";
            callStackList.OwnerDraw = true;
            callStackList.Size = new System.Drawing.Size(width, 154);
            callStackList.SmallImageList = this.images;
            callStackList.TabIndex = 2;
            callStackList.UseCompatibleStateImageBehavior = false;
            callStackList.View = System.Windows.Forms.View.Details;

            split.Name = "splitExceptions";
            split.Orientation = System.Windows.Forms.Orientation.Horizontal;

            //split.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Size.Height);
            //split.Size = new System.Drawing.Size(100, this.exceptionTabStrip.ClientRectangle.Height);

            split.Panel1.Controls.Add(treeTitle);
            split.Panel1.Controls.Add(tree);
            split.Panel1.Padding = new System.Windows.Forms.Padding(0, titleHeight , 0, 0);

            split.Panel2.Controls.Add(callStackTitle);
            split.Panel2.Controls.Add(callStackList);
            split.Panel2.Padding = new System.Windows.Forms.Padding(0, titleHeight, 0, 0);

            //split.Size = new System.Drawing.Size(558, 298);
            split.SplitterDistance = 122;
            split.TabIndex = 5;

            split.Dock = DockStyle.Fill;

            this.splitContainerMaster.Panel2.Controls.Add(split);
            ////this.tablePanel.Controls.Add(split, 0, 1);
            ////this.exceptionTabStrip.ActiveTab = this.exceptionTabStrip.AddTab("hello", split);

            split.Margin = new System.Windows.Forms.Padding(0);

            tree.ResumeLayout();
            callStackList.ResumeLayout();
            treeTitle.ResumeLayout();
            callStackTitle.ResumeLayout();
            split.ResumeLayout();

            this.exceptionTreeTitle = treeTitle;
            this.callStackListTitle = callStackTitle;

            return tree;
        }