Пример #1
0
        protected object MigrateFromVersion2(object oldConfig)
        {
            ConfigurationV2 config    = (ConfigurationV2)oldConfig;
            ConfigurationV3 newConfig = new ConfigurationV3();

            newConfig.ExtraDebugLogging = config.ExtraDebugLogging;
            foreach (var kvp in config.AmbientVolumes)
            {
                newConfig.AmbientSounds.Add(kvp.Key, new ConfigurationV3.Sound()
                {
                    Volume = kvp.Value
                });
            }
            foreach (var kvp in config.AnimalVolumes)
            {
                newConfig.AnimalSounds.Add(kvp.Key, new ConfigurationV3.Sound()
                {
                    Volume = kvp.Value
                });
            }
            foreach (var kvp in config.BuildingVolumes)
            {
                newConfig.BuildingSounds.Add(kvp.Key, new ConfigurationV3.Sound()
                {
                    Volume = kvp.Value
                });
            }
            foreach (var kvp in config.VehicleVolumes)
            {
                newConfig.VehicleSounds.Add(kvp.Key, new ConfigurationV3.Sound()
                {
                    Volume = kvp.Value
                });
            }
            foreach (var kvp in config.MiscVolumes)
            {
                newConfig.MiscSounds.Add(kvp.Key, new ConfigurationV3.Sound()
                {
                    Volume = kvp.Value
                });
            }

            return(newConfig);
        }
Пример #2
0
        protected object MigrateFromVersion1(object oldConfig)
        {
            ConfigurationV1 config    = (ConfigurationV1)oldConfig;
            ConfigurationV2 newConfig = new ConfigurationV2();

            newConfig.ExtraDebugLogging = config.ExtraDebugLogging;
            foreach (var kvp in config.AmbientVolumes)
            {
                newConfig.AmbientVolumes.Add(kvp.Key, kvp.Value);
            }
            foreach (var kvp in config.AnimalVolumes)
            {
                newConfig.AnimalVolumes.Add(kvp.Key, kvp.Value);
            }
            foreach (var kvp in config.BuildingVolumes)
            {
                newConfig.BuildingVolumes.Add(kvp.Key, kvp.Value);
            }
            foreach (var kvp in config.VehicleVolumes)
            {
                switch (kvp.Key)
                {
                case "Small Car Movement":
                    newConfig.VehicleVolumes.Add("Small Car Sound", kvp.Value);
                    break;

                case "Large Car Movement":
                    newConfig.VehicleVolumes.Add("Large Car Sound", kvp.Value);
                    break;

                default:
                    newConfig.VehicleVolumes.Add(kvp.Key, kvp.Value);
                    break;
                }
            }
            foreach (var kvp in config.MiscVolumes)
            {
                newConfig.MiscVolumes.Add(kvp.Key, kvp.Value);
            }

            return(newConfig);
        }