Exemplo n.º 1
0
        protected override bool ReadDetails(byte[] buf)
        {
            int pos = PacketHeader.PacketHeaderSize;
            int l   = sizeof(DB_OPERATION_TYPE);

            byte[] chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            OperationType = (DB_OPERATION_TYPE)BitConverter.ToUInt32(chars);

            pos  += l;
            l     = sizeof(ASKDBOPERATION_RESULT);
            chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            Result = (ASKDBOPERATION_RESULT)BitConverter.ToUInt32(chars);

            pos  += l;
            l     = sizeof(byte);
            chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            DatabaseNameSize = chars[0];

            pos   = pos + l;
            l     = (int)DatabaseNameSize;
            chars = new byte[DatabaseNameSize];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            DatabaseName = Encoding.ASCII.GetString(chars);
            return(true);
        }
Exemplo n.º 2
0
        protected override bool ReadDetails(byte[] buf)
        {
            int pos = PacketHeader.PacketHeaderSize;
            int l   = sizeof(DB_MANIPULATE_TYPE);

            byte[] chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            ManipulateType = (DB_MANIPULATE_TYPE)BitConverter.ToUInt32(chars);

            pos  += l;
            l     = sizeof(ASKDBOPERATION_RESULT);
            chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            Result = (ASKDBOPERATION_RESULT)BitConverter.ToUInt32(chars);

            return(true);
        }
Exemplo n.º 3
0
        protected override bool ReadDetails(byte[] buf)
        {
            int pos = PacketHeader.PacketHeaderSize;
            int l   = sizeof(DB_QUERY_TYPE);

            byte[] chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            QueryType = (DB_QUERY_TYPE)BitConverter.ToUInt32(chars);

            pos   = pos + l;
            l     = sizeof(ASKDBOPERATION_RESULT);
            chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            Result = (ASKDBOPERATION_RESULT)BitConverter.ToUInt32(chars);

            pos   = pos + l;
            l     = sizeof(uint);
            chars = new byte[l];
            System.Buffer.BlockCopy(buf, pos, chars, 0, l);
            ValuesSize = BitConverter.ToUInt32(chars);
            Values     = new List <string>();
            for (int i = 0; i < ValuesSize; i++)
            {
                pos   = pos + l;
                l     = sizeof(uint);
                chars = new byte[l];
                System.Buffer.BlockCopy(buf, pos, chars, 0, l);
                uint valueSize = BitConverter.ToUInt32(chars);

                pos   = pos + l;
                l     = (int)valueSize;
                chars = new byte[valueSize];
                System.Buffer.BlockCopy(buf, pos, chars, 0, l);
                string s = Encoding.ASCII.GetString(chars);
                Values.Add(s);
            }

            return(true);
        }