Exemple #1
0
        static void Main(string[] args)
        {
            var defaultConfig = sReader.ReadFile(DefaultConfig);
            var defaultParser = sCreator.ArgumentsSetup(sArguments);

            defaultParser.Parse(defaultConfig);

            var userConfig = sReader.ReadFile(sPathToUserFile);

            sValidator.Validate(userConfig, sPathToUserFile);
            OutputErrorsIfExistent();

            sValidator.Validate(args, CommandLineError);
            OutputErrorsIfExistent();

            var fileParser = sCreator.ArgumentsSetup(sArguments);

            fileParser.Parse(userConfig);

            var parser = sCreator.ArgumentsSetup(sArguments);

            parser.Parse(args);

            if (sArguments.UseCustomConfigFile != "")
            {
                RunCustomParser(args);
            }
            if (sArguments.ImportFromSpecificConfigFile != "")
            {
                ImportSpecificFile();
            }
            if (sArguments.WriteSwitchesToDefault)
            {
                WriteSwitchesToDefault(args, userConfig);
            }
            if (sArguments.RevertConfig)
            {
                RevertConfig();
            }

            var input = GetUserInput();

            try
            {
                sStringValidator.Validate(input);
            }
            catch (CalculationException x)
            {
                OnStringError(x, input);
            }


            sBuilder.RegisterAssemblyModules(typeof(Calculator.Logic.LogicModule).Assembly);
            var container         = sBuilder.Build();
            var pipelineEvaluator = container.Resolve <IEvaluationPipeline>();

            Console.WriteLine(pipelineEvaluator.Evaluate(input, sArguments));
            Console.ReadKey();
        }