public LoginClusterStatus(byte[] original) { // Initialize a reader for reading PacketReader reader = new PacketReader(original); // Read SWG header operandCount = reader.ReadShort(); opcode = reader.ReadInt(); // Read servers into gameserver list int serverCount = reader.ReadInt(); for(int i = 0; i < serverCount; i++) { GameServer server = new GameServer(); server.ID = reader.ReadInt(); server.IPAddress = reader.ReadASCII(); server.Port = reader.ReadShort(); server.PingPort = reader.ReadShort(); server.Population = reader.ReadInt(); server.MaxCapacity = reader.ReadInt(); server.MaxCharactersPerServer = reader.ReadInt(); server.Distance = reader.ReadInt(); server.Status = reader.ReadInt(); server.Recommended = reader.ReadByte(); gameServers.Add(server); } }
public static SWGPacket Find(byte[] data) { PacketReader reader = new PacketReader(data); reader.ReadShort(); uint opcode = reader.ReadUInt(); switch(opcode) { case 0x3436AEB6: return new LoginClusterStatus(data); default: return new GenericPacket(data); } }
public SOEPacket(byte[] data) { // Begin reading of SOE packet PacketReader reader = new PacketReader(data); SOEOpcode = reader.ReadShort(); // Setup SWG packet buffer and begin to read byte[] swgPacketBuffer = DecryptData(reader.ReadByteArray(data.Length - 4)); // - 4 b/c of (header + footer) PacketReader swgReader = new PacketReader(swgPacketBuffer); Sequence = swgReader.ReadShort(); Multi = swgReader.ReadShort(); while (swgReader.CanSeek()) { int length = swgReader.ReadByte(); if (length == 0) break; SWGPacket packet = PacketLookup.Find(swgReader.ReadByteArray(length)); childPackets.Add(packet); } this.ToArray(); }