예제 #1
0
 public void Setup()
 {
     this.mr = new MockRepository();
     this.uiPrefs = mr.Stub<IUiPreferencesService>();
     this.styles = new Dictionary<string, UiStyle>();
     this.uiPrefs.Stub(u => u.Styles).Return(styles);
 }
예제 #2
0
 public static Graph Generate(IUiPreferencesService uiPreferences, Procedure proc, Graphics g, Font defaultFont)
 {
     Graph graph = new Graph();
     var cfgGen = new CfgGraphGenerator(graph, uiPreferences, g, defaultFont);
     cfgGen.Traverse(proc.EntryBlock.Succ[0]);
     graph.Attr.LayerDirection = LayerDirection.TB;
     return graph;
 }
예제 #3
0
 private void CopyStyles(IUiPreferencesService from, IUiPreferencesService to)
 {
     to.Styles.Clear();
     foreach (var style in from.Styles.Values)
     {
         to.Styles[style.Name] = style.Clone();
     }
 }
예제 #4
0
 public CfgGraphGenerator(Graph graph, IUiPreferencesService uiPreferences, Graphics g, Font defaultFont)
 {
     this.uiPreferences = uiPreferences;
     this.graph         = graph;
     this.g             = g;
     this.defaultFont   = defaultFont;
     this.visited       = new HashSet <Block>();
 }
예제 #5
0
 public CfgGraphGenerator(Graph graph, IUiPreferencesService uiPreferences, Graphics g, Font defaultFont)
 {
     this.uiPreferences = uiPreferences;
     this.graph = graph;
     this.g = g;
     this.defaultFont = defaultFont;
     this.visited = new HashSet<Block>();
 }
예제 #6
0
 public StyleStack(IUiPreferencesService uiPrefSvc)
 {
     if (uiPrefSvc == null)
     {
         throw new ArgumentNullException("uiPrefSvc");
     }
     this.uiPrefSvc = uiPrefSvc;
     this.stack     = new List <string[]>();
 }
예제 #7
0
        public static Graph Generate(IUiPreferencesService uiPreferences, Procedure proc, Graphics g, Font defaultFont)
        {
            Graph graph  = new Graph();
            var   cfgGen = new CfgGraphGenerator(graph, uiPreferences, g, defaultFont);

            cfgGen.Traverse(proc.EntryBlock.Succ[0]);
            graph.Attr.LayerDirection = LayerDirection.TB;
            return(graph);
        }
예제 #8
0
        private void Control_Load(object sender, EventArgs e)
        {
            this.uiPrefsSvc = services.RequireService <IUiPreferencesService>();
            var items = program.ImportReferences.Values
                        .Select(CreateListItem)
                        .ToArray();

            control.Imports.Items.Clear();
            control.Imports.Items.AddRange(items);
        }
예제 #9
0
 public void Setup()
 {
     mr        = new MockRepository();
     sc        = new ServiceContainer();
     mockTree  = mr.StrictMock <ITreeView>();
     mockNodes = mr.StrictMock <ITreeNodeCollection>();
     uiSvc     = mr.StrictMock <IDecompilerShellUiService>();
     uiPrefSvc = mr.Stub <IUiPreferencesService>();
     mockTree.Stub(t => t.Nodes).Return(mockNodes);
     uiSvc.Stub(u => u.SetContextMenu(null, 0)).IgnoreArguments();
     sc.AddService <IDecompilerShellUiService>(uiSvc);
     sc.AddService <IUiPreferencesService>(uiPrefSvc);
     fakeTree = new FakeTreeView();
 }
예제 #10
0
 public void Setup()
 {
     mr         = new MockRepository();
     sp         = new ServiceContainer();
     uiSvc      = mr.StrictMock <IDecompilerShellUiService>();
     uiPrefsSvc = mr.StrictMock <IUiPreferencesService>();
     dlgFactory = mr.StrictMock <IDialogFactory>();
     uiSvc.Stub(u => u.GetContextMenu(MenuIds.CtxMemoryControl)).Return(new ContextMenu());
     uiSvc.Stub(u => u.GetContextMenu(MenuIds.CtxDisassembler)).Return(new ContextMenu());
     uiSvc.Replay();
     uiPrefsSvc.Replay();
     sp.AddService(typeof(IDecompilerShellUiService), uiSvc);
     sp.AddService(typeof(IDialogFactory), dlgFactory);
     sp.AddService(typeof(IUiPreferencesService), uiPrefsSvc);
     addrBase = Address.Ptr32(0x1000);
 }
