コード例 #1
0
        public AnalyzedPageInteractorImpl(IServiceProvider services) : base(services)
        {
            disasmViewerSvc = services.RequireService <IDisassemblyViewService>();
            projectSvc      = services.RequireService <IProjectBrowserService>();

            this.canAdvance = true;
        }
コード例 #2
0
		public void Setup()
		{
            mr = new MockRepository();
            form = new MainForm();
            sc = new ServiceContainer();
            loader = mr.StrictMock<ILoader>();
            dec = mr.StrictMock<IDecompiler>();
            sc = new ServiceContainer();
            uiSvc = new FakeShellUiService();
            host = mr.StrictMock<DecompilerHost>();
            memSvc = mr.StrictMock<ILowLevelViewService>();
            var mem = new MemoryArea(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = new SegmentMap(
                mem.BaseAddress,
                new ImageSegment("code", mem, AccessMode.ReadWriteExecute));
            var arch = mr.StrictMock<IProcessorArchitecture>();
            var platform = mr.StrictMock<IPlatform>();
            program = new Program(imageMap, arch, platform);
            project = new Project { Programs = { program } };

            browserSvc = mr.StrictMock<IProjectBrowserService>();

            sc.AddService<IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService<ILoader>(loader);
            sc.AddService<DecompilerHost>(host);

            i = new TestInitialPageInteractor(sc, dec);

		}
コード例 #3
0
		public void Setup()
		{
            mr = new MockRepository();
            form = new MainForm();
            sc = new ServiceContainer();
            loader = mr.StrictMock<ILoader>();
            dec = mr.StrictMock<IDecompiler>();
            sc = new ServiceContainer();
            uiSvc = new FakeShellUiService();
            host = mr.StrictMock<DecompilerHost>();
            memSvc = mr.StrictMock<ILowLevelViewService>();
            var image = new LoadedImage(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = image.CreateImageMap();
            var arch = mr.StrictMock<IProcessorArchitecture>();
            arch.Stub(a => a.CreateRegisterBitset()).Return(new BitSet(32));
            arch.Replay();
            var platform = mr.StrictMock<Platform>(null, arch);
            arch.BackToRecord();
            program = new Program(image, imageMap, arch, platform);
            project = new Project { Programs = { program } };

            browserSvc = mr.StrictMock<IProjectBrowserService>();

            sc.AddService<IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService<ILoader>(loader);

            i = new TestInitialPageInteractor(sc, dec);

		}
コード例 #4
0
		public AnalyzedPageInteractorImpl(IServiceProvider services) : base(services)
		{
            decompilerSvc = services.RequireService<IDecompilerService>();
            codeViewerSvc = services.RequireService<ICodeViewerService>();
            memViewerSvc = services.RequireService<ILowLevelViewService>();
            disasmViewerSvc = services.RequireService<IDisassemblyViewService>();
            projectSvc = services.RequireService<IProjectBrowserService>();

            this.canAdvance = true;
		}
コード例 #5
0
ファイル: AnalyzedPageInteractor.cs プロジェクト: mmyydd/reko
        public AnalyzedPageInteractorImpl(IServiceProvider services) : base(services)
        {
            decompilerSvc   = services.RequireService <IDecompilerService>();
            codeViewerSvc   = services.RequireService <ICodeViewerService>();
            memViewerSvc    = services.RequireService <ILowLevelViewService>();
            disasmViewerSvc = services.RequireService <IDisassemblyViewService>();
            projectSvc      = services.RequireService <IProjectBrowserService>();

            this.canAdvance = true;
        }
コード例 #6
0
        public void Setup()
        {
            mr = new MockRepository();

            form  = mr.StrictMock <IMainForm>();
            sc    = new ServiceContainer();
            uiSvc = AddService <IDecompilerShellUiService>();
            sc.AddService(typeof(IDecompilerUIService), uiSvc);
            codeViewSvc   = AddService <ICodeViewerService>();
            memViewSvc    = AddService <ILowLevelViewService>();
            disasmViewSvc = AddService <IDisassemblyViewService>();
            pbSvc         = AddService <IProjectBrowserService>();

            form.Stub(f => f.Show());

            var     platform    = mr.Stub <IPlatform>();
            var     loadAddress = Address.Ptr32(0x100000);
            var     bytes       = new byte[4711];
            var     arch        = new X86ArchitectureFlat32();
            var     mem         = new MemoryArea(loadAddress, bytes);
            Program prog        = new Program
            {
                SegmentMap = new SegmentMap(
                    mem.BaseAddress,
                    new ImageSegment(".text", mem, AccessMode.ReadExecute)),
                Architecture = arch,
                Platform     = platform,
            };
            ILoader ldr = mr.StrictMock <ILoader>();

            ldr.Stub(l => l.LoadExecutable(null, null, null)).IgnoreArguments().Return(prog);
            ldr.Stub(l => l.LoadImageBytes(null, 0)).IgnoreArguments().Return(bytes);
            ldr.Replay();
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService <DecompilerHost>(new FakeDecompilerHost());
            this.decSvc       = new DecompilerService();
            decSvc.Decompiler = new DecompilerDriver(ldr, sc);
            decSvc.Decompiler.Load("test.exe");
            program = decSvc.Decompiler.Project.Programs.First();
            decSvc.Decompiler.ScanPrograms();
            sc.AddService(typeof(IDecompilerService), decSvc);

            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
        }
コード例 #7
0
        public void Setup()
        {
            mr     = new MockRepository();
            form   = new MainForm();
            sc     = new ServiceContainer();
            loader = mr.StrictMock <ILoader>();
            dec    = mr.StrictMock <IDecompiler>();
            sc     = new ServiceContainer();
            uiSvc  = new FakeShellUiService();
            host   = mr.StrictMock <DecompilerHost>();
            memSvc = mr.StrictMock <ILowLevelViewService>();
            var image    = new LoadedImage(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = image.CreateImageMap();
            var arch     = mr.StrictMock <IProcessorArchitecture>();

            arch.Stub(a => a.CreateRegisterBitset()).Return(new BitSet(32));
            arch.Replay();
            var platform = mr.StrictMock <Platform>(null, arch);

            arch.BackToRecord();
            program = new Program(image, imageMap, arch, platform);
            project = new Project {
                Programs = { program }
            };

            browserSvc = mr.StrictMock <IProjectBrowserService>();

            sc.AddService <IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService <ILoader>(loader);

            i = new TestInitialPageInteractor(sc, dec);
        }
コード例 #8
0
        public void Setup()
        {
            mr = new MockRepository();

            form  = mr.StrictMock <IMainForm>();
            sc    = new ServiceContainer();
            uiSvc = AddService <IDecompilerShellUiService>();
            sc.AddService(typeof(IDecompilerUIService), uiSvc);
            codeViewSvc   = AddService <ICodeViewerService>();
            memViewSvc    = AddService <ILowLevelViewService>();
            disasmViewSvc = AddService <IDisassemblyViewService>();
            pbSvc         = AddService <IProjectBrowserService>();

            form.Stub(f => f.Show());

            var     loadAddress = Address.Ptr32(0x100000);
            var     bytes       = new byte[4711];
            Program prog        = new Program();

            prog.Image        = new LoadedImage(loadAddress, bytes);
            prog.ImageMap     = prog.Image.CreateImageMap();
            prog.Architecture = new IntelArchitecture(ProcessorMode.Protected32);
            ILoader ldr = mr.StrictMock <ILoader>();

            ldr.Stub(l => l.LoadExecutable(null, null, null)).IgnoreArguments().Return(prog);
            ldr.Stub(l => l.LoadImageBytes(null, 0)).IgnoreArguments().Return(bytes);
            ldr.Replay();
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            this.decSvc       = new DecompilerService();
            decSvc.Decompiler = new DecompilerDriver(ldr, new FakeDecompilerHost(), sc);
            decSvc.Decompiler.Load("test.exe");
            program = decSvc.Decompiler.Project.Programs.First();
            decSvc.Decompiler.ScanPrograms();
            sc.AddService(typeof(IDecompilerService), decSvc);

            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
        }
コード例 #9
0
        public void Setup()
        {
            mr     = new MockRepository();
            form   = new MainForm();
            sc     = new ServiceContainer();
            loader = mr.StrictMock <ILoader>();
            dec    = mr.StrictMock <IDecompiler>();
            sc     = new ServiceContainer();
            uiSvc  = new FakeShellUiService();
            host   = mr.StrictMock <DecompilerHost>();
            memSvc = mr.StrictMock <ILowLevelViewService>();
            var mem      = new MemoryArea(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = new SegmentMap(
                mem.BaseAddress,
                new ImageSegment("code", mem, AccessMode.ReadWriteExecute));
            var arch     = mr.StrictMock <IProcessorArchitecture>();
            var platform = mr.StrictMock <IPlatform>();

            program = new Program(imageMap, arch, platform);
            project = new Project {
                Programs = { program }
            };

            browserSvc = mr.StrictMock <IProjectBrowserService>();

            sc.AddService <IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService <ILoader>(loader);
            sc.AddService <DecompilerHost>(host);

            i = new TestInitialPageInteractor(sc, dec);
        }
コード例 #10
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>());
        }
コード例 #11
0
        private void CreateServices(IServiceFactory svcFactory, IServiceContainer sc)
        {
            sc.AddService <IDecompiledFileService>(svcFactory.CreateDecompiledFileService());

            config = svcFactory.CreateDecompilerConfiguration();
            sc.AddService(typeof(IConfigurationService), config);

            var cmdFactory = new Commands.CommandFactory(sc);

            sc.AddService <ICommandFactory>(cmdFactory);

            var sbSvc = svcFactory.CreateStatusBarService();

            sc.AddService <IStatusBarService>(sbSvc);

            diagnosticsSvc = svcFactory.CreateDiagnosticsService();
            sc.AddService(typeof(IDiagnosticsService), diagnosticsSvc);

            decompilerSvc = svcFactory.CreateDecompilerService();
            sc.AddService(typeof(IDecompilerService), decompilerSvc);

            sc.AddService(typeof(IDecompilerUIService), uiSvc);

            var codeViewSvc = svcFactory.CreateCodeViewerService();

            sc.AddService <ICodeViewerService>(codeViewSvc);

            var segmentViewSvc = svcFactory.CreateImageSegmentService();

            sc.AddService(typeof(ImageSegmentService), segmentViewSvc);

            var del = svcFactory.CreateDecompilerEventListener();

            workerDlgSvc = (IWorkerDialogService)del;
            sc.AddService(typeof(IWorkerDialogService), workerDlgSvc);
            sc.AddService(typeof(DecompilerEventListener), del);

            loader = svcFactory.CreateLoader();
            sc.AddService <ILoader>(loader);

            var abSvc = svcFactory.CreateArchiveBrowserService();

            sc.AddService <IArchiveBrowserService>(abSvc);

            sc.AddService <ILowLevelViewService>(svcFactory.CreateMemoryViewService());
            sc.AddService <IDisassemblyViewService>(svcFactory.CreateDisassemblyViewService());

            var tlSvc = svcFactory.CreateTypeLibraryLoaderService();

            sc.AddService <ITypeLibraryLoaderService>(tlSvc);

            this.projectBrowserSvc = svcFactory.CreateProjectBrowserService();
            sc.AddService <IProjectBrowserService>(projectBrowserSvc);

            this.procedureListSvc = svcFactory.CreateProcedureListService();
            sc.AddService <IProcedureListService>(procedureListSvc);

            var upSvc = svcFactory.CreateUiPreferencesService();

            sc.AddService <IUiPreferencesService>(upSvc);

            srSvc = svcFactory.CreateSearchResultService();
            sc.AddService <ISearchResultService>(srSvc);

            var callHierSvc = svcFactory.CreateCallHierarchyService();

            sc.AddService <ICallHierarchyService>(callHierSvc);

            this.searchResultsTabControl = svcFactory.CreateTabControlHost();
            sc.AddService <ITabControlHostService>(this.searchResultsTabControl);

            var resEditService = svcFactory.CreateResourceEditorService();

            sc.AddService <IResourceEditorService>(resEditService);

            var cgvSvc = svcFactory.CreateCallGraphViewService();

            sc.AddService <ICallGraphViewService>(cgvSvc);

            var viewImpSvc = svcFactory.CreateViewImportService();

            sc.AddService <IViewImportsService>(viewImpSvc);

            var symLdrSvc = svcFactory.CreateSymbolLoadingService();

            sc.AddService <ISymbolLoadingService>(symLdrSvc);

            var selSvc = svcFactory.CreateSelectionService();

            sc.AddService <ISelectionService>(selSvc);

            var testGenSvc = svcFactory.CreateTestGenerationService();

            sc.AddService <ITestGenerationService>(testGenSvc);
        }
コード例 #12
0
        private void CreateServices(IServiceFactory svcFactory, IServiceContainer sc, DecompilerMenus dm)
        {
            sc.AddService <DecompilerHost>(this);

            config = svcFactory.CreateDecompilerConfiguration();
            sc.AddService(typeof(IConfigurationService), config);

            var cmdFactory = new Commands.CommandFactory(sc);

            sc.AddService <ICommandFactory>(cmdFactory);

            sc.AddService(typeof(IStatusBarService), (IStatusBarService)this);

            diagnosticsSvc = svcFactory.CreateDiagnosticsService(form.DiagnosticsList);
            sc.AddService(typeof(IDiagnosticsService), diagnosticsSvc);

            decompilerSvc = svcFactory.CreateDecompilerService();
            sc.AddService(typeof(IDecompilerService), decompilerSvc);

            uiSvc = svcFactory.CreateShellUiService(form, dm);
            subWindowCommandTarget = uiSvc;
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerUIService), uiSvc);

            var codeViewSvc = new CodeViewerServiceImpl(sc);

            sc.AddService <ICodeViewerService>(codeViewSvc);
            var segmentViewSvc = new ImageSegmentServiceImpl(sc);

            sc.AddService(typeof(ImageSegmentService), segmentViewSvc);

            var del = svcFactory.CreateDecompilerEventListener();

            workerDlgSvc = (IWorkerDialogService)del;
            sc.AddService(typeof(IWorkerDialogService), workerDlgSvc);
            sc.AddService(typeof(DecompilerEventListener), del);

            loader = svcFactory.CreateLoader();
            sc.AddService <ILoader>(loader);

            var abSvc = svcFactory.CreateArchiveBrowserService();

            sc.AddService <IArchiveBrowserService>(abSvc);

            sc.AddService <ILowLevelViewService>(svcFactory.CreateMemoryViewService());
            sc.AddService <IDisassemblyViewService>(svcFactory.CreateDisassemblyViewService());

            var tlSvc = svcFactory.CreateTypeLibraryLoaderService();

            sc.AddService <ITypeLibraryLoaderService>(tlSvc);

            this.projectBrowserSvc = svcFactory.CreateProjectBrowserService(form.ProjectBrowser);
            sc.AddService <IProjectBrowserService>(projectBrowserSvc);

            var upSvc = svcFactory.CreateUiPreferencesService();

            sc.AddService <IUiPreferencesService>(upSvc);

            var fsSvc = svcFactory.CreateFileSystemService();

            sc.AddService <IFileSystemService>(fsSvc);

            this.searchResultsTabControl = svcFactory.CreateTabControlHost(form.TabControl);
            sc.AddService <ITabControlHostService>(this.searchResultsTabControl);

            srSvc = svcFactory.CreateSearchResultService(form.FindResultsList);
            sc.AddService <ISearchResultService>(srSvc);
            searchResultsTabControl.Attach((IWindowPane)srSvc, form.FindResultsPage);
            searchResultsTabControl.Attach((IWindowPane)diagnosticsSvc, form.DiagnosticsPage);

            var resEditService = svcFactory.CreateResourceEditorService();

            sc.AddService <IResourceEditorService>(resEditService);

            var cgvSvc = svcFactory.CreateCallGraphViewService();

            sc.AddService <ICallGraphViewService>(cgvSvc);

            var viewImpSvc = svcFactory.CreateViewImportService();

            sc.AddService <IViewImportsService>(viewImpSvc);
        }
