예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            _viewModel     = this.DataContext as MainWindowViewModel;
            _fileCollector = FileCollector.getInstance();
            _worker        = BWorker.getInstance();

            _worker.DoWork             += workerDoWork;
            _worker.RunWorkerCompleted += workerRunWorkerCompleted;
            _worker.ProgressChanged    += workerProgressChanged;

            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
        }
예제 #2
0
파일: Schedule.cs 프로젝트: afrog33k/eAd
 private void Xmds2RequiredFilesCompleted(object sender, RequiredFilesCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Trace.WriteLine(new LogMessage("Schedule - RequiredFilesCompleted", e.Error.Message),
                         LogType.Error.ToString());
         if (e.Error.Message == "This display client is not licensed")
         {
             Settings.Default.licensed = 0;
         }
         this._xmdsProcessing = false;
     }
     else
     {
         Settings.Default.XmdsLastConnection = DateTime.Now;
         if (Settings.Default.licensed == 0)
         {
             Settings.Default.licensed = 1;
         }
         try
         {
             FileCollector collector = new FileCollector(this._cacheManager, e.Result);
             collector.LayoutFileChanged +=
                 this.FileCollectorLayoutFileChanged;
             collector.CollectionComplete +=
                 this.FileCollectorCollectionComplete;
             collector.MediaFileChanged +=
                 this.fileCollector_MediaFileChanged;
             collector.CompareAndCollect();
         }
         catch (Exception exception)
         {
             this._xmdsProcessing = false;
             Trace.WriteLine(
                 new LogMessage("Schedule - RequiredFilesCompleted",
                                "Error Comparing and Collecting: " + exception.Message),
                 LogType.Error.ToString());
         }
         this._cacheManager.WriteCacheManager();
     }
     CollectingFiles = false;
 }
예제 #3
0
        public static async Task <TsConfigJson> IsContainedByTsConfig(this IWorkspace workspace, string filePath)
        {
            var fileService = workspace.GetFindFilesService();
            var collector   = new FileCollector();
            await fileService.FindFilesAsync("sconfig.json", collector);

            foreach (var configFile in collector.FoundFiles)
            {
                if (TypeScriptHelpers.IsTsJsConfigJsonFile(configFile))
                {
                    var directory = Path.GetDirectoryName(configFile);
                    if (filePath.StartsWith(directory, StringComparison.OrdinalIgnoreCase))
                    {
                        return(await TsConfigJsonFactory.CreateAsync(configFile));
                    }
                }
            }

            return(null);
        }
예제 #4
0
        public async Task GetChanged_2Existing_ShouldFind1ChangedFiles()
        {
            var folder = new CrawledFolder {
                Name = "FileFolder"
            };
            ICollection <File> existingFiles = new List <File>
            {
                Helper.GetFileModel("FileFolder", "test1.txt"),
                Helper.GetFileModel("FileFolder", "test2.txt", DateTime.Now)
            };

            var fileRepositoryMock = new Mock <IFileRepository>();

            fileRepositoryMock.Setup(x => x.GetFilesForFolder(It.IsAny <Guid>()))
            .Returns(Task.FromResult(Result <ICollection <File> > .Success(existingFiles)));

            var fileCollector = new FileCollector(fileRepositoryMock.Object, folder);
            await fileCollector.CollectFiles();

            Assert.AreEqual(1, fileCollector.ChangedFiles.Count);
            Assert.IsTrue(fileCollector.ChangedFiles.Any(x => x.Name == "test2.txt"));
        }
예제 #5
0
        public async Task GetNewFiles_ShouldFind8NewFiles()
        {
            var folder = new CrawledFolder {
                Name = "FileFolder"
            };
            var fileRepositoryMock = new Mock <IFileRepository>();

            fileRepositoryMock.Setup(x => x.GetFilesForFolder(It.IsAny <Guid>()))
            .ReturnsAsync(() => Result <ICollection <File> > .Success(new List <File>()));

            var fileCollector = new FileCollector(fileRepositoryMock.Object, folder);
            await fileCollector.CollectFiles();


            Assert.AreEqual(8, fileCollector.NewFiles.Count);
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test1.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test1_changed.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test1_compressed.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test1_copy.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test2.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test3.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test4.txt"));
            Assert.IsTrue(fileCollector.NewFiles.Any(x => x.Name == "test5.txt"));
        }
