예제 #1
0
        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);
        }
예제 #2
0
 public void Configure(Core.FileConfiguration.AsyncGenerator configuration, Solution solution, IFluentSolutionConfiguration solutionConfiguration,
                       Assembly assembly)
 {
     _realConfigurator.Configure(configuration, solution, solutionConfiguration, assembly);
 }