예제 #1
0
        public void FromBytes(WspBuffer buffer)
        {
            var header = new WspMessageHeader();

            header.FromBytes(buffer);

            Header = header;

            var request = (CPMConnectIn)Request;

            var tempBuffer = new WspBuffer();

            request.ToBytes(tempBuffer);

            var requestBytes = tempBuffer.GetBytes();

            var responseBytes = buffer.GetBytes().Skip(buffer.ReadOffset).ToArray();

            bool supportVersion = false;

            if (responseBytes.Length >= 20)
            {
                if (!Enumerable.SequenceEqual(requestBytes.Skip(4).Take(16), responseBytes.Skip(4).Take(16)))
                {
                    supportVersion = true;
                }
            }

            _serverVersion = buffer.ToStruct <uint>();

            if (supportVersion)
            {
                _reserved = new byte[4];

                for (int i = 0; i < 4; i++)
                {
                    _reserved[i] = buffer.ToStruct <byte>();
                }

                dwWinVerMajor = buffer.ToStruct <uint>();

                dwWinVerMinor = buffer.ToStruct <uint>();

                dwNLSVerMajor = buffer.ToStruct <uint>();

                dwNLSVerMinor = buffer.ToStruct <uint>();
            }
            else
            {
                _reserved = buffer.GetBytes().Skip(buffer.ReadOffset).ToArray();

                dwWinVerMajor = null;

                dwWinVerMinor = null;

                dwNLSVerMajor = null;

                dwNLSVerMinor = null;
            }
        }
        public byte[] GetBodyBytes()
        {
            var buffer = new WspBuffer();

            buffer.Add(_hCursor);

            buffer.Add(_cbRow);

            var tempBuffer = new WspBuffer();

            tempBuffer.Add(cColumns);

            foreach (var column in aColumns)
            {
                tempBuffer.AlignWrite(4);

                column.ToBytes(tempBuffer);
            }

            var bytesAfterDummy = tempBuffer.GetBytes();

            _cbBindingDesc = (uint)bytesAfterDummy.Length;

            buffer.Add(_cbBindingDesc);

            buffer.Add(_dummy);

            buffer.AddRange(bytesAfterDummy);

            return(buffer.GetBytes());
        }
예제 #3
0
        public void FromBytes(WspBuffer buffer)
        {
            var header = new WspMessageHeader();

            header.FromBytes(buffer);

            Header = header;

            _fTrueSequential = buffer.ToStruct <uint>();

            _fWorkIdUnique = buffer.ToStruct <uint>();

            int categorizationCount = 0;

            var createQueryIn = (CPMCreateQueryIn)Request;

            if (createQueryIn.CCategorizationSet.HasValue)
            {
                categorizationCount = (int)createQueryIn.CCategorizationSet.Value.count;
            }

            aCursors = new uint[categorizationCount + 1];

            for (int i = 0; i < aCursors.Length; i++)
            {
                uint cursor = buffer.ToStruct <uint>();

                aCursors[i] = cursor;
            }
        }
예제 #4
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(type);
            buffer.AlignWrite(4);

            buffer.Add(ccAlias);

            if (ccAlias != 0)
            {
                buffer.AddUnicodeString(Alias, false);
            }

            buffer.Add(idColumn);

            switch (type)
            {
            case CAggregSpec_type_Values.DBAGGTTYPE_FIRST:
            case CAggregSpec_type_Values.DBAGGTTYPE_BYFREQ:
            case CAggregSpec_type_Values.DBAGGTTYPE_REPRESENTATIVEOF:
                buffer.Add(ulMaxNumToReturn);
                break;
            }

            switch (type)
            {
            case CAggregSpec_type_Values.DBAGGTTYPE_REPRESENTATIVEOF:
                buffer.Add(idRepresentative);
                break;
            }
        }
예제 #5
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(cDims);

            buffer.Add(fFeatures);

            buffer.Add(cbElements);

            foreach (var bound in Rgsabound)
            {
                bound.ToBytes(buffer);
            }

            foreach (var data in vData)
            {
                if (data is IWspStructure)
                {
                    buffer.AlignWrite(4);
                    (data as IWspStructure).ToBytes(buffer);
                }
                else
                {
                    buffer.Add(data, 4);
                }
            }
        }
예제 #6
0
        public byte[] GetBodyBytes()
        {
            var buffer = new WspBuffer();

            buffer.Add(_wid);

            buffer.Add(_cbSoFar);

            var tempBuffer = new WspBuffer();

            PropSpec.ToBytes(tempBuffer);

            var propSpecBytes = tempBuffer.GetBytes();

            _cbPropSpec = (uint)propSpecBytes.Length;

            buffer.Add(_cbPropSpec);

            buffer.Add(_cbChunk);

            buffer.AddRange(propSpecBytes);

            buffer.AlignWrite(4);

            return(buffer.GetBytes());
        }
예제 #7
0
        public void FromBytes(WspBuffer buffer)
        {
            var header = new WspMessageHeader();

            header.FromBytes(buffer);

            Header = header;
        }
예제 #8
0
        public void ToBytes(WspBuffer buffer)
        {
            Header.ToBytes(buffer);

            buffer.Add(_hCursor);

            buffer.Add(_bmk);
        }
        public void FromBytes(WspBuffer buffer)
        {
            vType     = buffer.ToStruct <CBaseStorageVariant_vType_Values>();
            reserved1 = buffer.ToStruct <ushort>();
            reserved2 = buffer.ToStruct <uint>();

            DecodeCount(buffer);
            DecodeOffset(buffer);
        }