예제 #11
0
 public void Setup()
 {
     mr = new MockRepository();
     codeViewer = new CodeViewerPane();
     decompilerSvc = mr.Stub<IDecompilerService>();
     decompiler = mr.Stub<IDecompiler>();
     uiPreferencesSvc = mr.Stub<IUiPreferencesService>();
     uiSvc = mr.Stub<IDecompilerShellUiService>();
     font = new Font("Arial", 10);
     var sc = new ServiceContainer();
     decompilerSvc.Decompiler = decompiler;
     sc.AddService<IDecompilerService>(decompilerSvc);
     sc.AddService<IUiPreferencesService>(uiPreferencesSvc);
     sc.AddService<IDecompilerShellUiService>(uiSvc);
     codeViewer.SetSite(sc);
 }
예제 #12
0
 public void Setup()
 {
     mr         = new MockRepository();
     sp         = new ServiceContainer();
     uiSvc      = mr.StrictMock <IDecompilerShellUiService>();
     uiPrefsSvc = mr.StrictMock <IUiPreferencesService>();
     dlgFactory = mr.StrictMock <IDialogFactory>();
     uiSvc.Stub(u => u.SetContextMenu(null, 0)).IgnoreArguments();
     uiSvc.Replay();
     uiPrefsSvc.Stub(u => u.Styles).Return(new Dictionary <string, UiStyle>());
     uiPrefsSvc.Replay();
     sp.AddService(typeof(IDecompilerShellUiService), uiSvc);
     sp.AddService(typeof(IDialogFactory), dlgFactory);
     sp.AddService(typeof(IUiPreferencesService), uiPrefsSvc);
     addrBase = Address.Ptr32(0x1000);
 }
        public void Setup()
        {
            mr = new MockRepository();
            sp = new ServiceContainer();
            uiSvc = mr.StrictMock<IDecompilerShellUiService>();
            uiPrefsSvc = mr.StrictMock<IUiPreferencesService>();
            dlgFactory = mr.StrictMock<IDialogFactory>();
            uiSvc.Stub(u => u.GetContextMenu(MenuIds.CtxMemoryControl)).Return(new ContextMenu());
            uiSvc.Stub(u => u.GetContextMenu(MenuIds.CtxDisassembler)).Return(new ContextMenu());
            uiSvc.Replay();
            uiPrefsSvc.Stub(u => u.Styles).Return(new Dictionary<string, UiStyle>());
            uiPrefsSvc.Replay();
            sp.AddService(typeof(IDecompilerShellUiService), uiSvc);
			sp.AddService(typeof(IDialogFactory), dlgFactory);
            sp.AddService(typeof(IUiPreferencesService), uiPrefsSvc);
            addrBase = Address.Ptr32(0x1000);
        }
예제 #14
0
        public void Setup()
        {
            mr               = new MockRepository();
            codeViewer       = new CodeViewerPane();
            decompilerSvc    = mr.Stub <IDecompilerService>();
            decompiler       = mr.Stub <IDecompiler>();
            uiPreferencesSvc = mr.Stub <IUiPreferencesService>();
            uiSvc            = mr.Stub <IDecompilerShellUiService>();
            font             = new Font("Arial", 10);
            var sc = new ServiceContainer();

            decompilerSvc.Decompiler = decompiler;
            sc.AddService <IDecompilerService>(decompilerSvc);
            sc.AddService <IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService <IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }
