Ejemplo n.º 1
0
        private bool HandleParameterGroup(Parameter parameter, string command, string nextCommand, out bool nextCommandUsed, bool allParamsSet, int i)
        {
            nextCommandUsed = false;
            ParameterOrGroup orParameter = (ParameterOrGroup)parameter;

            foreach (Parameter p in orParameter.Parameters)
            {
                if (p is ParameterOrGroup)
                {
                    allParamsSet = HandleParameterGroup(p, command, nextCommand, out nextCommandUsed, allParamsSet, i);
                }
                else
                {
                    if (!p.IsSet)
                    {
                        if (p.TrySet(command, nextCommand, out nextCommandUsed))
                        {
                            lastCommandPos = lastCommandPos > i ? lastCommandPos : i;
                            break;
                        }
                    }
                }
            }
            if (!orParameter.IsSet || !orParameter.IsValid)
            {
                allParamsSet = false;
            }
            return(allParamsSet);
        }
Ejemplo n.º 2
0
 public void CheckParameters()
 {
     foreach (Parameter parameter in Parameters)
     {
         if (parameter is ParameterOrGroup)
         {
             ParameterOrGroup orParameter = (ParameterOrGroup)parameter;
             if (orParameter.IsSet && orParameter.IsValid)
             {
                 continue;
             }
             else
             {
                 throw new ArgumentException("Oder-Parameter ungültig.", orParameter.ToString());
             }
         }
         else
         {
             if (parameter.IsRequired && !parameter.IsSet)
             {
                 throw new ArgumentException("Parameter fehlt.", parameter.ToString());
             }
         }
     }
 }