Ejemplo n.º 1
0
 public void AddParameter(Parameter param)
 {
     AddParameter (param.content, param.Type);
 }
Ejemplo n.º 2
0
 public Parameter GetParameter(ref int index)
 {
     Parameter res = new Parameter ();
     res.Type = Read (index++, 1) [0];
     byte[] lenba = Read (index, 4);
     index += 4;
     int len = ClientInfo.GetInt (lenba, 0, 4);
     res.content = Read (index, len);
     index += len;
     return res;
 }
Ejemplo n.º 3
0
 public static String FormatParameter(Parameter p)
 {
     switch (p.Type) {
     case ParameterType.Int:
         int[] ia = ClientInfo.GetIntArray (p.content);
         StringBuilder sb = new StringBuilder ();
         foreach (int i in ia)
             sb.Append (i + " ");
         return sb.ToString ();
     case ParameterType.Uint:
         ia = ClientInfo.GetIntArray (p.content);
         sb = new StringBuilder ();
         foreach (int i in ia)
             sb.Append (i.ToString ("X8") + " ");
         return sb.ToString ();
     case ParameterType.String:
         return Encoding.UTF8.GetString (p.content);
     case ParameterType.StringArray:
         string[] sa = ClientInfo.GetStringArray (p.content, Encoding.UTF8);
         sb = new StringBuilder ();
         foreach (string s in sa)
             sb.Append (s + "; ");
         return sb.ToString ();
     case ParameterType.Byte:
         sb = new StringBuilder ();
         foreach (int b in p.content)
             sb.Append (b.ToString ("X2") + " ");
         return sb.ToString ();
     default:
         return "??";
     }
 }