protected void ValidateRecordType(FramingRecordType expectedType, FramingRecordType foundType) { if (foundType != expectedType) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.CreateInvalidRecordTypeException(expectedType, foundType)); } }
protected void ValidateRecordType(FramingRecordType expectedType, FramingRecordType foundType) { if (foundType != expectedType) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateInvalidRecordTypeException(expectedType, foundType)); } }
private static Exception CreateInvalidRecordTypeException(FramingRecordType expectedType, FramingRecordType foundType) { string framingRecordTypeMismatch = Resources.FramingRecordTypeMismatch; object[] str = new object[] { expectedType.ToString(), foundType.ToString() }; return(new InvalidDataException(Microsoft.ServiceBus.SR.GetString(framingRecordTypeMismatch, str))); }
protected void ValidateRecordType(FramingRecordType expectedType, FramingRecordType foundType) { if (foundType != expectedType) { throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(FramingDecoder.CreateInvalidRecordTypeException(expectedType, foundType)); } }
internal EncodedFramingRecord(FramingRecordType recordType, string value) { int byteCount = Encoding.UTF8.GetByteCount(value); int encodedSize = IntEncoder.GetEncodedSize(byteCount); this.encodedBytes = DiagnosticUtility.Utility.AllocateByteArray((1 + encodedSize) + byteCount); this.encodedBytes[0] = (byte) recordType; int offset = 1; offset += IntEncoder.Encode(byteCount, this.encodedBytes, offset); Encoding.UTF8.GetBytes(value, 0, value.Length, this.encodedBytes, offset); this.SetEncodedBytes(this.encodedBytes); }
internal EncodedFramingRecord(FramingRecordType recordType, string value) { int valueByteCount = Encoding.UTF8.GetByteCount(value); int sizeByteCount = IntEncoder.GetEncodedSize(valueByteCount); _encodedBytes = Fx.AllocateByteArray(checked(1 + sizeByteCount + valueByteCount)); _encodedBytes[0] = (byte)recordType; int offset = 1; offset += IntEncoder.Encode(valueByteCount, _encodedBytes, offset); Encoding.UTF8.GetBytes(value, 0, value.Length, _encodedBytes, offset); SetEncodedBytes(_encodedBytes); }
protected void ValidatePreambleAck(FramingRecordType foundType) { string str; if (foundType != FramingRecordType.PreambleAck) { Exception exception = FramingDecoder.CreateInvalidRecordTypeException(FramingRecordType.PreambleAck, foundType); str = ((byte)foundType == 104 || (byte)foundType == 72 ? Microsoft.ServiceBus.SR.GetString(Resources.PreambleAckIncorrectMaybeHttp, new object[0]) : Microsoft.ServiceBus.SR.GetString(Resources.PreambleAckIncorrect, new object[0])); throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(str, exception)); } }
internal EncodedFramingRecord(FramingRecordType recordType, string value) { int byteCount = Encoding.UTF8.GetByteCount(value); int encodedSize = IntEncoder.GetEncodedSize(byteCount); this.encodedBytes = DiagnosticUtility.Utility.AllocateByteArray((1 + encodedSize) + byteCount); this.encodedBytes[0] = (byte)recordType; int offset = 1; offset += IntEncoder.Encode(byteCount, this.encodedBytes, offset); Encoding.UTF8.GetBytes(value, 0, value.Length, this.encodedBytes, offset); this.SetEncodedBytes(this.encodedBytes); }
internal EncodedFramingRecord(FramingRecordType recordType, string value) { int valueByteCount = Encoding.UTF8.GetByteCount(value); int sizeByteCount = IntEncoder.GetEncodedSize(valueByteCount); _encodedBytes = Fx.AllocateByteArray(checked (1 + sizeByteCount + valueByteCount)); _encodedBytes[0] = (byte)recordType; int offset = 1; offset += IntEncoder.Encode(valueByteCount, _encodedBytes, offset); Encoding.UTF8.GetBytes(value, 0, value.Length, _encodedBytes, offset); SetEncodedBytes(_encodedBytes); }
// special validation for Preamble Ack for usability purposes (MB#39593) protected void ValidatePreambleAck(FramingRecordType foundType) { if (foundType != FramingRecordType.PreambleAck) { Exception inner = CreateInvalidRecordTypeException(FramingRecordType.PreambleAck, foundType); string exceptionString; if (((byte)foundType == 'h') || ((byte)foundType == 'H')) { exceptionString = SRServiceModel.PreambleAckIncorrectMaybeHttp; } else { exceptionString = SRServiceModel.PreambleAckIncorrect; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(exceptionString, inner)); } }
protected void ValidatePreambleAck(FramingRecordType foundType) { if (foundType != FramingRecordType.PreambleAck) { string str; Exception innerException = this.CreateInvalidRecordTypeException(FramingRecordType.PreambleAck, foundType); if ((((byte) foundType) == 0x68) || (((byte) foundType) == 0x48)) { str = System.ServiceModel.SR.GetString("PreambleAckIncorrectMaybeHttp"); } else { str = System.ServiceModel.SR.GetString("PreambleAckIncorrect"); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(str, innerException)); } }
protected void ValidatePreambleAck(FramingRecordType foundType) { if (foundType != FramingRecordType.PreambleAck) { string str; Exception innerException = this.CreateInvalidRecordTypeException(FramingRecordType.PreambleAck, foundType); if ((((byte)foundType) == 0x68) || (((byte)foundType) == 0x48)) { str = System.ServiceModel.SR.GetString("PreambleAckIncorrectMaybeHttp"); } else { str = System.ServiceModel.SR.GetString("PreambleAckIncorrect"); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(str, innerException)); } }
private Exception CreateInvalidRecordTypeException(FramingRecordType expectedType, FramingRecordType foundType) { return(new InvalidDataException(string.Format(SRServiceModel.FramingRecordTypeMismatch, expectedType.ToString(), foundType.ToString()))); }
// special validation for Preamble Ack for usability purposes (MB#39593) protected void ValidatePreambleAck(FramingRecordType foundType) { if (foundType != FramingRecordType.PreambleAck) { Exception inner = CreateInvalidRecordTypeException(FramingRecordType.PreambleAck, foundType); string exceptionString; if (((byte)foundType == 'h') || ((byte)foundType == 'H')) { exceptionString = SR.GetString(SR.PreambleAckIncorrectMaybeHttp); } else { exceptionString = SR.GetString(SR.PreambleAckIncorrect); } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(exceptionString, inner)); } }
Exception CreateInvalidRecordTypeException(FramingRecordType expectedType, FramingRecordType foundType) { return new InvalidDataException(SR.GetString(SR.FramingRecordTypeMismatch, expectedType.ToString(), foundType.ToString())); }
private Exception CreateInvalidRecordTypeException(FramingRecordType expectedType, FramingRecordType foundType) { return new InvalidDataException(System.ServiceModel.SR.GetString("FramingRecordTypeMismatch", new object[] { expectedType.ToString(), foundType.ToString() })); }
private Exception CreateInvalidRecordTypeException(FramingRecordType expectedType, FramingRecordType foundType) { return(new InvalidDataException(System.ServiceModel.SR.GetString("FramingRecordTypeMismatch", new object[] { expectedType.ToString(), foundType.ToString() }))); }