示例#1
0
        private static void UpgradeTranslations(Translations translations)
        {
            var defaults = Translations.CreateDefault();

            foreach (var item in defaults)
            {
                if (!translations.ContainsKey(item.Key))
                {
                    translations.Add(item.Key, item.Value);
                }
            }
        }
示例#2
0
        public static void UpgradeTo(this Config config, int targetVersion)
        {
            if (config.Version == 0 || config.Version < targetVersion)
            {
                config.Version = targetVersion;
            }

            if (config.Translations == null)
            {
                config.Translations = Translations.CreateDefault();
            }

            UpgradeTranslations(config.Translations);
        }