예제 #1
0
 public static void GetInteropFieldTypeAndNameFromXmlAttribute(
     Type containingType,
     string xmlAttribute,
     string xmlNamespace,
     out Type type,
     out string name)
 {
     if (containingType == null)
     {
         type = (Type)null;
         name = (string)null;
     }
     else
     {
         SoapServices.XmlToFieldTypeMap xmlToFieldType = (SoapServices.XmlToFieldTypeMap)SoapServices._xmlToFieldTypeMap[(object)containingType];
         if (xmlToFieldType != null)
         {
             xmlToFieldType.GetFieldTypeAndNameFromXmlAttribute(xmlAttribute, xmlNamespace, out type, out name);
         }
         else
         {
             type = (Type)null;
             name = (string)null;
         }
     }
 }
예제 #2
0
        public static void PreLoad(Type type)
        {
            foreach (MethodBase method in type.GetMethods())
            {
                SoapServices.RegisterSoapActionForMethodBase(method);
            }
            SoapTypeAttribute cachedSoapAttribute1 = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute((object)type);

            if (cachedSoapAttribute1.IsInteropXmlElement())
            {
                SoapServices.RegisterInteropXmlElement(cachedSoapAttribute1.XmlElementName, cachedSoapAttribute1.XmlNamespace, type);
            }
            if (cachedSoapAttribute1.IsInteropXmlType())
            {
                SoapServices.RegisterInteropXmlType(cachedSoapAttribute1.XmlTypeName, cachedSoapAttribute1.XmlTypeNamespace, type);
            }
            int num = 0;

            SoapServices.XmlToFieldTypeMap xmlToFieldTypeMap = new SoapServices.XmlToFieldTypeMap();
            foreach (FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
            {
                SoapFieldAttribute cachedSoapAttribute2 = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute((object)field);
                if (cachedSoapAttribute2.IsInteropXmlElement())
                {
                    string xmlElementName = cachedSoapAttribute2.XmlElementName;
                    string xmlNamespace   = cachedSoapAttribute2.XmlNamespace;
                    if (cachedSoapAttribute2.UseAttribute)
                    {
                        xmlToFieldTypeMap.AddXmlAttribute(field.FieldType, field.Name, xmlElementName, xmlNamespace);
                    }
                    else
                    {
                        xmlToFieldTypeMap.AddXmlElement(field.FieldType, field.Name, xmlElementName, xmlNamespace);
                    }
                    ++num;
                }
            }
            if (num <= 0)
            {
                return;
            }
            SoapServices._xmlToFieldTypeMap[(object)type] = (object)xmlToFieldTypeMap;
        }