public AddressingDictionary(ServiceModelDictionary dictionary)
 {
     this.Action = dictionary.CreateString("Action", 5);
     this.To = dictionary.CreateString("To", 6);
     this.RelatesTo = dictionary.CreateString("RelatesTo", 9);
     this.MessageId = dictionary.CreateString("MessageID", 13);
     this.Address = dictionary.CreateString("Address", 0x15);
     this.ReplyTo = dictionary.CreateString("ReplyTo", 0x16);
     this.Empty = dictionary.CreateString("", 0x51);
     this.From = dictionary.CreateString("From", 0x52);
     this.FaultTo = dictionary.CreateString("FaultTo", 0x53);
     this.EndpointReference = dictionary.CreateString("EndpointReference", 0x54);
     this.PortType = dictionary.CreateString("PortType", 0x55);
     this.ServiceName = dictionary.CreateString("ServiceName", 0x56);
     this.PortName = dictionary.CreateString("PortName", 0x57);
     this.ReferenceProperties = dictionary.CreateString("ReferenceProperties", 0x58);
     this.RelationshipType = dictionary.CreateString("RelationshipType", 0x59);
     this.Reply = dictionary.CreateString("Reply", 90);
     this.Prefix = dictionary.CreateString("a", 0x5b);
     this.IdentityExtensionNamespace = dictionary.CreateString("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity", 0x5c);
     this.Identity = dictionary.CreateString("Identity", 0x5d);
     this.Spn = dictionary.CreateString("Spn", 0x5e);
     this.Upn = dictionary.CreateString("Upn", 0x5f);
     this.Rsa = dictionary.CreateString("Rsa", 0x60);
     this.Dns = dictionary.CreateString("Dns", 0x61);
     this.X509v3Certificate = dictionary.CreateString("X509v3Certificate", 0x62);
     this.ReferenceParameters = dictionary.CreateString("ReferenceParameters", 100);
     this.IsReferenceParameter = dictionary.CreateString("IsReferenceParameter", 0x65);
 }
Пример #2
0
			public override bool TryAdd (XmlDictionaryString value, out int key)
			{
				if (!base.TryAdd (value, out key))
					return false;
				List.Add (value);
				return true;
			}
Пример #3
0
        public XmlDictionaryString Add(int id, string value)
        {
            if (id < 0)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(SR.Format(SR.XmlInvalidID)));
            if (value == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
            XmlDictionaryString xmlString;
            if (TryLookup(id, out xmlString))
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.XmlIDDefined)));

            xmlString = new XmlDictionaryString(this, value, id);
            if (id >= MaxArrayEntries)
            {
                if (_stringDict == null)
                    _stringDict = new Dictionary<int, XmlDictionaryString>();

                _stringDict.Add(id, xmlString);
            }
            else
            {
                if (_strings == null)
                {
                    _strings = new XmlDictionaryString[Math.Max(id + 1, 16)];
                }
                else if (id >= _strings.Length)
                {
                    XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
                    Array.Copy(_strings, 0, newStrings, 0, _strings.Length);
                    _strings = newStrings;
                }
                _strings[id] = xmlString;
            }
            return xmlString;
        }
Пример #4
0
        public bool TryLookup(string value, out XmlDictionaryString result)
        {
            if (value == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");

            if (_strings != null)
            {
                for (int i = 0; i < _strings.Length; i++)
                {
                    XmlDictionaryString s = _strings[i];
                    if (s != null && s.Value == value)
                    {
                        result = s;
                        return true;
                    }
                }
            }

            if (_stringDict != null)
            {
                foreach (XmlDictionaryString s in _stringDict.Values)
                {
                    if (s.Value == value)
                    {
                        result = s;
                        return true;
                    }
                }
            }

            result = null;
            return false;
        }
Пример #5
0
        public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver,
                                            out System.Xml.XmlDictionaryString typeName,
                                            out System.Xml.XmlDictionaryString typeNamespace)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (declaredType == null)
            {
                throw new ArgumentNullException("declaredType");
            }
            if (knownTypeResolver == null)
            {
                throw new ArgumentNullException("knownTypeResolver");
            }

            if (knownTypeResolver.TryResolveType(type, declaredType, knownTypeResolver, out typeName, out typeNamespace))
            {
                return(true);
            }

            if (type.IsPrimitive && declaredType == typeof(object))
            {
                return(knownTypeResolver.TryResolveType(type, type, knownTypeResolver, out typeName, out typeNamespace));
            }

            XmlDictionary dict = new XmlDictionary();

            typeNamespace = dict.Add(xmlNamespace);
            typeName      = dict.Add(type.AssemblyQualifiedName);

            return(true);
        }
