Example #1
0
        public static int Main(string[] args)
        {
            var arguments = new CliArguments();

            if (Parser.Default.ParseArguments(args, arguments))
            {
                var cli = new CommandLineInterface();

                try
                {
                    cli.Initialize(arguments);
                    cli.generator.CreateReport(cli.reader.GetEventIterator());

                    if (arguments.NumberOfEventsAsReturnCode)
                    {
                        return(cli.reader.GetEventIterator().Count());
                    }
                    return((int)CliReturnCodes.ExecutionSuccessful);
                }
                catch (FileNotFoundException fnf)
                {
                    Console.WriteLine(fnf.Message);
                    return((int)CliReturnCodes.FileNotFound);
                }
                catch (JsonReaderException jre)
                {
                    Console.WriteLine(jre.Message);
                }
            }
            else
            {
                Console.WriteLine("not all mandatory parameters were specified. use --help for further information.");
                return((int)CliReturnCodes.MissingParameters);
            }

            return((int)CliReturnCodes.UnhandledException);
        }
        public static int Main(string[] args)
        {
            var arguments = new CliArguments();
            if (Parser.Default.ParseArguments(args, arguments))
            {

                var cli = new CommandLineInterface();

                try
                {
                    cli.Initialize(arguments);
                    cli.generator.CreateReport(cli.reader.GetEventIterator());

                    if (arguments.NumberOfEventsAsReturnCode)
                    {
                        return cli.reader.GetEventIterator().Count();
                    }
                    return (int) CliReturnCodes.ExecutionSuccessful;
                }
                catch (FileNotFoundException fnf)
                {
                    Console.WriteLine(fnf.Message);
                    return (int) CliReturnCodes.FileNotFound;
                }
                catch (JsonReaderException jre)
                {
                    Console.WriteLine(jre.Message);
                }
            }
            else
            {
                Console.WriteLine("not all mandatory parameters were specified. use --help for further information.");
                return (int) CliReturnCodes.MissingParameters;
            }

            return (int)CliReturnCodes.UnhandledException;
        }