/// <summary>
        /// 搜索模组语言资源,加载合适的语言资源,加载合适的模组语言资源;
        /// </summary>
        void IModificationInitializeHandle.Initialize(IReadOnlyList <Modification> mods, CancellationToken token)
        {
            LocalizationConfigSerializer configSerializer = new LocalizationConfigSerializer();
            LanguagePackSerializer       packSerializer   = new LanguagePackSerializer();

            //读取语言配置
            LocalizationConfig?config = TrySerializeConfig(configSerializer);

            //搜索主语言包
            LanguagePacks = SearchLanguagePack(packSerializer, mods);

            //读取合适的主语言包
            LanguagePack languagePack = null;

            foreach (LanguagePackInfo info in EnumerateLanguagePask(config, LanguagePacks))
            {
                if (TryDeserializePack(packSerializer, info, out languagePack))
                {
                    break;
                }
            }

            if (languagePack == null)
            {
                throw new FileNotFoundException("未找到合适的语言包!");
            }


            //搜索读取语言补充包
            foreach (var mod in mods)
            {
                LanguagePackInfo supplementaryPackInfo = FindSupplementaryPack(packSerializer, mod, languagePack.Description);
                if (supplementaryPackInfo != null)
                {
                    LanguagePack supplementaryPack;
                    if (TryDeserializePack(packSerializer, supplementaryPackInfo, out supplementaryPack))
                    {
                        AddTo(languagePack, supplementaryPack);
                    }
                }
            }


            //若未成功读取语言配置,则输出;
            if (!config.HasValue)
            {
                DeserializeConfig(configSerializer, languagePack.Description);
            }

            Localization.LanguagePack = languagePack;
            Localization.NotifyLanguageChanged();
            UnityDebugHelper.SuccessfulReport(InitializerName, () => GetInfoLog());
        }
 private LocalizationConfig?TrySerializeConfig(LocalizationConfigSerializer configSerializer)
 {
     try
     {
         LocalizationConfig?config = configSerializer.Deserialize(Resource.ConfigContent);
         return(config);
     }
     catch (Exception ex)
     {
         Debug.LogWarning("读取语言配置失败:" + ex);
         return(null);
     }
 }
        private void DeserializeConfig(LocalizationConfigSerializer configSerializer, LanguagePackDescription description)
        {
            try
            {
                LocalizationConfig config = new LocalizationConfig()
                {
                    Name     = description.Name,
                    Language = description.Language,
                };

                using (Resource.ConfigContent.BeginUpdateAuto())
                {
                    configSerializer.Serialize(Resource.ConfigContent, config);
                }
            }
            catch (Exception ex)
            {
                Debug.LogWarning("输出语言配置失败:" + ex);
            }
        }