Esempio n. 1
0
 /// <summary>
 /// Checks to see if the argument array ends with the specified value.
 /// </summary>
 /// <param name="value">The value to check.</param>
 /// <returns>Whether the variable was found at the ends of the array.</returns>
 public bool EndsWithVariable(CommandArgVariable variable)
 {
     if (!(IsEmpty()) && (EndsWithArgument($"{variable.GetHeader()}{variable.GetValue()}")))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
 /// <summary>
 /// Gets the index from the argument index based on the value.
 /// </summary>
 /// <param name="variable">The value in the array.</param>
 /// <returns>The index of the value.</returns>
 public int IndexOfVariable(CommandArgVariable variable)
 {
     if (!(IsEmpty()))
     {
         return(IndexOfArg($"{variable.GetHeader()}{variable.GetValue()}"));
     }
     return(0);
 }
Esempio n. 3
0
 /// <summary>
 /// Gets an argument just before the one that was provided from the array.
 /// </summary>
 /// <param name="variable">The argument after the wanted argument.</param>
 /// <returns>The argument that was before the one specified.</returns>
 public string BeforeVariable(CommandArgVariable variable)
 {
     if (!(IsEmpty()))
     {
         if (Count() > 0)
         {
             return(GetArgAtPosition(IndexOfVariable(variable) - 1));
         }
     }
     return("");
 }
Esempio n. 4
0
 /// <summary>
 /// Checks the argument array has the following argument at the specified location within the array.
 /// </summary>
 /// <param name="pos">The position within the array.</param>
 /// <param name="variable">The variable to look for in the array.</param>
 /// <returns>Whether the array contains the variable.</returns>
 public bool ContainsVariable(int pos, CommandArgVariable variable)
 {
     if (!(IsEmpty()))
     {
         if (ContainsArg(pos, $"{variable.GetHeader()}{variable.GetValue()}"))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
 /// <summary>
 /// Gets an argument right after the one that was provided from the array.
 /// </summary>
 /// <param name="variable">The argument before the wanted argument.</param>
 /// <returns>The argument that was after the one specified.</returns>
 public string AfterVariable(CommandArgVariable variable)
 {
     if (!(IsEmpty()))
     {
         var index = IndexOfVariable(variable);
         if (index < Count())
         {
             return(GetArgAtPosition(index + 1));
         }
     }
     return("");
 }