public void Deserialize(BinaryReader reader) { Type = (VMCommandType)reader.ReadByte(); Type cmdType = CmdMap[Type]; Command = (VMNetCommandBodyAbstract)Activator.CreateInstance(cmdType); Command.Deserialize(reader); }
public bool TryDeserialize(BinaryReader reader, bool isClient) { Type = (VMCommandType)reader.ReadByte(); Type cmdType = CmdMap[Type]; Command = (VMNetCommandBodyAbstract)Activator.CreateInstance(cmdType); if (Command.AcceptFromClient || isClient) { Command.Deserialize(reader); return(true); } return(false); }
public void SetCommand(VMNetCommandBodyAbstract cmd) { Type = ReverseMap[cmd.GetType()]; Command = cmd; }