public static bool UpdateCore() { bool bThrewException = false; string LocalModulesList = IgorUtils.DownloadFileForUpdate(IgorModulesListFilename); try { if (File.Exists(LocalModulesList)) { if (File.Exists(InstalledModulesListPath) && HelperDelegates.bIsValid) { IgorUpdater.HelperDelegates.DeleteFile(InstalledModulesListPath); } IgorUpdater.HelperDelegates.CopyFile(LocalModulesList, InstalledModulesListPath); } UpdatedModules.Clear(); if (UpdateModule(CoreModuleName, false)) { return(true); } } catch (TimeoutException to) { if (!File.Exists(LocalModulesList)) { Debug.LogError("Igor Error: Caught exception while self-updating. Exception is " + (to == null ? "NULL exception!" : to.ToString())); bThrewException = true; CleanupTemp(); } } catch (Exception e) { Debug.LogError("Igor Error: Caught exception while updating core. Exception is " + (e == null ? "NULL exception!" : e.ToString())); bThrewException = true; CleanupTemp(); } if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered()) { if (bThrewException) { Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown."); if (HelperDelegates.bIsValid) { EditorApplication.Exit(-1); } } } return(false); }
public static void CheckIfResuming() { if (!EditorApplication.isCompiling) { bool bThrewException = false; EditorApplication.update -= CheckIfResuming; try { FindCore(); if (HelperDelegates.IgorJobConfig_IsBoolParamSet("restartingfromupdate") || HelperDelegates.IgorJobConfig_IsBoolParamSet("updatebeforebuild") || Core == null) { HelperDelegates.IgorJobConfig_SetBoolParam("restartingfromupdate", false); if (!CheckForUpdates()) { if (HelperDelegates.IgorJobConfig_IsBoolParamSet("updatebeforebuild")) { HelperDelegates.IgorJobConfig_SetBoolParam("updatebeforebuild", false); if (Core != null) { Core.RunJobInst(); } else { Debug.LogError("Igor Error: Something went really wrong. We don't have Igor's core, but we've already finished updating everything. Report this with your logs please!"); } } } } } catch (Exception e) { Debug.LogError("Igor Error: Caught exception while resuming from updates. Exception is " + (e == null ? "NULL exception!" : e.ToString())); bThrewException = true; } if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered()) { if (bThrewException) { Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown."); if (HelperDelegates.bIsValid) { EditorApplication.Exit(-1); } } } } }
public static bool UpdateModules() { bool bThrewException = false; try { FindCore(); if (Core != null) { bool bUpdated = false; UpdatedModules.Clear(); foreach (string CurrentModule in Core.GetEnabledModuleNames()) { bUpdated = UpdateModule(CurrentModule, false) || bUpdated; } if (bUpdated) { return(true); } } } catch (TimeoutException) { // We should eventually handle this case by triggering a re-attempt } catch (Exception e) { Debug.LogError("Igor Error: Caught exception while updating modules. Exception is " + (e == null ? "NULL exception!" : e.ToString())); bThrewException = true; CleanupTemp(); } if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered()) { if (bThrewException) { Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown."); if (HelperDelegates.bIsValid) { EditorApplication.Exit(-1); } } } return(false); }
public static bool SelfUpdate(out bool bMajorUpgrade) { bool bThrewException = false; bMajorUpgrade = false; string InstalledFilePath = Path.Combine(BaseIgorDirectory, IgorUpdaterFilename); try { string LocalUpdater = IgorUtils.DownloadFileForUpdate(IgorUpdaterURL); if (File.Exists(LocalUpdater)) { int NewVersion = GetVersionFromUpdaterFile(LocalUpdater); int NewMajorUpgrade = GetMajorUpgradeFromUpdaterFile(LocalUpdater); if (NewMajorUpgrade > MajorUpgrade) { bMajorUpgrade = true; } if (NewVersion > Version || bAlwaysUpdate) { if (File.Exists(InstalledFilePath)) { IgorUpdater.HelperDelegates.DeleteFile(InstalledFilePath); } if (!Directory.Exists(Path.GetDirectoryName(InstalledFilePath))) { Directory.CreateDirectory(Path.GetDirectoryName(InstalledFilePath)); } IgorUpdater.HelperDelegates.CopyFile(LocalUpdater, InstalledFilePath); return(true); } } } catch (TimeoutException to) { if (!File.Exists(InstalledFilePath)) { Debug.LogError("Igor Error: Caught exception while self-updating. Exception is " + (to == null ? "NULL exception!" : to.ToString())); bThrewException = true; CleanupTemp(); } } catch (Exception e) { Debug.LogError("Igor Error: Caught exception while self-updating. Exception is " + (e == null ? "NULL exception!" : e.ToString())); bThrewException = true; CleanupTemp(); } if (!HelperDelegates.IgorJobConfig_GetWasMenuTriggered()) { if (bThrewException) { Debug.LogError("Igor Error: Exiting EditorApplication because an exception was thrown."); if (HelperDelegates.bIsValid) { EditorApplication.Exit(-1); } } } return(false); }