Exemple #1
0
 public override bool Execute(Parser editor, string[] parameters)
 {
     bool result;
     object methodResult = null;
     if (result = this.Parameters.Length == 0 && parameters.All(parameter => parameter.IsEmpty()))
         methodResult = this.backend.Call();
     else if (result = parameters.Length == this.Parameters.Length && parameters.All(parameter => parameter.NotEmpty()) || parameters.Length - 1 == this.Parameters.Length && parameters[parameters.Length - 1].IsEmpty())
     {
         object[] p = new object[this.Parameters.Length];
         for (int i = 0; i < p.Length; i++)
             p[i] = this.Parameters[i].FromString(parameters[i]);
         methodResult = this.backend.Call(p);
     }
     if (methodResult.NotNull())
     {
         if (methodResult is bool)
         {
             if (!(bool)methodResult)
                 editor.Answer(this, "failed");
         }
         else if (methodResult is string)
             editor.Answer(this, methodResult as string);
         else
             editor.Answer(this, methodResult.ToString());
     }
     return result;
 }