예제 #15
0
        void dlg_Load(object sender, EventArgs e)
        {
            this.dlg.MemoryControl.Services = dlg.Services;
            this.uipSvc = dlg.Services.RequireService <IUiPreferencesService>();
            PopulateStyleTree();

            this.sc            = new ServiceContainer();
            this.localSettings = new UiPreferencesService(null, null);
            sc.AddService(typeof(IUiPreferencesService), localSettings);
            CopyStyles(uipSvc, localSettings);

            GenerateSimulatedProgram();
            dlg.MemoryControl.Services      = sc;
            dlg.MemoryControl.ProgramImage  = program.Image;
            dlg.MemoryControl.ImageMap      = program.ImageMap;
            dlg.MemoryControl.Architecture  = program.Architecture;
            dlg.MemoryControl.Font          = new System.Drawing.Font("Lucida Console", 9.0f);
            dlg.DisassemblyControl.Services = sc;
            dlg.DisassemblyControl.Model    = new DisassemblyTextModel(program);
            dlg.CodeControl.Model           = GenerateSimulatedHllCode();
        }
예제 #16
0
        public void Setup()
        {
            mr               = new MockRepository();
            program          = new Program();
            codeViewer       = new CodeViewerPane();
            decompilerSvc    = mr.Stub <IDecompilerService>();
            decompiler       = mr.Stub <IDecompiler>();
            uiPreferencesSvc = mr.Stub <IUiPreferencesService>();
            uiSvc            = mr.Stub <IDecompilerShellUiService>();
            frame            = mr.Stub <IWindowFrame>();
            font             = new Font("Arial", 10);
            var styles = new Dictionary <string, UiStyle>();

            uiPreferencesSvc.Stub(u => u.Styles).Return(styles);

            var sc = new ServiceContainer();

            decompilerSvc.Decompiler = decompiler;
            sc.AddService <IDecompilerService>(decompilerSvc);
            sc.AddService <IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService <IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }
예제 #17
0
        void dlg_Load(object sender, EventArgs e)
        {
            this.dlg.MemoryControl.Services = dlg.Services;
            this.uipSvc = dlg.Services.RequireService <IUiPreferencesService>();
            PopulateStyleTree();

            this.sc = new ServiceContainer();
            var cfgSvc      = dlg.Services.RequireService <IConfigurationService>();
            var settingsSvc = dlg.Services.RequireService <ISettingsService>();

            this.localSettings = new UiPreferencesService(cfgSvc, settingsSvc);
            sc.AddService <IUiPreferencesService>(localSettings);
            CopyStyles(uipSvc, localSettings);

            GenerateSimulatedProgram();
            dlg.MemoryControl.Services        = sc;
            dlg.MemoryControl.ImageMap        = program.ImageMap;
            dlg.MemoryControl.Architecture    = program.Architecture;
            dlg.MemoryControl.Font            = new System.Drawing.Font("Lucida Console", 9.0f);
            dlg.DisassemblyControl.StyleClass = UiStyles.Disassembler;
            dlg.DisassemblyControl.Services   = sc;
            dlg.DisassemblyControl.Model      = new DisassemblyTextModel(program, program.ImageMap.Segments.Values.First());
            dlg.CodeControl.Model             = GenerateSimulatedHllCode();
        }
예제 #18
0
        public void Setup()
        {
            mr = new MockRepository();
            mockFactory = new MockFactory(mr);
            var platform = mockFactory.CreatePlatform(); ;

            program = new Program
            {
                Architecture = platform.Architecture,
                Platform = platform,
            };
            codeViewer = new CodeViewerPane();
            decompilerSvc = mr.Stub<IDecompilerService>();
            decompiler = mr.Stub<IDecompiler>();
            uiPreferencesSvc = mr.Stub<IUiPreferencesService>();
            uiSvc = mr.Stub<IDecompilerShellUiService>();
            frame = mr.Stub<IWindowFrame>();
            font = new Font("Arial", 10);
            var styles = new Dictionary<string, UiStyle>()
            {
                {
                    UiStyles.CodeWindow,
                    new UiStyle
                    {
                        Background = new SolidBrush(Color.White),
                    }
                }
            };
            uiPreferencesSvc.Stub(u => u.Styles).Return(styles);
            var sc = new ServiceContainer();
            decompilerSvc.Decompiler = decompiler;
            sc.AddService<IDecompilerService>(decompilerSvc);
            sc.AddService<IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService<IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }
