private async Task DownloadPackage(Language language, Package package, TranslationConfigs translationService, PageTranslations pageTranslationService, bool update) { IList<Page> pages = await translationService.GetTranslationConfig(language.code, package.code, true); foreach (Page page in pages) { await pageTranslationService.GetPageTranslationsFromService(language.code, package.code, page.filename, update); } ChangeVersion(language.code, languageListFileName, package); }
private void ChangeVersion(string language, string _localFileName, Package package) { LanguageList languageList = GetLanguageListFromFile(new LanguageList()); Package current = languageList.Languages.Find(l => l.code == language).packages.Find(p => p.code == package.code); if (current == null) { languageList.Languages.Find(l => l.code == language).packages.Add(package); } else { languageList.Languages.Find(l => l.code == language).packages.Find(p => p.code == package.code).version = package.version; } languageList.LastUpdated = DateTime.Now; SaveDataToFile(languageList, _localFileName); }
public async Task DownloadLanguage(string language, Package package, bool refresh = false) { Language downloadLanguage = new Language(); TranslationConfigs translationService = new TranslationConfigs(); PageTranslations pageTranslationService = new PageTranslations(); downloadLanguage = await GetLanguage(language); IList<Page> pages = await translationService.GetTranslationConfig(downloadLanguage.code, package.code, true); foreach (Page page in pages) { await pageTranslationService.GetPageTranslationsFromService(downloadLanguage.code, package.code, page.filename, refresh); } ChangeVersion(language, languageListFileName, package); ChangeLanguageDownloadedFlag(language, languageListFileName, true); ChangeLanguageUpToDateFlag(language, languageListFileName, true); }