public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteBits(Version, 0x10); if (Version == 1) { if (Agents == null) { Agents = new AgentEntryData[AgentCount]; for (int xb = 0; xb < AgentCount; xb++) { Agents[xb] = new AgentEntryData(); } } io.WriteInt16((short)Agents.Length); for (int i = 0; i < Agents.Length; i++) { Agents[i].Write(io); } } return(true); } catch (Exception) { return(false); } }
public ClientAgent Read(DAIIO io) { xLength = io.ReadBit2(LengthBits); Version = (short)io.ReadBit2(0x10); if (Version == 1) { AgentCount = io.ReadInt16(); Agents = new AgentEntryData[AgentCount]; for (int i = 0; i < AgentCount; i++) { Agents[i] = new AgentEntryData().Read(io); } } return(this); }