Пример #6
0
        private EnvelopeVersion(string ultimateReceiverActor, string nextDestinationActorValue,
            string ns, XmlDictionaryString dictionaryNs, string actor, XmlDictionaryString dictionaryActor,
            string toStringFormat, string senderFaultName, string receiverFaultName)
        {
            _toStringFormat = toStringFormat;
            _ultimateDestinationActor = ultimateReceiverActor;
            _nextDestinationActorValue = nextDestinationActorValue;
            _ns = ns;
            _dictionaryNs = dictionaryNs;
            _actor = actor;
            _dictionaryActor = dictionaryActor;
            _senderFaultName = senderFaultName;
            _receiverFaultName = receiverFaultName;

            if (ultimateReceiverActor != null)
            {
                if (ultimateReceiverActor.Length == 0)
                {
                    _mustUnderstandActorValues = new string[] { "", nextDestinationActorValue };
                    _ultimateDestinationActorValues = new string[] { "", nextDestinationActorValue };
                }
                else
                {
                    _mustUnderstandActorValues = new string[] { "", ultimateReceiverActor, nextDestinationActorValue };
                    _ultimateDestinationActorValues = new string[] { "", ultimateReceiverActor, nextDestinationActorValue };
                }
            }
        }
        /// <summary>
        ///     Creates an instance of a class that inherits from <see cref="T:System.Runtime.Serialization.XmlObjectSerializer" />
        ///     for serialization and deserialization processes with an <see cref="T:System.Xml.XmlDictionaryString" /> that
        ///     contains the namespace.
        /// </summary>
        /// <param name="type">The type to serialize or deserialize.</param>
        /// <param name="name">The name of the serialized type.</param>
        /// <param name="ns">An <see cref="T:System.Xml.XmlDictionaryString" /> that contains the namespace of the serialized type.</param>
        /// <param name="knownTypes">
        ///     An <see cref="T:System.Collections.Generic.IList`1" /> of <see cref="T:System.Type" /> that
        ///     contains known types.
        /// </param>
        /// <returns>
        ///     An instance of a class that inherits from the <see cref="T:System.Runtime.Serialization.XmlObjectSerializer" />
        ///     class.
        /// </returns>
        public override XmlObjectSerializer CreateSerializer(Type type, XmlDictionaryString name, XmlDictionaryString ns,
            IList<Type> knownTypes)
        {
            Argument.IsNotNull("type", type);

            return new BinarySerializer(type);
        }
 public ExclusiveC14NDictionary(IXmlDictionary dictionary)
 {
     this.Namespace = this.LookupDictionaryString(dictionary, "http://www.w3.org/2001/10/xml-exc-c14n#");
     this.PrefixList = this.LookupDictionaryString(dictionary, "PrefixList");
     this.InclusiveNamespaces = this.LookupDictionaryString(dictionary, "InclusiveNamespaces");
     this.Prefix = this.LookupDictionaryString(dictionary, "ec");
 }
 private void CheckActualArrayLength(int expectedLength, int actualLength, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
 {
     if (expectedLength != actualLength)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("ArrayExceededSizeAttribute", new object[] { expectedLength, itemName.Value, itemNamespace.Value })));
     }
 }
 public bool TryLookup(int key, out XmlDictionaryString value)
 {
     const int keyThreshold = 32;
     if (key < 0 || key >= count)
     {
         value = null;
         return false;
     }
     XmlDictionaryString s;
     if (key < keyThreshold)
     {
         if (dictionaryStrings1 == null)
             dictionaryStrings1 = new XmlDictionaryString[keyThreshold];
         s = dictionaryStrings1[key];
         if (s == null)
         {
             s = CreateString(strings[key], key);
             dictionaryStrings1[key] = s;
         }
     }
     else
     {
         if (dictionaryStrings2 == null)
             dictionaryStrings2 = new XmlDictionaryString[count - keyThreshold];
         s = dictionaryStrings2[key - keyThreshold];
         if (s == null)
         {
             s = CreateString(strings[key], key);
             dictionaryStrings2[key - keyThreshold] = s;
         }
     }
     value = s;
     return true;
 }
 public XmlSignatureDictionary(IdentityModelDictionary dictionary)
 {
     this.Algorithm = dictionary.CreateString("Algorithm", 0);
     this.URI = dictionary.CreateString("URI", 1);
     this.Reference = dictionary.CreateString("Reference", 2);
     this.Transforms = dictionary.CreateString("Transforms", 4);
     this.Transform = dictionary.CreateString("Transform", 5);
     this.DigestMethod = dictionary.CreateString("DigestMethod", 6);
     this.DigestValue = dictionary.CreateString("DigestValue", 7);
     this.Namespace = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#", 8);
     this.EnvelopedSignature = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#enveloped-signature", 9);
     this.KeyInfo = dictionary.CreateString("KeyInfo", 10);
     this.Signature = dictionary.CreateString("Signature", 11);
     this.SignedInfo = dictionary.CreateString("SignedInfo", 12);
     this.CanonicalizationMethod = dictionary.CreateString("CanonicalizationMethod", 13);
     this.SignatureMethod = dictionary.CreateString("SignatureMethod", 14);
     this.SignatureValue = dictionary.CreateString("SignatureValue", 15);
     this.KeyName = dictionary.CreateString("KeyName", 0x52);
     this.Type = dictionary.CreateString("Type", 0x53);
     this.MgmtData = dictionary.CreateString("MgmtData", 0x54);
     this.Prefix = dictionary.CreateString("", 0x55);
     this.KeyValue = dictionary.CreateString("KeyValue", 0x56);
     this.RsaKeyValue = dictionary.CreateString("RSAKeyValue", 0x57);
     this.Modulus = dictionary.CreateString("Modulus", 0x58);
     this.Exponent = dictionary.CreateString("Exponent", 0x59);
     this.X509Data = dictionary.CreateString("X509Data", 90);
     this.X509IssuerSerial = dictionary.CreateString("X509IssuerSerial", 0x5b);
     this.X509IssuerName = dictionary.CreateString("X509IssuerName", 0x5c);
     this.X509SerialNumber = dictionary.CreateString("X509SerialNumber", 0x5d);
     this.X509Certificate = dictionary.CreateString("X509Certificate", 0x5e);
 }
        public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
        {
            if (type == null)
            {
                typeName = null;
                typeNamespace = null;
                return false;
            }
            if (declaredType != null && declaredType.GetTypeInfo().IsInterface && CollectionDataContract.IsCollectionInterface(declaredType))
            {
                typeName = null;
                typeNamespace = null;
                return true;
            }

            DataContract contract = DataContract.GetDataContract(type);
            if (_context.IsKnownType(contract, contract.KnownDataContracts, declaredType))
            {
                typeName = contract.Name;
                typeNamespace = contract.Namespace;
                return true;
            }
            else
            {
                typeName = null;
                typeNamespace = null;
                return false;
            }
        }
