private static void MigrateProjectSettings() { // Doing a manual migration of project settings because Ludiq.Graphs and Ludiq.Core were merged into Bolt.Core // and each plugin has some shared project settings (so we need to merge them as well) // Ludiq.Graphs + Ludiq.Core + Bolt.Core -> VisualScripting.Core var coreProjectSettings = BoltCore.Configuration.projectSettings; var ludiqGraphsProjectSettings = MigrationUtility_1_4_13_to_1_5_1.GetLegacyProjectSettingsAsset("Ludiq.Graphs"); if (ludiqGraphsProjectSettings != null) { MigrationUtility_1_4_13_to_1_5_1.TransferSettings(ludiqGraphsProjectSettings, coreProjectSettings); } var ludiqCoreProjectSettings = MigrationUtility_1_4_13_to_1_5_1.GetLegacyProjectSettingsAsset("Ludiq.Core"); if (ludiqCoreProjectSettings != null) { MigrationUtility_1_4_13_to_1_5_1.TransferSettings(ludiqCoreProjectSettings, coreProjectSettings); } var boltCoreProjectSettings = MigrationUtility_1_4_13_to_1_5_1.GetLegacyProjectSettingsAsset("Bolt.Core"); if (boltCoreProjectSettings != null) { MigrationUtility_1_4_13_to_1_5_1.TransferSettings(boltCoreProjectSettings, coreProjectSettings); } BoltCore.Configuration.Save(); }
public override void Run() { plugin.configuration.Initialize(); try { MigrateProjectSettings(); } #pragma warning disable 168 catch (Exception e) #pragma warning restore 168 { Debug.LogWarning("There was a problem migrating your Visual Scripting project settings. Be sure to check them in Edit -> Project Settings -> Visual Scripting"); #if VISUAL_SCRIPT_DEBUG_MIGRATION Debug.LogError(e); #endif } try { MigrationUtility_1_4_13_to_1_5_1.MigrateEditorPreferences(this.plugin); } #pragma warning disable 168 catch (Exception e) #pragma warning restore 168 { Debug.LogWarning("There was a problem migrating your Visual Scripting editor preferences. Be sure to check them in Edit -> Preferences -> Visual Scripting"); #if VISUAL_SCRIPT_DEBUG_MIGRATION Debug.LogError(e); #endif } UnitBase.Rebuild(); }
public static SemanticVersion TryManualParseSavedVersion(string pluginId) { try { var oldProjectRootPath = MigrationUtility_1_4_13_to_1_5_1.GetLegacyRootPath(pluginId); var oldProjectSettingsPath = Path.Combine(oldProjectRootPath, "Generated", "ProjectSettings.asset"); if (!File.Exists(oldProjectSettingsPath)) { return(new SemanticVersion()); } string projectSettingsText = System.IO.File.ReadAllText(oldProjectSettingsPath); int savedVersionIndex = projectSettingsText.IndexOf("savedVersion", StringComparison.Ordinal); if (savedVersionIndex == -1) { return(new SemanticVersion()); } Match majorVersionMatch = new Regex(@"""major"":([0-9]*),").Match(projectSettingsText, savedVersionIndex); Match minorVersionMatch = new Regex(@"""minor"":([0-9]*),").Match(projectSettingsText, savedVersionIndex); Match patchVersionMatch = new Regex(@"""patch"":([0-9]*),").Match(projectSettingsText, savedVersionIndex); int majorVersion = int.Parse(majorVersionMatch.Groups[1].Value); int minorVersion = int.Parse(minorVersionMatch.Groups[1].Value); int patchVersion = int.Parse(patchVersionMatch.Groups[1].Value); return(new SemanticVersion(majorVersion, minorVersion, patchVersion, null, 0)); } catch (Exception) { return(new SemanticVersion()); } }
public override bool Run(out SemanticVersion savedVersion) { var manuallyParsedVersion = MigrationUtility_1_4_13_to_1_5_1.TryManualParseSavedVersion("Bolt.Flow"); savedVersion = manuallyParsedVersion; return(savedVersion != "0.0.0"); }
private void MigrateProjectSettings() { // Bolt.Flow -> VisualScripting.Flow var flowProjectSettings = BoltFlow.Configuration.projectSettings; var boltFlowProjectSettings = MigrationUtility_1_4_13_to_1_5_1.GetLegacyProjectSettingsAsset("Bolt.Flow"); if (boltFlowProjectSettings != null) { MigrationUtility_1_4_13_to_1_5_1.TransferSettings(boltFlowProjectSettings, flowProjectSettings); } }
private void MigrateProjectSettings() { // Bolt.State -> VisualScripting.State var stateProjectSettings = BoltState.Configuration.projectSettings; var boltStateProjectSettings = MigrationUtility_1_4_13_to_1_5_1.GetLegacyProjectSettingsAsset("Bolt.State"); if (boltStateProjectSettings != null) { MigrationUtility_1_4_13_to_1_5_1.TransferSettings(boltStateProjectSettings, stateProjectSettings); } }
private static void CleanupLegacyUserFiles() { // Todo: This partially fails because we can't delete the loaded sqlite3 dll. // Causes no problems for the migration here, but leaves files for the user to delete // Remove Old Ludiq folder, including project settings and unit database var rootPath = MigrationUtility_1_4_13_to_1_5_1.GetLegacyRootPath("Bolt.Core"); var ludiqFolderFullPath = Directory.GetParent(rootPath).FullName; var ludiqFolderAssetPath = Path.Combine("Assets", PathUtility.FromAssets(ludiqFolderFullPath)); AssetDatabase.DeleteAsset(ludiqFolderAssetPath); }
public override void Run() { RemoveLegacyPackageFiles(); // We need to clear our cached types so that legacy types (Bolt.x, Ludiq.y, etc) aren't held in memory // by name. When we deserialize our graphs anew, we need to deserialize them into their new types (with new // namespaces) and the cached type lookup will interfere with that. See RuntimeCodebase.TryDeserializeType() RuntimeCodebase.ClearCachedTypes(); RuntimeCodebase.disallowedAssemblies.Add("Bolt.Core.Editor"); RuntimeCodebase.disallowedAssemblies.Add("Bolt.Core.Runtime"); RuntimeCodebase.disallowedAssemblies.Add("Bolt.Flow.Editor"); RuntimeCodebase.disallowedAssemblies.Add("Bolt.Flow.Runtime"); RuntimeCodebase.disallowedAssemblies.Add("Bolt.State.Editor"); RuntimeCodebase.disallowedAssemblies.Add("Bolt.State.Runtime"); RuntimeCodebase.disallowedAssemblies.Add("Ludiq.Core.Editor"); RuntimeCodebase.disallowedAssemblies.Add("Ludiq.Core.Runtime"); RuntimeCodebase.disallowedAssemblies.Add("Ludiq.Graphs.Editor"); RuntimeCodebase.disallowedAssemblies.Add("Ludiq.Graphs.Runtime"); ScriptReferenceResolver.Run(); plugin.configuration.Initialize(); try { MigrateProjectSettings(); } #pragma warning disable 168 catch (Exception e) #pragma warning restore 168 { Debug.LogWarning("There was a problem migrating your Visual Scripting project settings. Be sure to check them in Edit -> Project Settings -> Visual Scripting"); #if VISUAL_SCRIPT_DEBUG_MIGRATION Debug.LogError(e); #endif } try { MigrationUtility_1_4_13_to_1_5_1.MigrateEditorPreferences(this.plugin); } #pragma warning disable 168 catch (Exception e) #pragma warning restore 168 { Debug.LogWarning("There was a problem migrating your Visual Scripting editor preferences. Be sure to check them in Edit -> Preferences -> Visual Scripting"); #if VISUAL_SCRIPT_DEBUG_MIGRATION Debug.LogError(e); #endif } }
private static void RemoveLegacyPackageFiles() { // Todo: This partially fails because we can't delete the loaded sqlite3 dll. // Causes no problems for the migration here, but leaves files for the user to delete // Remove Assemblies var rootPath = MigrationUtility_1_4_13_to_1_5_1.GetLegacyRootPath("Bolt.Core"); var assembliesFullPath = $"{Directory.GetParent(rootPath).FullName}/Assemblies"; var assembliesAssetPath = Path.Combine("Assets", PathUtility.FromAssets(assembliesFullPath)); // Todo: This currently fails because of the sqlite dll. Deletes everything else AssetDatabase.DeleteAsset(assembliesAssetPath); // Remove icon map files AssetDatabase.DeleteAsset(MigrationUtility_1_4_13_to_1_5_1.GetLegacyIconMapAssetPath("Bolt.Core")); AssetDatabase.DeleteAsset(MigrationUtility_1_4_13_to_1_5_1.GetLegacyIconMapAssetPath("Bolt.Flow")); AssetDatabase.DeleteAsset(MigrationUtility_1_4_13_to_1_5_1.GetLegacyIconMapAssetPath("Bolt.State")); }