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); }
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); }
public override void OnSend(Stream stream) { ProtocolParser.WriteString(stream, Request.Id); SerializableTypeRegister.Serialize(ReplyCommand.Key, stream); ReplyCommand.OnSend(stream); }
public static void WriteObject(this Stream stream, object obj) { SerializableTypeRegister.Serialize(obj, stream); }
public override void OnSend(Stream stream) { SerializableTypeRegister.Serialize(this.ViewAndObjects, stream); }
public void WriteToStream(Stream stream) { SerializableTypeRegister.Serialize(Key, stream); OnSend(stream); }