Пример #13
0
 private void ReflectionInitArgs(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces)
 {
     _arg0XmlReader = xmlReader;
     _arg1Context = context;
     _arg2MemberNames = memberNames;
     _arg3MemberNamespaces = memberNamespaces;
 }
 public XmlSignatureDictionary(IXmlDictionary dictionary)
 {
     this.Algorithm = this.LookupDictionaryString(dictionary, "Algorithm");
     this.URI = this.LookupDictionaryString(dictionary, "URI");
     this.Reference = this.LookupDictionaryString(dictionary, "Reference");
     this.Transforms = this.LookupDictionaryString(dictionary, "Transforms");
     this.Transform = this.LookupDictionaryString(dictionary, "Transform");
     this.DigestMethod = this.LookupDictionaryString(dictionary, "DigestMethod");
     this.DigestValue = this.LookupDictionaryString(dictionary, "DigestValue");
     this.Namespace = this.LookupDictionaryString(dictionary, "http://www.w3.org/2000/09/xmldsig#");
     this.EnvelopedSignature = this.LookupDictionaryString(dictionary, "http://www.w3.org/2000/09/xmldsig#enveloped-signature");
     this.KeyInfo = this.LookupDictionaryString(dictionary, "KeyInfo");
     this.Signature = this.LookupDictionaryString(dictionary, "Signature");
     this.SignedInfo = this.LookupDictionaryString(dictionary, "SignedInfo");
     this.CanonicalizationMethod = this.LookupDictionaryString(dictionary, "CanonicalizationMethod");
     this.SignatureMethod = this.LookupDictionaryString(dictionary, "SignatureMethod");
     this.SignatureValue = this.LookupDictionaryString(dictionary, "SignatureValue");
     this.KeyName = this.LookupDictionaryString(dictionary, "KeyName");
     this.Type = this.LookupDictionaryString(dictionary, "Type");
     this.MgmtData = this.LookupDictionaryString(dictionary, "MgmtData");
     this.Prefix = this.LookupDictionaryString(dictionary, "");
     this.KeyValue = this.LookupDictionaryString(dictionary, "KeyValue");
     this.RsaKeyValue = this.LookupDictionaryString(dictionary, "RSAKeyValue");
     this.Modulus = this.LookupDictionaryString(dictionary, "Modulus");
     this.Exponent = this.LookupDictionaryString(dictionary, "Exponent");
     this.X509Data = this.LookupDictionaryString(dictionary, "X509Data");
     this.X509IssuerSerial = this.LookupDictionaryString(dictionary, "X509IssuerSerial");
     this.X509IssuerName = this.LookupDictionaryString(dictionary, "X509IssuerName");
     this.X509SerialNumber = this.LookupDictionaryString(dictionary, "X509SerialNumber");
     this.X509Certificate = this.LookupDictionaryString(dictionary, "X509Certificate");
 }
Пример #15
0
        public override bool TryResolveType(Type type, Type declaredType,
        DataContractResolver knownTypeResolver,
        out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
        {
            if (knownTypeResolver.TryResolveType(type, declaredType,
              null, out typeName, out typeNamespace))
            return true;

              string typeNameString = null;
              if (Resolver.IsCollection(type))
              {
            TryGetCollectionTypeName(type, knownTypeResolver, out typeNameString);
              }
              else if (Resolver.IsArray(type))
              {
            TryGetArrayTypeName(type, knownTypeResolver, out typeNameString);
              }

              if (typeNameString != null)
              {
            typeNamespace = new XmlDictionaryString(XmlDictionary.Empty, Namespaces.DEFAULT, 0);
            typeName = new XmlDictionaryString(XmlDictionary.Empty, typeNameString, 0);
            return true;
              }
              return false;
        }
Пример #16
0
 private void ReflectionReadMembers(object obj, XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces)
 {
     int memberCount = _classContract.MemberNames.Length;
     context.IncrementItemCount(memberCount);
     int memberIndex = -1;
     int firstRequiredMember;
     bool[] requiredMembers = GetRequiredMembers(_classContract, out firstRequiredMember);
     bool hasRequiredMembers = (firstRequiredMember < memberCount);
     int requiredIndex = hasRequiredMembers ? firstRequiredMember : -1;
     int index = -1;
     while (true)
     {
         if (!XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
         {
             return;
         }
         if (hasRequiredMembers)
         {
             index = context.GetMemberIndexWithRequiredMembers(xmlReader, memberNames, memberNamespaces, memberIndex, requiredIndex, null);
         }
         else
         {
             index = context.GetMemberIndex(xmlReader, memberNames, memberNamespaces, memberIndex, null);
         }
         ReflectionReadMember(obj, index, xmlReader, context, memberNames, memberNamespaces);
         memberIndex = index;
         requiredIndex = index + 1;
     }
 }
 public int GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, int memberIndex, ExtensionDataObject extensionData)
 {
     int length = memberNames.Length;
     if (length != 0)
     {
         for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length)
         {
             if (xmlReader.IsStartElement(memberNames[index], XmlDictionaryString.Empty))
             {
                 return index;
             }
         }
         string name;
         if (TryGetJsonLocalName(xmlReader, out name))
         {
             for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length)
             {
                 if (memberNames[index].Value == name)
                 {
                     return index;
                 }
             }
         }
     }
     HandleMemberNotFound(xmlReader, extensionData, memberIndex);
     return length;
 }