예제 #19
0
        private void Given_MainFormInteractor()
        {
            program       = CreateFakeProgram();
            svcFactory    = mr.StrictMock <IServiceFactory>();
            archSvc       = mr.StrictMock <IArchiveBrowserService>();
            dlgFactory    = mr.StrictMock <IDialogFactory>();
            memSvc        = mr.StrictMock <ILowLevelViewService>();
            disasmSvc     = mr.StrictMock <IDisassemblyViewService>();
            typeLibSvc    = mr.StrictMock <ITypeLibraryLoaderService>();
            brSvc         = mr.Stub <IProjectBrowserService>();
            uiPrefs       = mr.StrictMock <IUiPreferencesService>();
            fsSvc         = mr.StrictMock <IFileSystemService>();
            tcHostSvc     = mr.StrictMock <ITabControlHostService>();
            dcSvc         = mr.StrictMock <IDecompilerService>();
            srSvc         = MockRepository.GenerateMock <ISearchResultService, IWindowPane>();
            diagnosticSvc = MockRepository.GenerateMock <IDiagnosticsService, IWindowPane>();
            resEditSvc    = mr.StrictMock <IResourceEditorService>();
            cgvSvc        = mr.StrictMock <ICallGraphViewService>();
            loader        = mr.StrictMock <ILoader>();
            sbSvc         = mr.Stub <IStatusBarService>();
            vimpSvc       = mr.StrictMock <IViewImportsService>();
            cvSvc         = mr.StrictMock <ICodeViewerService>();
            imgSegSvc     = mr.StrictMock <ImageSegmentService>();
            symLoadSvc    = mr.StrictMock <ISymbolLoadingService>();

            svcFactory.Stub(s => s.CreateArchiveBrowserService()).Return(archSvc);
            svcFactory.Stub(s => s.CreateCodeViewerService()).Return(cvSvc);
            svcFactory.Stub(s => s.CreateDecompilerConfiguration()).Return(new FakeDecompilerConfiguration());
            svcFactory.Stub(s => s.CreateDiagnosticsService()).Return(diagnosticSvc);
            svcFactory.Stub(s => s.CreateDecompilerService()).Return(dcSvc);
            svcFactory.Stub(s => s.CreateDisassemblyViewService()).Return(disasmSvc);
            svcFactory.Stub(s => s.CreateMemoryViewService()).Return(memSvc);
            svcFactory.Stub(s => s.CreateDecompilerEventListener()).Return(new FakeDecompilerEventListener());
            svcFactory.Stub(s => s.CreateImageSegmentService()).Return(imgSegSvc);
            svcFactory.Stub(s => s.CreateInitialPageInteractor()).Return(new FakeInitialPageInteractor());
            svcFactory.Stub(s => s.CreateScannedPageInteractor()).Return(new FakeScannedPageInteractor());
            svcFactory.Stub(s => s.CreateTypeLibraryLoaderService()).Return(typeLibSvc);
            svcFactory.Stub(s => s.CreateProjectBrowserService()).Return(brSvc);
            svcFactory.Stub(s => s.CreateUiPreferencesService()).Return(uiPrefs);
            svcFactory.Stub(s => s.CreateFileSystemService()).Return(fsSvc);
            svcFactory.Stub(s => s.CreateStatusBarService()).Return(sbSvc);
            svcFactory.Stub(s => s.CreateTabControlHost()).Return(tcHostSvc);
            svcFactory.Stub(s => s.CreateLoader()).Return(loader);
            svcFactory.Stub(s => s.CreateSearchResultService()).Return(srSvc);
            svcFactory.Stub(s => s.CreateResourceEditorService()).Return(resEditSvc);
            svcFactory.Stub(s => s.CreateCallGraphViewService()).Return(cgvSvc);
            svcFactory.Stub(s => s.CreateViewImportService()).Return(vimpSvc);
            svcFactory.Stub(s => s.CreateSymbolLoadingService()).Return(symLoadSvc);
            services.AddService(typeof(IDialogFactory), dlgFactory);
            services.AddService(typeof(IServiceFactory), svcFactory);
            brSvc.Stub(b => b.Clear());

            form = mr.StrictMock <IMainForm>();
            form.Stub(f => f.Dispose());
            form.Stub(f => f.UpdateToolbarState());
            form.Closed += null;
            LastCall.IgnoreArguments();
            tcHostSvc.Stub(t => t.QueryStatus(
                               Arg <CommandID> .Is.Anything,
                               Arg <CommandStatus> .Is.Anything,
                               Arg <CommandText> .Is.Anything)).Return(false);
            tcHostSvc.Stub(t => t.Execute(Arg <CommandID> .Is.Anything)).Return(false);

            uiSvc.Stub(u => u.DocumentWindows).Return(new List <IWindowFrame>());
            brSvc.Stub(u => u.ContainsFocus).Return(false);
            tcHostSvc.Stub(u => u.ContainsFocus).Return(false);

            // We currently don't care about testing the appearance of the Main window text.
            // Should this be required, you will need to remove the line below and add an
            // appropriate stub/expectation in all the tests below. Good luck with that.
            form.Stub(f => f.TitleText = "").IgnoreArguments();
        }
