Exemplo n.º 1
0
        public Control CreateControl()
        {
            var uiService  = services.RequireService <IDecompilerShellUiService>();
            var uiPrefsSvc = services.RequireService <IUiPreferencesService>();

            this.control      = new LowLevelView();
            this.Control.Font = uiPrefsSvc.DisassemblerFont ?? new Font("Lucida Console", 10F); //$TODO: use user preference
            this.Control.CurrentAddressChanged += LowLevelView_CurrentAddressChanged;

            this.Control.ImageMapView.SelectedAddressChanged += ImageMapView_SelectedAddressChanged;

            this.Control.MemoryView.SelectionChanged += MemoryView_SelectionChanged;
            this.Control.MemoryView.ContextMenu       = uiService.GetContextMenu(MenuIds.CtxMemoryControl);
            this.control.MemoryView.Services          = this.services;

            this.Control.DisassemblyView.SelectedObjectChanged += DisassemblyView_SelectedObjectChanged;
            this.Control.DisassemblyView.ContextMenu            = uiService.GetContextMenu(MenuIds.CtxDisassembler);
            this.Control.DisassemblyView.Navigate += DisassemblyControl_Navigate;

            this.Control.ToolBarGoButton.Click         += ToolBarGoButton_Click;
            this.Control.ToolBarAddressTextbox.KeyDown += ToolBarAddressTextbox_KeyDown;

            this.navInteractor = new NavigationInteractor();
            this.navInteractor.Attach(this.Control);

            typeMarker               = new TypeMarker(control.MemoryView);
            typeMarker.TextChanged  += typeMarker_FormatType;
            typeMarker.TextAccepted += typeMarker_TextAccepted;

            return(control);
        }
Exemplo n.º 2
0
        public Control CreateControl()
        {
            var uiSvc = services.RequireService <IDecompilerShellUiService>();

            this.combinedCodeView      = new CombinedCodeView();
            this.combinedCodeView.Dock = DockStyle.Fill;

            this.combinedCodeView.CurrentAddressChanged += CombinedCodeView_CurrentAddressChanged;

            this.combinedCodeView.MixedCodeDataView.VScrollValueChanged += MixedCodeDataView_VScrollValueChanged;
            this.combinedCodeView.MixedCodeDataView.Services             = services;
            this.combinedCodeView.MixedCodeDataView.MouseDown           += MixedCodeDataView_MouseDown;
            this.combinedCodeView.MixedCodeDataView.ModelChanged        += MixedCodeDataView_ModelChanged;
            this.combinedCodeView.MixedCodeDataView.Navigate            += TextView_Navigate;

            this.combinedCodeView.CodeView.VScrollValueChanged += CodeView_VScrollValueChanged;
            this.combinedCodeView.CodeView.Services             = services;
            this.combinedCodeView.CodeView.MouseDown           += CodeView_MouseDown;
            this.combinedCodeView.CodeView.Navigate            += TextView_Navigate;

            this.combinedCodeView.ContextMenu = uiSvc.GetContextMenu(MenuIds.CtxCodeView);

            this.combinedCodeView.ToolBarGoButton.Click         += ToolBarGoButton_Click;
            this.combinedCodeView.ToolBarAddressTextbox.KeyDown += ToolBarAddressTextbox_KeyDown;

            this.gViewer                  = new GViewer();
            this.gViewer.Dock             = DockStyle.Fill;
            this.gViewer.Visible          = false;
            this.gViewer.PanButtonPressed = true;
            this.gViewer.ToolBarIsVisible = true;
            this.gViewer.KeyDown         += GViewer_KeyDown;
            this.gViewer.ContextMenu      = uiSvc.GetContextMenu(MenuIds.CtxCodeView);
            this.gViewer.LayoutAlgorithmSettingsButtonVisible = false;
            this.gViewer.LayoutEditingEnabled    = false;
            this.gViewer.EdgeInsertButtonVisible = false;
            this.gViewer.SaveButtonVisible       = false;
            this.gViewer.SaveGraphButtonVisible  = false;
            this.gViewer.SaveAsMsaglEnabled      = false;
            this.gViewer.UndoRedoButtonsVisible  = false;
            this.gViewer.KeyDown              += GViewer_KeyDown;
            this.gViewer.ContextMenu           = uiSvc.GetContextMenu(MenuIds.CtxCodeView);
            this.gViewer.MouseUp              += GViewer_MouseUp;
            this.gViewer.DrawingPanel.MouseUp += GViewer_MouseUp;
            var iViewer = (IViewer)gViewer;

            iViewer.MouseUp   += IViewer_MouseUp;
            iViewer.MouseDown += IViewer_MouseDown;

            this.navInteractor = new NavigationInteractor <Address>();
            this.navInteractor.Attach(this.combinedCodeView);

            declarationFormInteractor = new DeclarationFormInteractor(services);
            previewInteractor         = new PreviewInteractor(
                services,
                this.program,
                this.combinedCodeView.PreviewTimer,
                this.combinedCodeView.MixedCodeDataView);

            return(combinedCodeView);
        }
