Example #1
0
        internal void ValidateOptions()
        {
            if (!PromptForText)
            {
                ValidateOptionsWhenNotPromptedForText();
            }
            else
            {
                ValidateOptionsWhenPromptedForText();
            }

            if ((CycleInterval != null) && (Variables.Any() || AskForVariables))
            {
                Fail("You can't use the '-m' and '-v' / '-va' options at the same time.");
            }

            if ((SequenceValues?.Any() ?? false) && (CurrentConfig.Sequences?.Length ?? 0) == 0)
            {
                Fail($"There are no sequences declared in '{ConfigFile}' config file to override.");
            }
        }
Example #2
0
 internal void TryParseSequenceValues()
 {
     if (SequenceValues != null && SequenceValues.Any())
     {
         ParsedSequenceValues = new Dictionary <int, string>();
         foreach (string sequenceValue in SequenceValues)
         {
             if (!sequenceValue.Contains(','))
             {
                 Fail("Sequence values must be specified in the {sequenceIndex},{sequenceValue}, ex: '1,lorem'. If you need to place a comma in the sequence text, use '\\,' to escape it.");
             }
             string[] pair = sequenceValue.Replace("\\,", "##COMMA##").Split(',').Select(p => p.Replace("##COMMA##", ",")).ToArray();
             if (pair.Length != 2)
             {
                 Fail("Sequence values must be specified in the {sequenceIndex},{sequenceValue}, ex: '1,lorem'. If you need to place a comma in the sequence text, use '\\,' to escape it.");
             }
             if (!int.TryParse(pair[0], out int sequenceIndex) || sequenceIndex < 0 || sequenceIndex >= CurrentConfig.Sequences.Length)
             {
                 Fail($"Sequence index must be numeric, and as you declared {CurrentConfig.Sequences.Length} sequence sequences, the index must be between 0 and {CurrentConfig.Sequences.Length - 1}.");
             }
             ParsedSequenceValues.Add(sequenceIndex, pair[1]);
         }
     }
 }