/// <summary> /// Initializes a new instance of the <see cref="SolrOperationRunner" /> class. /// </summary> /// <param name="directoryInfoWrapper">The directory information wrapper.</param> /// <param name="restClient">The rest client.</param> /// <param name="log">The log.</param> public SolrOperationRunner(IDirectoryInfoWrapper directoryInfoWrapper = null, IRestClient restClient = null, ISolrLog log = null) { _directoryInfoWrapper = directoryInfoWrapper ?? new DirectoryInfoWrapper(); _restClient = restClient; _log = log; LoadDeserializedOperationObjects(_restClient, _log); }
private IEnumerable <IFileSystemInfoWrapper> GetFileSystemTree(IDirectoryInfoWrapper startDirectory, CurrentAction currentAction) { IFileSystemInfoWrapper[] foundFilesAndDirectoriesInPath = startDirectory.GetFileSystemInfos(); foreach (var item in foundFilesAndDirectoriesInPath) { if (currentAction.Action == ActionType.Stop) { yield break; } if (item is IFileInfoWrapper file) { currentAction.Action = ProcessFile(file); switch (currentAction.Action) { case ActionType.Continue: { yield return(file); break; } case ActionType.Stop: { yield break; } } } else if (item is IDirectoryInfoWrapper directory) { currentAction.Action = ProcessDirectory(directory); switch (currentAction.Action) { case ActionType.Continue: { yield return(directory); foreach (var dir in GetFileSystemTree(directory, currentAction)) { yield return(dir); } break; } case ActionType.Stop: { yield break; } } } } }
public IEnumerable <IFileSystemInfoWrapper> StartProcess(IDirectoryInfoWrapper startDirectory) { OnEvent(OnStart, new SystemVisitorArgs()); var list = GetFileSystemTree(startDirectory, CurrentAction.ContinueSearch); foreach (var item in list) { yield return(item); } OnEvent(OnFinish, new SystemVisitorArgs()); }
public async Task StartAsync() { Console.Clear(); IDirectoryInfoWrapper directory = _directoryInfoWrapperFactory.Create(_magisterDirectoryLocation); IFileInfoWrapper[] files = directory.GetFiles(); if (files.Any()) { PrintAvailableFiles(files); await CreateClassFromFile(files); } else { Console.WriteLine("No magister files present. Add a file into the folder:"); Console.WriteLine(_magisterDirectoryLocation.Value); SharedConsoleFlows.AskForAnyKey("Press any key to go back."); } }
public FileSystem(IDirectoryInfoWrapper currentDirectory, IFileInfoWrapper fileInfoWrapper) { _currentDirectory = currentDirectory; _fileInfoWrapper = fileInfoWrapper; WorkingDirectory = _currentDirectory.WorkingDirectory; }
private ActionType ProcessDirectory(IDirectoryInfoWrapper directory) { return(fileSystemProcessingStrategy .ProcessItemFinded(directory, filter, OnDirectoryFinded, OnDirectoryFiltered, OnEvent)); }
public DirectoryHelper(IDirectoryInfoWrapper directoryInfo) { nazwaTowaruHelper = new NazwaTowaruSubiektHelper(); this.directoryInfo = directoryInfo; }