Example #1
0
        public byte[] Serialize(PacketBuilder packetBuilder)
        {
            packetBuilder.NewPacket();

            packetBuilder.WriteInt(ClientFlags);
            packetBuilder.WriteInt(MaxPacketSize);
            packetBuilder.WriteByte(CharsetNumber);
            packetBuilder.Write(new byte[23]);
            packetBuilder.WriteString(User);

            if (ScrambleBuffer != null)
            {
                packetBuilder.WriteLengthCodedBinary(ScrambleBuffer);
            }
            else
            {
                packetBuilder.WriteByte(0);
            }

            if (!string.IsNullOrEmpty(Databasename))
            {
                packetBuilder.WriteString(Databasename);
            }

            return(packetBuilder.Serialize(1));
        }
Example #2
0
        public QueryCommand Query(string queryString)
        {
            packetBuilder.NewPacket();
            packetBuilder.WriteByte((byte)DatabaseCommand.QUERY);
            packetBuilder.WriteStringNoNull(queryString);

            var info = new CommandInfo()
            {
                Callback = new QueryCommand(),
                Packet   = packetBuilder.Serialize(0)
            };

            FireFirstCommand(info);

            return(info.Callback);
        }
Example #3
0
		public byte[] Serialize(PacketBuilder packetBuilder)
		{
			packetBuilder.NewPacket();
			
			packetBuilder.WriteInt(ClientFlags);
			packetBuilder.WriteInt(MaxPacketSize);
			packetBuilder.WriteByte(CharsetNumber);
			packetBuilder.Write(new byte[23]);
			packetBuilder.WriteString(User);
			
			if (ScrambleBuffer != null) {
				packetBuilder.WriteLengthCodedBinary(ScrambleBuffer);
			} else {
				packetBuilder.WriteByte(0);
			}
			
			if (!string.IsNullOrEmpty(Databasename)) {
				packetBuilder.WriteString(Databasename);
			}
			
			return packetBuilder.Serialize(1);
		}