예제 #1
0
        public static byte[] ToBytes(HttpHeadInfo info)
        {
            BinaryFormatter binFormat = new BinaryFormatter();
            MemoryStream    stream    = new MemoryStream();

            binFormat.Serialize(stream, info);
            byte[] rawBytes = stream.ToArray();
            DC.DCLogger.LogTrace("rawBytes.Length:{0}", rawBytes.Length);
            byte[] totalLen = BitConverter.GetBytes(rawBytes.Length);
            return(totalLen.Concat(rawBytes).ToArray());
        }
예제 #2
0
 public static byte[] PackRespose(HttpHeadInfo httpHeadInfo, byte[] rawBytes)
 {
     byte[] codeBytes = HttpHeadInfo.ToBytes(httpHeadInfo);
     return(codeBytes.Concat(rawBytes).ToArray());
 }
예제 #3
0
 public static byte[] PackRespose(HttpHeadInfo httpHeadInfo, ListDictionary msgItems)
 {
     byte[] codeBytes = HttpHeadInfo.ToBytes(httpHeadInfo);
     byte[] rawBytes  = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(msgItems, jsonSettings));
     return(codeBytes.Concat(rawBytes).ToArray());
 }