public void AddBook(string bookPath) { lock (_updateBookLock) { var bookName = Path.GetFileName(bookPath); if (String.IsNullOrEmpty(bookName)) { return; } var storage = ZibaobaoLibContext.Instance.PersistentStorage; var dbPath = Path.Combine(storage.DataPath, bookName); storage.CopyFile(bookPath, dbPath); var newBook = _serverBookList.Books.FirstOrDefault(o => o.Name == bookName); if (newBook == null) { return; } var book = GetExistingBook(bookName); if (book != null) { _localBookList.Books.Remove(book); } _localBookList.Books.Add(newBook); FileSettingsHelper <BaobaoBookList> .SaveSetting(_localBookList); } UpdateBookList(); }
public static void SaveQuestion(ExamPaper examPaper, string name) { FileSettingsHelper <ExamPaper> .SaveSetting(examPaper, Path.Combine(ZibaobaoLibContext.Instance.PersistentStorage.DataPath, name)); }