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