protected TestProjectFileConfigurator(IFileConfigurator realConfigurator, string inputFolderPath, string fileName, Action <IFluentProjectConfiguration> configureProjectAction) { _fileName = fileName; _inputFolderPath = inputFolderPath; _configureProjectAction = configureProjectAction; _realConfigurator = realConfigurator; }
internal AsyncCodeConfiguration ConfigureFromFile(string filePath, IFileConfigurator fileConfigurator) { if (filePath == null) { throw new ArgumentNullException(nameof(filePath)); } filePath = Path.GetFullPath(Path.Combine(GetExecutingDirectory(), filePath)); if (!File.Exists(filePath)) { throw new FileNotFoundException($"Configuration file not found. Path:'{filePath}'"); } return(ConfigureFromStream(File.OpenRead(filePath), fileConfigurator, Path.GetDirectoryName(filePath))); }
internal AsyncCodeConfiguration ConfigureFromStream(Stream stream, IFileConfigurator fileConfigurator, string basePath = null) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (fileConfigurator == null) { throw new ArgumentNullException(nameof(fileConfigurator)); } basePath = basePath ?? GetExecutingDirectory(); Core.FileConfiguration.AsyncGenerator configuration; using (var reader = new StreamReader(stream)) { configuration = fileConfigurator.Parse(reader.ReadToEnd()); } Assembly assembly = null; if (!string.IsNullOrEmpty(configuration.CSharpScript)) { assembly = SourceCodeCompiler.Compile(configuration.CSharpScript); } if (!string.IsNullOrEmpty(configuration.Solution.FilePath)) { var filePath = Path.GetFullPath(Path.Combine(basePath, configuration.Solution.FilePath)); ConfigureSolution(filePath, o => fileConfigurator.Configure(configuration, configuration.Solution, o, assembly)); } foreach (var project in configuration.Projects) { var filePath = Path.GetFullPath(Path.Combine(basePath, project.FilePath)); ConfigureProject(filePath, o => fileConfigurator.Configure(configuration, project, o, assembly)); } return(this); }
/// <summary> /// Create instance of FileSysMover /// </summary> /// <param name="configurator">IFileConfigurator to provide configuration settings</param> /// <param name="logger">Ilogger to provide loging to file and console</param> public FileSysMover(IFileConfigurator configurator, ILogger logger) { _configurator = configurator; _logger = logger; }