예제 #20
0
        private void Given_MainFormInteractor()
        {
            program       = CreateFakeProgram();
            svcFactory    = mr.StrictMock <IServiceFactory>();
            archSvc       = mr.StrictMock <IArchiveBrowserService>();
            dlgFactory    = mr.StrictMock <IDialogFactory>();
            uiSvc         = mr.StrictMock <IDecompilerShellUiService>();
            memSvc        = mr.StrictMock <ILowLevelViewService>();
            disasmSvc     = mr.StrictMock <IDisassemblyViewService>();
            typeLibSvc    = mr.StrictMock <ITypeLibraryLoaderService>();
            brSvc         = mr.Stub <IProjectBrowserService>();
            uiPrefs       = mr.StrictMock <IUiPreferencesService>();
            fsSvc         = mr.StrictMock <IFileSystemService>();
            tcHostSvc     = mr.StrictMock <ITabControlHostService>();
            dcSvc         = mr.StrictMock <IDecompilerService>();
            srSvc         = MockRepository.GenerateMock <ISearchResultService, IWindowPane>();
            diagnosticSvc = MockRepository.GenerateMock <IDiagnosticsService, IWindowPane>();
            resEditSvc    = mr.StrictMock <IResourceEditorService>();
            cgvSvc        = mr.StrictMock <ICallGraphViewService>();
            loader        = mr.StrictMock <ILoader>();
            vimpSvc       = mr.StrictMock <IViewImportsService>();
            symLdrSvc     = mr.StrictMock <ISymbolLoadingService>();

            svcFactory.Stub(s => s.CreateArchiveBrowserService()).Return(archSvc);
            svcFactory.Stub(s => s.CreateDecompilerConfiguration()).Return(new FakeDecompilerConfiguration());
            svcFactory.Stub(s => s.CreateDiagnosticsService(Arg <ListView> .Is.Anything)).Return(diagnosticSvc);
            svcFactory.Stub(s => s.CreateDecompilerService()).Return(dcSvc);
            svcFactory.Stub(s => s.CreateDisassemblyViewService()).Return(disasmSvc);
            svcFactory.Stub(s => s.CreateMemoryViewService()).Return(memSvc);
            svcFactory.Stub(s => s.CreateDecompilerEventListener()).Return(new FakeDecompilerEventListener());
            svcFactory.Stub(s => s.CreateInitialPageInteractor()).Return(new FakeInitialPageInteractor());
            svcFactory.Stub(s => s.CreateScannedPageInteractor()).Return(new FakeScannedPageInteractor());
            svcFactory.Stub(s => s.CreateAnalyzedPageInteractor()).Return(new FakeAnalyzedPageInteractor());
            svcFactory.Stub(s => s.CreateFinalPageInteractor()).Return(new FakeFinalPageInteractor());
            svcFactory.Stub(s => s.CreateTypeLibraryLoaderService()).Return(typeLibSvc);
            svcFactory.Stub(s => s.CreateProjectBrowserService(Arg <ITreeView> .Is.NotNull)).Return(brSvc);
            svcFactory.Stub(s => s.CreateUiPreferencesService()).Return(uiPrefs);
            svcFactory.Stub(s => s.CreateFileSystemService()).Return(fsSvc);
            svcFactory.Stub(s => s.CreateShellUiService(Arg <IMainForm> .Is.NotNull, Arg <DecompilerMenus> .Is.NotNull)).Return(uiSvc);
            svcFactory.Stub(s => s.CreateTabControlHost(Arg <TabControl> .Is.NotNull)).Return(tcHostSvc);
            svcFactory.Stub(s => s.CreateLoader()).Return(loader);
            svcFactory.Stub(s => s.CreateSearchResultService(Arg <ListView> .Is.NotNull)).Return(srSvc);
            svcFactory.Stub(s => s.CreateResourceEditorService()).Return(resEditSvc);
            svcFactory.Stub(s => s.CreateCallGraphViewService()).Return(cgvSvc);
            svcFactory.Stub(s => s.CreateViewImportService()).Return(vimpSvc);
            svcFactory.Stub(s => s.CreateSymbolLoadingService()).Return(symLdrSvc);
            services.AddService(typeof(IDialogFactory), dlgFactory);
            services.AddService(typeof(IServiceFactory), svcFactory);
            brSvc.Stub(b => b.Clear());

            form = mr.StrictMock <IMainForm>();
            var listView       = new ListView();
            var imagelist      = new ImageList();
            var tabResults     = new TabPage();
            var tabDiagnostics = new TabPage();
            var tabControl     = new TabControl {
                TabPages = { tabResults, tabDiagnostics }
            };
            var toolStrip   = new ToolStrip {
            };
            var statusStrip = new StatusStrip {
                Items = { new ToolStripLabel() }
            };
            var brToolbar      = new ToolStrip();
            var projectBrowser = mr.Stub <ITreeView>();

            form.Stub(f => f.DiagnosticsList).Return(listView);
            form.Stub(f => f.ImageList).Return(imagelist);
            form.Stub(f => f.Menu).SetPropertyAndIgnoreArgument();
            form.Stub(f => f.AddToolbar(null)).IgnoreArguments();
            form.Stub(f => f.AddProjectBrowserToolbar(null)).IgnoreArguments();
            form.Stub(f => f.Dispose());
            form.Stub(f => f.TabControl).Return(tabControl);
            form.Stub(f => f.FindResultsPage).Return(tabResults);
            form.Stub(f => f.DiagnosticsPage).Return(tabDiagnostics);
            form.Stub(f => f.FindResultsList).Return(listView);
            form.Stub(f => f.ToolBar).Return(toolStrip);
            form.Stub(f => f.ProjectBrowserToolbar).Return(toolStrip);
            form.Stub(f => f.ProjectBrowser).Return(projectBrowser);
            form.Stub(f => f.StatusStrip).Return(statusStrip);
            form.Stub(f => f.AddProjectBrowserToolbar(null)).IgnoreArguments();
            form.Stub(f => f.ProjectBrowserToolbar).Return(brToolbar);
            form.Stub(f => f.TitleText = "main.exe ").IgnoreArguments();
            form.Load += null;
            LastCall.IgnoreArguments();
            form.Closed += null;
            LastCall.IgnoreArguments();
            form.ProcessCommandKey += null;
            LastCall.IgnoreArguments();
            dlgFactory.Stub(d => d.CreateMainForm()).Return(form);
            tcHostSvc.Stub(t => t.Attach(Arg <IWindowPane> .Is.NotNull, Arg <TabPage> .Is.NotNull));
            tcHostSvc.Stub(t => t.QueryStatus(
                               Arg <CommandID> .Is.Anything,
                               Arg <CommandStatus> .Is.Anything,
                               Arg <CommandText> .Is.Anything)).Return(false);
            tcHostSvc.Stub(t => t.Execute(Arg <CommandID> .Is.Anything)).Return(false);

            uiSvc.Stub(u => u.DocumentWindows).Return(new List <IWindowFrame>());
        }