コード例 #13
0
ファイル: MainFormInteractor.cs プロジェクト: nemerle/reko
        private void CreateServices(IServiceFactory svcFactory, IServiceContainer sc, DecompilerMenus dm)
        {
            sc.AddService<DecompilerHost>(this);

            config = svcFactory.CreateDecompilerConfiguration();
            sc.AddService(typeof(IConfigurationService), config);

            var cmdFactory = new Commands.CommandFactory(sc);
            sc.AddService<ICommandFactory>(cmdFactory);

            sc.AddService(typeof(IStatusBarService), (IStatusBarService)this);

            diagnosticsSvc = svcFactory.CreateDiagnosticsService(form.DiagnosticsList);
            sc.AddService(typeof(IDiagnosticsService), diagnosticsSvc);

            decompilerSvc = svcFactory.CreateDecompilerService();
            sc.AddService(typeof(IDecompilerService), decompilerSvc);

            uiSvc = svcFactory.CreateShellUiService(form, dm);
            subWindowCommandTarget = uiSvc;
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerUIService), uiSvc);

            var codeViewSvc = new CodeViewerServiceImpl(sc);
            sc.AddService(typeof(ICodeViewerService), codeViewSvc);
            var segmentViewSvc = new ImageSegmentServiceImpl(sc);
            sc.AddService(typeof(ImageSegmentService), segmentViewSvc);

            var del = svcFactory.CreateDecompilerEventListener();
            workerDlgSvc = (IWorkerDialogService)del;
            sc.AddService(typeof(IWorkerDialogService), workerDlgSvc);
            sc.AddService(typeof(DecompilerEventListener), del);

            loader = svcFactory.CreateLoader();
            sc.AddService(typeof(ILoader), loader);

            var abSvc = svcFactory.CreateArchiveBrowserService();
            sc.AddService(typeof(IArchiveBrowserService), abSvc);

            sc.AddService(typeof(ILowLevelViewService), svcFactory.CreateMemoryViewService());
            sc.AddService(typeof(IDisassemblyViewService), svcFactory.CreateDisassemblyViewService());

            var tlSvc = svcFactory.CreateTypeLibraryLoaderService();
            sc.AddService(typeof(ITypeLibraryLoaderService), tlSvc);

            this.projectBrowserSvc = svcFactory.CreateProjectBrowserService(form.ProjectBrowser);
            sc.AddService<IProjectBrowserService>(projectBrowserSvc);

            var upSvc = svcFactory.CreateUiPreferencesService();
            sc.AddService<IUiPreferencesService>(upSvc);

            var fsSvc = svcFactory.CreateFileSystemService();
            sc.AddService<IFileSystemService>(fsSvc);

            this.searchResultsTabControl = svcFactory.CreateTabControlHost(form.TabControl);
            sc.AddService<ITabControlHostService>(this.searchResultsTabControl);

            srSvc = svcFactory.CreateSearchResultService(form.FindResultsList);
            sc.AddService<ISearchResultService>(srSvc);
            searchResultsTabControl.Attach((IWindowPane) srSvc, form.FindResultsPage);
            searchResultsTabControl.Attach((IWindowPane) diagnosticsSvc, form.DiagnosticsPage);

            var resEditService = svcFactory.CreateResourceEditorService();
            sc.AddService<IResourceEditorService>(resEditService);
        }
コード例 #14
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();
        }