public ThumbnailCreator(string logicalPath, IFilesData filesData, PathHelper pathHelper) { LogicalPath = logicalPath; _filesData = filesData; _pathHelper = pathHelper; }
public FilesController(IOptions <FolderSettings> options, IFilesData filesData, PathHelper pathHelper) { _options = options; _filesData = filesData; _pathHelper = pathHelper; }
private void RemoveNonExistingFromDbRecursively(IEnumerable <Folder> folders, IFilesData data, HashSet <string> originFolderPaths, HashSet <string> originFilePaths, ref int visited, ref DateTime lastProgressReport) { foreach (var folder in folders) { if (DateTime.UtcNow - lastProgressReport > new TimeSpan(0, 0, 10)) { _logger.LogInformation("Objects visited: {VISITED}", visited); lastProgressReport = DateTime.UtcNow; } visited++; if (!originFolderPaths.Contains(folder.Path)) { _logger.LogInformation($"Removing folder '{folder.Path}' from DB"); data.Remove(folder); } else { foreach (var file in folder.Files) { if (DateTime.UtcNow - lastProgressReport > new TimeSpan(0, 0, 10)) { _logger.LogInformation("Objects visited: {VISITED}", visited); lastProgressReport = DateTime.UtcNow; } visited++; if (!originFilePaths.Contains(file.Path)) { _logger.LogInformation($"Removing file '{file.Path}' from DB"); data.Remove(file); } } RemoveNonExistingFromDbRecursively(folder.Children, data, originFolderPaths, originFilePaths, ref visited, ref lastProgressReport); } } }