Example #1
0
 public override void Write(string value)
 {
     byte[] buffer = PacketTextEncoder.GetEncoding(value);
     //
     base.Write(buffer.Length);
     base.Write(buffer);
 }
 /// <summary>
 /// 把字节编码
 /// </summary>
 /// <returns></returns>
 public static string GetEncoding(this byte[] value)
 {
     Encoding e = PacketTextEncoder.GetEncoding();
     return e.GetString(value);
 }
 /// <summary>
 /// 把字节编码
 /// </summary>
 /// <returns></returns>
 public static string GetEncoding(this byte[] value, int index, int count)
 {
     Encoding e = PacketTextEncoder.GetEncoding();
     return e.GetString(value, index, count);
 }
 /// <summary>
 /// 把字符串编码
 /// </summary>
 /// <returns></returns>
 public static byte[] GetEncoding(this string value)
 {
     Encoding e = PacketTextEncoder.GetEncoding();
     return e.GetBytes(value);
 }