示例#1
0
        void sendPack(Dictionary <string, object> valuePairs)
        {
            //string json = JsonUtility.ToJson(valuePairs);
            string json = CtServer.ConvertDictionaryToJsonHard(valuePairs);

            Console.WriteLine(json);
            byte[] data = Encoding.UTF8.GetBytes(json);
            stream.Write(data, 0, data.Length);
        }
示例#2
0
 private Dictionary <string, object> Udpate()
 {
     while (true)
     {
         State so    = new State();
         int   bytes = stream.Read(so.buffer, 0, so.buffer.Length);
         if (bytes != 0)
         {
             Console.WriteLine($"Pack size: {bytes} byte");
             return(CtServer.ByteJsonToDictionaryHard(so.buffer, bytes));
         }
     }
 }