void PickModuleRef() { if (dnlibTypePicker == null) throw new InvalidOperationException(); var file = dnlibTypePicker.GetDnlibType<IDnSpyFile>(dnSpy_AsmEditor_Resources.Pick_Module, new SameAssemblyFileTreeNodeFilter(typeSigCreatorOptions.OwnerModule, new FlagsFileTreeNodeFilter(VisibleMembersFlags.ModuleDef)), null, typeSigCreatorOptions.OwnerModule); if (file != null) { var module = file.ModuleDef; if (module != null) { var modRef = new ModuleRefUser(typeSigCreatorOptions.OwnerModule, module.Name); Class = typeSigCreatorOptions.OwnerModule.UpdateRowId(modRef); } } }
IScope GetScope(ExportedType exportedType) { if (exportedType == null) return null; if (!recursionCounter.Increment()) return null; IScope result; ExportedType et; AssemblyRef asmRef; FileDef file; var scope = exportedType.Implementation; if ((et = scope as ExportedType) != null) result = GetScope(et); else if ((asmRef = scope as AssemblyRef) != null) result = asmRef; else if ((file = scope as FileDef) != null) { var ownerModule = GetOwnerModule(exportedType); //TODO: Not all modules' names are equal to the name in FileDef.Name var modRef = new ModuleRefUser(ownerModule, file.Name); if (ownerModule != null) ownerModule.UpdateRowId(modRef); result = modRef; } else result = null; recursionCounter.Decrement(); return result; }
void PickModuleRef() { if (dnlibTypePicker == null) throw new InvalidOperationException(); var loadedAsm = dnlibTypePicker.GetDnlibType<LoadedAssembly>(new SameAssemblyTreeViewNodeFilter(typeSigCreatorOptions.OwnerModule, new FlagsTreeViewNodeFilter(VisibleMembersFlags.ModuleDef)), null, typeSigCreatorOptions.OwnerModule); if (loadedAsm != null) { var module = loadedAsm.ModuleDefinition; if (module != null) { var modRef = new ModuleRefUser(typeSigCreatorOptions.OwnerModule, module.Name); Class = typeSigCreatorOptions.OwnerModule.UpdateRowId(modRef); } } }