Ejemplo n.º 1
0
        public void SetUp()
        {
            DirectoryUtility.EnsureClearFolder(Folder);

            _parser = new FileSystemParser(new FileSystemListener());
            _parser.FoldersToParse = new List <string> {
                Folder
            };
        }
 public NavigationService(IFileSystemParser fileSystemParser,
                          IMatchSearcher matchSearcher,
                          INavigatorManager primaryNavigatorManager,
                          List <INavigatorManager> supportedNavigatorManagers)
 {
     _fileSystemParser           = fileSystemParser;
     _matchSearcher              = matchSearcher;
     _primaryNavigatorManager    = primaryNavigatorManager;
     _supportedNavigatorManagers = supportedNavigatorManagers;
 }
        public void GetSubFolders_FileCreatedWhileOperation_FileNotIncludedInOutput()
        {
            DirectoryUtility.EnsureClearFolder(SubFolder);
            _parser = new FileSystemParserWithAction(new FileSystemListener(), () => File.WriteAllText(SubFolder + "\\temp.txt", "text"));
            _parser.FoldersToParse = new List<string> { Folder };

            List<FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
 public NavigationService(IFileSystemParser fileSystemParser,
     IMatchSearcher matchSearcher,
     INavigatorManager primaryNavigatorManager,
     List<INavigatorManager> supportedNavigatorManagers)
 {
     _fileSystemParser = fileSystemParser;
     _matchSearcher = matchSearcher;
     _primaryNavigatorManager = primaryNavigatorManager;
     _supportedNavigatorManagers = supportedNavigatorManagers;
 }
Ejemplo n.º 5
0
 //For test purposes
 public CachedFileSystemParser(IFileSystemParser fileSystemParser,
                               ICacheSerializer cacheSerializer,
                               IFileSystemListener fileSystemListener,
                               IRegistryService registryService,
                               IAsyncFileSystemParser asyncFileSystemParser,
                               bool appRunOnStartup,
                               int updatesCountToWrite)
     : this(fileSystemParser, cacheSerializer, fileSystemListener, registryService, asyncFileSystemParser, appRunOnStartup)
 {
     _updatesCountToWrite = updatesCountToWrite;
 }
 //For test purposes
 public CachedFileSystemParser(IFileSystemParser fileSystemParser,
     ICacheSerializer cacheSerializer,
     IFileSystemListener fileSystemListener,
     IRegistryService registryService,
     IAsyncFileSystemParser asyncFileSystemParser,
     bool appRunOnStartup,
     int updatesCountToWrite)
     : this(fileSystemParser, cacheSerializer, fileSystemListener, registryService, asyncFileSystemParser, appRunOnStartup)
 {
     _updatesCountToWrite = updatesCountToWrite;
 }
Ejemplo n.º 7
0
        public void GetSubFolders_FileCreatedWhileOperation_FileNotIncludedInOutput()
        {
            DirectoryUtility.EnsureClearFolder(SubFolder);
            _parser = new FileSystemParserWithAction(new FileSystemListener(), () => File.WriteAllText(SubFolder + "\\temp.txt", "text"));
            _parser.FoldersToParse = new List <string> {
                Folder
            };

            List <FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
Ejemplo n.º 8
0
        public void GetSubFolders_FolderCreatedWhileOperation_FolderIncludedInOutput()
        {
            _parser = new FileSystemParserWithAction(new FileSystemListener(), () => Directory.CreateDirectory(SubFolder));
            _parser.FoldersToParse = new List <string> {
                Folder
            };

            List <FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
            Assert.That(subfolders[1].FullPath, Is.EqualTo(Path.GetFullPath(SubFolder)));
        }
Ejemplo n.º 9
0
        public void GetSubFolders_FolderMadeHiddenWhileOperation_FolderIsNotAdded()
        {
            Directory.CreateDirectory(SubFolder);
            _parser = new FileSystemParserWithAction(new FileSystemListener(), MakeSubFolderHidden);
            _parser.FoldersToParse = new List <string> {
                Folder
            };

            List <FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
        public void GetSubFolders_FileMadeHiddenWhileOperation_FileNotIncludedInOutput()
        {
            DirectoryUtility.EnsureClearFolder(SubFolder);
            File.WriteAllText(SubFolder + "\\temp.txt", "text");
            _parser = new FileSystemParserWithAction(new FileSystemListener(),
                                                     () =>
                                                         {
                                                             FileInfo fileInfo = new FileInfo(SubFolder + "\\temp.txt");
                                                             fileInfo.Attributes = fileInfo.Attributes | FileAttributes.Hidden;
                                                         });
            _parser.FoldersToParse = new List<string> { Folder };

            List<FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
Ejemplo n.º 11
0
        public CachedFileSystemParser(IFileSystemParser fileSystemParser,
                                      ICacheSerializer cacheSerializer,
                                      IFileSystemListener fileSystemListener,
                                      IRegistryService registryService,
                                      IAsyncFileSystemParser asyncFileSystemParser,
                                      bool appRunOnStartup)
        {
            _cacheSerializer       = cacheSerializer;
            _fileSystemListener    = fileSystemListener;
            _registryService       = registryService;
            _fileSystemParser      = fileSystemParser;
            _asyncFileSystemParser = asyncFileSystemParser;
            _fileSystemFilter      = new FileSystemFilter();

            Initialize(appRunOnStartup);
        }
        public CachedFileSystemParser(IFileSystemParser fileSystemParser,
            ICacheSerializer cacheSerializer,
            IFileSystemListener fileSystemListener,
            IRegistryService registryService,
            IAsyncFileSystemParser asyncFileSystemParser,
            bool appRunOnStartup)
        {
            _cacheSerializer = cacheSerializer;
            _fileSystemListener = fileSystemListener;
            _registryService = registryService;
            _fileSystemParser = fileSystemParser;
            _asyncFileSystemParser = asyncFileSystemParser;
            _fileSystemFilter = new FileSystemFilter();

            Initialize(appRunOnStartup);
        }
Ejemplo n.º 13
0
        public void GetSubFolders_FileMadeHiddenWhileOperation_FileNotIncludedInOutput()
        {
            DirectoryUtility.EnsureClearFolder(SubFolder);
            File.WriteAllText(SubFolder + "\\temp.txt", "text");
            _parser = new FileSystemParserWithAction(new FileSystemListener(),
                                                     () =>
            {
                FileInfo fileInfo   = new FileInfo(SubFolder + "\\temp.txt");
                fileInfo.Attributes = fileInfo.Attributes | FileAttributes.Hidden;
            });
            _parser.FoldersToParse = new List <string> {
                Folder
            };

            List <FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
Ejemplo n.º 14
0
        public INavigationService BuildNavigationService(Settings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            IFileSystemParser parser = CreateParser(settings);

            INavigatorManager        primaryNavigatorManager    = CreateNavigatorManager(settings.PrimaryNavigator, settings);
            List <INavigatorManager> supportedNavigatorManagers = CreateSupportedNavigatorManagers(settings, primaryNavigatorManager);

            INavigationService navigationAssistant = new NavigationService(parser,
                                                                           new MatchSearcher(),
                                                                           primaryNavigatorManager,
                                                                           supportedNavigatorManagers);

            //Warming up (to fill caches, etc)
            navigationAssistant.GetFolderMatches("temp");

            return(navigationAssistant);
        }
 public AsyncFileSystemParser(IFileSystemParser fileSystemParser)
 {
     _fileSystemParser = fileSystemParser;
 }
 public AsyncFileSystemParser(IFileSystemParser fileSystemParser, int delayIntervalInSeconds)
 {
     _fileSystemParser = fileSystemParser;
     _delayIntervalInSeconds = delayIntervalInSeconds;
 }
 public AsyncFileSystemParser(IFileSystemParser fileSystemParser, int delayIntervalInSeconds)
 {
     _fileSystemParser       = fileSystemParser;
     _delayIntervalInSeconds = delayIntervalInSeconds;
 }
 public AsyncFileSystemParser(IFileSystemParser fileSystemParser)
 {
     _fileSystemParser = fileSystemParser;
 }
        public void GetSubFolders_FolderMadeVisibleWhileOperation_FolderIsNotAdded()
        {
            Directory.CreateDirectory(SubFolder);
            MakeSubFolderHidden();

            _parser = new FileSystemParserWithAction(new FileSystemListener(), MakeSubFolderVisible);
            _parser.FoldersToParse = new List<string> { Folder };

            List<FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(2));
        }
        public void SetUp()
        {
            DirectoryUtility.EnsureClearFolder(Folder);

            _parser = new FileSystemParser(new FileSystemListener());
            _parser.FoldersToParse = new List<string> {Folder};
        }
        public void GetSubFolders_FolderDeletedWhileOperation_FolderDeletedInOutput()
        {
            Directory.CreateDirectory(SubFolder);

            _parser = new FileSystemParserWithAction(new FileSystemListener(), () => Directory.Delete(SubFolder, true));
            _parser.FoldersToParse = new List<string> { Folder };

            List<FileSystemItem> subfolders = _parser.GetSubFolders();

            Assert.That(subfolders.Count, Is.EqualTo(1));
            Assert.That(subfolders[0].FullPath, Is.EqualTo(Path.GetFullPath(Folder)));
        }