Beispiel #1
0
        public void closeToolStripMenuItem_Click(object sender, EventArgs e, ref CurrentAssembly currentAssembly)
        {
            //TODO: Update on changes

            if (SelectedNode == null)
            {
                return;
            }

            TreeNode assembly = SelectedNode.FirstParentNode();

            if (assembly == null)
            {
                return;
            }

            CurrentMethod   = null;
            CurrentModule   = null;
            currentAssembly = null;
            DataGridViewHandler.ClearInstructions();
            VariableHandler.ClearVariables();
            ILSpyHandler.Clear();
            AnalysisHandler.Reset();
            assembly.Remove();
        }
Beispiel #2
0
        public static void ReadMethod(MethodDef method)
        {
            if (_currentMethod == method)
            {
                _currentRowIndex = MainForm.DgBody.FirstDisplayedScrollingRowIndex;

                if (MainForm.DgBody.SelectedRows.Count > 0)
                {
                    _currentSelectedRowIndex = MainForm.DgBody.SelectedRows.TopmostRow().Index;
                }

                _currentVariableRowIndex = MainForm.DgVariables.FirstDisplayedScrollingRowIndex;

                if (MainForm.DgVariables.SelectedRows.Count > 0)
                {
                    _currentVariableSelectedRowIndex = MainForm.DgVariables.SelectedRows.TopmostRow().Index;
                }
            }
            else
            {
                _currentMethod = method;

                _currentRowIndex         = 0;
                _currentSelectedRowIndex = 0;

                _currentVariableRowIndex         = 0;
                _currentVariableSelectedRowIndex = 0;
            }

            ClearInstructions();
            VariableHandler.ClearVariables();

            MainForm.CurrentAssembly.Method = method;

            ILSpyHandler.CheckDecompile();

            if (!method.HasBody)
            {
                return;
            }

            ReadInstructions(method);
            VariableHandler.ReadVariables(method);
            ExceptionHandler.ReadExceptionHandlers(method);

            RestoreInstructionSelection();
            RestoreVariableSelection();
        }
Beispiel #3
0
        public void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode assemblyNode = e.Node.FirstParentNode();

            if (MainForm.CurrentAssembly == null || MainForm.CurrentAssembly.ManifestModule != assemblyNode.Tag as ModuleDefMD)
            {
                AnalysisHandler.Reset();

                MainForm.CurrentAssembly      = new CurrentAssembly(assemblyNode.Tag as ModuleDefMD);
                MainForm.CurrentAssembly.Path = assemblyNode.ToolTipText;

                if (e.Node.ModuleNode() != null)
                {
                    CurrentModule = e.Node.ModuleNode();
                }
            }

            if (e.Node.Tag is MethodDef)
            {
                var method = e.Node.Tag as MethodDef;

                if (CurrentMethod == null || method != CurrentMethod.Tag as MethodDef)
                {
                    ILSpyHandler.Clear();
                    DataGridViewHandler.ReadMethod(method);
                    CurrentMethod = e.Node;

                    NavigationHistory.AddPastHistory(method);
                }
            }
            else
            {
                CurrentMethod = null;
                MainForm.CurrentAssembly.Method = null;
                DataGridViewHandler.ClearInstructions();
                VariableHandler.ClearVariables();
                ILSpyHandler.Clear();
            }

            SelectedNode = e.Node;
        }