Example #1
0
        private void SetStringArg(char argChar)
        {
            _currentArgument++;
            try
            {
                if (_stringArgs.ContainsKey(argChar))
                {
                    _stringArgs[argChar].Value = _args[_currentArgument];
                }
                else

                {
                    var stringArgumentMarshaller = new ArgumentMarshaller <string> {
                        Value = _args[_currentArgument]
                    };
                    _stringArgs.Add(argChar, stringArgumentMarshaller);
                }
            }
            catch (IndexOutOfRangeException)
            {
                _valid           = false;
                _errorArgumentId = argChar;
                _errorCode       = ErrorCode.MissingString;
                throw new ArgumentException();
            }
        }
Example #2
0
 private void SetIntArg(char argChar)
 {
     _currentArgument++;
     try
     {
         var parameter = _args[_currentArgument];
         var intArg    = int.Parse(parameter);
         if (_intArgs.ContainsKey(argChar))
         {
             _intArgs[argChar].Value = intArg;
         }
         else
         {
             var intArgumentMarshaller = new ArgumentMarshaller <int> {
                 Value = intArg
             };
             _intArgs.Add(argChar, intArgumentMarshaller);
         }
     }
     catch (IndexOutOfRangeException)
     {
         _valid           = false;
         _errorArgumentId = argChar;
         _errorCode       = ErrorCode.MissingInteger;
         throw new ArgumentException();
     }
     catch (FormatException)
     {
         _valid           = false;
         _errorArgumentId = argChar;
         _errorCode       = ErrorCode.InvalidInterger;
         throw new ArgumentException();
     }
 }
Example #3
0
 private void SetBooleanArg(char argChar, bool value)
 {
     if (_boolArgs.ContainsKey(argChar))
     {
         _boolArgs[argChar].Value = value;
     }
     else
     {
         var booleanArgumentMarshaller = new ArgumentMarshaller <bool> {
             Value = value
         };
         _boolArgs.Add(argChar, booleanArgumentMarshaller);
     }
 }