public static Book getByFile(ZLFile bookFile) { if (bookFile == null) { return null; } final ZLPhysicalFile physicalFile = bookFile.getPhysicalFile(); if (physicalFile != null && !physicalFile.exists()) { return null; } final FileInfoSet fileInfos = new FileInfoSet(bookFile); Book book = BooksDatabase.Instance().loadBookByFile(fileInfos.getId(bookFile), bookFile); if (book != null) { book.loadLists(); } if (book != null && fileInfos.check(physicalFile, physicalFile != bookFile)) { return book; } fileInfos.save(); if (book == null) { book = new Book(bookFile); } if (book.readMetaInfo()) { book.save(); return book; } return null; }
@Override protected void onPause() { super.onPause(); if (myBook != null) { myBook.save(); } }
public void reloadInfoFromFile() { if (readMetaInfo()) { save(); } }