hMailServer.Shared.CommandLineParser.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( ) : void
return void
        public static void Parse()
        {
            _argumentMap = new Dictionary<string, string>();

             bool firstArgument = true;

             string[] arguments = Environment.GetCommandLineArgs();

             foreach (string argument in arguments)
             {
            if (firstArgument)
            {
               // first argument is the executable path.
               firstArgument = false;
               continue;
            }

            if (argument.IndexOf(":") > 0)
            {
               string name = argument.Substring(0, argument.IndexOf(":"));
               string value = argument.Substring(argument.IndexOf(":") + 1);

               _argumentMap[name] = value;
            }
            else
            {
               _argumentMap[argument] = string.Empty;
            }
             }
        }