Пример #18
0
 public bool TryLookup(XmlDictionaryString key, out XmlDictionaryString value)
 {
     if (key == null)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("key"));
     if (key.Dictionary == this)
     {
         value = key;
         return true;
     }
     if (key.Dictionary == CurrentVersion)
     {
         if (_versionedDictionaryStrings == null)
             _versionedDictionaryStrings = new XmlDictionaryString[CurrentVersion._count];
         XmlDictionaryString s = _versionedDictionaryStrings[key.Key];
         if (s == null)
         {
             if (!TryLookup(key.Value, out s))
             {
                 value = null;
                 return false;
             }
             _versionedDictionaryStrings[key.Key] = s;
         }
         value = s;
         return true;
     }
     value = null;
     return false;
 }
 public OleTxTransactionExternalDictionary(ServiceModelDictionary dictionary)
 {
     this.Namespace = dictionary.CreateString("http://schemas.microsoft.com/ws/2006/02/tx/oletx", 0x160);
     this.Prefix = dictionary.CreateString("oletx", 0x161);
     this.OleTxTransaction = dictionary.CreateString("OleTxTransaction", 0x162);
     this.PropagationToken = dictionary.CreateString("PropagationToken", 0x163);
 }
 public ExclusiveC14NDictionary(ServiceModelDictionary dictionary)
 {
     this.Namespace = dictionary.CreateString("http://www.w3.org/2001/10/xml-exc-c14n#", 0x6f);
     this.PrefixList = dictionary.CreateString("PrefixList", 0x70);
     this.InclusiveNamespaces = dictionary.CreateString("InclusiveNamespaces", 0x71);
     this.Prefix = dictionary.CreateString("ec", 0x72);
 }
		void CheckDictionaryStringArgs (XmlDictionaryString localName, XmlDictionaryString namespaceUri)
		{
			if (localName == null)
				throw new ArgumentNullException ("localName");
			if (namespaceUri == null)
				throw new ArgumentNullException ("namespaceUri");
		}
 public SecureConversationDec2005Dictionary(XmlDictionary dictionary)
 {
     base.SecurityContextToken = dictionary.Add("SecurityContextToken");
     base.AlgorithmAttribute = dictionary.Add("Algorithm");
     base.Generation = dictionary.Add("Generation");
     base.Label = dictionary.Add("Label");
     base.Offset = dictionary.Add("Offset");
     base.Properties = dictionary.Add("Properties");
     base.Identifier = dictionary.Add("Identifier");
     base.Cookie = dictionary.Add("Cookie");
     base.RenewNeededFaultCode = dictionary.Add("RenewNeeded");
     base.BadContextTokenFaultCode = dictionary.Add("BadContextToken");
     base.Prefix = dictionary.Add("sc");
     base.DerivedKeyTokenType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/dk");
     base.SecurityContextTokenType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct");
     base.SecurityContextTokenReferenceValueType = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct");
     base.RequestSecurityContextIssuance = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT");
     base.RequestSecurityContextIssuanceResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT");
     this.RequestSecurityContextRenew = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT/Renew");
     this.RequestSecurityContextRenewResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT/Renew");
     this.RequestSecurityContextClose = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT/Cancel");
     this.RequestSecurityContextCloseResponse = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT/Cancel");
     base.Namespace = dictionary.Add("http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512");
     base.DerivedKeyToken = dictionary.Add("DerivedKeyToken");
     base.Nonce = dictionary.Add("Nonce");
     base.Length = dictionary.Add("Length");
     this.Instance = dictionary.Add("Instance");
 }
 public SecurityAlgorithmDictionary(ServiceModelDictionary dictionary)
 {
     this.Aes128Encryption = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#aes128-cbc", 0x8a);
     this.Aes128KeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#kw-aes128", 0x8b);
     this.Aes192Encryption = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#aes192-cbc", 140);
     this.Aes192KeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#kw-aes192", 0x8d);
     this.Aes256Encryption = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#aes256-cbc", 0x8e);
     this.Aes256KeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#kw-aes256", 0x8f);
     this.DesEncryption = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#des-cbc", 0x90);
     this.DsaSha1Signature = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#dsa-sha1", 0x91);
     this.ExclusiveC14n = dictionary.CreateString("http://www.w3.org/2001/10/xml-exc-c14n#", 0x6f);
     this.ExclusiveC14nWithComments = dictionary.CreateString("http://www.w3.org/2001/10/xml-exc-c14n#WithComments", 0x92);
     this.HmacSha1Signature = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#hmac-sha1", 0x93);
     this.HmacSha256Signature = dictionary.CreateString("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", 0x94);
     this.Psha1KeyDerivation = dictionary.CreateString("http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1", 0x95);
     this.Ripemd160Digest = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#ripemd160", 150);
     this.RsaOaepKeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p", 0x97);
     this.RsaSha1Signature = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#rsa-sha1", 0x98);
     this.RsaSha256Signature = dictionary.CreateString("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", 0x99);
     this.RsaV15KeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#rsa-1_5", 0x9a);
     this.Sha1Digest = dictionary.CreateString("http://www.w3.org/2000/09/xmldsig#sha1", 0x9b);
     this.Sha256Digest = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#sha256", 0x9c);
     this.Sha512Digest = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#sha512", 0x9d);
     this.TripleDesEncryption = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#tripledes-cbc", 0x9e);
     this.TripleDesKeyWrap = dictionary.CreateString("http://www.w3.org/2001/04/xmlenc#kw-tripledes", 0x9f);
     this.TlsSspiKeyWrap = dictionary.CreateString("http://schemas.xmlsoap.org/2005/02/trust/tlsnego#TLS_Wrap", 160);
     this.WindowsSspiKeyWrap = dictionary.CreateString("http://schemas.xmlsoap.org/2005/02/trust/spnego#GSS_Wrap", 0xa1);
 }
Пример #24
0
 internal bool IsLocalName(XmlDictionaryString localName)
 {
     if (dictionaryReader == null)
         return localName.Value == reader.LocalName;
     else
         return dictionaryReader.IsLocalName(localName);
 }
