/// <summary> /// 运行本地资源服务器 /// </summary> static void Run() { string pathToAssetServer = Path.Combine(Application.dataPath, "AssetBundleManager/Editor/AssetBundleServer.exe"); string pathToApp = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')); KillRunningAssetBundleServer(); // 写入本地资源服务器地址 BuildScript.WriteServerURL(); string args = Path.Combine(pathToApp, "AssetBundles"); args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id); ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono( MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", pathToAssetServer, args, true); startInfo.WorkingDirectory = Path.Combine(System.Environment.CurrentDirectory, "AssetBundles"); startInfo.UseShellExecute = false; Process launchProcess = Process.Start(startInfo); if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0) { //Unable to start process UnityEngine.Debug.LogError("Unable Start AssetBundleServer process"); } else { //We seem to have launched, let's save the PID instance.m_ServerPID = launchProcess.Id; } }
static string GetMonoProfileVersion() { string path = Path.Combine(Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "lib"), "mono"); string[] folders = Directory.GetDirectories(path); string[] foldersWithApi = folders.Where(f => f.Contains("-api")).ToArray(); float profileVersion = 1.0f; //for (int i = 0; i < foldersWithApi.Length; i++) //{ // foldersWithApi[i] = foldersWithApi[i].Split(Path.DirectorySeparatorChar).Last(); // foldersWithApi[i] = foldersWithApi[i].Split('-').First(); // if (float.Parse(foldersWithApi[i]) > profileVersion) // { // profileVersion = float.Parse(foldersWithApi[i]); // } //} //return profileVersion.ToString(); var i = foldersWithApi.Length - 1; foldersWithApi[i] = foldersWithApi[i].Split(Path.DirectorySeparatorChar).Last(); foldersWithApi[i] = foldersWithApi[i].Split('-').First(); return(foldersWithApi[i]); }
static string GetMonoProfileVersion() { string path = Path.Combine(Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "lib"), "mono"); string[] folders = Directory.GetDirectories(path); string[] foldersWithApi = folders.Where(f => f.Contains("-api")).ToArray(); //float profileVersion = 1.0f; Version profileVersion = new Version("1.0"); for (int i = 0; i < foldersWithApi.Length; i++) { foldersWithApi[i] = foldersWithApi[i].Split(Path.DirectorySeparatorChar).Last(); foldersWithApi[i] = foldersWithApi[i].Split('-').First(); Version newVersion = new Version(foldersWithApi[i].ToString()); /* * if (float.Parse(foldersWithApi[i]) > profileVersion) * { * profileVersion = float.Parse(foldersWithApi[i]); * }*/ if (newVersion > profileVersion) { profileVersion = newVersion; } } return(profileVersion.ToString()); }
static string GetMonoProfileVersion() { string path = Path.Combine(Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "lib"), "mono"); string[] folders = Directory.GetDirectories(path); string[] foldersWithApi = folders.Where(f => f.Contains("-api")).ToArray(); string profileVersion = "0"; for (int i = 0; i < foldersWithApi.Length; i++) { foldersWithApi[i] = foldersWithApi[i].Split(Path.DirectorySeparatorChar).Last(); foldersWithApi[i] = foldersWithApi[i].Split('-').First(); if (string.Compare(foldersWithApi[i], profileVersion) > 0) { profileVersion = foldersWithApi[i]; } } return(profileVersion); }
static string GetMonoProfileVersion() { string path = Path.Combine(Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "lib"), "mono"); string[] folders = Directory.GetDirectories(path); string[] foldersWithApi = folders.Where(f => f.Contains("-api")).ToArray(); float profileVersion = 1.0f; for (int i = 0; i < foldersWithApi.Length; i++) { foldersWithApi[i] = foldersWithApi[i].Split(Path.DirectorySeparatorChar).Last(); foldersWithApi[i] = foldersWithApi[i].Split('-').First(); char[] chars = foldersWithApi[i].ToCharArray(); bool firstFlag = true; for (int j = 0; j < chars.Length; j++) { if (chars[j] == '.') { if (firstFlag) { firstFlag = false; } else { chars[j] = 'x'; } } } foldersWithApi[i] = new string(chars).Replace("x", ""); if (float.Parse(foldersWithApi[i]) > profileVersion) { profileVersion = float.Parse(foldersWithApi[i]); } } return(profileVersion.ToString()); }
static void Run() { KillRunningAssetBundleServer(); AssetBundleUtility.WriteAssetBundleServerURL(); string args = string.Format("\"{0}\" {1}", AssetBundleConfig.LocalSvrAppWorkPath, Process.GetCurrentProcess().Id); ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), GetMonoProfileVersion(), AssetBundleConfig.LocalSvrAppPath, args, true); startInfo.WorkingDirectory = AssetBundleConfig.LocalSvrAppWorkPath; startInfo.UseShellExecute = false; Process launchProcess = Process.Start(startInfo); if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0) { UnityEngine.Debug.LogError("Unable Start AssetBundleServer process!"); } else { instance.mServerPID = launchProcess.Id; UnityEngine.Debug.Log("Local assetbundle server run!"); } }
static void Run() { string pathToAssetServer = Path.GetFullPath("Assets/AssetBundleManager/Editor/AssetBundleServer.exe"); string assetBundlesDirectory = Path.Combine(Environment.CurrentDirectory, "AssetBundles"); KillRunningAssetBundleServer(); BuildScript.CreateAssetBundleDirectory(); BuildScript.WriteServerURL(); string args = assetBundlesDirectory; args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id); ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), GetMonoProfileVersion(), pathToAssetServer, args, true); startInfo.WorkingDirectory = assetBundlesDirectory; startInfo.UseShellExecute = false; Process launchProcess = Process.Start(startInfo); if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0) { //Unable to start process UnityEngine.Debug.LogError("Unable Start AssetBundleServer process"); } else { //We seem to have launched, let's save the PID instance.m_ServerPID = launchProcess.Id; } }
static void Run() { string pathToAssetServer = Path.Combine(Application.dataPath, "AssetBundleManager/Editor/AssetBundleServer.exe"); string pathToApp = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')); KillRunningAssetBundleServer(); BuildScript.WriteServerURL(); string bundleFolder = AssetBundleManager.UseGraphToolBundle ? "GraphToolBundles" : "AssetBundles"; string args = Path.Combine(pathToApp, bundleFolder); if (!Directory.Exists(args)) { UnityEngine.Debug.LogError("Directory does not exist. Build asset bundles first and create directory to run local server:" + args); return; } args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id); ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", pathToAssetServer, args, true); startInfo.WorkingDirectory = Path.Combine(System.Environment.CurrentDirectory, bundleFolder); startInfo.UseShellExecute = false; Process launchProcess = Process.Start(startInfo); if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0) { //Unable to start process UnityEngine.Debug.LogError("Unable Start AssetBundleServer process"); } else { UnityEngine.Debug.LogFormat("Local Server started with arg:{0}", args); //We seem to have launched, let's save the PID instance.m_ServerPID = launchProcess.Id; } }