예제 #10
0
        private bool IsCPMDisconnectMessage(byte[] messageBlob)
        {
            var buffer = new WspBuffer(messageBlob);
            var header = new WspMessageHeader();

            header.FromBytes(buffer);

            return(header._msg == WspMessageHeader_msg_Values.CPMDisconnect);
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(cLen);

            if (cLen != 0)
            {
                buffer.AddUnicodeString(_string);
            }
        }
        public byte[] GetBodyBytes()
        {
            var buffer = new WspBuffer();

            buffer.Add(_hCursor);

            buffer.Add(_cRowsToTransfer);

            buffer.Add(_cbRowWidth);

            var tempBuffer = new WspBuffer();

            tempBuffer.Add(eType);

            tempBuffer.Add(_chapt);

            switch (SeekDescription)
            {
            case CRowSeekNext seek:
                seek.ToBytes(tempBuffer);
                break;

            case CRowSeekAt seek:
                seek.ToBytes(tempBuffer);
                break;

            case CRowSeekAtRatio seek:
                seek.ToBytes(tempBuffer);
                break;

            case CRowSeekByBookmark seek:
                seek.ToBytes(tempBuffer);
                break;

            default:
                break;
            }

            var bytesFromEType = tempBuffer.GetBytes();

            _cbSeek = (uint)bytesFromEType.Length;

            buffer.Add(_cbSeek);

            buffer.Add(_cbReserved);

            buffer.Add(_cbReadBuffer);

            buffer.Add(_ulClientBase);

            buffer.Add(_fBwdFetch);

            buffer.AddRange(bytesFromEType);

            return(buffer.GetBytes());
        }
예제 #13
0
        public VT_BSTR(string val)
        {
            var buffer = new WspBuffer();

            buffer.AddUnicodeString(val);

            cbSize = (uint)buffer.WriteOffset;

            blobData = buffer.GetBytes();
        }
        public void ToBytes(WspBuffer buffer)
        {
            _Property.ToBytes(buffer);

            buffer.Add(Cc, 4);

            buffer.AddUnicodeString(_pwcsPhrase, false);

            buffer.Add(Lcid, 4);
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(_cNode);

            foreach (var node in _paNode)
            {
                buffer.AlignWrite(4);
                node.ToBytes(buffer);
            }
        }
        public void FromBytes(WspBuffer buffer)
        {
            var header = new WspMessageHeader();

            header.FromBytes(buffer);

            Header = header;

            State = buffer.ToStruct <CPMCiState>();
        }
 public void ToBytes(WspBuffer buffer)
 {
     buffer.Add(count);
     if (aPropSpec != null)
     {
         foreach (var property in aPropSpec)
         {
             property.ToBytes(buffer);
         }
     }
 }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(count);

            foreach (var sort in sortArray)
            {
                buffer.AlignWrite(4);

                sort.ToBytes(buffer);
            }
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(_ulCategType);

            _sortKey.ToBytes(buffer);

            if (CRangeCategSpec.HasValue)
            {
                CRangeCategSpec.Value.ToBytes(buffer);
            }
        }
예제 #20
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(count);

            buffer.Add(_groupPid);

            foreach (var prop in Props)
            {
                prop.ToBytes(buffer);
            }
        }
예제 #21
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(DBPROPID);

            buffer.Add(DBPROPOPTIONS);

            buffer.Add(DBPROPSTATUS);

            colid.ToBytes(buffer);

            vValue.ToBytes(buffer);
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(_relop);

            _Property.ToBytes(buffer);

            buffer.AlignWrite(4);

            _prval.ToBytes(buffer);

            buffer.Add(_lcid, 4);
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(count);

            if (aGroupArray != null)
            {
                foreach (var group in aGroupArray)
                {
                    group.ToBytes(buffer);
                }
            }
        }
예제 #24
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(CcLowerPath);

            buffer.AddUnicodeString(_lowerPath, false);

            buffer.Add(_length, 4);

            buffer.Add(_fRecursive);

            buffer.Add(_fVirtual);
        }
예제 #25
0
        private int GetNullTerminatedUnicodeStringLength(WspBuffer buffer, int startOffset)
        {
            int length = 0;

            while (buffer.Peek <ushort>(startOffset) != 0)
            {
                startOffset += 2;
                length      += 2;
            }

            return(length);
        }
예제 #26
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(count);

            if (categories != null)
            {
                foreach (var category in categories)
                {
                    category.ToBytes(buffer);
                }
            }
        }
예제 #27
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(count);

            if (count != 0)
            {
                foreach (var index in indexes)
                {
                    buffer.Add(index);
                }
            }
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(cCount);

            if (cCount != 0)
            {
                foreach (var sortKey in SortKeys)
                {
                    sortKey.ToBytes(buffer);
                }
            }
        }
예제 #29
0
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(_lcid);

            buffer.Add(cRange);

            foreach (var range in aRangeBegin)
            {
                buffer.AlignWrite(4);

                range.ToBytes(buffer);
            }
        }
        public void ToBytes(WspBuffer buffer)
        {
            buffer.Add(cCount);

            if (cCount != 0)
            {
                foreach (var spec in AggregSpecs)
                {
                    buffer.AlignWrite(4);
                    spec.ToBytes(buffer);
                }
            }
        }