Пример #1
0
        protected Exception CreateException(InvalidDataException innerException, string framingFault)
        {
            Exception exception = this.CreateException(innerException);

            FramingEncodingString.AddFaultString(exception, framingFault);
            return(exception);
        }
        protected override Exception OnSizeQuotaExceeded(int size)
        {
            string framingContentTypeTooLong = Resources.FramingContentTypeTooLong;

            object[]  objArray             = new object[] { size };
            Exception invalidDataException = new InvalidDataException(Microsoft.ServiceBus.SR.GetString(framingContentTypeTooLong, objArray));

            FramingEncodingString.AddFaultString(invalidDataException, "http://schemas.microsoft.com/ws/2006/05/framing/faults/ContentTypeTooLong");
            return(invalidDataException);
        }
        private bool ContinueReading()
        {
            int    num;
            string str;

            while (true)
            {
                if (this.size == 0)
                {
                    if (ConnectionModeReader.readCallback == null)
                    {
                        ConnectionModeReader.readCallback = new WaitCallback(ConnectionModeReader.ReadCallback);
                    }
                    if (base.Connection.BeginRead(0, base.Connection.AsyncReadBufferSize, this.GetRemainingTimeout(), ConnectionModeReader.readCallback, this) == AsyncReadResult.Queued)
                    {
                        break;
                    }
                    if (!this.GetReadResult())
                    {
                        return(false);
                    }
                }
                do
                {
                    try
                    {
                        num = this.decoder.Decode(this.buffer, this.offset, this.size);
                    }
                    catch (CommunicationException communicationException)
                    {
                        if (FramingEncodingString.TryGetFaultString(communicationException, out str))
                        {
                            byte[] numArray = new byte[128];
                            InitialServerConnectionReader.SendFault(base.Connection, str, numArray, this.GetRemainingTimeout(), base.MaxViaSize + base.MaxContentTypeSize);
                            base.Close(this.GetRemainingTimeout());
                        }
                        throw;
                    }
                    if (num > 0)
                    {
                        ConnectionModeReader connectionModeReader = this;
                        connectionModeReader.offset = connectionModeReader.offset + num;
                        ConnectionModeReader connectionModeReader1 = this;
                        connectionModeReader1.size = connectionModeReader1.size - num;
                    }
                    if (this.decoder.CurrentState != ServerModeDecoder.State.Done)
                    {
                        continue;
                    }
                    return(true);
                }while (this.size != 0);
            }
            return(false);
        }