private string GetArgValue(CommandlineSwitchType t)
        {
            if (_parsedArguments.HasValue(t))
                return _parsedArguments.GetValue(t);

            return string.Empty;
        }
Ejemplo n.º 2
0
        private ParsedArguments GetSwitchDictionary(
            string[] args)
        {
            var result = new ParsedArguments();

            int indexOfSwitch = 0;

            while (indexOfSwitch < args.Length)
            {
                var switchArg  = args[indexOfSwitch];
                var switchType = CommandlineSwitchType.GetTypeForCommandLineSwitch(switchArg);

                var indexOfSwitchValue = indexOfSwitch + 1;

                if (WeHaveMatchingCommandLineSwitch(switchType) &&
                    ArgsIsLargeEnoughtToSupportSwitchValue(args, indexOfSwitchValue))

                {
                    var switchValue = args[indexOfSwitchValue];
                    result.SetValue(switchType, switchValue);
                }

                indexOfSwitch += 2;
            }

            return(result);
        }
 private bool WeHaveMatchingCommandLineSwitch(
     CommandlineSwitchType c)
 {
     return c != null;
 }
Ejemplo n.º 4
0
 public void SetValue(
     CommandlineSwitchType c,
     string v)
 {
     _switchDictionary.Add(c, v);
 }
Ejemplo n.º 5
0
 public bool HasValue(
     CommandlineSwitchType c)
 {
     return _switchDictionary.ContainsKey(c);
 }
Ejemplo n.º 6
0
 public string GetValue(
     CommandlineSwitchType c)
 {
     return _switchDictionary[c];
 }
Ejemplo n.º 7
0
 private bool WeHaveMatchingCommandLineSwitch(
     CommandlineSwitchType c)
 {
     return(c != null);
 }