public override void ParsePacket(PacketParser parser) { ParsePacketHeader(parser); if (protocol41) { clientFlags = parser.ParseUnsigned4(); //4 maxPacketSize = parser.ParseUnsigned4(); //4 charsetNumber = parser.ParseByte(); parser.ParseFiller(23); user = parser.ParseNullTerminatedString(); scrambleBuff = parser.ParseLengthCodedBuffer(); database = parser.ParseNullTerminatedString(); } else { clientFlags = parser.ParseUnsigned2(); //2 maxPacketSize = parser.ParseUnsigned3(); //3 user = parser.ParseNullTerminatedString(); scrambleBuff = parser.ParseBuffer(8); database = parser.ParseLengthCodedString(); } }
public override void ParsePacket(PacketParser parser) { ParsePacketHeader(parser); protocolVersion = parser.ParseUnsigned1(); //1 serverVertion = parser.ParseNullTerminatedString(); threadId = parser.ParseUnsigned4(); //4 scrambleBuff1 = parser.ParseBuffer(8); filler1 = parser.ParseByte(); serverCapabilities1 = parser.ParseUnsigned2(); //2 serverLanguage = parser.ParseByte(); serverStatus = parser.ParseUnsigned2(); //2 protocol41 = (serverCapabilities1 & (1 << 9)) > 0; if (protocol41) { serverCapabilities2 = parser.ParseUnsigned2(); scrambleLength = parser.ParseByte(); filler2 = parser.ParseBuffer(10); scrambleBuff2 = parser.ParseBuffer(12); filler3 = parser.ParseByte(); } else { filler2 = parser.ParseBuffer(13); } if (parser.Position == parser.Length) { return; } pluginData = parser.ParsePacketTerminatedString(); var last = pluginData.Length - 1; if (pluginData[last] == '\0') { pluginData = pluginData.Substring(0, last); } }