////////////////////////////////////////////////////////////////////////////// #region Commands private DemoCmd Read(BitReadBuffer buffer) { DemoCmdType cmdType = (DemoCmdType)buffer.ReadUInt32(BitsPerCmdType); DemoCmd cmd = FindCmd(cmdType); if (cmd == null) { throw new Exception("Unexpected command: " + cmdType); } cmd.Read(buffer); return(cmd); }
private bool ReadTick() { while (m_buffer.BitsAvailable > 0) { DemoCmd cmd = Read(m_buffer); bool shouldStop = cmd.Execute(); if (shouldStop) { return(true); } } return(false); }
////////////////////////////////////////////////////////////////////////////// #region Commands private void Write(DemoCmd cmd) { m_buffer.Write((uint)cmd.cmdType, BitsPerCmdType); cmd.Write(m_buffer); }