Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                // Retrieving application settings from the commandline
                if (!CommandLineSettings.Parse(args))
                {
                    Error("Unable to parse commandline. Program terminating.");
                }

                Settings.Get();

                // Do not run through main logic if there are currently errors
                if (!HasErrors)
                {
                    ParseEventLog();
                }
            }
            catch (Exception ex)
            {
                Error("Error encountered:\r\n" + ex.ToString());
            }


#if DEBUG
            Console.WriteLine();
            Console.WriteLine("Press Any Key to Continue...");
            Console.ReadKey();
#endif
        }
Exemple #2
0
        public static void Get()
        {
            if (CommandLineSettings.ProptUserForHostInfo)
            {
                Console.Write("Host: ");
                _host = Console.ReadLine();

                Console.Write("Port: ");
                if (!int.TryParse(Console.ReadLine(), out _port))
                {
                    Console.WriteLine("Invalid port. Defaulting to " + DEFAULT_PORT.ToString());
                    _port = DEFAULT_PORT;
                }
            }
            else
            {
                // Get the host from the commandline, default if blank
                _host = CommandLineSettings.GetString("Host", DEFAULT_HOST);
                Console.WriteLine("Host: " + Host);

                // Get the port from the commandline, default if blank
                _port = CommandLineSettings.GetInt("Port", DEFAULT_PORT);
                Console.WriteLine("Port: " + Port.ToString());
            }

            if (CommandLineSettings.PromptForAddressInformation)
            {
                Console.Write("Send From: ");
                _sendFrom = Console.ReadLine();

                Console.Write("Send To: ");
                _sendTo = Console.ReadLine();
            }
            else
            {
                // Get the send to address, if not set place in a default value
                _sendTo = CommandLineSettings.GetString("SendTo", "*****@*****.**");
                Console.WriteLine("Send To: " + SendTo);

                // Get the send from address, if not set place in a default value
                _sendFrom = CommandLineSettings.GetString("SendFrom", "*****@*****.**");
                Console.WriteLine("Send From: " + SendFrom);
            }

            _password = CommandLineSettings.GetString("Password");
            if (string.IsNullOrEmpty(_password))
            {
                Console.Write("Password:");
                _password = Console.ReadLine();
            }
        }