コード例 #1
0
ファイル: Packets.cs プロジェクト: txdv/LibuvSharp.MySql
		public static MySqlConnectionPacket Parse(PacketReader packetReader)
		{
			MySqlConnectionPacket packet = new MySqlConnectionPacket();
			packet.ProtocolVersion    = packetReader.ReadByte();
			packet.ServerVersion      = DatabaseVersion.Parse(packetReader.ReadString(Encoding.ASCII));
			packet.ThreadId           = packetReader.ReadInt();
			packet.ScrambleBuffer     = packetReader.ReadBytes(sizeof(long));
			packet.Filler             = packetReader.ReadByte();
			packet.ServerCapabilities = packetReader.ReadShort();
			packet.ServerLanguage     = packetReader.ReadByte();
			packet.ServerStatus       = packetReader.ReadShort();
			packet.ServerCapabilitiesUpper = packetReader.ReadShort();
			packet.ScrambleLength     = packetReader.ReadByte();
			packet.SecondFiller       = packetReader.ReadBytes(10);
			
			packetReader.ReadByte();
			
			packet.SecondScramble  = packetReader.ReadBytes(packetReader.Length - packetReader.Position - 1);
			
			return packet;
		}
コード例 #2
0
ファイル: Packets.cs プロジェクト: PlumpMath/LibuvSharp.MySql
        public static MySqlConnectionPacket Parse(PacketReader packetReader)
        {
            MySqlConnectionPacket packet = new MySqlConnectionPacket();

            packet.ProtocolVersion         = packetReader.ReadByte();
            packet.ServerVersion           = DatabaseVersion.Parse(packetReader.ReadString(Encoding.ASCII));
            packet.ThreadId                = packetReader.ReadInt();
            packet.ScrambleBuffer          = packetReader.ReadBytes(sizeof(long));
            packet.Filler                  = packetReader.ReadByte();
            packet.ServerCapabilities      = packetReader.ReadShort();
            packet.ServerLanguage          = packetReader.ReadByte();
            packet.ServerStatus            = packetReader.ReadShort();
            packet.ServerCapabilitiesUpper = packetReader.ReadShort();
            packet.ScrambleLength          = packetReader.ReadByte();
            packet.SecondFiller            = packetReader.ReadBytes(10);

            packetReader.ReadByte();

            packet.SecondScramble = packetReader.ReadBytes(packetReader.Length - packetReader.Position - 1);

            return(packet);
        }
コード例 #3
0
        public static FieldPacket Parse(PacketReader packetReader)
        {
            return(new FieldPacket()
            {
                Catalog = packetReader.ReadLengthString(),
                Database = packetReader.ReadLengthString(),
                Table = packetReader.ReadLengthString(),
                OriginalTable = packetReader.ReadLengthString(),
                Name = packetReader.ReadLengthString(),
                OriginalName = packetReader.ReadLengthString(),

                Filler = packetReader.ReadByte(),

                CharsetNumber = packetReader.ReadShort(),
                Length = packetReader.ReadInt(),
                Type = (MySqlDbType)packetReader.ReadByte(),
                Flags = (ColumnFlags)packetReader.ReadShort(),
                Decimals = packetReader.ReadByte(),

                Filler2 = packetReader.ReadBytes(2),
                Default = packetReader.ReadLengthBytes()
            });
        }
コード例 #4
0
ファイル: Response.cs プロジェクト: txdv/LibuvSharp.MySql
		public static FieldPacket Parse(PacketReader packetReader)
		{
			return new FieldPacket() {
				Catalog       = packetReader.ReadLengthString(),
				Database      = packetReader.ReadLengthString(),
				Table         = packetReader.ReadLengthString(),
				OriginalTable = packetReader.ReadLengthString(),
				Name          = packetReader.ReadLengthString(),
				OriginalName  = packetReader.ReadLengthString(),
				
				Filler = packetReader.ReadByte(),
				
				CharsetNumber = packetReader.ReadShort(),
				Length        = packetReader.ReadInt(),
				Type          = (MySqlDbType)packetReader.ReadByte(),
				Flags         = (ColumnFlags)packetReader.ReadShort(),
				Decimals      = packetReader.ReadByte(),
				
				Filler2 = packetReader.ReadBytes(2),
				Default = packetReader.ReadLengthBytes()
			};
		}