Example #1
0
        private static bool ProcessArgs(string[] args, MailSimOptions options)
        {
            if (args.Length > 0 && args[0] == "/t")
            {
                // Execute smoke test
                var testClass = new MailSimTest(options, args.Length > 1 ? args[1] : null);
                testClass.Execute();
                return(false);
            }

            if (args.Length != 1)
            {
                Log.Out(Log.Severity.Error, "", "Invalid arguments");
            }
            else if (!File.Exists(args[0]))
            {
                Log.Out(Log.Severity.Error, "", "Invalid argument, file does not exist");
            }
            else
            {
                return(true);
            }

            PrintUsage();
            return(false);
        }
        private static bool ProcessArgs(string[] args, MailSimOptions options)
        {
            if (args.Length > 0 && args[0] == "/t")
            {
                // Execute smoke test
                var testClass = new MailSimTest(options, args.Length > 1 ? args[1] : null);
                testClass.Execute();
                return false;
            }

            if (args.Length != 1)
            {
                Log.Out(Log.Severity.Error, "", "Invalid arguments");
            }
            else if (!File.Exists(args[0]))
            {
                Log.Out(Log.Severity.Error, "", "Invalid argument, file does not exist");
            }
            else
            {
                return true;
            }

            PrintUsage();
            return false;
        }
        /// <summary>
        /// Main program
        /// </summary>
        /// <param name="args">Command line arguments</param>
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            if (args.Length > 0)
            {
                if (args[0] == "/t")
                {
                    MailSimTest testClass = new MailSimTest();
                    testClass.Execute(args);
                    Log.Out(Log.Severity.Info, "", "Press any key to quit");
                    Console.Read();
                    return;
                }
            }

            if (args.Length != 1)
            {
                Log.Out(Log.Severity.Error, "", "Invalid parameter!");
                PrintUsage();
                return;
            }

            if (!File.Exists(args[0]))
            {
                Log.Out(Log.Severity.Error, "", "Invalid parameter, file does not exist");
                PrintUsage();
                return;
            }

            ProcessArgs(args);
        }
        /// <summary>
        /// Main program
        /// </summary>
        /// <param name="args">Command line arguments</param>
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            if (args.Length > 0)
            {
                if (args[0] == "/t")
                {
                    MailSimTest testClass = new MailSimTest();
                    testClass.Execute(args);
                    Log.Out(Log.Severity.Info, "", "Press any key to quit");
                    Console.Read();
                    return;
                }
            }

            if (args.Length != 1)
            {
                Log.Out(Log.Severity.Error, "", "Invalid parameter!");
                PrintUsage();
                return;
            }

            if (!File.Exists(args[0]))
            {
                Log.Out(Log.Severity.Error, "", "Invalid parameter, file does not exist");
                PrintUsage();
                return;
            }

            ProcessArgs(args);
        }