Ejemplo n.º 1
0
        public void Read(TDSReader r, int headerLength)
        {
            int    ReadLength = 4;
            ushort IDLength;
            ushort DeploymentLength;

            IDLength         = r.ReadUInt16();
            NotifyID         = r.ReadUnicodeString(IDLength / 2);         // IDLength is supposed to be BYTEs rather than Characters - according to the spec
            DeploymentLength = r.ReadUInt16();
            SSBDeployment    = r.ReadUnicodeString(DeploymentLength / 2); // spec section 2.2.5.3.1 (p33/195) says it is a count of bytes not chars
            ReadLength      += 4 + IDLength + DeploymentLength;           // multiply these guys by 2 if it turns out they a char counts - but spec says bytes
            if (ReadLength == headerLength - 4)
            {
                fHasTimeout   = true;
                NotifyTimeout = r.ReadUInt32();
                ReadLength   += 4;
            }
            if (ReadLength != headerLength)
            {
                throw new InvalidTDSException("Query notification header length (" + headerLength + ") does not match bytes read (" + ReadLength + ").");
            }
        }