private void Crawler(string directoryName, Func <string, bool> ignorePaths, string dir) { var finder = new LogFileFinder(WriteFile, _fileSystem, _logger, ignorePaths); string localPath = _fileSystem.Path.Combine(_serviceVariables.OutputFolderPath, directoryName, _fileSystem.Path.GetFileName(dir) + ""); _fileSystem.EnsureDirectory(localPath); _folderNotificationHelper.SetCurrentFolderNames(null, dir); finder.FindFilesInDirectories(new DirectorySetting(dir), _serviceVariables.StartDateForLogs, _serviceVariables.StopDateForLogs, localPath); Debug.WriteLine("found=>" + dir); }
private DirectorySetting CrawlAllLogBaseDirectories(DirectorySetting directory) { //Trace.WriteLine(directory.Path); if (directory != null && directory.Exists) { if (IsBaseLogDirecory(directory)) { foreach (string dir in directory.GetDirectories()) { //todo:The _ignored files has dual purpose, and if there is folder called all it will be ignored. if (_ignoredFiles.HasFlag(_folderFinder.GetSenseLogBaseTypes(new DirectorySetting(dir)))) {//_ignoredFiles != SenseLogBaseTypes.All && Trace.WriteLine("Ignoring directory=>" + dir); continue; } var finder = new LogFileFinder(WriteFile, _fileSystem, _logger, null); string localPath = _fileSystem.Path.Combine(_settings.OutputFolderPath, (_fileSystem.Path.GetFileName(directory.Path)).SanitizeFileName(), _fileSystem.Path.GetFileName(dir) + ""); //_fileSystem.EnsureDirectory(localPath); finder.FindFilesInDirectories(new DirectorySetting(dir), _settings.StartDateForLogs, _settings.StopDateForLogs, localPath); Trace.WriteLine("found=>" + dir); } } var i = 0; //FIX:on unstable networks this can return null var dirs = _fileSystem.GetDirectories(directory.Path); while (dirs == null) { dirs = _fileSystem.GetDirectories(directory.Path); i++; if (i > 10) { break; } } foreach (string dir in dirs) { var baseDir = CrawlAllLogBaseDirectories(new DirectorySetting(dir)); if (baseDir != null) { return(baseDir); } } } return(null); }
private void FindLogFiles(string dir, string outputFilePath) { var finder = new LogFileFinder(WriteFile, _fileSystem, _logger, null); finder.FindFilesInDirectories(new DirectorySetting(dir), _settings.StartDateForLogs, _settings.StopDateForLogs, outputFilePath); }