Пример #25
0
        EnvelopeVersion(string ultimateReceiverActor, string nextDestinationActorValue,
            string ns, XmlDictionaryString dictionaryNs, string actor, XmlDictionaryString dictionaryActor,
            string toStringFormat, string senderFaultName, string receiverFaultName)
        {
            this.toStringFormat = toStringFormat;
            this.ultimateDestinationActor = ultimateReceiverActor;
            this.nextDestinationActorValue = nextDestinationActorValue;
            this.ns = ns;
            this.dictionaryNs = dictionaryNs;
            this.actor = actor;
            this.dictionaryActor = dictionaryActor;
            this.senderFaultName = senderFaultName;
            this.receiverFaultName = receiverFaultName;

            if (ultimateReceiverActor != null)
            {
                if (ultimateReceiverActor.Length == 0)
                {
                    mustUnderstandActorValues = new string[] { "", nextDestinationActorValue };
                    ultimateDestinationActorValues = new string[] { "", nextDestinationActorValue };
                }
                else
                {
                    mustUnderstandActorValues = new string[] { "", ultimateReceiverActor, nextDestinationActorValue };
                    ultimateDestinationActorValues = new string[] { "", ultimateReceiverActor, nextDestinationActorValue };
                }
            }
        }
 public ExclusiveC14NDictionary(IdentityModelDictionary dictionary)
 {
     this.Namespace = dictionary.CreateString("http://www.w3.org/2001/10/xml-exc-c14n#", 20);
     this.PrefixList = dictionary.CreateString("PrefixList", 0x15);
     this.InclusiveNamespaces = dictionary.CreateString("InclusiveNamespaces", 0x16);
     this.Prefix = dictionary.CreateString("ec", 0x17);
 }
