예제 #1
0
        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;
        }
예제 #2
0
 protected BblLibraryNode(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info)
 {
     Root   = root;
     Parent = parent;
     LoadInfo(info);
 }
예제 #3
0
 protected BblLibraryNode(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData)
 {
     Root   = root;
     Parent = parent;
     LoadInfo(parent.Path, findData);
 }
예제 #4
0
 public BblBookArchive(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Archive)
 {
 }
예제 #5
0
 public BblBookArchive(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Archive)
 {
 }
예제 #6
0
 public BblBookDirectory(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Directory)
 {
 }
예제 #7
0
 public BblBookDirectory(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Directory)
 {
 }
예제 #8
0
 public BblBookPdf(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info) : base(root, parent, info, BookType.Pdf)
 {
 }
예제 #9
0
 public BblBookPdf(BblLibraryRootNode root, BblLibraryNode parent, WIN32_FIND_DATA findData) : base(root, parent, findData, BookType.Pdf)
 {
 }
예제 #10
0
 protected BblBook(BblLibraryRootNode root, BblLibraryNode parent, FileSystemInfoEx info, BookType type) : base(root, parent, info)
 {
     Initialize(type);
 }
예제 #11
0
 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);
 }