public override bool Parse(ArgumentParser parser, string key, string[] values, ref int index)
 {
     if ((index + 1) < values.Length)
     {
         string str = values[index + 1];
         string str2 = str;
         if (str.StartsWith("-") || str.StartsWith("+"))
         {
             str2 = ConsoleChars.GetMathsChar(ConsoleMathsChars.PlusMinus) + key.Substring(1);
         }
         ArgumentKey outKey = null;
         IArgumentValue forKey = null;
         if (parser.ContainsKey(str))
         {
             forKey = parser.GetForKey(str, out outKey);
         }
         else if (!str2.Equals(str) && parser.ContainsKey(str2))
         {
             forKey = parser.GetForKey(str2, out outKey);
         }
         if ((outKey == null) || (forKey == null))
         {
             this.SetValue(values[index + 1]);
             index++;
         }
     }
     return false;
 }
 public override bool Parse(ArgumentParser parser, string key, string[] values, ref int index)
 {
     if ((index + 1) >= values.Length)
     {
         throw new Exception(string.Format(Strings.ArgumentParser_InvalidArgument, key));
     }
     return true;
 }
Beispiel #3
0
 public override bool Parse(ArgumentParser parser, string key, string[] values, ref int index)
 {
     if ((index + 1) >= values.Length)
     {
         throw new Exception(string.Format(Strings.ArgumentParser_InvalidArgument, key));
     }
     this.SetValue(values[index + 1]);
     index++;
     return false;
 }
Beispiel #4
0
        static RpxInterface()
        {
            Title = Strings.App_Title + " " + typeof(Program).Assembly.GetName().Version.ToString();

            Parser = new ArgumentParser("Rpx", Title + "\n" + Strings.App_AboutText);

            Parser.AboutTitleText = Title;
            Parser.AboutText = Strings.App_AboutText;
            Parser.AboutTextLong = Strings.App_AboutTextLong;
            Parser.CreditsText = Strings.App_CreditsText;
            Parser.LegalText = Strings.App_LegalText;
            Parser.HasApplicationDocument = true;

            PathString = new StringArgument(Strings.Arg_PathString_Name, Strings.Arg_PathString_ShortHelp, Strings.Arg_PathString_Help);
            FileList = new StringListArgument(Strings.Arg_FileList_Name, "", Strings.Arg_FileList_Help);

            Parser.FirstArgument = PathString;
            Parser.DefaultArgument = FileList;

            AssemblyInfoPath = new StringArgument(Strings.Arg_AssemblyInfoPath_Name, Strings.Arg_AssemblyInfoPath_ShortHelp, Strings.Arg_AssemblyInfoPath_Help);
            IconPath = new StringArgument(Strings.Arg_IconPath_Name, Strings.Arg_IconPath_ShortHelp, Strings.Arg_IconPath_Help);
            OutputPath = new StringArgument(Strings.Arg_OutputPath_Name, Strings.Arg_OutputPath_ShortHelp, Strings.Arg_OutputPath_Help);
            ConsoleSwitch = new PlusMinusSwitch(Strings.Arg_ConsoleSwitch_ShortHelp, Strings.Arg_ConsoleSwitch_Help, true);
            PassArgsSwitch = new BoolSwitch(Strings.Arg_PassArgsSwitch_ShortHelp, Strings.Arg_PassArgsSwitch_Help);
            DecorateSwitch = new BoolSwitch(Strings.Arg_Decorate_ShortHelp, Strings.Arg_Decorate_Help);
            ProtectZipSwitch = new OptionalStringArgument(Strings.Arg_Hide_Name, Strings.Arg_Hide_ShortHelp, Strings.Arg_Hide_Help);

            ToolsCsv = new CsvArgument(Strings.Arg_Toolkit_Name, Strings.Arg_Toolkit_ShortHelp, Strings.Arg_Toolkit_Help);

            Parser.Add(PlusMinusSwitch.KeyPrefix, Strings.Arg_ConsoleSwitch_Symbol, Strings.Arg_ConsoleSwitch_Key, ConsoleSwitch);
            Parser.Add("/", Strings.Arg_PassArgsSwitch_Symbol, Strings.Arg_PassArgsSwitch_Key, PassArgsSwitch);
            Parser.Add("/", Strings.Arg_Toolkit_Key, ToolsCsv);
            Parser.Add("/", Strings.Arg_OutputPath_Symbol, Strings.Arg_OutputPath_Key, OutputPath);
            Parser.Add("/", Strings.Arg_Decorate_Key, DecorateSwitch);
            Parser.Add("/", Strings.Arg_IconPath_Symbol, Strings.Arg_IconPath_Key, IconPath);
            Parser.Add("/", Strings.Arg_AssemblyInfoPath_Symbol, Strings.Arg_AssemblyInfoPath_Key, AssemblyInfoPath);
            Parser.Add("/", Strings.Arg_Hide_Key, ProtectZipSwitch);


            BuildSwitch = new BoolSwitch(Strings.Arg_BuildSwitch_ShortHelp, Strings.Arg_BuildSwitch_Help);
            QuietSwitch = new BoolSwitch(Strings.Arg_QuietSwitch_ShortHelp, Strings.Arg_QuietSwitch_Help);
            VerboseSwitch = new EnumSwitch(Strings.Arg_Verbose_ShortHelp, Strings.Arg_Verbose_Help, typeof(ConsoleVerbosity));

            Parser.Add("/", Strings.Arg_BuildSwitch_Key, BuildSwitch);
            Parser.Add("/", Strings.Arg_QuietSwitch_Key, QuietSwitch);
            Parser.Add("/", Strings.Arg_Verbose_Key, VerboseSwitch);

            WarningsAsErrors = new PlusMinusSwitch(Strings.Arg_WarningsAsErrors_ShortHelp, Strings.Arg_WarningsAsErrors_Help, false);

            Parser.Add(PlusMinusSwitch.KeyPrefix, Strings.Arg_WarningsAsErrors_Key, WarningsAsErrors);
        }
Beispiel #5
0
 public abstract bool Parse(ArgumentParser parser, string key, string[] arguments, ref int index);
Beispiel #6
0
 public override bool Parse(ArgumentParser parser, string key, string[] values, ref int index)
 {
     this.SetValue(bool.TrueString);
     return false;
 }
Beispiel #7
0
 public abstract bool Parse(ArgumentParser parser, string key, string[] arguments, ref int index);
 public RunCmdCommandLineParser(ILogger logManager)
 {
     Parser = new ArgumentParser("payroll", "Path to the input file");
     LogManager = logManager;
 }
 public override bool Parse(ArgumentParser parser, string key, string[] values, ref int index)
 {
     this.SetValue(key.StartsWith("+").ToString());
     return false;
 }