コード例 #1
0
        public override DataType GetResponseDataType()
        {
            DataType result;

            try
            {
                if (this.endOfStream)
                {
                    result = DataType.Undetermined;
                }
                else
                {
                    if (this.dimeReader == null)
                    {
                        this.dimeReader        = new DimeReader(this.bufferedStream);
                        this.dimeRecordForRead = this.dimeReader.ReadRecord();
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace = new StackTrace();
                            stackTrace.GetFrame(1).GetMethod();
                        }
                        this.DetermineNegotiatedOptions();
                    }
                    if (this.dimeRecordForRead == null)
                    {
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace2 = new StackTrace();
                            stackTrace2.GetFrame(1).GetMethod();
                        }
                        this.dimeReader.Close();
                        this.dimeReader  = null;
                        this.endOfStream = true;
                        result           = DataType.Undetermined;
                    }
                    else
                    {
                        DataType dataTypeFromString = DataTypes.GetDataTypeFromString(this.dimeRecordForRead.Type);
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace3 = new StackTrace();
                            stackTrace3.GetFrame(1).GetMethod();
                        }
                        if (dataTypeFromString == DataType.Unknown)
                        {
                            throw new AdomdUnknownResponseException(XmlaSR.Dime_DataTypeNotSupported(this.dimeRecordForRead.Type), "");
                        }
                        result = dataTypeFromString;
                    }
                }
            }
            catch (XmlaStreamException)
            {
                throw;
            }
            catch (IOException innerException)
            {
                throw new XmlaStreamException(innerException);
            }
            catch (SocketException innerException2)
            {
                throw new XmlaStreamException(innerException2);
            }
            return(result);
        }
コード例 #2
0
        public override int Read(byte[] buffer, int offset, int size)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(null);
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if (size < 0)
            {
                throw new ArgumentOutOfRangeException("size");
            }
            if (size + offset > buffer.Length)
            {
                throw new ArgumentException(XmlaSR.InvalidArgument, "buffer");
            }
            int result;

            try
            {
                if (size == 0 || this.endOfStream)
                {
                    result = 0;
                }
                else
                {
                    if (this.dimeReader == null)
                    {
                        this.dimeReader        = new DimeReader(this.bufferedStream);
                        this.dimeRecordForRead = this.dimeReader.ReadRecord();
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace = new StackTrace();
                            stackTrace.GetFrame(1).GetMethod();
                        }
                    }
                    if (this.dimeRecordForRead == null)
                    {
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace2 = new StackTrace();
                            stackTrace2.GetFrame(1).GetMethod();
                        }
                        this.dimeReader.Close();
                        this.dimeReader  = null;
                        this.endOfStream = true;
                        result           = 0;
                    }
                    else
                    {
                        int num = this.dimeRecordForRead.ReadBody(buffer, offset, size);
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace3 = new StackTrace();
                            stackTrace3.GetFrame(1).GetMethod();
                        }
                        if (num == 0)
                        {
                            this.dimeRecordForRead.Close();
                            this.dimeReader.Close();
                            this.dimeRecordForRead = null;
                            this.dimeReader        = null;
                            this.endOfStream       = true;
                        }
                        result = num;
                    }
                }
            }
            catch (XmlaStreamException)
            {
                throw;
            }
            catch (IOException innerException)
            {
                throw new XmlaStreamException(innerException);
            }
            catch (SocketException innerException2)
            {
                throw new XmlaStreamException(innerException2);
            }
            return(result);
        }