public override void Serialize(IDataWriter writer)
{
if (this.ServerId < 0)
{
throw new Exception("Forbidden value (" + this.ServerId + ") on element serverId.");
}
writer.WriteVarShort(this.ServerId);
writer.WriteUTF(this.Address);
if (this.Port < 0 || this.Port > 65535)
{
throw new Exception("Forbidden value (" + this.Port + ") on element port.");
}
writer.WriteShort((short)this.Port);
writer.WriteBoolean(this.CanCreateNewCharacter);
writer.WriteVarInt(this.Ticket.Length);
uint _loc2_ = 0;
while (_loc2_ < this.Ticket.Length)
{
writer.WriteSByte(this.Ticket[_loc2_]);
_loc2_++;
}
}
public override void Deserialize(IDataReader reader)
{
this.ServerId = (ushort)reader.ReadVarShort();
bool flag = this.ServerId < 0;
if (flag)
{
throw new Exception("Forbidden value on ServerId = " + this.ServerId + ", it doesn't respect the following condition : serverId < 0");
}
this.Address = reader.ReadUTF();
this.Port = reader.ReadUShort();
bool flag2 = this.Port < 0 || this.Port > 65535;
if (flag2)
{
throw new Exception("Forbidden value on Port = " + this.Port + ", it doesn't respect the following condition : port < 0 || port > 65535");
}
this.CanCreateNewCharacter = reader.ReadBoolean();
int num = reader.ReadVarInt();
this.Ticket = new sbyte[num];
for (int i = 0; i < num; i++)
{
this.Ticket = reader.ReadSByte();
}
}