public static void MigrateLegacySettings() { if (Settings.Default.migrateLegacyHyperionConfiguration) { LOG.Info("[Settings Migration] Migrating legacy hyperion configuration to JSON string"); List <HyperionTaskConfiguration> configurations = new List <HyperionTaskConfiguration>(); configurations.Add(HyperionTaskConfiguration.BuildUsingLegacySettings()); Settings.Default.hyperionTaskConfigurations = JsonConvert.SerializeObject(configurations); Settings.Default.migrateLegacyHyperionConfiguration = false; Settings.Default.Save(); LOG.Info("[Settings Migration] Saved legacy hyperion configuration as JSON string"); } }
public static void MigrateLegacySettings() { if (Settings.Default.migrateLegacyHyperionConfiguration) { LOG.Info("[Settings Migration] Migrating legacy hyperion configuration to JSON string"); List <HyperionTaskConfiguration> configurations = new List <HyperionTaskConfiguration>(); configurations.Add(HyperionTaskConfiguration.BuildUsingLegacySettings()); Settings.Default.hyperionTaskConfigurations = JsonConvert.SerializeObject(configurations); Settings.Default.migrateLegacyHyperionConfiguration = false; Settings.Default.migrateFromBefore2_7 = false; Settings.Default.Save(); LOG.Info("[Settings Migration] Saved legacy hyperion configuration as JSON string"); } else if (Settings.Default.migrateFromBefore2_7) { LOG.Info("[Settings Migration] Migrating settings from before version 2.7"); var configurations = JsonConvert.DeserializeObject <List <HyperionTaskConfiguration> >(Settings.Default.hyperionTaskConfigurations); foreach (HyperionTaskConfiguration configuration in configurations) { configuration.Enabled = true; foreach (HyperionServer server in configuration.HyperionServers) { server.Protocol = HyperionServerProtocol.PROTOCOL_BUFFERS; if (server.Priority < HyperionServer.MIN_PRIORITY) { server.Priority = HyperionServer.MIN_PRIORITY; } if (server.Priority > HyperionServer.MAX_PRIORITY) { server.Priority = HyperionServer.MAX_PRIORITY; } } } Settings.Default.hyperionTaskConfigurations = JsonConvert.SerializeObject(configurations); Settings.Default.migrateFromBefore2_7 = false; Settings.Default.Save(); LOG.Info("[Settings Migration] Settings from befor version 2.7 were migrated successfully"); } }