コード例 #1
0
        /// <summary>
        /// Adds a configuration processor.
        /// </summary>
        /// <param name="configProcessor">The configuration processor to add.</param>
        /// <returns>The table builder.</returns>
        public ITableBuilder AddProcessor(IConfigProcessor configProcessor)
        {
            CheckInitialized();

            Processors.Add(configProcessor);
            return(this);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tmnkopp/SledgeOmatic
        static void Main(string[] args)
        {
            ServiceProvider serviceProvider = RegisterServices(args);
            IConfiguration  config          = serviceProvider.GetService <IConfiguration>();

            Serilog.ILogger   logger = serviceProvider.GetService <Serilog.ILogger>();
            ISomContext       somContext;       //= serviceProvider.GetService<ISomContext>();
            IParseProcessor   parseProcessor;   //= serviceProvider.GetService<IParseProcessor>();
            ICompileProcessor compileProcessor; // = serviceProvider.GetService<ICompileProcessor>();
            IConfigProcessor  configProcessor = serviceProvider.GetService <IConfigProcessor>();

            var exit = Parser.Default.ParseArguments <CompileOptions, ParseOptions, ConfigOptions>(args)
                       .MapResult(
                (CompileOptions o) => {
                logger.Information("{o}", JsonConvert.SerializeObject(o));
                somContext         = serviceProvider.GetService <ISomContext>();
                somContext.Options = o;
                compileProcessor   = serviceProvider.GetService <ICompileProcessor>();
                compileProcessor.Process(somContext);
                return(0);
            },
                (ParseOptions o) => {
                logger.Information("{o}", JsonConvert.SerializeObject(o));
                somContext         = serviceProvider.GetService <ISomContext>();
                somContext.Options = o;
                parseProcessor     = serviceProvider.GetService <IParseProcessor>();
                parseProcessor.Process(somContext);
                return(0);
            },
                (ConfigOptions o) => {
                logger.Information("{o}", JsonConvert.SerializeObject(o));
                configProcessor.Process(o);
                return(0);
            },
                errs => 1);
        }