예제 #21
0
        void dlg_Load(object sender, EventArgs e)
        {
            this.dlg.MemoryControl.Services = dlg.Services;
            this.uipSvc = dlg.Services.RequireService<IUiPreferencesService>();
            PopulateStyleTree();

            this.sc = new ServiceContainer();
            this.localSettings = new UiPreferencesService(null, null);
            sc.AddService(typeof(IUiPreferencesService), localSettings);
            CopyStyles(uipSvc, localSettings);

            GenerateSimulatedProgram();
            dlg.MemoryControl.ProgramImage = program.Image;
            dlg.MemoryControl.ImageMap = program.ImageMap;
            dlg.MemoryControl.Architecture = program.Architecture;
            dlg.MemoryControl.Font = new System.Drawing.Font("Lucida Console", 9.0f);
            dlg.DisassemblyControl.Model = new DisassemblyTextModel(program);
            dlg.CodeControl.Model = null; /*;*/ 
        }
예제 #22
0
파일: StyleStack.cs 프로젝트: relaxar/reko
 public StyleStack(IUiPreferencesService uiPrefSvc)
 {
     if (uiPrefSvc == null) throw new ArgumentNullException("uiPrefSvc");
     this.uiPrefSvc = uiPrefSvc;
     this.stack = new List<string[]>();
 }
