Пример #1
0
 public override void OnSend(Stream stream)
 {
     ProtocolParser.WriteInt32(stream, (int)this.BroadcastType);
     ProtocolParser.WriteInt32(stream, this.PlayerId);
     ProtocolParser.WriteString(stream, this.MethodName);
     SerializableTypeRegister.Serialize(this.Args, stream);
 }
Пример #2
0
        public static Dictionary <object, object> PropToBytesDict(Dictionary <object, object> originDict)
        {
            if (originDict == null)
            {
                return(new Dictionary <object, object>());
            }
            MemoryStream tmpStream = new MemoryStream();
            Dictionary <object, object> bytesDict = new Dictionary <object, object>();          //TODO 这里是简单实现,GC很大

            foreach (var kv in originDict)
            {
                SerializableTypeRegister.Serialize(kv.Value, tmpStream);
                bytesDict.Add(kv.Key, tmpStream.ToArray());
                tmpStream.Clean();
            }
            return(bytesDict);
        }
Пример #3
0
 public override void OnSend(Stream stream)
 {
     ProtocolParser.WriteString(stream, Request.Id);
     SerializableTypeRegister.Serialize(ReplyCommand.Key, stream);
     ReplyCommand.OnSend(stream);
 }
Пример #4
0
 public static void WriteObject(this Stream stream, object obj)
 {
     SerializableTypeRegister.Serialize(obj, stream);
 }
Пример #5
0
 public override void OnSend(Stream stream)
 {
     SerializableTypeRegister.Serialize(this.ViewAndObjects, stream);
 }
Пример #6
0
 public void WriteToStream(Stream stream)
 {
     SerializableTypeRegister.Serialize(Key, stream);
     OnSend(stream);
 }