예제 #6
0
파일: FileProber.cs 프로젝트: solind/modSIC
        protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var sshCommandRunner = ((SSHConnectionProvider)ConnectionProvider).SshCommandLineRunner;
                var newFileCollector = new FileCollector()
                {
                    LsCommand = new LsCommand(sshCommandRunner)
                };

                base.ObjectCollector = new FileObjectCollector(newFileCollector);

                if (base.ItemTypeGenerator == null)
                {
                    var fileContentProvider = new FileContentCollector(sshCommandRunner);
                    var unixFileProvider    = new UnixFileProvider(fileContentProvider, newFileCollector);
                    base.ItemTypeGenerator = new FileItemTypeGenerator()
                    {
                        SystemDataSource = ObjectCollector,
                        FileProvider     = unixFileProvider
                    };
                }
            }
        }
예제 #7
0
 public static FileCollector AddIgnoreModule(this FileCollector fileCollector, IEnumerable <string> ignorePatterns)
 {
     fileCollector.AddModule(new IgnoreModule(ignorePatterns));
     return(fileCollector);
 }
예제 #8
0
 public FileObjectCollector(FileCollector filesCollector)
 {
     this.FilesCollector = filesCollector;
 }
예제 #9
0
 public MainWindowViewModel()
 {
     fc = FileCollector.getInstance();
 }
예제 #10
0
 /// <summary>
 /// Adds a new <see cref="ListModule"/> to a <see cref="FileCollector"/> with given patterns
 /// </summary>
 /// <param name="fileCollector">FileCollector to add module to</param>
 /// <param name="blockPatterns">patterns to decide if a path should be skipped</param>
 public static FileCollector AddListModule(this FileCollector fileCollector, IEnumerable <string> blockPatterns)
 {
     fileCollector.AddModule(new ListModule(Array.Empty <string>(), blockPatterns));
     return(fileCollector);
 }
예제 #11
0
 /// <summary>
 /// Adds a new <see cref="ListModule"/> to a <see cref="FileCollector"/> with given patterns
 /// </summary>
 /// <param name="fileCollector">FileCollector to add module to</param>
 /// <param name="allowPatterns">patterns to decide if a path should be taken</param>
 /// <param name="blockPatterns">patterns to decide if a path should be skipped</param>
 public static FileCollector AddListModule(this FileCollector fileCollector, IEnumerable <string> allowPatterns, IEnumerable <string> blockPatterns)
 {
     fileCollector.AddModule(new ListModule(allowPatterns, blockPatterns));
     return(fileCollector);
 }
예제 #12
0
 /// <summary>
 /// The constructor loads the file on instantiation, but if you want to reload a different file path, call this method
 /// </summary>
 /// <param name="filePath"></param>
 public void SetFilePath(string pathToFiles)
 {
     this.PathToFiles    = pathToFiles;
     this._fileCollector = new FileCollector(pathToFiles);
 }
예제 #13
0
 public ParsingEngine(string pathToFiles)
 {
     this.PathToFiles    = pathToFiles;
     this._fileCollector = new FileCollector(pathToFiles);
 }
예제 #14
0
 private void readFile(string file)
 {
     Console.WriteLine("  reading " + file);
     var collector = new FileCollector(file);
     collector.Read().Each(x => x.WriteFile(_outputFolder));
 }
예제 #15
0
 public UnixFileProvider(FileContentCollector unixFileContentCollector, FileCollector unixFileCollector)
 {
     this.UnixFileContentCollector = unixFileContentCollector;
     this.UnixFileCollector        = unixFileCollector;
 }