private static void ScanDirectory(string rootPath, string path, int level) { if (!Locator.UserWantsToContinue()) { return; } if (level > 4) { return; } if (path == null || rootPath == null) { return; } if (File.Exists(Path.Combine(path, Locator.moduleFile))) { try { InternalPackageInfo internalPackageInfo = Locator.Parse(Locator.CombinePaths(new string[] { path, Locator.moduleFile })); if (internalPackageInfo != null) { Locator.s_Tree.Add(internalPackageInfo); return; } } catch (Exception ex) { Console.WriteLine("Error parsing module from {0}. {1}", Locator.CombinePaths(new string[] { path, Locator.moduleFile }), ex.Message); return; } } string[] directories = Directory.GetDirectories(path); if (directories.Length == 0) { return; } string[] array = directories; for (int i = 0; i < array.Length; i++) { string path2 = array[i]; Locator.ScanDirectory(rootPath, path2, level + 1); } }
public static PackageInfo GetPackageManager(string unityVersion) { PackageVersion version = new PackageVersion(unityVersion); InternalPackageInfo internalPackageInfo = (from p in Locator.s_Tree where p.package.type == PackageType.PackageManager && p.module.UnityVersion.IsCompatibleWith(version) orderby p.package.version descending select p).FirstOrDefault <InternalPackageInfo>(); if (internalPackageInfo != null) { return(internalPackageInfo.package); } return(null); }