Exemplo n.º 3
0
        public void Ni_Attach()
        {
            ni = new NavigationInteractor();
            mr.ReplayAll();

            When_Attached();

            Assert.IsFalse(btnBack.Enabled);
            Assert.IsFalse(btnForward.Enabled);
        }
Exemplo n.º 4
0
        public void Ni_UserNavigateTo()
        {
            ni = new NavigationInteractor();
            mr.ReplayAll();


            When_Attached();
            navControl.CurrentAddress = addr42;
            Assert.IsFalse(btnBack.Enabled);
            ni.UserNavigateTo(addr43);
            Assert.IsTrue(btnBack.Enabled);
            Assert.AreEqual(addr43, navControl.CurrentAddress);

            mr.VerifyAll();
        }
        public void Ni_UserNavigateTo()
        {
            ni = new NavigationInteractor<Address>();
            mr.ReplayAll();


            When_Attached();
            navControl.CurrentAddress = addr42;
            Assert.IsFalse(btnBack.Enabled);
            ni.RememberAddress(addr43);
            Assert.IsTrue(btnBack.Enabled);
            Assert.IsFalse(btnForward.Enabled);

            mr.VerifyAll();
        }
Exemplo n.º 6
0
        public Control CreateControl()
        {
            var uiPrefsSvc = services.RequireService <IUiPreferencesService>();

            this.codeView      = new CodeView();
            this.codeView.Dock = DockStyle.Fill;
            this.codeView.CurrentAddressChanged            += codeView_CurrentAddressChanged;
            this.codeView.ProcedureDeclaration.TextChanged += ProcedureDeclaration_TextChanged;

            this.TextView.Font      = new Font("Lucida Console", 10F);
            this.TextView.BackColor = SystemColors.Window;
            this.TextView.Services  = services;

            this.TextView.ContextMenu = services.RequireService <IDecompilerShellUiService>().GetContextMenu(MenuIds.CtxCodeView);

            this.navInteractor = new NavigationInteractor <Procedure>();
            this.navInteractor.Attach(codeView);
            this.TextView.Navigate += textView_Navigate;
            return(this.codeView);
        }
Exemplo n.º 7
0
        public void Ni_Back()
        {
            ni = new NavigationInteractor();
            mr.ReplayAll();

            When_Attached();
            navControl.CurrentAddress = addr42;
            ni.UserNavigateTo(addr43);
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);

            Assert.IsFalse(btnBack.Enabled);
            Assert.IsTrue(btnForward.Enabled);
            Assert.AreSame(addr42, navControl.CurrentAddress);
        }
