Пример #1
0
        public static CommandLineParameters GetCommandLineParameters(string[] args)
        {
            var options = new CommandLineParameters();

            new Parser().ParseArgumentsStrict(args, options, () => OnFail(options));
            return(options);
        }
Пример #2
0
        private static WeavingParameters GetWeavingParameters(CommandLineParameters options)
        {
            WeavingParameters weavingParameters;

            using (var fodyXmlConfiguration = new FileStream(options.FodyWeaverConfigPath, FileMode.Open))
            {
                var currentDirectory = Directory.GetCurrentDirectory();
                weavingParameters = WeavingParameters.GetWeavingParameters(fodyXmlConfiguration, currentDirectory, options.References);
            }
            return(weavingParameters);
        }
Пример #3
0
        public string GetUsage()
        {
            var help = new HelpText(new EnglishSentenceBuilder(), Assembly.GetExecutingAssembly().FullName, "Marcello Faga, Laurent Nguyen");

            var commandLineParameters = new CommandLineParameters();

            help.AddOptions(commandLineParameters);


            if (this.LastParserState?.Errors.Any() == true)
            {
                var errors = help.RenderParsingErrorsText(this, 2);

                if (!string.IsNullOrEmpty(errors))
                {
                    help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):"));
                    help.AddPreOptionsLine(errors);
                }
            }

            return(help);
        }
Пример #4
0
 private static void OnFail(CommandLineParameters options)
 {
     throw new WrongCommandLineParametersException(options.GetUsage());
 }