Пример #27
0
 internal bool IsNamespaceUri(XmlDictionaryString ns)
 {
     if (dictionaryReader == null)
         return ns.Value == reader.NamespaceURI;
     else
         return dictionaryReader.IsNamespaceUri(ns);
 }
 public Wsrm11Dictionary(XmlDictionary dictionary)
 {
     this.AckRequestedAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested");
     this.CloseSequence = dictionary.Add("CloseSequence");
     this.CloseSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence");
     this.CloseSequenceResponse = dictionary.Add("CloseSequenceResponse");
     this.CloseSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequenceResponse");
     this.CreateSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence");
     this.CreateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequenceResponse");
     this.DiscardFollowingFirstGap = dictionary.Add("DiscardFollowingFirstGap");
     this.Endpoint = dictionary.Add("Endpoint");
     this.FaultAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/fault");
     this.Final = dictionary.Add("Final");
     this.IncompleteSequenceBehavior = dictionary.Add("IncompleteSequenceBehavior");
     this.LastMsgNumber = dictionary.Add("LastMsgNumber");
     this.MaxMessageNumber = dictionary.Add("MaxMessageNumber");
     this.Namespace = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702");
     this.NoDiscard = dictionary.Add("NoDiscard");
     this.None = dictionary.Add("None");
     this.SequenceAcknowledgementAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement");
     this.SequenceClosed = dictionary.Add("SequenceClosed");
     this.TerminateSequenceAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequence");
     this.TerminateSequenceResponse = dictionary.Add("TerminateSequenceResponse");
     this.TerminateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequenceResponse");
     this.UsesSequenceSSL = dictionary.Add("UsesSequenceSSL");
     this.UsesSequenceSTR = dictionary.Add("UsesSequenceSTR");
     this.WsrmRequired = dictionary.Add("WsrmRequired");
 }
 public SecurityJan2004Dictionary(ServiceModelDictionary dictionary)
 {
     this.SecurityTokenReference = dictionary.CreateString("SecurityTokenReference", 30);
     this.Namespace = dictionary.CreateString("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", 0x24);
     this.Security = dictionary.CreateString("Security", 0x34);
     this.ValueType = dictionary.CreateString("ValueType", 0x3a);
     this.TypeAttribute = dictionary.CreateString("Type", 0x3b);
     this.Prefix = dictionary.CreateString("o", 0xa4);
     this.NonceElement = dictionary.CreateString("Nonce", 40);
     this.PasswordElement = dictionary.CreateString("Password", 0xa5);
     this.PasswordTextName = dictionary.CreateString("PasswordText", 0xa6);
     this.UserNameElement = dictionary.CreateString("Username", 0xa7);
     this.UserNameTokenElement = dictionary.CreateString("UsernameToken", 0xa8);
     this.BinarySecurityToken = dictionary.CreateString("BinarySecurityToken", 0xa9);
     this.EncodingType = dictionary.CreateString("EncodingType", 170);
     this.Reference = dictionary.CreateString("Reference", 12);
     this.URI = dictionary.CreateString("URI", 11);
     this.KeyIdentifier = dictionary.CreateString("KeyIdentifier", 0xab);
     this.EncodingTypeValueBase64Binary = dictionary.CreateString("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary", 0xac);
     this.EncodingTypeValueHexBinary = dictionary.CreateString("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#HexBinary", 0xad);
     this.EncodingTypeValueText = dictionary.CreateString("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Text", 0xae);
     this.X509SKIValueType = dictionary.CreateString("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier", 0xaf);
     this.KerberosTokenTypeGSS = dictionary.CreateString("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ", 0xb0);
     this.KerberosTokenType1510 = dictionary.CreateString("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ1510", 0xb1);
     this.SamlAssertionIdValueType = dictionary.CreateString("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID", 0xb2);
     this.SamlAssertion = dictionary.CreateString("Assertion", 0xb3);
     this.SamlUri = dictionary.CreateString("urn:oasis:names:tc:SAML:1.0:assertion", 180);
     this.RelAssertionValueType = dictionary.CreateString("http://docs.oasis-open.org/wss/oasis-wss-rel-token-profile-1.0.pdf#license", 0xb5);
     this.FailedAuthenticationFaultCode = dictionary.CreateString("FailedAuthentication", 0xb6);
     this.InvalidSecurityTokenFaultCode = dictionary.CreateString("InvalidSecurityToken", 0xb7);
     this.InvalidSecurityFaultCode = dictionary.CreateString("InvalidSecurity", 0xb8);
     this.KerberosHashValueType = dictionary.CreateString("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#Kerberosv5APREQSHA1", 0x1ab);
 }
 public SamlDictionary(IdentityModelDictionary dictionary)
 {
     this.Access = dictionary.CreateString("Access", 0x18);
     this.AccessDecision = dictionary.CreateString("AccessDecision", 0x19);
     this.Action = dictionary.CreateString("Action", 0x1a);
     this.Advice = dictionary.CreateString("Advice", 0x1b);
     this.Assertion = dictionary.CreateString("Assertion", 0x1c);
     this.AssertionId = dictionary.CreateString("AssertionID", 0x1d);
     this.AssertionIdReference = dictionary.CreateString("AssertionIDReference", 30);
     this.Attribute = dictionary.CreateString("Attribute", 0x1f);
     this.AttributeName = dictionary.CreateString("AttributeName", 0x20);
     this.AttributeNamespace = dictionary.CreateString("AttributeNamespace", 0x21);
     this.AttributeStatement = dictionary.CreateString("AttributeStatement", 0x22);
     this.AttributeValue = dictionary.CreateString("AttributeValue", 0x23);
     this.Audience = dictionary.CreateString("Audience", 0x24);
     this.AudienceRestrictionCondition = dictionary.CreateString("AudienceRestrictionCondition", 0x25);
     this.AuthenticationInstant = dictionary.CreateString("AuthenticationInstant", 0x26);
     this.AuthenticationMethod = dictionary.CreateString("AuthenticationMethod", 0x27);
     this.AuthenticationStatement = dictionary.CreateString("AuthenticationStatement", 40);
     this.AuthorityBinding = dictionary.CreateString("AuthorityBinding", 0x29);
     this.AuthorityKind = dictionary.CreateString("AuthorityKind", 0x2a);
     this.AuthorizationDecisionStatement = dictionary.CreateString("AuthorizationDecisionStatement", 0x2b);
     this.Binding = dictionary.CreateString("Binding", 0x2c);
     this.Condition = dictionary.CreateString("Condition", 0x2d);
     this.Conditions = dictionary.CreateString("Conditions", 0x2e);
     this.Decision = dictionary.CreateString("Decision", 0x2f);
     this.DoNotCacheCondition = dictionary.CreateString("DoNotCacheCondition", 0x30);
     this.Evidence = dictionary.CreateString("Evidence", 0x31);
     this.IssueInstant = dictionary.CreateString("IssueInstant", 50);
     this.Issuer = dictionary.CreateString("Issuer", 0x33);
     this.Location = dictionary.CreateString("Location", 0x34);
     this.MajorVersion = dictionary.CreateString("MajorVersion", 0x35);
     this.MinorVersion = dictionary.CreateString("MinorVersion", 0x36);
     this.Namespace = dictionary.CreateString("urn:oasis:names:tc:SAML:1.0:assertion", 0x37);
     this.NameIdentifier = dictionary.CreateString("NameIdentifier", 0x38);
     this.NameIdentifierFormat = dictionary.CreateString("Format", 0x39);
     this.NameIdentifierNameQualifier = dictionary.CreateString("NameQualifier", 0x3a);
     this.ActionNamespaceAttribute = dictionary.CreateString("Namespace", 0x3b);
     this.NotBefore = dictionary.CreateString("NotBefore", 60);
     this.NotOnOrAfter = dictionary.CreateString("NotOnOrAfter", 0x3d);
     this.PreferredPrefix = dictionary.CreateString("saml", 0x3e);
     this.Statement = dictionary.CreateString("Statement", 0x3f);
     this.Subject = dictionary.CreateString("Subject", 0x40);
     this.SubjectConfirmation = dictionary.CreateString("SubjectConfirmation", 0x41);
     this.SubjectConfirmationData = dictionary.CreateString("SubjectConfirmationData", 0x42);
     this.SubjectConfirmationMethod = dictionary.CreateString("ConfirmationMethod", 0x43);
     this.HolderOfKey = dictionary.CreateString("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key", 0x44);
     this.SenderVouches = dictionary.CreateString("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches", 0x45);
     this.SubjectLocality = dictionary.CreateString("SubjectLocality", 70);
     this.SubjectLocalityDNSAddress = dictionary.CreateString("DNSAddress", 0x47);
     this.SubjectLocalityIPAddress = dictionary.CreateString("IPAddress", 0x48);
     this.SubjectStatement = dictionary.CreateString("SubjectStatement", 0x49);
     this.UnspecifiedAuthenticationMethod = dictionary.CreateString("urn:oasis:names:tc:SAML:1.0:am:unspecified", 0x4a);
     this.NamespaceAttributePrefix = dictionary.CreateString("xmlns", 0x4b);
     this.Resource = dictionary.CreateString("Resource", 0x4c);
     this.UserName = dictionary.CreateString("UserName", 0x4d);
     this.UserNameNamespace = dictionary.CreateString("urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName", 0x4e);
     this.EmailName = dictionary.CreateString("EmailName", 0x4f);
     this.EmailNamespace = dictionary.CreateString("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", 80);
 }
