コード例 #1
0
 private bool IsBindingElementsMatch(BinaryMessageEncodingBindingElement binaryEncoding, NetMessagingTransportBindingElement netMessagingTransport)
 {
     if (!NetMessagingBinding.IsTransportMatch(this.transport, netMessagingTransport))
     {
         return(false);
     }
     if (!NetMessagingBinding.IsEncodingMatch(this.encoder, binaryEncoding))
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
        private static bool IsEncodingMatch(BindingElement a, BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            if (!(b is MessageEncodingBindingElement))
            {
                return(false);
            }
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement  = a as BinaryMessageEncodingBindingElement;
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement1 = b as BinaryMessageEncodingBindingElement;

            if (binaryMessageEncodingBindingElement1 == null)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.MaxReadPoolSize != binaryMessageEncodingBindingElement1.MaxReadPoolSize)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.MaxWritePoolSize != binaryMessageEncodingBindingElement1.MaxWritePoolSize)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.ReaderQuotas.MaxStringContentLength != binaryMessageEncodingBindingElement1.ReaderQuotas.MaxStringContentLength)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.ReaderQuotas.MaxArrayLength != binaryMessageEncodingBindingElement1.ReaderQuotas.MaxArrayLength)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.ReaderQuotas.MaxBytesPerRead != binaryMessageEncodingBindingElement1.ReaderQuotas.MaxBytesPerRead)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.ReaderQuotas.MaxDepth != binaryMessageEncodingBindingElement1.ReaderQuotas.MaxDepth)
            {
                return(false);
            }
            if (binaryMessageEncodingBindingElement.ReaderQuotas.MaxNameTableCharCount != binaryMessageEncodingBindingElement1.ReaderQuotas.MaxNameTableCharCount)
            {
                return(false);
            }
            if (!NetMessagingBinding.IsMessageVersionMatch(binaryMessageEncodingBindingElement.MessageVersion, binaryMessageEncodingBindingElement1.MessageVersion))
            {
                return(false);
            }
            return(true);
        }
コード例 #3
0
        internal static bool TryCreate(BindingElementCollection elements, out NetMessagingBinding binding)
        {
            bool flag;

            binding = null;
            if (elements.Count > 2)
            {
                return(false);
            }
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = null;
            NetMessagingTransportBindingElement netMessagingTransportBindingElement = null;

            using (IEnumerator <BindingElement> enumerator = elements.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BindingElement current = enumerator.Current;
                    if (current is TransportBindingElement)
                    {
                        netMessagingTransportBindingElement = current as NetMessagingTransportBindingElement;
                    }
                    else if (!(current is BinaryMessageEncodingBindingElement))
                    {
                        flag = false;
                        return(flag);
                    }
                    else
                    {
                        binaryMessageEncodingBindingElement = current as BinaryMessageEncodingBindingElement;
                    }
                }
                if (netMessagingTransportBindingElement == null)
                {
                    return(false);
                }
                if (binaryMessageEncodingBindingElement == null)
                {
                    return(false);
                }
                NetMessagingBinding netMessagingBinding = new NetMessagingBinding();
                netMessagingBinding.InitializeFrom(binaryMessageEncodingBindingElement, netMessagingTransportBindingElement);
                if (!netMessagingBinding.IsBindingElementsMatch(binaryMessageEncodingBindingElement, netMessagingTransportBindingElement))
                {
                    return(false);
                }
                binding = netMessagingBinding;
                return(true);
            }
            return(flag);
        }