private void CollectReferencesFromRootsRecursive(string dir, IEnumerable <string> roots, bool ignoreSystemDlls) { DefaultAssemblyResolver assemblyResolver = AssemblyReferenceChecker.AssemblyResolverFor(dir); foreach (string current in roots) { string fileName = Path.Combine(dir, current); if (!this._assemblyFileNames.Contains(current)) { AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(fileName, new ReaderParameters { AssemblyResolver = assemblyResolver }); if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.Name.Name)) { this._assemblyFileNames.Add(current); this._assemblyDefinitions.Add(assemblyDefinition); foreach (AssemblyNameReference current2 in assemblyDefinition.MainModule.AssemblyReferences) { string text = current2.Name + ".dll"; if (!this._assemblyFileNames.Contains(text)) { this.CollectReferencesFromRootsRecursive(dir, new string[] { text }, ignoreSystemDlls); } } } } } }
public void CollectReferences(string path, bool collectMethods, float progressValue, bool ignoreSystemDlls) { this._progressValue = progressValue; this._assemblyDefinitions = new HashSet <AssemblyDefinition>(); string[] array = (!Directory.Exists(path)) ? new string[0] : Directory.GetFiles(path); DefaultAssemblyResolver assemblyResolver = AssemblyReferenceChecker.AssemblyResolverFor(path); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i]; if (!(Path.GetExtension(text) != ".dll")) { AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(text, new ReaderParameters { AssemblyResolver = assemblyResolver }); if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.Name.Name)) { this._assemblyFileNames.Add(Path.GetFileName(text)); this._assemblyDefinitions.Add(assemblyDefinition); } } } AssemblyDefinition[] array3 = this._assemblyDefinitions.ToArray <AssemblyDefinition>(); this._referencedTypes = MonoAOTRegistration.BuildReferencedTypeList(array3); if (collectMethods) { this.CollectReferencedAndDefinedMethods(array3); } }
private void CollectReferencesFromRootsRecursive(string dir, IEnumerable <string> roots, bool ignoreSystemDlls) { DefaultAssemblyResolver assemblyResolver = AssemblyReferenceChecker.AssemblyResolverFor(dir); foreach (string current in roots) { string text = Path.Combine(dir, current); if (!this._assemblyFileNames.Contains(current)) { string arg_4D_0 = text; ReaderParameters readerParameters = new ReaderParameters(); readerParameters.set_AssemblyResolver(assemblyResolver); AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(arg_4D_0, readerParameters); if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.get_Name().get_Name())) { this._assemblyFileNames.Add(current); this._assemblyDefinitions.Add(assemblyDefinition); using (Collection <AssemblyNameReference> .Enumerator enumerator2 = assemblyDefinition.get_MainModule().get_AssemblyReferences().GetEnumerator()) { while (enumerator2.MoveNext()) { AssemblyNameReference current2 = enumerator2.get_Current(); string text2 = current2.get_Name() + ".dll"; if (!this._assemblyFileNames.Contains(text2)) { this.CollectReferencesFromRootsRecursive(dir, new string[] { text2 }, ignoreSystemDlls); } } } } } } }