static void Main(string[] args) { List <ConfigSplit> origionTranslates = new List <ConfigSplit>(); AppConfig appConfig = AppConfig.Read(); List <FileInfo> newTransFiles = new List <FileInfo>(); AppUtils.GetFileName(newTransFiles, appConfig.OrigionFilePath); AppUtils.AddItems <ConfigSplit>(newTransFiles, origionTranslates); ConfigOperate.FixConfig(origionTranslates); }
static void Main(string[] args) { //新回来的已经翻译的文件 List <LanguageConifgSplit> newTranslates = new List <LanguageConifgSplit>(); //老的已翻译文件 List <LanguageConifgSplit> oldTranslates = new List <LanguageConifgSplit>(); //维护原表ClinetLocalization List <ConfigSplit> clinetLocalizations = new List <ConfigSplit>(); AppConfig appConfig = AppConfig.Read(); //新回来的已经翻译的文件 List <FileInfo> newTransFiles = new List <FileInfo>(); AppUtils.GetFileName(newTransFiles, appConfig.AlreadyTranslatedPath); AppUtils.AddItems <LanguageConifgSplit>(newTransFiles, newTranslates); //老的已翻译文件 List <FileInfo> oldTransFiles = new List <FileInfo>(); AppUtils.GetFileName(oldTransFiles, appConfig.InputTranslatedPath); AppUtils.AddItems <LanguageConifgSplit>(oldTransFiles, oldTranslates); //原表ClinetLocalization List <FileInfo> clientTransFiles = new List <FileInfo>(); AppUtils.GetFileName(clientTransFiles, appConfig.OrigionFilePath); AppUtils.AddItems <ConfigSplit>(clientTransFiles, clinetLocalizations); //新的 旧的 往 原表塞 CombinClinetConfig(newTranslates, clinetLocalizations); CombinClinetConfig(oldTranslates, clinetLocalizations); //新的 往老的里面塞 CombinNewConfig(newTranslates, oldTranslates); for (int i = 0; i < clinetLocalizations.Count; i++) { clinetLocalizations[i].SaveOrigionFile(); } for (int i = 0; i < oldTranslates.Count; i++) { oldTranslates[i].SaveOrigionFile(); } //导入后清理原配置表 ConfigOperate.ConfigChecker(clinetLocalizations, newTranslates); //修复配置表 ConfigOperate.FixConfig(clinetLocalizations); }
static void Main(string[] args) { ///ClinetLocalization下的文件 List <ConfigSplit> clinetCfgs = new List <ConfigSplit>(); List <LanguageConifgSplit> transFileCfgs = new List <LanguageConifgSplit>(); AppConfig appConfig = AppConfig.Read(); //获取ClinetLocalization下的文件 List <FileInfo> clinetFileinfos = new List <FileInfo>(); AppUtils.GetFileName(clinetFileinfos, appConfig.OrigionFilePath); AppUtils.AddItems <ConfigSplit>(clinetFileinfos, clinetCfgs); //获取已翻译文件下的文件 List <FileInfo> transFileinfos = new List <FileInfo>(); AppUtils.GetFileName(transFileinfos, appConfig.InputTranslatedPath); AppUtils.AddItems <LanguageConifgSplit>(transFileinfos, transFileCfgs); //导出时清理原配置表 ConfigOperate.ConfigChecker(clinetCfgs, transFileCfgs); //写差异表 List <LanguageConifgSplit> readyTransFileCfgs = new List <LanguageConifgSplit>(); for (int i = 0; i < (int)eLanguageEnum.Th; i++) { string fileName = $"待翻译文件{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}_{DateTime.Now.Hour}_{DateTime.Now.Minute}_{DateTime.Now.Second}_{((eLanguageEnum)i).ToString()}"; LanguageConifgSplit newConfig = new LanguageConifgSplit(); newConfig.SetFileName(fileName); newConfig.SetLanguage((eLanguageEnum)i); newConfig.AddHead(fileName, new eLanguageEnum[] { (eLanguageEnum)i }); newConfig.SetPath(AppDefine.AppCurrentDirectory + "/" + appConfig.PendingTranslationPath + $"/{fileName}.txt"); readyTransFileCfgs.Add(newConfig); } int totalCount = clinetCfgs.Count * transFileCfgs.Count * readyTransFileCfgs.Count; int count = 1; foreach (var clinet in clinetCfgs) { foreach (var trans in transFileCfgs) { foreach (var ready in readyTransFileCfgs) { CheckSameLanguage(clinet, trans, ready); Console.WriteLine($"处理{count}/{totalCount}"); count++; } } } totalCount = clinetCfgs.Count * readyTransFileCfgs.Count; count = 0; foreach (var clinet in clinetCfgs) { foreach (var ready in readyTransFileCfgs) { AddNewLanguageKey(clinet, ready); Console.WriteLine($"处理{count}/{totalCount}"); count++; } } int length = transFileCfgs.Count; Dictionary <eLanguageEnum, bool> hasList = new Dictionary <eLanguageEnum, bool>(); for (int i = 0; i < length; i++) { hasList.Add(transFileCfgs[i].EConfigLang, true); } //var len = (int)eLanguageEnum.Th; //for (int i = 0; i < len; i++) //{ // if (!hasList.ContainsKey((eLanguageEnum)i)) // { // var data = readyTransFileCfgs[i]; // List<string> keys = GetCountryKeys(clinetCfgs, (eLanguageEnum)i); // foreach (var item in keys) // { // data.AddNewKey(item); // } // } //} foreach (var newConfig in readyTransFileCfgs) { newConfig.SaveOrigionFile(); } ConfigOperate.FixConfig(clinetCfgs); }