public static bool InstallTestFlightForAndroidCheck() { // Restrict our search area for performance reasons string hydrogenPath = HydrogenUtility.GetHydrogenPath(); if (Directory.GetFiles(hydrogenPath, "TestFlightLib.jar", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "tf.properties", SearchOption.AllDirectories).Length == 0) { return(false); } return(true); }
//[MenuItem ("Help/Library Documentation/Install for MonoDevelop")] static void InstallLibraryDocumentationMonoDevelop() { #if UNITY_EDITOR_OSX EditorUtility.DisplayProgressBar("Installing", "Initializing ...", 0.00f); string _baseLocation = HydrogenUtility.GetHydrogenPath() + HydrogenUtility.DS + "Extras" + HydrogenUtility.DS + "MonoDevelop"; //Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc/sources string _unityBase = EditorApplication.applicationPath.Replace("Unity.app", ""); // Quick Way of Finding EditorUtility.DisplayProgressBar("Installing", "Getting Path Information ...", 0.20f); string _monoBase = Directory.GetFiles(_unityBase, "Mono.source", SearchOption.AllDirectories) [0].Replace("/Mono.source", ""); EditorUtility.DisplayProgressBar("Installing", "Copy Unity.source ... ", 0.50f); File.Copy(_baseLocation + HydrogenUtility.DS + "Unity.source", _monoBase + HydrogenUtility.DS + "Unity.source", true); EditorUtility.DisplayProgressBar("Installing", "Copy Unity.source ... ", 0.70f); File.Copy(_baseLocation + HydrogenUtility.DS + "Unity.tree", _monoBase + HydrogenUtility.DS + "Unity.tree", true); EditorUtility.DisplayProgressBar("Installing", "Copy Unity.zip ... ", 0.80f); File.Copy(_baseLocation + HydrogenUtility.DS + "Unity.zip", _monoBase + HydrogenUtility.DS + "Unity.zip", true); EditorUtility.DisplayProgressBar("Completed", "Finished Installing MonoDevelop Documentation.", 1f); EditorUtility.ClearProgressBar(); #endif }
public static bool InstallTestFlightForIOSCheck() { // Restrict our search area for performance reasons string hydrogenPath = HydrogenUtility.GetHydrogenPath(); if (Directory.GetFiles(hydrogenPath, "libTestFlight.a", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "TestFlight+AsyncLogging.h", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "libTestFlight.a", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "libTestFlight.a", SearchOption.AllDirectories).Length == 0) { return(false); } return(true); }
//[MenuItem ("Help/Library Documentation/Install for MonoDevelop", true)] public static bool InstallLibraryDocumentationMonoDevelopCheck() { #if UNITY_EDITOR_OSX // Restrict our search area for performance reasons string hydrogenPath = HydrogenUtility.GetHydrogenPath(); if (Directory.GetFiles(hydrogenPath, "Unity.source", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "Unity.tree", SearchOption.AllDirectories).Length == 0) { return(false); } if (Directory.GetFiles(hydrogenPath, "Unity.zip", SearchOption.AllDirectories).Length == 0) { return(false); } return(true); #else return(false); #endif }
public static void CheckUpdate() { try { EditorUtility.DisplayCancelableProgressBar("Checking for Hydrogen Updates", "Contacting GitHub ...", 0.1f); WebClient client = new WebClient(); string changelogHTML = client.DownloadString(HydrogenUtility.ChangelogURI); System.Version latestVersion = new Version( changelogHTML.Substring(0, changelogHTML.IndexOf("\n")).Replace("Version ", "")); EditorUtility.DisplayCancelableProgressBar("Checking for Hydrogen Updates", "Processing information ...", 0.2f); if (latestVersion.CompareTo(HydrogenUtility.Version) > 0) { EditorUtility.ClearProgressBar(); // Check if they are using a repository of Hydrogen? if (Directory.Exists(HydrogenUtility.GetHydrogenPath() + ".git")) { int gitChoice = EditorUtility.DisplayDialogComplex("Hydrogen Update Available", "An update is availble from the Hydrogen GIT repository. Would you like to pull the updates?\n\nThis will OVERWRITE any changes you've made to the framework. This also will only work if you have GIT available via the command line.", "No", "Yes", string.Empty); if (gitChoice == 1) { EditorUtility.DisplayCancelableProgressBar("Updating Hydrogen", "Reseting local repository ...", 0.3f); System.Diagnostics.ProcessStartInfo gitInfo = new System.Diagnostics.ProcessStartInfo("git"); // Establish base settings gitInfo.WorkingDirectory = HydrogenUtility.GetHydrogenPath(); gitInfo.LoadUserProfile = true; gitInfo.CreateNoWindow = true; // We'll change these as we need too gitInfo.Arguments = "reset --hard HEAD"; // Reset the repo ... HARD! System.Diagnostics.Process.Start(gitInfo); gitInfo.Arguments = "pull"; EditorUtility.DisplayCancelableProgressBar("Updating Hydrogen", "Fetching latest (" + latestVersion.ToString() + ") ...", 0.6f); // Update the repo System.Diagnostics.Process.Start(gitInfo); } } else { // If they are not int decision = EditorUtility.DisplayDialogComplex("Hydrogen Update Available", "Do you wish to update your version of the Hydrogen Framework? \n\nThis will OVERWRITE any changes you've made to the framework.", "No", "Yes", string.Empty); if (decision == 1) { EditorUtility.DisplayCancelableProgressBar("Updating Hydrogen", "Downloading latest (" + latestVersion.ToString() + ") ...", 0.3f); string tempFile = Path.GetTempFileName(); string tempFolder = Path.GetTempPath() + "Hydrogen_" + latestVersion.ToString(); client.DownloadFile(HydrogenUtility.PackageURI, tempFile); EditorUtility.DisplayCancelableProgressBar("Updating Hydrogen", "Extracting ...", 0.6f); // Create Temp Extraction Folder if (Directory.Exists(tempFolder)) { Directory.Delete(tempFolder, true); } Directory.CreateDirectory(tempFolder); HydrogenUtility.ExtractZipFile(tempFile, "", tempFolder); EditorUtility.DisplayCancelableProgressBar("Updating Hydrogen", "Moving Into Place ...", 0.8f); if (Directory.Exists(HydrogenUtility.GetHydrogenPath())) { Directory.Delete(HydrogenUtility.GetHydrogenPath(), true); } Directory.Move(tempFolder + Path.DirectorySeparatorChar + "Hydrogen-master", HydrogenUtility.GetHydrogenPath()); } } } // Save time of last checking so we only do it every so often EditorPrefs.SetString("HydrogenFramework_LastChecked", DateTime.Now.ToString()); } catch (System.Exception e) { UnityEngine.Debug.LogWarning("Unable to update Hydogen. " + "\n" + e.Message + "\n" + e.Source + "\n" + e.StackTrace); } finally { // This just makes sure that we dont have a progress bar laying around EditorUtility.ClearProgressBar(); } }
public static void InstallTestFlightForIOS() { EditorUtility.DisplayProgressBar("Installing", "Getting Path Information ...", 0.00f); // Restrict our search area for performance reasons string _hydrogenPath = HydrogenUtility.GetHydrogenPath(); string _baseLocation = _hydrogenPath + HydrogenUtility.DS + "Vendors" + HydrogenUtility.DS + "TestFlight" + HydrogenUtility.DS + "iOS"; string _extraLocation = _hydrogenPath + HydrogenUtility.DS + "Extras" + HydrogenUtility.DS + "TestFlight" + HydrogenUtility.DS + "iOS"; EditorUtility.DisplayProgressBar("Installing", "Installing iOS Files ...", 0.1f); if (_baseLocation != "" && _extraLocation != "") { // Create our output directories (Cool Chain Effect! +10 Fun) Directory.CreateDirectory(Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS"); EditorUtility.DisplayProgressBar("Installing", "Copying iOS Files ...", 0.2f); // Copy over the main TestFlight iOS system File.Copy(_baseLocation + HydrogenUtility.DS + "libTestFlight.a", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS" + HydrogenUtility.DS + "libTestFlight.a", true); EditorUtility.DisplayProgressBar("Installing", "Copying iOS Files ...", 0.3f); File.Copy(_baseLocation + HydrogenUtility.DS + "TestFlight.h", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS" + HydrogenUtility.DS + "TestFlight.h", true); EditorUtility.DisplayProgressBar("Installing", "Copying iOS Files ...", 0.4f); File.Copy(_baseLocation + HydrogenUtility.DS + "TestFlight+AsyncLogging.h", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS" + HydrogenUtility.DS + "TestFlight+AsyncLogging.h", true); EditorUtility.DisplayProgressBar("Installing", "Copying iOS Files ...", 0.5f); File.Copy(_baseLocation + HydrogenUtility.DS + "TestFlight+ManualSessions.h", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS" + HydrogenUtility.DS + "TestFlight+ManualSessions.h", true); EditorUtility.DisplayProgressBar("Installing", "Copying iOS Extras ...", 0.6f); // Copy over our little bit of code to make it all work inside of Xcode File.Copy(_extraLocation + HydrogenUtility.DS + "HydrogenTestFlight.mm", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "iOS" + HydrogenUtility.DS + "HydrogenTestFlight.mm", true); EditorUtility.DisplayProgressBar("Installing", "Finished Copying iOS Files ...", 0.7f); // Make it all pretty with Unity AssetDatabase.Refresh(); EditorUtility.DisplayProgressBar("Installing", "Establishing Defined Symbols ...", 0.9f); // Better turn on the compilation part for iOS, this was a handy way to get around errors if (!PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iPhone).Contains("HYDROGEN_TESTFLIGHT")) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iPhone, "HYDROGEN_TESTFLIGHT;" + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iPhone)); } EditorUtility.DisplayProgressBar("Completed", "Finished Installing iOS Files.", 1f); } else { Debug.Log("Unable to find the required TestFlight files for iOS."); } EditorUtility.ClearProgressBar(); }
public static void InstallTestFlightForAndroid() { EditorUtility.DisplayProgressBar("Installing", "Getting Path Information ...", 0.00f); string _hydrogenPath = HydrogenUtility.GetHydrogenPath(); string _baseLocation = _hydrogenPath + HydrogenUtility.DS + "Vendors" + HydrogenUtility.DS + "TestFlight" + HydrogenUtility.DS + "Android"; string _extraLocation = _hydrogenPath + HydrogenUtility.DS + "Extras" + HydrogenUtility.DS + "TestFlight" + HydrogenUtility.DS + "Android"; EditorUtility.DisplayProgressBar("Installing", "Installing Android Files ...", 0.1f); if (_baseLocation != "" && _extraLocation != "") { // Create our output directories (Cool Chain Effect! +10 Fun) Directory.CreateDirectory(Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "res" + HydrogenUtility.DS + "raw"); EditorUtility.DisplayProgressBar("Installing", "Copying Android Files ...", 0.2f); // Copy over the main TestFlight Android system File.Copy(_baseLocation + HydrogenUtility.DS + "TestFlightLib.jar", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "TestFlightLib.jar", true); EditorUtility.DisplayProgressBar("Installing", "Copying Android Extras ...", 0.3f); // Copy that little annoying file into position that makes TestFlight actually know that we have TestFlight packed away into the build File.Copy(_extraLocation + HydrogenUtility.DS + "tf.properties", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "res" + HydrogenUtility.DS + "raw" + HydrogenUtility.DS + "tf.properties", true); EditorUtility.DisplayProgressBar("Installing", "Copying Android Extras ...", 0.4f); // Grab a copy of Unity's AndroidManifest and shove it in the Android plugins folder (only if we don't already have one there) if (!File.Exists(Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "AndroidManifest.xml")) { File.Copy(EditorApplication.applicationContentsPath + HydrogenUtility.DS + "PlaybackEngines" + HydrogenUtility.DS + "AndroidPlayer" + HydrogenUtility.DS + "AndroidManifest.xml", Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "AndroidManifest.xml", true); } // Add the required permissions for TestFlight string[] _manifestLines = File.ReadAllLines(Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "AndroidManifest.xml"); int _insertionLocation = 0; bool _foundInternet = false; bool _foundNetState = false; // Loop through the file's lines looking for something like what we need for (int x = 0; x < _manifestLines.Length; x++) { _foundInternet |= _manifestLines [x].Contains("<uses-permission android:name=\"android.permission.INTERNET\""); _foundNetState |= _manifestLines [x].Contains("<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\""); if (_manifestLines [x].Contains("</application>")) { _insertionLocation = x + 1; } } if (!_foundInternet) { Hydrogen.Array.AddAt(ref _manifestLines, _insertionLocation, "<uses-permission android:name=\"android.permission.INTERNET\" />", true); } if (!_foundNetState) { Hydrogen.Array.AddAt(ref _manifestLines, _insertionLocation, "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />", true); } File.WriteAllLines(Application.dataPath + HydrogenUtility.DS + "Plugins" + HydrogenUtility.DS + "Android" + HydrogenUtility.DS + "AndroidManifest.xml", _manifestLines); EditorUtility.DisplayProgressBar("Installing", "Finished Copying Android Files ...", 0.7f); // Make it all pretty with Unity AssetDatabase.Refresh(); EditorUtility.DisplayProgressBar("Installing", "Establishing Defined Symbols ...", 0.9f); // Better turn on the compilation part for Android, this was a handy way to get around errors if (!PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android).Contains("HYDROGEN_TESTFLIGHT")) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "HYDROGEN_TESTFLIGHT;" + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android)); } EditorUtility.DisplayProgressBar("Completed", "Finished Installing Android Files.", 1f); } else { Debug.Log("Unable to find the required TestFlight files for Android."); } EditorUtility.ClearProgressBar(); }