示例#1
0
        public override bool Equals(object obj)
        {
            AddressHeader hdr = obj as AddressHeader;

            if (hdr == null)
            {
                return(false);
            }

            StringBuilder builder = new StringBuilder();
            string        hdr1    = GetComparableForm(builder);

            builder.Remove(0, builder.Length);
            string hdr2 = hdr.GetComparableForm(builder);

            if (hdr1.Length != hdr2.Length)
            {
                return(false);
            }

            if (string.CompareOrdinal(hdr1, hdr2) != 0)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public void GetListenAddressAndContext(out EndpointAddress listenAddress, out IDictionary <string, string> context)
        {
            if (this.CallbackAddress == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callbackaddress");
            }
            EndpointAddressBuilder builder = new EndpointAddressBuilder(this.CallbackAddress);
            AddressHeader          header  = null;
            int index = -1;

            for (int i = 0; i < builder.Headers.Count; i++)
            {
                if ((builder.Headers[i].Name == "Context") && (builder.Headers[i].Namespace == "http://schemas.microsoft.com/ws/2006/05/context"))
                {
                    if (header != null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(System.ServiceModel.SR.GetString("MultipleContextHeadersFoundInCallbackAddress")));
                    }
                    header = builder.Headers[i];
                    index  = i;
                }
            }
            if (header != null)
            {
                builder.Headers.RemoveAt(index);
            }
            context       = (header != null) ? ContextMessageHeader.ParseContextHeader(header.GetAddressHeaderReader()).Context : null;
            listenAddress = builder.ToEndpointAddress();
        }
示例#3
0
 internal static void WriteStartHeader(XmlDictionaryWriter writer, AddressHeader parameter, AddressingVersion addressingVersion)
 {
     parameter.WriteStartAddressHeader(writer);
     if (addressingVersion == AddressingVersion.WSAddressing10)
     {
         writer.WriteAttributeString(XD.AddressingDictionary.IsReferenceParameter, XD.Addressing10Dictionary.Namespace, "true");
     }
 }
示例#4
0
        public override bool Equals(object obj)
        {
            AddressHeader o = obj as AddressHeader;

            if (o == null)
            {
                return(false);
            }

            return(o.Name == this.Name && o.Namespace == this.Namespace);
        }
示例#5
0
        private bool CreateUniqueLocalAddress(out EndpointAddress address, out int priority)
        {
            long num = Interlocked.Increment(ref channelCount);

            if (num > 1L)
            {
                AddressHeader header = AddressHeader.CreateAddressHeader(XD.UtilityDictionary.UniqueEndpointHeaderName, XD.UtilityDictionary.UniqueEndpointHeaderNamespace, num);
                address  = new EndpointAddress(this.innerChannelListener.Uri, new AddressHeader[] { header });
                priority = 1;
                return(true);
            }
            address  = new EndpointAddress(this.innerChannelListener.Uri, new AddressHeader[0]);
            priority = 0;
            return(false);
        }
示例#6
0
        bool CreateUniqueLocalAddress(out EndpointAddress address, out int priority)
        {
            long tempChannelCount = Interlocked.Increment(ref channelCount);

            if (tempChannelCount > 1)
            {
                AddressHeader uniqueEndpointHeader = AddressHeader.CreateAddressHeader(XD.UtilityDictionary.UniqueEndpointHeaderName,
                                                                                       XD.UtilityDictionary.UniqueEndpointHeaderNamespace, tempChannelCount);
                address  = new EndpointAddress(this.innerChannelListener.Uri, uniqueEndpointHeader);
                priority = 1;
                return(true);
            }
            else
            {
                address  = new EndpointAddress(this.innerChannelListener.Uri);
                priority = 0;
                return(false);
            }
        }
        public override bool Equals(object obj)
        {
            AddressHeader header = obj as AddressHeader;

            if (header == null)
            {
                return(false);
            }
            StringBuilder builder        = new StringBuilder();
            string        comparableForm = this.GetComparableForm(builder);

            builder.Remove(0, builder.Length);
            string strB = header.GetComparableForm(builder);

            if (comparableForm.Length != strB.Length)
            {
                return(false);
            }
            if (string.CompareOrdinal(comparableForm, strB) != 0)
            {
                return(false);
            }
            return(true);
        }
示例#8
0
 internal static void WriteHeaderContents(XmlDictionaryWriter writer, AddressHeader parameter)
 {
     parameter.WriteAddressHeaderContents(writer);
 }
示例#9
0
 public ParameterHeader(AddressHeader parameter)
 {
     this.parameter = parameter;
 }
示例#10
0
 public ParameterHeader(AddressHeader parameter)
 {
     _parameter = parameter;
 }
 public DictionaryAddressHeader(XmlDictionaryString name, XmlDictionaryString ns, object value) : base(name.Value, ns.Value, value, DataContractSerializerDefaults.CreateSerializer(AddressHeader.GetObjectType(value), name, ns, 0x7fffffff))
 {
     this.name = name;
     this.ns   = ns;
 }