예제 #23
0
        public void Setup()
        {
            mr = new MockRepository();
            program = new Program();
            codeViewer = new CodeViewerPane();
            decompilerSvc = mr.Stub<IDecompilerService>();
            decompiler = mr.Stub<IDecompiler>();
            uiPreferencesSvc = mr.Stub<IUiPreferencesService>();
            uiSvc = mr.Stub<IDecompilerShellUiService>();
            frame = mr.Stub<IWindowFrame>();
            font = new Font("Arial", 10);
            var styles = new Dictionary<string, UiStyle>();
            uiPreferencesSvc.Stub(u => u.Styles).Return(styles);

            var sc = new ServiceContainer();
            decompilerSvc.Decompiler = decompiler;
            sc.AddService<IDecompilerService>(decompilerSvc);
            sc.AddService<IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService<IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }
예제 #24
0
 public StyleStack(IUiPreferencesService uiPrefSvc)
 {
     this.uiPrefSvc = uiPrefSvc;
     this.stack = new List<UiStyle>();
 }
        void dlg_Load(object sender, EventArgs e)
        {
            this.dlg.MemoryControl.Services = dlg.Services;
            this.uipSvc = dlg.Services.RequireService<IUiPreferencesService>();
            PopulateStyleTree();

            this.sc = new ServiceContainer();
            var cfgSvc = dlg.Services.RequireService<IConfigurationService>();
            var settingsSvc = dlg.Services.RequireService<ISettingsService>();
            this.localSettings = new UiPreferencesService(cfgSvc, settingsSvc);
            sc.AddService<IUiPreferencesService>(localSettings);
            CopyStyles(uipSvc, localSettings);

            GenerateSimulatedProgram();
            dlg.MemoryControl.Services = sc;
            dlg.MemoryControl.ProgramImage = program.Image;
            dlg.MemoryControl.ImageMap = program.ImageMap;
            dlg.MemoryControl.Architecture = program.Architecture;
            dlg.MemoryControl.Font = new System.Drawing.Font("Lucida Console", 9.0f);
            dlg.DisassemblyControl.StyleClass = UiStyles.Disassembler;
            dlg.DisassemblyControl.Services = sc;
            dlg.DisassemblyControl.Model = new DisassemblyTextModel(program);
            dlg.CodeControl.Model = GenerateSimulatedHllCode();
        }
 private void CopyStyles(IUiPreferencesService from, IUiPreferencesService to)
 {
     to.Styles.Clear();
     foreach (var style in from.Styles.Values)
     {
         to.Styles[style.Name] = style.Clone();
     }
 }