EditCodeVMCreator(IOpenFromGAC openFromGAC, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, [ImportMany] IEnumerable <ILanguageCompilerProvider> languageCompilerProviders) { this.openFromGAC = openFromGAC; this.openAssembly = new OpenAssembly(documentTreeView.DocumentService); this.decompilerService = decompilerService; this.languageCompilerProviders = languageCompilerProviders.OrderBy(a => a.Order).ToArray(); }
public EventOptionsVM(EventDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = true, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); OtherMethodsVM = new MethodDefsVM(ownerModule, decompilerService); origOptions = options; TypeSigCreator.CanAddFnPtr = false; Reinitialize(); }
AppService(IAppWindow appWindow, IDocumentTabService documentTabService, IDocumentTreeView documentTreeView, IDecompilerService decompilerService) { AppWindow = appWindow; DocumentTabService = documentTabService; DocumentTreeView = documentTreeView; DecompilerService = decompilerService; }
public void Setup() { sc = new ServiceContainer(); svc = new DecompilerService(); sc.AddService(typeof(IDecompilerService), svc); sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener()); }
static TypeSigCreatorVM CreateTypeSigCreatorVM(ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod, bool allowNullTypeSig, PropertyChangedEventHandler handler) { var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, NullTypeSigAllowed = allowNullTypeSig, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } var typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); typeSigCreator.PropertyChanged += handler; return(typeSigCreator); }
public PropertyOptionsVM(PropertyDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; origOptions = options; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = true, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions); methodSigCreatorOptions.IsPropertySig = true; MethodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions); MethodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged; MethodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged; MethodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false; GetMethodsVM = new MethodDefsVM(ownerModule, decompilerService); SetMethodsVM = new MethodDefsVM(ownerModule, decompilerService); OtherMethodsVM = new MethodDefsVM(ownerModule, decompilerService); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); ConstantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, dnSpy_AsmEditor_Resources.Property_DefaultValue); ConstantVM.PropertyChanged += constantVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; Reinitialize(); }
EditCodeVMCreator(IRawModuleBytesProvider rawModuleBytesProvider, IOpenFromGAC openFromGAC, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, [ImportMany] IEnumerable<ILanguageCompilerProvider> languageCompilerProviders) { this.rawModuleBytesProvider = rawModuleBytesProvider; this.openFromGAC = openFromGAC; openAssembly = new OpenAssembly(documentTreeView.DocumentService); this.decompilerService = decompilerService; this.languageCompilerProviders = languageCompilerProviders.OrderBy(a => a.Order).ToArray(); }
BreakpointsVM(IDecompilerService decompilerService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointService breakpointService, IBreakpointSettings breakpointSettings, Lazy <IModuleLoader> moduleLoader, IInMemoryModuleService inMemoryModuleService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) { var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); breakpointContext = new BreakpointContext(moduleLoader, classificationFormatMap, textElementProvider) { Decompiler = decompilerService.Decompiler, SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints, UseHexadecimal = debuggerSettings.UseHexadecimal, ShowTokens = breakpointSettings.ShowTokens, ShowModuleNames = breakpointSettings.ShowModuleNames, ShowParameterTypes = breakpointSettings.ShowParameterTypes, ShowParameterNames = breakpointSettings.ShowParameterNames, ShowOwnerTypes = breakpointSettings.ShowOwnerTypes, ShowReturnTypes = breakpointSettings.ShowReturnTypes, ShowNamespaces = breakpointSettings.ShowNamespaces, ShowTypeKeywords = breakpointSettings.ShowTypeKeywords, }; this.breakpointService = breakpointService; this.theDebugger = theDebugger; breakpointList = new ObservableCollection <BreakpointVM>(); breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged; breakpointService.BreakpointsAdded += BreakpointService_BreakpointsAdded; breakpointService.BreakpointsRemoved += BreakpointService_BreakpointsRemoved; debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged; theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged; classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; inMemoryModuleService.DynamicModulesLoaded += InMemoryModuleService_DynamicModulesLoaded; foreach (var bp in breakpointService.GetBreakpoints()) { AddBreakpoint(bp); } }
BreakpointsVM(IDecompilerService decompilerService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointService breakpointService, IBreakpointSettings breakpointSettings, Lazy<IModuleLoader> moduleLoader, IInMemoryModuleService inMemoryModuleService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) { var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); breakpointContext = new BreakpointContext(moduleLoader, classificationFormatMap, textElementProvider) { Decompiler = decompilerService.Decompiler, SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints, UseHexadecimal = debuggerSettings.UseHexadecimal, ShowTokens = breakpointSettings.ShowTokens, ShowModuleNames = breakpointSettings.ShowModuleNames, ShowParameterTypes = breakpointSettings.ShowParameterTypes, ShowParameterNames = breakpointSettings.ShowParameterNames, ShowOwnerTypes = breakpointSettings.ShowOwnerTypes, ShowReturnTypes = breakpointSettings.ShowReturnTypes, ShowNamespaces = breakpointSettings.ShowNamespaces, ShowTypeKeywords = breakpointSettings.ShowTypeKeywords, }; this.breakpointService = breakpointService; this.theDebugger = theDebugger; breakpointList = new ObservableCollection<BreakpointVM>(); breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged; breakpointService.BreakpointsAdded += BreakpointService_BreakpointsAdded; breakpointService.BreakpointsRemoved += BreakpointService_BreakpointsRemoved; debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged; theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged; classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; inMemoryModuleService.DynamicModulesLoaded += InMemoryModuleService_DynamicModulesLoaded; foreach (var bp in breakpointService.GetBreakpoints()) AddBreakpoint(bp); }
DbgRuntimeNativeCodeProviderImpl(Lazy <DbgMetadataService> dbgMetadataService, Lazy <DbgModuleIdProviderService> dbgModuleIdProviderService, IDecompilerService decompilerService) { this.dbgMetadataService = dbgMetadataService; this.dbgModuleIdProviderService = dbgModuleIdProviderService; this.decompilerService = decompilerService; ilDecompiler = decompilerService.AllDecompilers.FirstOrDefault(a => a.GenericGuid == DecompilerConstants.LANGUAGE_IL); }
public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Number = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); TypeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>(dnSpy_AsmEditor_Resources.EditGenericParameterConstraint, dnSpy_AsmEditor_Resources.CreateGenericParameterConstraint, ownerModule, decompilerService, ownerType, ownerMethod); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); GPVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public PhasePageInteractorImpl(IServiceProvider services) { this.Services = services; decompilerSvc = services.RequireService <IDecompilerService>(); decompilerUiSvc = services.RequireService <IDecompilerShellUiService>(); workerDlgSvc = services.RequireService <IWorkerDialogService>(); }
DocumentSearcherProvider(IDotNetImageService dotNetImageService, IDecompilerService decompilerService, ITextElementProvider textElementProvider, IClassificationFormatMapService classificationFormatMapService) { this.dotNetImageService = dotNetImageService; this.decompilerService = decompilerService; this.textElementProvider = textElementProvider; classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); }
DbgDotNetDecompilerServiceImpl(IDecompilerService decompilerService, DbgLanguageService dbgLanguageService, [ImportMany] IEnumerable <Lazy <DbgDotNetDecompilerGuidProvider, IDbgDotNetDecompilerGuidProviderMetadata> > dbgDotNetDecompilerGuidProviders) { this.decompilerService = decompilerService; this.dbgDotNetDecompilerGuidProviders = dbgDotNetDecompilerGuidProviders.OrderBy(a => a.Metadata.Order).ToArray(); dbgLanguageService.LanguageChanged += DbgLanguageService_LanguageChanged; SetDecompiler(dbgLanguageService.GetCurrentLanguage(PredefinedDbgRuntimeKindGuids.DotNet_Guid)); }
AppService(IAppWindow appWindow, IDocumentTabService documentTabService, IDocumentTreeView documentTreeView, IDecompilerService decompilerManager) { this.AppWindow = appWindow; this.DocumentTabService = documentTabService; this.DocumentTreeView = documentTreeView; this.DecompilerManager = decompilerManager; }
BreakpointsVM(IDecompilerService decompilerService, IThemeService themeService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointService breakpointService, IBreakpointSettings breakpointSettings, Lazy <IModuleLoader> moduleLoader, IInMemoryModuleService inMemoryModuleService) { this.breakpointContext = new BreakpointContext(moduleLoader) { Decompiler = decompilerService.Decompiler, SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints, UseHexadecimal = debuggerSettings.UseHexadecimal, ShowTokens = breakpointSettings.ShowTokens, ShowModuleNames = breakpointSettings.ShowModuleNames, ShowParameterTypes = breakpointSettings.ShowParameterTypes, ShowParameterNames = breakpointSettings.ShowParameterNames, ShowOwnerTypes = breakpointSettings.ShowOwnerTypes, ShowReturnTypes = breakpointSettings.ShowReturnTypes, ShowNamespaces = breakpointSettings.ShowNamespaces, ShowTypeKeywords = breakpointSettings.ShowTypeKeywords, }; this.breakpointService = breakpointService; this.theDebugger = theDebugger; this.breakpointList = new ObservableCollection <BreakpointVM>(); breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged; breakpointService.BreakpointsAdded += BreakpointService_BreakpointsAdded; breakpointService.BreakpointsRemoved += BreakpointService_BreakpointsRemoved; debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged; theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged; themeService.ThemeChanged += ThemeService_ThemeChanged; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; inMemoryModuleService.DynamicModulesLoaded += InMemoryModuleService_DynamicModulesLoaded; foreach (var bp in breakpointService.GetBreakpoints()) { AddBreakpoint(bp); } }
public MemberPickerVM(IDocumentSearcherProvider fileSearcherProvider, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeNodeFilter filter, string title, IEnumerable <IDsDocument> assemblies) { Title = title; this.fileSearcherProvider = fileSearcherProvider; this.decompilerService = decompilerService; this.documentTreeView = documentTreeView; allDecompilers = new ObservableCollection <DecompilerVM>(decompilerService.AllDecompilers.Select(a => new DecompilerVM(a))); decompiler = allDecompilers.FirstOrDefault(a => a.Decompiler == decompilerService.Decompiler); this.filter = filter; delayedSearch = new DelayedAction(DEFAULT_DELAY_SEARCH_MS, DelayStartSearch); SearchResults = new ObservableCollection <ISearchResult>(); searchResultsCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(SearchResults); searchResultsCollectionView.CustomSort = new SearchResult_Comparer(); foreach (var file in assemblies) { documentTreeView.DocumentService.ForceAdd(file, false, null); } documentTreeView.DocumentService.CollectionChanged += (s, e) => Restart(); CaseSensitive = false; MatchWholeWords = false; MatchAnySearchTerm = false; RefreshTreeView(); }
public PhasePageInteractorImpl(IServiceProvider services) { this.Services = services; decompilerSvc = services.RequireService<IDecompilerService>(); decompilerUiSvc = services.RequireService<IDecompilerShellUiService>(); workerDlgSvc = services.RequireService<IWorkerDialogService>(); }
public void Setup() { mr = new MockRepository(); sc = new ServiceContainer(); svc = new DecompilerService(); sc.AddService(typeof(IDecompilerService), svc); sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener()); }
ExportProjectCommand(IAppWindow appWindow, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeViewSettings documentTreeViewSettings, IExportToProjectSettings exportToProjectSettings, [ImportMany] IEnumerable<Lazy<IBamlDecompiler>> bamlDecompilers, [ImportMany] IEnumerable<Lazy<IXamlOutputOptionsProvider>> xamlOutputOptionsProviders) { this.appWindow = appWindow; this.documentTreeView = documentTreeView; this.decompilerService = decompilerService; this.documentTreeViewSettings = documentTreeViewSettings; this.exportToProjectSettings = exportToProjectSettings; bamlDecompiler = bamlDecompilers.FirstOrDefault(); xamlOutputOptionsProvider = xamlOutputOptionsProviders.FirstOrDefault(); }
EditCodeVMCreator(RawModuleBytesProvider rawModuleBytesProvider, IOpenFromGAC openFromGAC, IPickFilename pickFilename, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, [ImportMany] IEnumerable <ILanguageCompilerProvider> languageCompilerProviders) { this.rawModuleBytesProvider = rawModuleBytesProvider; this.openFromGAC = openFromGAC; openAssembly = new OpenAssembly(documentTreeView.DocumentService); this.pickFilename = pickFilename; this.decompilerService = decompilerService; this.languageCompilerProviders = languageCompilerProviders.OrderBy(a => a.Order).ToArray(); }
ExportProjectCommand(IAppWindow appWindow, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeViewSettings documentTreeViewSettings, IExportToProjectSettings exportToProjectSettings, [ImportMany] IEnumerable <Lazy <IBamlDecompiler> > bamlDecompilers) { this.appWindow = appWindow; this.documentTreeView = documentTreeView; this.decompilerService = decompilerService; this.documentTreeViewSettings = documentTreeViewSettings; this.exportToProjectSettings = exportToProjectSettings; this.bamlDecompiler = bamlDecompilers.FirstOrDefault(); }
public LoadedPageInteractor(IServiceProvider services) : base(services) { decompilerSvc = services.RequireService<IDecompilerService>(); sbSvc = services.RequireService<IStatusBarService>(); memSvc = services.RequireService<ILowLevelViewService>(); mpCmdidToCommand = new Dictionary<int, MenuCommand>(); AddCommand(new CommandID(CmdSets.GuidReko, CmdIds.ViewShowAllFragments)); AddCommand(new CommandID(CmdSets.GuidReko, CmdIds.ViewShowUnscanned)); }
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; }
DocumentViewerToolTipServiceProvider(IDotNetImageService dotNetImageService, ICodeToolTipSettings codeToolTipSettings, IQuickInfoBroker quickInfoBroker, IClassificationFormatMapService classificationFormatMapService, IThemeClassificationTypeService themeClassificationTypeService, IDecompilerService decompilerService, [ImportMany] IEnumerable <Lazy <IDocumentViewerToolTipProvider, IDocumentViewerToolTipProviderMetadata> > documentViewerToolTipProviders) { this.dotNetImageService = dotNetImageService; this.codeToolTipSettings = codeToolTipSettings; this.quickInfoBroker = quickInfoBroker; this.classificationFormatMapService = classificationFormatMapService; this.themeClassificationTypeService = themeClassificationTypeService; this.decompilerService = decompilerService; this.documentViewerToolTipProviders = documentViewerToolTipProviders.OrderBy(a => a.Metadata.Order).ToArray(); }
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; }
public ScannedPageInteractor(IServiceProvider services) : base(services) { decompilerSvc = services.RequireService <IDecompilerService>(); sbSvc = services.RequireService <IStatusBarService>(); memSvc = services.RequireService <ILowLevelViewService>(); mpCmdidToCommand = new Dictionary <int, MenuCommand>(); AddCommand(new CommandID(CmdSets.GuidReko, CmdIds.ViewShowAllFragments)); AddCommand(new CommandID(CmdSets.GuidReko, CmdIds.ViewShowUnscanned)); }
DecompileDocumentTabContentFactory(IDsDocumentService documentService, IDocumentTreeNodeDecompiler documentTreeNodeDecompiler, IDecompilerService decompilerService, IDecompilationCache decompilationCache, IMethodAnnotations methodAnnotations, IContentTypeRegistryService contentTypeRegistryService, IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider, IDocumentWriterService documentWriterService) { DocumentService = documentService; DocumentTreeNodeDecompiler = documentTreeNodeDecompiler; DecompilerService = decompilerService; DecompilationCache = decompilationCache; MethodAnnotations = methodAnnotations; ContentTypeRegistryService = contentTypeRegistryService; DocumentViewerContentFactoryProvider = documentViewerContentFactoryProvider; DocumentWriterService = documentWriterService; }
DecompileDocumentTabContentFactory(IDsDocumentService documentService, IDocumentTreeNodeDecompiler documentTreeNodeDecompiler, IDecompilerService decompilerService, IDecompilationCache decompilationCache, IMethodAnnotations methodAnnotations, IContentTypeRegistryService contentTypeRegistryService, IDocumentViewerContentFactoryProvider documentViewerContentFactoryProvider) { DocumentService = documentService; DocumentTreeNodeDecompiler = documentTreeNodeDecompiler; DecompilerService = decompilerService; DecompilationCache = decompilationCache; MethodAnnotations = methodAnnotations; ContentTypeRegistryService = contentTypeRegistryService; DocumentViewerContentFactoryProvider = documentViewerContentFactoryProvider; }
public ProjectFilesWatcher(IServiceProvider services) { this.decompilerSvc = services.RequireService <IDecompilerService>(); this.eventListener = services.RequireService <DecompilerEventListener>(); this.loader = services.RequireService <ILoader>(); this.Decompiler = decompilerSvc.Decompiler; decompilerSvc.DecompilerChanged += OnDecompilerChanged; this.scriptWatchers = new FileWatchersMap(); this.changedFiles = new ConcurrentDictionary <string, bool>(); }
public DocumentTreeView(bool isGlobal, IDocumentTreeNodeFilter filter, ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentService documentService, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata> > dsDocumentNodeProvider, [ImportMany] IEnumerable <Lazy <IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata> > mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider) { this.decompilerService = decompilerService; this.documentTreeViewSettings = documentTreeViewSettings; this.appSettings = appSettings; this.context = new DocumentTreeNodeDataContext(this, resourceNodeFactory, filter ?? FilterNothingDocumentTreeNodeFilter.Instance, treeViewNodeTextElementProvider) { SyntaxHighlight = documentTreeViewSettings.SyntaxHighlight, SingleClickExpandsChildren = documentTreeViewSettings.SingleClickExpandsTreeViewChildren, ShowAssemblyVersion = documentTreeViewSettings.ShowAssemblyVersion, ShowAssemblyPublicKeyToken = documentTreeViewSettings.ShowAssemblyPublicKeyToken, ShowToken = documentTreeViewSettings.ShowToken, Decompiler = decompilerService.Decompiler, UseNewRenderer = appSettings.UseNewRenderer_DocumentTreeView, DeserializeResources = documentTreeViewSettings.DeserializeResources, CanDragAndDrop = isGlobal, }; var options = new TreeViewOptions { AllowDrop = true, IsVirtualizing = true, VirtualizationMode = VirtualizationMode.Recycling, TreeViewListener = this, RootNode = new RootNode { DropNodes = OnDropNodes, DropFiles = OnDropFiles, }, }; this.documentTreeNodeGroups = new DocumentTreeNodeGroups(); this.dsDocumentNodeProvider = dsDocumentNodeProvider.OrderBy(a => a.Metadata.Order).ToArray(); this.TreeView = treeViewService.Create(new Guid(TreeViewConstants.DOCUMENT_TREEVIEW_GUID), options); this.TreeView.SelectionChanged += TreeView_SelectionChanged; this.DocumentService = documentService; this.DotNetImageService = dotNetImageService; this.dispatcher = Dispatcher.CurrentDispatcher; this.DocumentService.SetDispatcher(AddAction); documentService.CollectionChanged += DocumentService_CollectionChanged; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged; appSettings.PropertyChanged += AppSettings_PropertyChanged; this.WpfCommands = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENT_TREEVIEW); if (isGlobal) { menuService.InitializeContextMenu(this.TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID), new GuidObjectsProvider(this.TreeView)); wpfCommandService.Add(ControlConstants.GUID_DOCUMENT_TREEVIEW, TreeView.UIObject); } this.nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray(); InitializeDocumentTreeNodeGroups(); }
public TypeOptionsVM(TypeDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } this.TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); this.TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; this.CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService, ownerType, null); this.DeclSecuritiesVM = new DeclSecuritiesVM(ownerModule, decompilerService, ownerType, null); this.GenericParamsVM = new GenericParamsVM(ownerModule, decompilerService, ownerType, null); this.InterfaceImplsVM = new TypeDefOrRefAndCAsVM <InterfaceImpl>(dnSpy_AsmEditor_Resources.EditInterfaceImpl, dnSpy_AsmEditor_Resources.CreateInterfaceImpl, ownerModule, decompilerService, ownerType, null); this.origOptions = options; this.IsNestedType = (options.Attributes & TypeAttributes.VisibilityMask) > TypeAttributes.Public; this.TypeKind = new EnumListVM(typeKindList, (a, b) => OnTypeKindChanged()); this.TypeLayout = new EnumListVM(typeLayoutList, (a, b) => InitializeTypeKind()); this.TypeSemantics = new EnumListVM(typeSemanticsList, (a, b) => InitializeTypeKind()); this.PackingSize = new NullableUInt16VM(a => HasErrorUpdated()); this.ClassSize = new NullableUInt32VM(a => HasErrorUpdated()); Types.TypeVisibility start, end; if (!IsNestedType) { start = Types.TypeVisibility.NotPublic; end = Types.TypeVisibility.Public; } else { start = Types.TypeVisibility.NestedPublic; end = Types.TypeVisibility.NestedFamORAssem; } for (var t = Types.TypeVisibility.NotPublic; t <= Types.TypeVisibility.NestedFamORAssem; t++) { if (t < start || t > end) { TypeVisibility.Items.RemoveAt(TypeVisibility.GetIndex(t)); } } InitializeTypeKind(); this.TypeSigCreator.CanAddFnPtr = false; Reinitialize(); }
public MethodBodyVM(MethodBodyOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origOptions = options; NativeMethodBodyVM = new MethodBody.NativeMethodBodyVM(options.NativeMethodBodyOptions, false); NativeMethodBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); CilBodyVM = new MethodBody.CilBodyVM(options.CilBodyOptions, ownerModule, decompilerService, ownerType, ownerMethod, false); CilBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); MethodBodyTypeVM = new EnumListVM(methodBodyTypeList, (a, b) => OnMethodBodyTypeChanged()); Reinitialize(); }
public SecurityAttributeVM(SecurityAttribute sa, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origSa = sa; this.ownerModule = ownerModule; CANamedArgumentsVM = new CANamedArgumentsVM(ownerModule, decompilerService, ownerType, ownerMethod, a => { // The named args blob length must also be at most 0x1FFFFFFF bytes but we can't verify it here return a.Collection.Count < ModelUtils.COMPRESSED_UINT32_MAX; }); CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged; Reinitialize(); }
public CmdLineDriver( IServiceProvider services, ILoader ldr, IDecompilerService dcSvc, CmdLineListener listener) { this.services = services; this.ldr = ldr; this.dcSvc = dcSvc; this.listener = listener; this.config = services.RequireService <IConfigurationService>(); }
public SecurityAttributeVM(SecurityAttribute sa, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origSa = sa; this.ownerModule = ownerModule; CANamedArgumentsVM = new CANamedArgumentsVM(ownerModule, decompilerService, ownerType, ownerMethod, a => { // The named args blob length must also be at most 0x1FFFFFFF bytes but we can't verify it here return(a.Collection.Count < ModelUtils.COMPRESSED_UINT32_MAX); }); CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged; Reinitialize(); }
public MethodBodyVM(MethodBodyOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; this.NativeMethodBodyVM = new MethodBody.NativeMethodBodyVM(options.NativeMethodBodyOptions, false); NativeMethodBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); this.CilBodyVM = new MethodBody.CilBodyVM(options.CilBodyOptions, ownerModule, decompilerService, ownerType, ownerMethod, false); CilBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); this.MethodBodyTypeVM = new EnumListVM(methodBodyTypeList, (a, b) => OnMethodBodyTypeChanged()); Reinitialize(); }
public void Setup() { sc = new ServiceContainer(); form = new Mock <IMainForm>(); var arch = new X86ArchitectureReal(sc, "x86-real-16"); var platform = new Mock <IPlatform>(); platform.Setup(p => p.CreateMetadata()).Returns(new TypeLibrary()); platform.Setup(p => p.Architecture).Returns(arch); program = new Program(); program.Architecture = arch; program.Platform = platform.Object; var mem = new ByteMemoryArea(Address.SegPtr(0xC00, 0), new byte[10000]); program.SegmentMap = new SegmentMap( mem.BaseAddress, new ImageSegment("0C00", mem, AccessMode.ReadWriteExecute)); program.SegmentMap.AddOverlappingSegment("0C10", mem, Address.SegPtr(0x0C10, 0), AccessMode.ReadWrite); program.SegmentMap.AddOverlappingSegment("0C20", mem, Address.SegPtr(0x0C20, 0), AccessMode.ReadWrite); mapSegment1 = program.SegmentMap.Segments.Values[0]; mapSegment2 = program.SegmentMap.Segments.Values[1]; decSvc = new DecompilerService(); sc.AddService <IDecompilerService>(decSvc); sc.AddService <IWorkerDialogService>(new FakeWorkerDialogService()); sc.AddService <DecompilerEventListener>(new FakeDecompilerEventListener()); sc.AddService <IStatusBarService>(new FakeStatusBarService()); sc.AddService <IDecompiledFileService>(new FakeDecompiledFileService()); uiSvc = AddService <IDecompilerShellUiService>(); memSvc = AddService <ILowLevelViewService>(); var ldr = new Mock <ILoader>(); ldr.Setup(l => l.LoadImageBytes("test.exe", 0)).Returns(new byte[400]); ldr.Setup(l => l.LoadExecutable( It.IsNotNull <string>(), It.IsNotNull <byte[]>(), null, It.IsAny <Address>())).Returns(program) .Callback(() => { program.ToString(); }); decSvc.Decompiler = new Decompiler(ldr.Object, sc); decSvc.Decompiler.Load("test.exe"); interactor = new ScannedPageInteractor(sc); }
public void Setup() { repository = new MockRepository(); interactor = repository.Stub<DisassemblyViewInteractor>(); sc = new ServiceContainer(); uiSvc = repository.DynamicMock<IDecompilerShellUiService>(); dcSvc = repository.Stub<IDecompilerService>(); dlgFactory = repository.DynamicMock<IDialogFactory>(); sc.AddService<IDecompilerShellUiService>(uiSvc); sc.AddService<IDecompilerService>(dcSvc); sc.AddService<IDialogFactory>(dlgFactory); }
public void Setup() { repository = new MockRepository(); interactor = repository.Stub <DisassemblyViewInteractor>(); sc = new ServiceContainer(); uiSvc = repository.DynamicMock <IDecompilerShellUiService>(); dcSvc = repository.Stub <IDecompilerService>(); dlgFactory = repository.DynamicMock <IDialogFactory>(); sc.AddService <IDecompilerShellUiService>(uiSvc); sc.AddService <IDecompilerService>(dcSvc); sc.AddService <IDialogFactory>(dlgFactory); }
public DeclSecurityVM(DeclSecurityOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.decompilerService = decompilerService; this.ownerType = ownerType; this.ownerMethod = ownerMethod; origOptions = options; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); CustomAttributesVM.PropertyChanged += CustomAttributesVM_PropertyChanged; DeclSecVerEnumList = new EnumListVM(declSecVerList, (a, b) => OnDeclSecVerChanged()); SecurityActionEnumList = new EnumListVM(secActList, (a, b) => OnSecurityActionChanged()); SecurityAttributesVM = new SecurityAttributesVM(ownerModule, decompilerService, ownerType, ownerMethod); SecurityAttributesVM.Collection.CollectionChanged += SecurityAttributesVM_CollectionChanged; Reinitialize(); }
LanguageComboBoxToolbarCommand(IDecompilerService decompilerService) { this.decompilerService = decompilerService; infos = decompilerService.AllDecompilers.OrderBy(a => a.OrderUI).Select(a => new LanguageInfo { Decompiler = a }).ToList(); UpdateSelectedItem(); comboBox = new ComboBox { DisplayMemberPath = "Name", Width = 90, ItemsSource = infos, }; comboBox.SetBinding(Selector.SelectedItemProperty, new Binding(nameof(SelectedItem)) { Source = this, }); decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; }
public void Setup() { mr = new MockRepository(); sc = new ServiceContainer(); mockTree = mr.StrictMock <ITreeView>(); mockNodes = mr.StrictMock <ITreeNodeCollection>(); decompilerSvc = mr.StrictMock <IDecompilerService>(); uiSvc = mr.StrictMock <IDecompilerShellUiService>(); decompiler = mr.StrictMock <IDecompiler>(); mockTree.Stub(t => t.Nodes).Return(mockNodes); uiSvc.Stub(u => u.GetContextMenu(0)).IgnoreArguments().Return(new ContextMenu()); sc.AddService <IDecompilerShellUiService>(uiSvc); fakeTree = new FakeTreeView(); }
DocumentTreeViewProvider(ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentServiceProvider documentServiceProvider, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable<Lazy<IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata>> dsDocumentNodeProviders, [ImportMany] IEnumerable<Lazy<IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata>> mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider) { this.treeViewService = treeViewService; this.decompilerService = decompilerService; this.documentServiceProvider = documentServiceProvider; this.documentTreeViewSettings = documentTreeViewSettings; this.menuService = menuService; this.dotNetImageService = dotNetImageService; this.wpfCommandService = wpfCommandService; this.resourceNodeFactory = resourceNodeFactory; this.appSettings = appSettings; this.dsDocumentNodeProviders = dsDocumentNodeProviders.ToArray(); this.mefFinders = mefFinders.ToArray(); this.treeViewNodeTextElementProvider = treeViewNodeTextElementProvider; }
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); }
public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origOptions = options; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); Reinitialize(); }
AnalyzeCommandLoader(IDsToolWindowService toolWindowService, IWpfCommandService wpfCommandService, IDocumentTabService documentTabService, Lazy<IAnalyzerService> analyzerService, IDecompilerService decompilerService) { this.toolWindowService = toolWindowService; this.documentTabService = documentTabService; this.analyzerService = analyzerService; this.decompilerService = decompilerService; var cmds = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENTVIEWER_UICONTEXT); cmds.Add(AnalyzeRoutedCommand, TextEditor_Executed, TextEditor_CanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds.Add(AnalyzeRoutedCommand, ShowAnalyzerExecuted, ShowAnalyzerCanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENT_TREEVIEW); cmds.Add(AnalyzeRoutedCommand, DocumentTreeView_Executed, DocumentTreeView_CanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds.Add(AnalyzeRoutedCommand, ShowAnalyzerExecuted, ShowAnalyzerCanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds = wpfCommandService.GetCommands(ControlConstants.GUID_ANALYZER_TREEVIEW); cmds.Add(AnalyzeRoutedCommand, AnalyzerTreeView_Executed, AnalyzerTreeView_CanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds.Add(AnalyzeRoutedCommand, ShowAnalyzerExecuted, ShowAnalyzerCanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds = wpfCommandService.GetCommands(ControlConstants.GUID_SEARCH_LISTBOX); cmds.Add(AnalyzeRoutedCommand, SearchListBox_Executed, SearchListBox_CanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); cmds.Add(AnalyzeRoutedCommand, ShowAnalyzerExecuted, ShowAnalyzerCanExecute, ModifierKeys.Control | ModifierKeys.Shift, Key.R); }
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); }
public ExportToProjectVM(IPickDirectory pickDirectory, IDecompilerService decompilerService, IExportTask exportTask, bool canDecompileBaml) { this.pickDirectory = pickDirectory; this.decompilerService = decompilerService; this.exportTask = exportTask; this.canDecompileBaml = canDecompileBaml; unpackResources = true; createResX = true; decompileXaml = canDecompileBaml; createSolution = true; ProjectVersionVM.SelectedItem = ProjectVersion.VS2010; decompiler = decompilerService.AllDecompilers.FirstOrDefault(a => a.ProjectFileExtension != null); isIndeterminate = false; ProjectGuid = new NullableGuidVM(Guid.NewGuid(), a => HasErrorUpdated()); }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Sequence = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Parameter_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; MarshalTypeVM = new MarshalTypeVM(ownerModule, decompilerService, ownerType != null ? ownerType : ownerMethod?.DeclaringType, ownerMethod); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; Reinitialize(); }
static TypeSigCreatorVM CreateTypeSigCreatorVM(ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod, bool allowNullTypeSig, PropertyChangedEventHandler handler) { var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, NullTypeSigAllowed = allowNullTypeSig, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; var typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); typeSigCreator.PropertyChanged += handler; return typeSigCreator; }
public MarshalTypeVM(ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { NativeType = new EnumListVM(nativeTypeList, (a, b) => { OnNativeTypeChanged(); TypeStringUpdated(); }); FixNativeTypeEnum(NativeType, false); RawMarshalType_Data = new HexStringVM(a => { HasErrorUpdated(); TypeStringUpdated(); }); FixedSysStringMarshalType_Size = new NullableCompressedUInt32(a => { HasErrorUpdated(); TypeStringUpdated(); }); SafeArrayMarshalType_VariantType = new EnumListVM(variantTypeList, (a, b) => { OnSafeArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); SafeArrayMarshalType_UserDefinedSubType_TypeSigCreator = CreateTypeSigCreatorVM(ownerModule, decompilerService, ownerType, ownerMethod, true, safeArrayMarshalType_userDefinedSubType_typeSigCreator_PropertyChanged); FixedArrayMarshalType_Size = new NullableCompressedUInt32(a => { OnFixedArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); FixedArrayMarshalType_NativeType = new EnumListVM(nativeTypeList, (a, b) => { OnFixedArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); FixNativeTypeEnum(FixedArrayMarshalType_NativeType, true); ArrayMarshalType_NativeType = new EnumListVM(nativeTypeList, (a, b) => { OnArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); FixNativeTypeEnum(ArrayMarshalType_NativeType, true); ArrayMarshalType_ParamNum = new NullableCompressedUInt32(a => { OnArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); ArrayMarshalType_NumElems = new NullableCompressedUInt32(a => { OnArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); ArrayMarshalType_Flags = new NullableCompressedUInt32(a => { OnArrayMarshalTypeIsEnabledChanged(); TypeStringUpdated(); }); CustomMarshalType_CustMarshaler_TypeSigCreator = CreateTypeSigCreatorVM(ownerModule, decompilerService, ownerType, ownerMethod, true, customMarshalType_custMarshaler_typeSigCreator_PropertyChanged); InterfaceMarshalType_IidParamIndex = new NullableCompressedUInt32(a => { HasErrorUpdated(); TypeStringUpdated(); }); }
public CustomAttributeVM(CustomAttributeOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origOptions = options; this.ownerModule = ownerModule; this.decompilerService = decompilerService; this.ownerType = ownerType; this.ownerMethod = ownerMethod; RawData = new HexStringVM(a => HasErrorUpdated()); CANamedArgumentsVM = new CANamedArgumentsVM(ownerModule, decompilerService, ownerType, ownerMethod, a => !IsRawData && a.Collection.Count < ushort.MaxValue); ConstructorArguments.CollectionChanged += Args_CollectionChanged; CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged; Reinitialize(); }
public MemberPickerVM(IDocumentSearcherProvider fileSearcherProvider, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeNodeFilter filter, string title, IEnumerable<IDsDocument> assemblies) { Title = title; this.fileSearcherProvider = fileSearcherProvider; this.decompilerService = decompilerService; this.documentTreeView = documentTreeView; decompiler = decompilerService.Decompiler; this.filter = filter; delayedSearch = new DelayedAction(DEFAULT_DELAY_SEARCH_MS, DelayStartSearch); SearchResults = new ObservableCollection<ISearchResult>(); searchResultsCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(SearchResults); searchResultsCollectionView.CustomSort = new SearchResult_Comparer(); foreach (var file in assemblies) documentTreeView.DocumentService.ForceAdd(file, false, null); documentTreeView.DocumentService.CollectionChanged += (s, e) => Restart(); CaseSensitive = false; MatchWholeWords = false; MatchAnySearchTerm = false; RefreshTreeView(); }
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); }
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); }
public TypeOptionsVM(TypeDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService, ownerType, null); DeclSecuritiesVM = new DeclSecuritiesVM(ownerModule, decompilerService, ownerType, null); GenericParamsVM = new GenericParamsVM(ownerModule, decompilerService, ownerType, null); InterfaceImplsVM = new TypeDefOrRefAndCAsVM<InterfaceImpl>(dnSpy_AsmEditor_Resources.EditInterfaceImpl, dnSpy_AsmEditor_Resources.CreateInterfaceImpl, ownerModule, decompilerService, ownerType, null); origOptions = options; IsNestedType = (options.Attributes & TypeAttributes.VisibilityMask) > TypeAttributes.Public; TypeKind = new EnumListVM(typeKindList, (a, b) => OnTypeKindChanged()); TypeLayout = new EnumListVM(typeLayoutList, (a, b) => InitializeTypeKind()); TypeSemantics = new EnumListVM(typeSemanticsList, (a, b) => InitializeTypeKind()); PackingSize = new NullableUInt16VM(a => HasErrorUpdated()); ClassSize = new NullableUInt32VM(a => HasErrorUpdated()); Types.TypeVisibility start, end; if (!IsNestedType) { start = Types.TypeVisibility.NotPublic; end = Types.TypeVisibility.Public; } else { start = Types.TypeVisibility.NestedPublic; end = Types.TypeVisibility.NestedFamORAssem; } for (var t = Types.TypeVisibility.NotPublic; t <= Types.TypeVisibility.NestedFamORAssem; t++) { if (t < start || t > end) TypeVisibility.Items.RemoveAt(TypeVisibility.GetIndex(t)); } InitializeTypeKind(); TypeSigCreator.CanAddFnPtr = false; Reinitialize(); }
AnalyzerService(IWpfCommandService wpfCommandService, IDocumentTabService documentTabService, ITreeViewService treeViewService, IMenuService menuService, IAnalyzerSettings analyzerSettings, IDotNetImageService dotNetImageService, IDecompilerService decompilerService, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider) { this.documentTabService = documentTabService; context = new AnalyzerTreeNodeDataContext { DotNetImageService = dotNetImageService, Decompiler = decompilerService.Decompiler, TreeViewNodeTextElementProvider = treeViewNodeTextElementProvider, DocumentService = documentTabService.DocumentTreeView.DocumentService, ShowToken = analyzerSettings.ShowToken, SingleClickExpandsChildren = analyzerSettings.SingleClickExpandsChildren, SyntaxHighlight = analyzerSettings.SyntaxHighlight, UseNewRenderer = analyzerSettings.UseNewRenderer, AnalyzerService = this, }; var options = new TreeViewOptions { CanDragAndDrop = false, TreeViewListener = this, }; TreeView = treeViewService.Create(ANALYZER_TREEVIEW_GUID, options); context.TreeView = TreeView; documentTabService.DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged; documentTabService.DocumentModified += DocumentTabService_FileModified; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; analyzerSettings.PropertyChanged += AnalyzerSettings_PropertyChanged; menuService.InitializeContextMenu(TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_ANALYZER_TREEVIEW_GUID), new GuidObjectsProvider(TreeView)); wpfCommandService.Add(ControlConstants.GUID_ANALYZER_TREEVIEW, TreeView.UIObject); var cmds = wpfCommandService.GetCommands(ControlConstants.GUID_ANALYZER_TREEVIEW); var command = new RelayCommand(a => ActivateNode()); cmds.Add(command, ModifierKeys.Control, Key.Enter); cmds.Add(command, ModifierKeys.Shift, Key.Enter); }
public ModuleOptionsVM(ModuleDef module, ModuleOptions options, IDecompilerService decompilerService) { this.module = module; this.options = new ModuleOptions(); origOptions = options; ModuleKind = new EnumListVM(SaveModule.SaveModuleOptionsVM.moduleKindList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.DotNet.ModuleKind)ModuleKind.SelectedItem); }); Machine = new EnumListVM(SaveModule.PEHeadersOptionsVM.machineList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.PE.Machine)Machine.SelectedItem); }); Mvid = new NullableGuidVM(a => HasErrorUpdated()); EncId = new NullableGuidVM(a => HasErrorUpdated()); EncBaseId = new NullableGuidVM(a => HasErrorUpdated()); ClrVersion = new EnumListVM(NetModuleOptionsVM.clrVersionList, (a, b) => OnClrVersionChanged()); ClrVersion.Items.Add(new EnumVM(Module.ClrVersion.Unknown, dnSpy_AsmEditor_Resources.Unknown)); ClrVersion.SelectedItem = Module.ClrVersion.Unknown; Cor20HeaderRuntimeVersion = new NullableUInt32VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); TablesHeaderVersion = new NullableUInt16VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); NativeEntryPointRva = new UInt32VM(a => HasErrorUpdated()); CustomAttributesVM = new CustomAttributesVM(module, decompilerService); Reinitialize(); }