Exemplo n.º 8
0
        public Control CreateControl()
        {
            var uiPrefsSvc = services.RequireService<IUiPreferencesService>();

            this.codeView = new CodeView();
            this.codeView.Dock = DockStyle.Fill;
            this.codeView.CurrentAddressChanged += codeView_CurrentAddressChanged;
            this.codeView.ProcedureDeclaration.TextChanged += ProcedureDeclaration_TextChanged;

            this.TextView.Font = new Font("Lucida Console", 10F);
            this.TextView.BackColor = SystemColors.Window;
            this.TextView.Services = services;

            this.TextView.ContextMenu = services.RequireService<IDecompilerShellUiService>().GetContextMenu(MenuIds.CtxCodeView);

            this.navInteractor = new NavigationInteractor<Procedure>();
            this.navInteractor.Attach(codeView);
            this.TextView.Navigate += textView_Navigate;
            return this.codeView;
        }
Exemplo n.º 9
0
        public Control CreateControl()
        {
            var uiService = services.RequireService<IDecompilerShellUiService>();
            var uiPrefsSvc = services.RequireService<IUiPreferencesService>();
            this.control = new LowLevelView();
            this.Control.Font = uiPrefsSvc.DisassemblerFont ?? new Font("Lucida Console", 10F); //$TODO: use user preference
            this.Control.CurrentAddressChanged += LowLevelView_CurrentAddressChanged;

            this.Control.ImageMapView.SelectedAddressChanged += ImageMapView_SelectedAddressChanged;

            this.Control.MemoryView.SelectionChanged += MemoryView_SelectionChanged;
            this.Control.MemoryView.ContextMenu = uiService.GetContextMenu(MenuIds.CtxMemoryControl);
            this.control.MemoryView.Services = this.services;

            this.Control.DisassemblyView.SelectedObjectChanged += DisassemblyView_SelectedObjectChanged;
            this.Control.DisassemblyView.ContextMenu = uiService.GetContextMenu(MenuIds.CtxDisassembler);
            this.Control.DisassemblyView.Navigate += DisassemblyControl_Navigate;

            this.Control.ToolBarGoButton.Click += ToolBarGoButton_Click;
            this.Control.ToolBarAddressTextbox.KeyDown += ToolBarAddressTextbox_KeyDown;

            this.navInteractor = new NavigationInteractor();
            this.navInteractor.Attach(this.Control);

            typeMarker = new TypeMarker(control.MemoryView);
            typeMarker.TextChanged += typeMarker_FormatType;
            typeMarker.TextAccepted += typeMarker_TextAccepted;

            return control;
        }
Exemplo n.º 10
0
        public void Ni_Back2_Then_Navigate()
        {
            ni = new NavigationInteractor<Address>();
            mr.ReplayAll();

            When_Attached();
            navControl.CurrentAddress = addr42;
            ni.RememberAddress(addr43);
            ni.RememberAddress(addr44);
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);

            Assert.IsFalse(btnBack.Enabled);
            Assert.IsTrue(btnForward.Enabled);

            ni.RememberAddress(addr44);
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);
        }
