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; }
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; }
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); }
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")); }
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")); }
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 }; } } }
public static FileCollector AddIgnoreModule(this FileCollector fileCollector, IEnumerable <string> ignorePatterns) { fileCollector.AddModule(new IgnoreModule(ignorePatterns)); return(fileCollector); }
public FileObjectCollector(FileCollector filesCollector) { this.FilesCollector = filesCollector; }
public MainWindowViewModel() { fc = FileCollector.getInstance(); }
/// <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); }
/// <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); }
/// <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); }
public ParsingEngine(string pathToFiles) { this.PathToFiles = pathToFiles; this._fileCollector = new FileCollector(pathToFiles); }
private void readFile(string file) { Console.WriteLine(" reading " + file); var collector = new FileCollector(file); collector.Read().Each(x => x.WriteFile(_outputFolder)); }
public UnixFileProvider(FileContentCollector unixFileContentCollector, FileCollector unixFileCollector) { this.UnixFileContentCollector = unixFileContentCollector; this.UnixFileCollector = unixFileCollector; }