public void UpdateBookVersion(string filePath) { _serverBookList = FileSettingsHelper <BaobaoBookList> .LoadSetting(filePath); if (_serverBookList == null) { return; } bool gotNewBook = false; foreach (var book in _serverBookList.Books) { var existingBook = GetExistingBook(book.Name); if (existingBook == null || existingBook.Version < book.Version) { gotNewBook = true; AWSHelper.Instance.DownloadFile(Path.Combine(ResourceBase, book.Name), Path.Combine(ZibaobaoLibContext.Instance.PersistentStorage.DownloadPath, book.Name)).Forget(); } } if (!gotNewBook) { UpdateBookList(); } }
public BaobaoModel(string indexFileName) { X1LogHelper.LogLevel = (int)X1EventLogEntryType.Verbose; _localBookList = FileSettingsHelper <BaobaoBookList> .LoadSetting() ?? new BaobaoBookList(); IndexFileName = indexFileName; UpdateBookList(false); AWSHelper.Instance.OnFileAvailable += Download_OnFileAvailable; AWSHelper.Instance.DownloadFile(Path.Combine(ResourceBase, IndexFileName), Path.Combine(ZibaobaoLibContext.Instance.PersistentStorage.DownloadPath, IndexFileName)).Forget(); BaobaoSpellingModel = new BaobaoSpellingModel(); }