protected object MigrateFromVersion3(object oldConfig) { ConfigurationV3 config = (ConfigurationV3)oldConfig; ConfigurationV4 newConfig = new ConfigurationV4(); newConfig.SoundPackPreset = config.SoundPackPreset; newConfig.ExtraDebugLogging = config.ExtraDebugLogging; foreach (var kvp in config.AmbientSounds) { newConfig.AmbientSounds.Add(kvp.Key, new ConfigurationV4.Sound() { SoundPack = kvp.Value.Active, Volume = kvp.Value.Volume }); } foreach (var kvp in config.AnimalSounds) { newConfig.AnimalSounds.Add(kvp.Key, new ConfigurationV4.Sound() { SoundPack = kvp.Value.Active, Volume = kvp.Value.Volume }); } foreach (var kvp in config.BuildingSounds) { newConfig.BuildingSounds.Add(kvp.Key, new ConfigurationV4.Sound() { SoundPack = kvp.Value.Active, Volume = kvp.Value.Volume }); } foreach (var kvp in config.VehicleSounds) { newConfig.VehicleSounds.Add(kvp.Key, new ConfigurationV4.Sound() { SoundPack = kvp.Value.Active, Volume = kvp.Value.Volume }); } foreach (var kvp in config.MiscSounds) { newConfig.MiscSounds.Add(kvp.Key, new ConfigurationV4.Sound() { SoundPack = kvp.Value.Active, Volume = kvp.Value.Volume }); } return(newConfig); }
protected object MigrateFromVersion4(object oldConfig) { ConfigurationV4 config = (ConfigurationV4)oldConfig; Configuration newConfig = new Configuration(); newConfig.SoundPackPreset = config.SoundPackPreset; newConfig.ExtraDebugLogging = config.ExtraDebugLogging; foreach (var kvp in config.AmbientSounds) { newConfig.AmbientSounds.Add(kvp.Key.ToString(), kvp.Value); } newConfig.AnimalSounds = config.AnimalSounds; foreach (var kvp in config.BuildingSounds) { switch (kvp.Key) { case "Coal Power Plant": newConfig.BuildingSounds.Add("Oil Power Plant", new ConfigurationV4.Sound() { SoundPack = kvp.Value.SoundPack, Volume = kvp.Value.Volume }); break; case "Water Outlet": newConfig.BuildingSounds.Add("Water Treatment Plant", new ConfigurationV4.Sound() { SoundPack = kvp.Value.SoundPack, Volume = kvp.Value.Volume }); break; } newConfig.BuildingSounds.Add(kvp.Key, kvp.Value); } foreach (var kvp in config.VehicleSounds) { string key; switch (kvp.Key) { case "Aircraft Movement": key = "Aircraft Sound"; break; default: key = kvp.Key; break; } switch (kvp.Key) { case "Small Car Sound": newConfig.VehicleSounds.Add("Scooter Sound", new ConfigurationV4.Sound() { SoundPack = kvp.Value.SoundPack, Volume = kvp.Value.Volume }); break; } newConfig.VehicleSounds.Add(key, kvp.Value); } newConfig.MiscSounds = config.MiscSounds; return(newConfig); }