Exemplo n.º 11
0
        public Control CreateControl()
        {
            var uiSvc = services.RequireService<IDecompilerShellUiService>();

            this.combinedCodeView = new CombinedCodeView();
            this.combinedCodeView.Dock = DockStyle.Fill;

            this.combinedCodeView.CurrentAddressChanged += CombinedCodeView_CurrentAddressChanged;

            this.combinedCodeView.MixedCodeDataView.VScrollValueChanged += MixedCodeDataView_VScrollValueChanged;
            this.combinedCodeView.MixedCodeDataView.Services = services;
            this.combinedCodeView.MixedCodeDataView.MouseDown += MixedCodeDataView_MouseDown;
            this.combinedCodeView.MixedCodeDataView.ModelChanged += MixedCodeDataView_ModelChanged;
            this.combinedCodeView.MixedCodeDataView.Navigate += TextView_Navigate;

            this.combinedCodeView.CodeView.VScrollValueChanged += CodeView_VScrollValueChanged;
            this.combinedCodeView.CodeView.Services = services;
            this.combinedCodeView.CodeView.MouseDown += CodeView_MouseDown;
            this.combinedCodeView.CodeView.Navigate += TextView_Navigate;

            this.combinedCodeView.ContextMenu = uiSvc.GetContextMenu(MenuIds.CtxCodeView);

            this.combinedCodeView.ToolBarGoButton.Click += ToolBarGoButton_Click;
            this.combinedCodeView.ToolBarAddressTextbox.KeyDown += ToolBarAddressTextbox_KeyDown;

            this.gViewer = new GViewer();
            this.gViewer.Dock = DockStyle.Fill;
            this.gViewer.Visible = false;
            this.gViewer.PanButtonPressed = true;
            this.gViewer.ToolBarIsVisible = true;
            this.gViewer.KeyDown += GViewer_KeyDown;
            this.gViewer.ContextMenu = uiSvc.GetContextMenu(MenuIds.CtxCodeView);
            this.gViewer.LayoutAlgorithmSettingsButtonVisible = false;
            this.gViewer.LayoutEditingEnabled = false;
            this.gViewer.EdgeInsertButtonVisible = false;
            this.gViewer.SaveButtonVisible = false;
            this.gViewer.SaveGraphButtonVisible = false;
            this.gViewer.SaveAsMsaglEnabled = false;
            this.gViewer.UndoRedoButtonsVisible = false;
            this.gViewer.KeyDown += GViewer_KeyDown;
            this.gViewer.ContextMenu = uiSvc.GetContextMenu(MenuIds.CtxCodeView);
            this.gViewer.MouseUp += GViewer_MouseUp;
            this.gViewer.DrawingPanel.MouseUp += GViewer_MouseUp;
            var iViewer = (IViewer)gViewer;
            iViewer.MouseUp += IViewer_MouseUp;
            iViewer.MouseDown += IViewer_MouseDown;

            this.navInteractor = new NavigationInteractor<Address>();
            this.navInteractor.Attach(this.combinedCodeView);

            declarationFormInteractor = new DeclarationFormInteractor(services);

            return combinedCodeView;
        }
Exemplo n.º 12
0
        public void Ni_Back2_Then_Forward2_Distinct()
        {
            ni = new NavigationInteractor<Address>();
            mr.ReplayAll();

            When_Attached();

            Assert.IsFalse(btnBack.Enabled);
            Assert.IsFalse(btnForward.Enabled);

            navControl.CurrentAddress = addr42;
            ni.RememberAddress(addr43);
            navControl.CurrentAddress = addr45;
            ni.RememberAddress(addr44);

            Assert.IsTrue(btnBack.Enabled);
            Assert.IsFalse(btnForward.Enabled);

            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);
            Assert.AreEqual("0000002D", navControl.CurrentAddress.ToString());
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);
            Assert.AreEqual("0000002B", navControl.CurrentAddress.ToString());
            btnBack.Raise(b => b.Click += null, btnBack, EventArgs.Empty);
            Assert.AreEqual("0000002A", navControl.CurrentAddress.ToString());

            Assert.IsFalse(btnBack.Enabled);
            Assert.IsTrue(btnForward.Enabled);

            btnForward.Raise(b => b.Click += null, btnForward, EventArgs.Empty);
            Assert.AreEqual("0000002B", navControl.CurrentAddress.ToString());
            btnForward.Raise(b => b.Click += null, btnForward, EventArgs.Empty);
            Assert.AreEqual("0000002D", navControl.CurrentAddress.ToString());
            btnForward.Raise(b => b.Click += null, btnForward, EventArgs.Empty);
            Assert.AreEqual("0000002C", navControl.CurrentAddress.ToString());

            Assert.IsTrue(btnBack.Enabled);
            Assert.IsFalse(btnForward.Enabled);
        }