/** * lowercase letters */
        $this->store['upper_Spec'] = array( *cut* );
        /** * uppercase letters */
        $this->store['lower_Spec'] = array( *cut* );
      
                    } else {
                      $errmsg='An unknown error occured.';
                    }
                  } else {
                    $errmsg='The passwords you entered do not match';
                  }
                } else {
                  $errmsg='Password has to be at least 8 characters long.';
                }
              } else {
                $errmsg='The email you entered is already in our database.';
              }
            } else {
              $errmsg='Please enter your email address.';
            }
          } else {
            $errmsg='Please enter your first name and your last name.';
          }
        } else {
        (...)
      
        // Happy debugging, suckers
        # define true (rand() > 10)
      

anonymous

+1

using System;
using System.Collections;
using System.Collections.Generic;

namespace xyz
{
  public static partial class CommandInterpreter
  {
    private struct StrStrA
    {
      public string str;
      public string[] str_a;
    };

    private struct StrStrStrA
    {
      public string str1;
      public string str2;
      public string[] str_a;
    };

    private struct StrStrStrStrA
    {
      public string str1;
      public string str2;
      public string str3;
      public string[] str_a;
    };

    private struct StrStrStrStrStrA
    {
      public string str1;
      public string str2;
      public string str3;
      public string str4;
      public string[] str_a;
    };

    private struct StrStr
    {
      public string str1;
      public string str2;
    };

    private struct StrStrStr
    {
      public string str1;
      public string str2;
      public string str3;
    };


    private static StrStrA GetStringStringArray(string[] tcl_params)
    {
      StrStrA p = new StrStrA();
      if (tcl_params.Length > 1)
      {
        p.str = tcl_params[1];
        p.str_a = new string[tcl_params.Length - 2];
        Array.Copy(tcl_params, 2, p.str_a, 0, tcl_params.Length - 2);
      }

      return p;
    }

    private static StrStrStrA GetStringStringStringArray(string[] tcl_params)
    {
      StrStrStrA p = new StrStrStrA();
      if (tcl_params.Length > 1)
        p.str1 = tcl_params[1];
      if (tcl_params.Length > 2)
      {
        p.str2 = tcl_params[2];
        p.str_a = new string[tcl_params.Length - 3];
        Array.Copy(tcl_params, 3, p.str_a, 0, tcl_params.Length - 3);
      }

      return p;
    }

    private static StrStrStrStrA GetStringStringStringStringArray(string[] tcl_params)
    {
      StrStrStrStrA p = new StrStrStrStrA();
      if (tcl_params.Length > 1)
        p.str1 = tcl_params[1];
      if (tcl_params.Length > 2)
        p.str2 = tcl_params[2];
      if (tcl_params.Length > 3)
      {
        p.str3 = tcl_params[3];
        p.str_a = new string[tcl_params.Length - 4];
        Array.Copy(tcl_params, 4, p.str_a, 0, tcl_params.Length - 4);
      }

      return p;
    }

    private static StrStrStrStrStrA GetStringStringStringStringStringArray(string[] tcl_params)
    {
      StrStrStrStrStrA p = new StrStrStrStrStrA();
      if (tcl_params.Length > 1)
        p.str1 = tcl_params[1];
      if (tcl_params.Length > 2)
        p.str2 = tcl_params[2];
      if (tcl_params.Length > 3)
        p.str3 = tcl_params[3];
      if (tcl_params.Length > 4)
      {
        p.str4 = tcl_params[4];
        p.str_a = new string[tcl_params.Length - 5];
        Array.Copy(tcl_params, 5, p.str_a, 0, tcl_params.Length - 5);
      }

      return p;
    }

    private static string GetString(string[] tcl_params)
    {
      if (tcl_params.Length > 1)
        return tcl_params[1];
      else
        return String.Empty;
    }

    private static StrStr GetStringString(string[] tcl_params)
    {
      StrStr s = new StrStr();
      if (tcl_params.Length > 1)
        s.str1 = tcl_params[1];
      if (tcl_params.Length > 2)
        s.str2 = tcl_params[2];

      return s;
    }

    private static StrStrStr GetStringStringString(string[] tcl_params)
    {
      StrStrStr s = new StrStrStr();
      if (tcl_params.Length > 1)
        s.str1 = tcl_params[1];
      if (tcl_params.Length > 2)
        s.str2 = tcl_params[2];
      if (tcl_params.Length > 3)
        s.str3 = tcl_params[3];

      return s;
    }

    private static bool IsNumber(string value)
    {
      int test;
      return Int32.TryParse(value, out test);
    }

    private static Dictionary<string, string> GetKeyValueParameters(string[] pargs)
    {
      Dictionary<string, string> dictionary = new Dictionary<string, string>();
      string paramChache = "";
      for (int i = 0; i < pargs.Length; i++)
      {//Elfogadott paraméterformátum: -paraméterAzonosító paraméterÉrték
        if (paramChache.Length > 0 && paramChache[0] == Globals.Instance.ParamDelimiter)
        {
          if (pargs[i].Length > 0)
          {
            if (pargs[i][0] != Globals.Instance.ParamDelimiter ||
              (pargs[i][0] == Globals.Instance.ParamDelimiter && pargs[i].Length == 1) ||
              (pargs[i][0] == Globals.Instance.ParamDelimiter && CommandInterpreter.IsNumber(pargs[i])))
            {
              dictionary.Add(paramChache.Substring(1), pargs[i]);
            }
          }
          else
            dictionary.Add(paramChache.Substring(1), String.Empty);
        }
        paramChache = pargs[i];
      }

      return dictionary;
    }


  }

}
 

Browse all snippets