public static Book Create(string path) { Book book; if (Directory.Exists(path)) { book = new Book(path); } else if (Storage.IsZipFile(path)) { book = new ZipBook(path); } else { var dir = Path.GetDirectoryName(path); book = new Book(dir); if (Storage.IsPictureFile(path)) { book.MoveAt(path); } } return(book); }
public BookShelf(string path) : base() { if (File.Exists(path)) { Parent = Path.GetDirectoryName(path); } else { Parent = path; } int counter = 0; var entries = Storage.GetBookEntries(Parent); if (Any()) { Index = 0; } foreach (var entry in entries) { Add(BookMaker.Create(entry)); if (entry == Parent) { Index = counter; } if (entry == path) { Index = counter; } counter++; } if (Storage.IsPictureFile(path)) { Value.MoveAt(path); } _book = ViewModeSelector.Create(Value, ViewMode); }