Exemple #1
0
 public void AddParameter(Parameter param) { AddParameter(param.content, param.Type); }
Exemple #2
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.Double:
             double[] da = ClientInfo.GetDoubleArray(p.content);
             sb = new StringBuilder();
             foreach (double d in da) sb.Append(d + " ");
             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 "??";
     }
 }
Exemple #3
0
 public Parameter GetParameter(ref int index)
 {
     paraminx = 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;
 }