public override int WriteTo(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; Buffer[cursor] = (byte)CommandType; // Type (1 byte) cursor++; cursor += GuildInfo.WriteTo(Buffer, cursor); // GuildInfo (n bytes) return(cursor - StartIndex); }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; if ((UserCommandType)Buffer[cursor] != CommandType) { throw new Exception(ERRORWRONGTYPEBYTE); } else { cursor++; // Type (1 byte) GuildInfo = new GuildInfo(Buffer, cursor); // GuildInfo (n bytes) cursor += GuildInfo.ByteLength; } return(cursor - StartIndex); }
public UserCommandGuildInfo(GuildInfo GuildInfo) { this.GuildInfo = GuildInfo; }