ModuleLoader(Lazy<ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IDsDocumentService documentService, Lazy<IInMemoryModuleService> inMemoryModuleService, IModuleIdProvider moduleIdProvider) { this.theDebugger = theDebugger; this.debuggerSettings = debuggerSettings; this.documentService = documentService; this.inMemoryModuleService = inMemoryModuleService; this.moduleIdProvider = moduleIdProvider; }
public static bool IsInModifiedModule(IDsDocumentService documentService, HashSet <IDsDocument?> modules, IEnumerable <object?> references) { var checkedAsmRefs = new HashSet <IAssembly>(AssemblyNameComparer.CompareAll); foreach (var r in references.Distinct()) { IAssembly?asmRef = null; if (r is IType t) { asmRef = t.DefinitionAssembly; } if (asmRef is null && r is IMemberRef) { var type = ((IMemberRef)r).DeclaringType; if (!(type is null)) { asmRef = type.DefinitionAssembly; } } if (!(asmRef is null) && !checkedAsmRefs.Contains(asmRef)) { checkedAsmRefs.Add(asmRef); var asm = documentService.FindAssembly(asmRef); if (!(asm is null) && modules.Contains(asm)) { return(true); } } } return(false); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, EventDef eventDef, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) : this(documentService, eventDef.DeclaringType, typeAnalysisFunction) { // we only have to check the accessibility of the the get method // [CLS Rule 30: The accessibility of an event and of its accessors shall be identical.] memberAccessibility = GetMethodAccessibility(eventDef.AddMethod); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, TypeDef type, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) { typeScope = type; moduleScope = type.Module; this.typeAnalysisFunction = typeAnalysisFunction; this.documentService = documentService; }
public IDsDocument?Create(IDsDocumentService documentService, DsDocumentInfo documentInfo) { if (documentInfo.Type == DocumentConstants.DOCUMENTTYPE_INMEMORY) { var getFileData = documentInfo.Data as Func <(byte[]? filedata, bool isFileLayout)>; Debug2.Assert(getFileData is not null); if (getFileData is not null) { var info = getFileData(); if (info.filedata is not null) { return(documentService.CreateDocument(documentInfo, info.filedata, documentInfo.Name, info.isFileLayout)); } } return(null); } var filename = GetFilename(documentInfo); if (filename is not null) { return(documentService.CreateDocument(documentInfo, filename)); } return(null); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, FieldDef field, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) : this(documentService, field.DeclaringType, typeAnalysisFunction) { switch (field.Attributes & FieldAttributes.FieldAccessMask) { case FieldAttributes.Private: default: memberAccessibility = Accessibility.Private; break; case FieldAttributes.FamANDAssem: memberAccessibility = Accessibility.FamilyAndInternal; break; case FieldAttributes.Assembly: memberAccessibility = Accessibility.Internal; break; case FieldAttributes.PrivateScope: case FieldAttributes.Family: memberAccessibility = Accessibility.Family; break; case FieldAttributes.FamORAssem: memberAccessibility = Accessibility.FamilyOrInternal; break; case FieldAttributes.Public: memberAccessibility = Accessibility.Public; break; } }
public DsDocumentLoader(IDsDocumentService documentService, Window ownerWindow) { this.documentService = documentService; this.ownerWindow = ownerWindow; this.loadedDocuments = new List <IDsDocument>(); this.hash = new HashSet <IDsDocument>(); }
public IDsDocumentNameKey CreateKey(IDsDocumentService documentService, DsDocumentInfo documentInfo) { if (documentInfo.Type == MyDsDocument.THE_GUID) return new FilenameKey(documentInfo.Name); // Must match the key in MyDsDocument.Key // Also check for normal files if (documentInfo.Type == DocumentConstants.DOCUMENTTYPE_FILE && IsSupportedFile(documentInfo.Name)) return new FilenameKey(documentInfo.Name); // Must match the key in MyDsDocument.Key return null; }
ModuleLoader(Lazy <ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IDsDocumentService documentService, Lazy <IInMemoryModuleService> inMemoryModuleService, IModuleIdProvider moduleIdProvider) { this.theDebugger = theDebugger; this.debuggerSettings = debuggerSettings; this.documentService = documentService; this.inMemoryModuleService = inMemoryModuleService; this.moduleIdProvider = moduleIdProvider; }
DbgMetadataServiceImpl(DbgModuleIdProviderService dbgModuleIdProviderService, DbgInMemoryModuleService dbgInMemoryModuleService, DsDocumentProvider dsDocumentProvider, IDsDocumentService documentService, DebuggerSettings debuggerSettings) { this.dbgModuleIdProviderService = dbgModuleIdProviderService; this.dbgInMemoryModuleService = dbgInMemoryModuleService; this.dsDocumentProvider = dsDocumentProvider; this.documentService = documentService; this.debuggerSettings = debuggerSettings; }
OpenListCommand(IAppWindow appWindow, IDocumentListLoader documentListLoader, DocumentListService documentListService, IMessageBoxService messageBoxService, IDsDocumentService documentService) { this.appWindow = appWindow; this.documentListLoader = documentListLoader; this.documentListService = documentListService; this.messageBoxService = messageBoxService; this.documentService = documentService; }
public DsDocumentLoader(IDsDocumentService documentService, Window ownerWindow, AssemblyExplorerMostRecentlyUsedList?mruList) { this.documentService = documentService; this.ownerWindow = ownerWindow; this.mruList = mruList; loadedDocuments = new List <IDsDocument>(); hash = new HashSet <IDsDocument>(); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, PropertyDef property, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction, ScopedWhereUsedAnalyzerOptions options = ScopedWhereUsedAnalyzerOptions.None) : this(documentService, property.DeclaringType, typeAnalysisFunction, options) { var getterAccessibility = property.GetMethod is null ? Accessibility.Private : GetMethodAccessibility(property.GetMethod, options); var setterAccessibility = property.SetMethod is null ? Accessibility.Private : GetMethodAccessibility(property.SetMethod, options); memberAccessibility = (Accessibility)Math.Max((int)getterAccessibility, (int)setterAccessibility); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, PropertyDef property, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) : this(documentService, property.DeclaringType, typeAnalysisFunction) { Accessibility getterAccessibility = (property.GetMethod == null) ? Accessibility.Private : GetMethodAccessibility(property.GetMethod); Accessibility setterAccessibility = (property.SetMethod == null) ? Accessibility.Private : GetMethodAccessibility(property.SetMethod); memberAccessibility = (Accessibility)Math.Max((int)getterAccessibility, (int)setterAccessibility); }
public IDsDocument Create(IDsDocumentService documentService, DsDocumentInfo documentInfo) { if (documentInfo.Type == MyDsDocument.THE_GUID) return MyDsDocument.TryCreate(documentInfo.Name); // Also check for normal files if (documentInfo.Type == DocumentConstants.DOCUMENTTYPE_FILE && IsSupportedFile(documentInfo.Name)) return MyDsDocument.TryCreate(documentInfo.Name); return null; }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, TypeDef analyzedType, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) { this.analyzedType = analyzedType; typeScope = analyzedType; this.typeAnalysisFunction = typeAnalysisFunction; this.documentService = documentService; allModules = new List <ModuleDef>(); }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, EventDef eventDef, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction, ScopedWhereUsedAnalyzerOptions options = ScopedWhereUsedAnalyzerOptions.None) : this(documentService, eventDef.DeclaringType, typeAnalysisFunction, options) { var adderAccessibility = eventDef.AddMethod is null ? Accessibility.Private : GetMethodAccessibility(eventDef.AddMethod, options); var removerAccessibility = eventDef.RemoveMethod is null ? Accessibility.Private : GetMethodAccessibility(eventDef.RemoveMethod, options); var invokerAccessibility = eventDef.InvokeMethod is null ? Accessibility.Private : GetMethodAccessibility(eventDef.InvokeMethod, options); memberAccessibility = (Accessibility)Math.Max(Math.Max((int)adderAccessibility, (int)removerAccessibility), (int)invokerAccessibility); }
public IDsDocument Create(IDsDocumentService documentService, DsDocumentInfo documentInfo) { var filename = GetFilename(documentInfo); if (filename != null) { return(documentService.CreateDocument(documentInfo, filename)); } return(null); }
InMemoryModuleService(ITheDebugger theDebugger, IDocumentTabService documentTabService, Lazy <IMethodAnnotations> methodAnnotations, IAppWindow appWindow) { this.documentTabService = documentTabService; this.documentTreeView = documentTabService.DocumentTreeView; this.documentService = this.documentTreeView.DocumentService; this.appWindow = appWindow; this.methodAnnotations = methodAnnotations; this.theDebugger = theDebugger; theDebugger.OnProcessStateChanged_First += TheDebugger_OnProcessStateChanged_First; }
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; }
InMemoryModuleService(ITheDebugger theDebugger, IDocumentTabService documentTabService, Lazy<IMethodAnnotations> methodAnnotations, IAppWindow appWindow, SimpleProcessReader simpleProcessReader) { this.documentTabService = documentTabService; documentTreeView = documentTabService.DocumentTreeView; documentService = documentTreeView.DocumentService; this.appWindow = appWindow; this.methodAnnotations = methodAnnotations; this.theDebugger = theDebugger; this.simpleProcessReader = simpleProcessReader; theDebugger.OnProcessStateChanged_First += TheDebugger_OnProcessStateChanged_First; }
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; }
OpenListCommand(IAppWindow appWindow, IDocumentListLoader documentListLoader, DocumentListService documentListService, IMessageBoxService messageBoxService, IDsDocumentService documentService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) { this.appWindow = appWindow; this.documentListLoader = documentListLoader; this.documentListService = documentListService; this.messageBoxService = messageBoxService; this.documentService = documentService; classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); this.textElementProvider = textElementProvider; }
public IDsDocumentNameKey?CreateKey(IDsDocumentService documentService, DsDocumentInfo documentInfo) { var filename = GetFilename(documentInfo); if (filename is not null) { return(new FilenameKey(filename)); } return(null); }
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; 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, }, }; documentTreeNodeGroups = new DocumentTreeNodeGroups(); this.dsDocumentNodeProvider = dsDocumentNodeProvider.OrderBy(a => a.Metadata.Order).ToArray(); TreeView = treeViewService.Create(new Guid(TreeViewConstants.DOCUMENT_TREEVIEW_GUID), options); TreeView.SelectionChanged += TreeView_SelectionChanged; DocumentService = documentService; DotNetImageService = dotNetImageService; dispatcher = Dispatcher.CurrentDispatcher; DocumentService.SetDispatcher(AddAction); documentService.CollectionChanged += DocumentService_CollectionChanged; decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged; appSettings.PropertyChanged += AppSettings_PropertyChanged; WpfCommands = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENT_TREEVIEW); if (isGlobal) { menuService.InitializeContextMenu(TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID), new GuidObjectsProvider(TreeView)); wpfCommandService.Add(ControlConstants.GUID_DOCUMENT_TREEVIEW, TreeView.UIObject); } nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray(); InitializeDocumentTreeNodeGroups(); }
static bool IsInModifiedModule(IDsDocumentService documentService, HashSet <IDsDocument?> modules, Item item) { var result = item.Content; if (result is null && !(item.WeakContent is null)) { result = (DocumentViewerContent?)item.WeakContent.Target; } var refs = result?.ReferenceCollection; if (refs is null) { return(false); } return(InModifiedModuleHelper.IsInModifiedModule(documentService, modules, refs.Select(a => a.Data.Reference))); }
internal static HashSet <string> GetFriendAssemblies(IDsDocumentService documentService, ModuleDef mod, out IDsDocument[] modules) { var asm = mod.Assembly; Debug.Assert(!(asm is null)); var friendAssemblies = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var attribute in asm.CustomAttributes.FindAll("System.Runtime.CompilerServices.InternalsVisibleToAttribute")) { if (attribute.ConstructorArguments.Count == 0) { continue; } string assemblyName = attribute.ConstructorArguments[0].Value as UTF8String; if (assemblyName is null) { continue; } assemblyName = assemblyName.Split(',')[0]; friendAssemblies.Add(assemblyName); } modules = documentService.GetDocuments().Where(a => CanIncludeModule(mod, a.ModuleDef)).ToArray(); foreach (var module in modules) { Debug.Assert(!(module.ModuleDef is null)); var asm2 = module.AssemblyDef; if (asm2 is null) { continue; } foreach (var attribute in asm2.CustomAttributes.FindAll("System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute")) { string assemblyName = attribute.ConstructorArguments[0].Value as UTF8String; if (assemblyName is null) { continue; } assemblyName = assemblyName.Split(',')[0]; if (StringComparer.OrdinalIgnoreCase.Equals(asm.Name.String, assemblyName)) { friendAssemblies.Add(asm2.Name); } } } return(friendAssemblies); }
internal static void AddTypeEquivalentTypes(IDsDocumentService documentService, TypeDef analyzedType, List <TypeDef> analyzedTypes) { Debug.Assert(analyzedTypes.Count == 1 && analyzedTypes[0] == analyzedType); if (!TIAHelper.IsTypeDefEquivalent(analyzedType)) { return; } foreach (var document in documentService.GetDocuments()) { foreach (var type in GetTypeEquivalentTypes(document.AssemblyDef, document.ModuleDef, analyzedType)) { if (type != analyzedType) { analyzedTypes.Add(type); } } } }
public DefaultDsDocumentLoader(IDsDocumentService documentService) { this.documentService = documentService; }
public ScopedWhereUsedAnalyzer(IDsDocumentService documentService, MethodDef method, Func <TypeDef, IEnumerable <T> > typeAnalysisFunction) : this(documentService, method.DeclaringType, typeAnalysisFunction) { memberAccessibility = GetMethodAccessibility(method); }
public OpenAssembly(IDsDocumentService documentService) { this.documentService = documentService; }
DsDocumentProviderImpl(IDsDocumentService documentService) => this.documentService = documentService;
DsDocumentServiceAppSettingsModifiedListener(IDsDocumentService documentService) { this.documentService = documentService; }
public IDsDocument Create(IDsDocumentService documentService, DsDocumentInfo documentInfo) { var filename = GetFilename(documentInfo); if (filename != null) return documentService.CreateDocument(documentInfo, filename); return null; }
public IDsDocumentNameKey CreateKey(IDsDocumentService documentService, DsDocumentInfo documentInfo) { var filename = GetFilename(documentInfo); if (filename != null) return new FilenameKey(filename); return null; }
DecompilationCache(IDsDocumentService documentService) { this.documentService = documentService; AddTimerWait(this); }
public DefaultDsDocumentLoader(IDsDocumentService documentService) => this.documentService = documentService;
public DsDocumentLoader(IDsDocumentService documentService, Window ownerWindow) { this.documentService = documentService; this.ownerWindow = ownerWindow; loadedDocuments = new List<IDsDocument>(); hash = new HashSet<IDsDocument>(); }