private static bool InitializePackageManager(PackageInfo package) { string str = ((IEnumerable <KeyValuePair <string, PackageFileData> >)package.get_files()).Where <KeyValuePair <string, PackageFileData> >((Func <KeyValuePair <string, PackageFileData>, bool>)(x => x.Value.type == 3)).Select <KeyValuePair <string, PackageFileData>, string>((Func <KeyValuePair <string, PackageFileData>, string>)(x => x.Key)).FirstOrDefault <string>(); if (str == null || !File.Exists(Path.Combine((string)package.basePath, str))) { return(false); } InternalEditorUtility.SetPlatformPath((string)package.basePath); return(ModuleManager.InitializePackageManager(InternalEditorUtility.LoadAssemblyWrapper(Path.GetFileName(str), Path.Combine((string)package.basePath, str)), package)); }
private static bool InitializePackageManager(Unity.DataContract.PackageInfo package) { string text = (from x in package.files where x.Value.type == PackageFileType.Dll select x.Key).FirstOrDefault <string>(); if (text == null || !File.Exists(Path.Combine(package.basePath, text))) { return(false); } InternalEditorUtility.SetPlatformPath(package.basePath); Assembly assembly = InternalEditorUtility.LoadAssemblyWrapper(Path.GetFileName(text), Path.Combine(package.basePath, text)); return(ModuleManager.InitializePackageManager(assembly, package)); }
private static bool InitializePackageManager(PackageInfo package) { string text = (from x in package.get_files() where x.Value.type == 3 select x.Key).FirstOrDefault <string>(); bool result; if (text == null || !File.Exists(Path.Combine(package.basePath, text))) { result = false; } else { InternalEditorUtility.SetPlatformPath(package.basePath); Assembly assembly = InternalEditorUtility.LoadAssemblyWrapper(Path.GetFileName(text), Path.Combine(package.basePath, text)); result = ModuleManager.InitializePackageManager(assembly, package); } return(result); }
private static void RegisterPackageManager() { ModuleManager.s_EditorModules = new List <IEditorModule>(); try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => null != a.GetType("Unity.PackageManager.PackageManager")); if (assembly != null) { if (ModuleManager.InitializePackageManager(assembly, null)) { return; } } } catch (Exception arg) { Console.WriteLine("Error enumerating assemblies looking for package manager. {0}", arg); } Type type = (from a in AppDomain.CurrentDomain.GetAssemblies() where a.GetName().Name == "Unity.Locator" select a.GetType("Unity.PackageManager.Locator")).FirstOrDefault <Type>(); try { string unityPath = FileUtil.CombinePaths(new string[] { Directory.GetParent(EditorApplication.applicationPath).ToString(), "PlaybackEngines" }); type.InvokeMember("Scan", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new object[] { new string[] { FileUtil.NiceWinPath(EditorApplication.applicationContentsPath), FileUtil.NiceWinPath(unityPath) }, Application.unityVersion }); } catch (Exception arg2) { Console.WriteLine("Error scanning for packages. {0}", arg2); return; } Unity.DataContract.PackageInfo packageInfo; try { packageInfo = (type.InvokeMember("GetPackageManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new string[] { Application.unityVersion }) as Unity.DataContract.PackageInfo); if (packageInfo == null) { Console.WriteLine("No package manager found!"); return; } } catch (Exception arg3) { Console.WriteLine("Error scanning for packages. {0}", arg3); return; } try { ModuleManager.InitializePackageManager(packageInfo); } catch (Exception arg4) { Console.WriteLine("Error initializing package manager. {0}", arg4); } if (ModuleManager.s_PackageManager != null) { ModuleManager.s_PackageManager.CheckForUpdates(); } }
private static void RegisterPackageManager() { ModuleManager.s_EditorModules = new List <IEditorModule>(); try { Assembly assembly = ((IEnumerable <Assembly>)AppDomain.CurrentDomain.GetAssemblies()).FirstOrDefault <Assembly>((Func <Assembly, bool>)(a => null != a.GetType("Unity.PackageManager.PackageManager"))); if (assembly != null) { if (ModuleManager.InitializePackageManager(assembly, (PackageInfo)null)) { return; } } } catch (Exception ex) { Console.WriteLine("Error enumerating assemblies looking for package manager. {0}", (object)ex); } System.Type type = ((IEnumerable <Assembly>)AppDomain.CurrentDomain.GetAssemblies()).Where <Assembly>((Func <Assembly, bool>)(a => a.GetName().Name == "Unity.Locator")).Select <Assembly, System.Type>((Func <Assembly, System.Type>)(a => a.GetType("Unity.PackageManager.Locator"))).FirstOrDefault <System.Type>(); try { type.InvokeMember("Scan", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, (Binder)null, (object)null, new object[2] { (object)new string[1] { FileUtil.NiceWinPath(EditorApplication.applicationContentsPath) }, (object)Application.unityVersion }); } catch (Exception ex) { Console.WriteLine("Error scanning for packages. {0}", (object)ex); return; } PackageInfo package; try { package = type.InvokeMember("GetPackageManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, (Binder)null, (object)null, (object[])new string[1] { Application.unityVersion }) as PackageInfo; if (PackageInfo.op_Equality(package, (PackageInfo)null)) { Console.WriteLine("No package manager found!"); return; } } catch (Exception ex) { Console.WriteLine("Error scanning for packages. {0}", (object)ex); return; } try { ModuleManager.InitializePackageManager(package); } catch (Exception ex) { Console.WriteLine("Error initializing package manager. {0}", (object)ex); } if (ModuleManager.s_PackageManager == null) { return; } ModuleManager.s_PackageManager.CheckForUpdates(); }