Пример #31
0
		public override bool TryResolveType (Type type, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
		{
			//Console.WriteLine ("TryResolveType: {0} {1}", type, declaredType);
			if (knownTypeResolver.TryResolveType (type, declaredType, null, out typeName, out typeNamespace))
				return true;
			return SafeResolveType (type, out typeName, out typeNamespace);
		}
Пример #32
0
 public SystemInterface.Runtime.Serialization.Json.IDataContractJsonSerializer Create(
     System.Type type,
     System.Xml.XmlDictionaryString rootName)
 {
     return(new SystemWrapper.Runtime.Serialization.Json.DataContractJsonSerializerWrap(
                type,
                rootName));
 }
Пример #33
0
        //public ProtoOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormat) : base(operation, dataContractFormat) { }

        /// <summary>
        /// Creates a protobuf serializer if possible (falling back to the default WCF serializer)
        /// </summary>
        public override XmlObjectSerializer CreateSerializer(Type type, System.Xml.XmlDictionaryString name, System.Xml.XmlDictionaryString ns, IList <Type> knownTypes)
        {
            if (model == null)
            {
                throw new InvalidOperationException("No Model instance has been assigned to the ProtoOperationBehavior");
            }
            return(XmlProtoSerializer.TryCreate(model, type) ?? base.CreateSerializer(type, name, ns, knownTypes));
        }
Пример #34
0
 public SystemInterface.Runtime.Serialization.Json.IDataContractJsonSerializer Create(
     System.Type type,
     System.Xml.XmlDictionaryString rootName,
     System.Collections.Generic.IEnumerable <System.Type> knownTypes)
 {
     return(new SystemWrapper.Runtime.Serialization.Json.DataContractJsonSerializerWrap(
                type,
                rootName,
                knownTypes));
 }
Пример #35
0
        public override bool TryResolveType(Type type
                                            , Type declaredType
                                            , DataContractResolver knownTypeResolver
                                            , out System.Xml.XmlDictionaryString typeName
                                            , out System.Xml.XmlDictionaryString typeNamespace)
        {
            XmlDictionary dictionary = new XmlDictionary();

            // 将类型放到Namespace中,放在typeName中会出现错误
            typeName      = dictionary.Add(ObjectTypeName);
            typeNamespace = dictionary.Add(type.FullName);

            return(true);
        }
Пример #36
0
 public SystemInterface.Runtime.Serialization.Json.IDataContractJsonSerializer Create(
     System.Type type,
     System.Xml.XmlDictionaryString rootName,
     System.Collections.Generic.IEnumerable <System.Type> knownTypes,
     int maxItemsInObjectGraph,
     bool ignoreExtensionDataObject,
     System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate,
     bool alwaysEmitTypeInformation)
 {
     return(new SystemWrapper.Runtime.Serialization.Json.DataContractJsonSerializerWrap(
                type,
                rootName,
                knownTypes,
                maxItemsInObjectGraph,
                ignoreExtensionDataObject,
                dataContractSurrogate,
                alwaysEmitTypeInformation));
 }
Пример #37
0
 public virtual void WriteXmlAttribute(XmlDictionaryString localName,
                                       XmlDictionaryString value)
 {
     WriteXmlAttribute(localName.Value, value.Value);
 }
Пример #38
0
 public virtual void WriteXmlnsAttribute(string prefix,
                                         XmlDictionaryString namespaceUri)
 {
     WriteXmlnsAttribute(prefix, namespaceUri.Value);
 }
Пример #39
0
        private void ReadNamespace(byte ident)
        {
            // create attrubute slot.
            if (attributes.Count == attr_count)
            {
                attributes.Add(new AttrNodeInfo(this));
            }
            AttrNodeInfo a = attributes [attr_count++];

            a.Reset();
            a.Position = source.Position;

            string prefix = null, ns = null;
            XmlDictionaryString dns = null;

            switch (ident)
            {
            case BF.DefaultNSString:
                prefix = String.Empty;
                ns     = ReadUTF8();
                break;

            case BF.PrefixNSString:
                prefix = ReadUTF8();
                ns     = ReadUTF8();
                break;

            case BF.DefaultNSIndex:
                prefix = String.Empty;
                dns    = ReadDictName();
                ns_dict_store.Add(ns_store.Count, dns);
                ns = dns.Value;
                break;

            case BF.PrefixNSIndex:
                prefix = ReadUTF8();
                dns    = ReadDictName();
                ns_dict_store.Add(ns_store.Count, dns);
                ns = dns.Value;
                break;
            }

            // fill attribute slot.
            a.Prefix     = prefix.Length > 0 ? "xmlns" : String.Empty;
            a.LocalName  = prefix.Length > 0 ? prefix : "xmlns";
            a.NS         = "http://www.w3.org/2000/xmlns/";
            a.ValueIndex = attr_value_count;
            if (attr_value_count == attr_values.Count)
            {
                attr_values.Add(new NodeInfo(true));
            }
            NodeInfo v = attr_values [attr_value_count++];

            v.Reset();
            v.Value     = ns;
            v.ValueType = BF.Chars8;
            v.NodeType  = XmlNodeType.Text;

            ns_store.Add(new QName(prefix, ns));
            context.NamespaceManager.AddNamespace(prefix, ns);
        }
Пример #40
0
 public bool TryLookup(XmlDictionaryString value, out XmlDictionaryString result)
 {
     result = null;
     return(false);
 }
Пример #41
0
 public virtual bool TryLookup(string value, out XmlDictionaryString result)
 {
     return(_lookup.TryGetValue(value, out result));
 }
Пример #42
0
 static public void ThrowFullStartElementExpected(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
 {
     ThrowFullStartElementExpected(reader, XmlDictionaryString.GetString(localName), XmlDictionaryString.GetString(ns));
 }
Пример #43
0
 public override XmlObjectSerializer CreateSerializer(Type type, System.Xml.XmlDictionaryString name, System.Xml.XmlDictionaryString ns, IList <Type> knownTypes)
 {
     return(new DataContractJsonSerializer(type, name, knownTypes, this.MaxItemsInObjectGraph, this.IgnoreExtensionDataObject, this.DataContractSurrogate, alwaysEmitTypeInformation));
 }
Пример #44
0
 public virtual void WriteXmlnsAttribute(string prefix, XmlDictionaryString namespaceUri)
 {
     WriteXmlnsAttribute(prefix, XmlDictionaryString.GetString(namespaceUri));
 }
Пример #45
0
 public void WriteStartElement(
     XmlDictionaryString localName,
     XmlDictionaryString namespaceUri)
 {
     WriteStartElement(null, localName, namespaceUri);
 }
Пример #46
0
 public void WriteStartAttribute(
     XmlDictionaryString localName,
     XmlDictionaryString namespaceUri)
 {
     WriteStartAttribute(localName.Value, namespaceUri.Value);
 }
Пример #47
0
 public virtual void WriteValue(XmlDictionaryString value)
 {
     WriteValue(value.Value);
 }
Пример #48
0
 public void WriteAttributeString(XmlDictionaryString localName, XmlDictionaryString namespaceUri, string value)
 {
     WriteAttributeString((string)null, localName, namespaceUri, value);
 }
Пример #49
0
 public virtual void WriteStartAttribute(string prefix,
                                         XmlDictionaryString localName,
                                         XmlDictionaryString namespaceUri)
 {
     WriteStartAttribute(prefix, localName.Value, namespaceUri.Value);
 }
Пример #50
0
        public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
        {
            Debug.WriteLine("TryResolveType ", type.Name);
            var retVal = _typeToNames.ContainsKey(type);

            if (retVal)
            {
                XmlDictionary dictionary = new XmlDictionary();
                typeNamespace = dictionary.Add(_typeToNames[type].Item1);
                typeName      = dictionary.Add(_typeToNames[type].Item2);
            }
            else
            {
                retVal = knownTypeResolver.TryResolveType(type, declaredType, null, out typeName, out typeNamespace);
            }

            return(retVal);
        }
Пример #51
0
 /// <summary>
 /// Override this method to map a data contract type to an xsi:type name and namespace during serialization.
 /// </summary>
 /// <param name="type">The type to map.</param>
 /// <param name="declaredType">The type declared in the data contract.</param>
 /// <param name="knownTypeResolver">The known type resolver.</param>
 /// <param name="typeName">The xsi:type name.</param>
 /// <param name="typeNamespace">The xsi:type namespace.</param>
 /// <returns>
 /// true if mapping succeeded; otherwise, false.
 /// </returns>
 public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
 {
     if (type == typeof(Tag))
     {
         XmlDictionary dictionary = new XmlDictionary();
         typeName      = dictionary.Add("Tag");
         typeNamespace = dictionary.Add(uri);
         return(true);
     }
     else if (type == typeof(Entry))
     {
         XmlDictionary dictionary = new XmlDictionary();
         typeName      = dictionary.Add("Entry");
         typeNamespace = dictionary.Add(uri);
         return(true);
     }
     else if (type == typeof(LinkEntry))
     {
         XmlDictionary dictionary = new XmlDictionary();
         typeName      = dictionary.Add("LinkEntry");
         typeNamespace = dictionary.Add(uri);
         return(true);
     }
     else if (type == typeof(LinkItem))
     {
         XmlDictionary dictionary = new XmlDictionary();
         typeName      = dictionary.Add("LinkItem");
         typeNamespace = dictionary.Add(uri);
         return(true);
     }
     else
     {
         return(knownTypeResolver.TryResolveType(type, declaredType, knownTypeResolver, out typeName, out typeNamespace));
     }
 }
Пример #52
0
 public abstract void WriteQualifiedName(string prefix, XmlDictionaryString localName);
Пример #53
0
 public abstract void WriteStartAttribute(string prefix, XmlDictionaryString localName);
Пример #54
0
 public virtual void WriteQualifiedName(
     XmlDictionaryString localName,
     XmlDictionaryString namespaceUri)
 {
     WriteQualifiedName(localName.Value, namespaceUri.Value);
 }
Пример #55
0
        public override bool TryResolveType(Type dataContractType, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
        {
            EntityUtil.CheckArgumentNull(dataContractType, "dataContractType");
            EntityUtil.CheckArgumentNull(declaredType, "declaredType");
            EntityUtil.CheckArgumentNull(knownTypeResolver, "knownTypeResolver");

            Type nonProxyType = ObjectContext.GetObjectType(dataContractType);

            if (nonProxyType != dataContractType)
            {
                // Type was a proxy type, so map the name to the non-proxy name
                XmlQualifiedName qualifiedName = _exporter.GetSchemaTypeName(nonProxyType);
                XmlDictionary    dictionary    = new XmlDictionary(2);
                typeName      = new XmlDictionaryString(dictionary, qualifiedName.Name, 0);
                typeNamespace = new XmlDictionaryString(dictionary, qualifiedName.Namespace, 1);
                return(true);
            }
            else
            {
                // Type was not a proxy type, so do the default
                return(knownTypeResolver.TryResolveType(dataContractType, declaredType, null, out typeName, out typeNamespace));
            }
        }
Пример #56
0
 public abstract void WriteText(XmlDictionaryString value);
Пример #57
0
 public abstract void WriteStartElement(string prefix, XmlDictionaryString localName);
Пример #58
0
 public abstract void WriteXmlnsAttribute(string prefix, XmlDictionaryString ns);
        //public ProtoOperationBehavior(OperationDescription operation, DataContractFormatAttribute dataContractFormat) : base(operation, dataContractFormat) { }

        /// <summary>
        /// Creates a protobuf serializer if possible (falling back to the default WCF serializer)
        /// </summary>
        public override XmlObjectSerializer CreateSerializer(Type type, System.Xml.XmlDictionaryString name, System.Xml.XmlDictionaryString ns, IList <Type> knownTypes)
        {
            return(XmlProtoSerializer.TryCreate(model, type) ?? base.CreateSerializer(type, name, ns, knownTypes));
        }
        // Serialization
        public override bool TryResolveType(Type type, Type declaredType, DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace)
        {
            Type[] genericTypes = type.GetGenericArguments();

            string ns          = string.Empty;
            Type   genericType = null;

            foreach (Type genType in genericTypes)
            {
                if (typesByType.ContainsKey(genType) == true)
                {
                    typesByType.TryGetValue(genType, out ns);
                    genericType = genType;
                    break;
                }
            }

            if (string.IsNullOrEmpty(ns) == false)
            {
                XmlDictionary dictionary = new XmlDictionary();
                typeName      = dictionary.Add(genericType.Name);
                typeNamespace = dictionary.Add(ns);

                return(true);
            }
            else
            {
                return(knownTypeResolver.TryResolveType(type, declaredType, null, out typeName, out typeNamespace));
            }
        }