public override void Serialize(Stream stream) { using (var w = stream.ToBinaryWriter(true)) { w.WriteEnum(GameRuleMapper.GetOpCode(GetType())); Serializer.Serialize(w, this); } }
public ProudMessage GetMessage(ISession session, ushort opCode, BinaryReader r) { if (Enum.IsDefined(typeof(GameOpCode), opCode)) { return(GameMapper.GetMessage((GameOpCode)opCode, r)); } if (Enum.IsDefined(typeof(GameRuleOpCode), opCode)) { return(GameRuleMapper.GetMessage((GameRuleOpCode)opCode, r)); } throw new NetsphereBadOpCodeException(opCode); }