public BblLibrary(DirectoryInfoEx root) { if (mainThread == null) { mainThread = TaskScheduler.FromCurrentSynchronizationContext(); } _root = new BblLibraryRootNode(root); _progress = new Progress <BookOperationData>((bookOperationData) => { OnBookOperation(bookOperationData); }); _populatingTask = Task.Run(() => BuildLibrary(_progress), _populatingCancelTokenSrc.Token); _populatingTask.ContinueWith((t1) => { OnPopulatingCompleted(); }, _populatingCancelTokenSrc.Token, TaskContinuationOptions.OnlyOnRanToCompletion, mainThread); _fileWatcher.Path = root.FullName; _dirWatcher.Path = root.FullName; _fileWatcher.IncludeSubdirectories = true; _dirWatcher.IncludeSubdirectories = true; _fileWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName; _dirWatcher.NotifyFilter = NotifyFilters.DirectoryName; _fileWatcher.Created += OnFileCreated; _fileWatcher.Deleted += OnFileDeleted; _fileWatcher.Renamed += OnFileRenamed; _dirWatcher.Created += OnDirectoryCreated; _dirWatcher.Deleted += OnDirectoryDeleted; _dirWatcher.Renamed += OnDirectoryRenamed; // Begin watching. _fileWatcher.EnableRaisingEvents = true; _dirWatcher.EnableRaisingEvents = true; }
protected BblLibraryNode(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) { Root = root; Parent = parent; LoadInfo(info); }
protected BblLibraryNode(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) { Root = root; Parent = parent; LoadInfo(parent.Path, findData); }
public BblBookArchive(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Archive) { }
public BblBookArchive(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Archive) { }
public BblBookDirectory(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Directory) { }
public BblBookDirectory(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Directory) { }
public BblBookPdf(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Pdf) { }
public BblBookPdf(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Pdf) { }
protected BblBook(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info, BookType type) : base(root, parent, info) { Initialize(type); }
protected bool _demoted; //book has no pages or BblBookDirectory renamed with no .book extension protected BblBook(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData, BookType type) : base(root, parent, findData) { Initialize(type); }