Example #1
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;
        }
Example #2
0
        public static bool GetXmlTypeForInteropType(
            Type type,
            out string xmlType,
            out string xmlTypeNamespace)
        {
            SoapServices.XmlEntry xmlEntry = (SoapServices.XmlEntry)SoapServices._interopTypeToXmlType[(object)type];
            if (xmlEntry != null)
            {
                xmlType          = xmlEntry.Name;
                xmlTypeNamespace = xmlEntry.Namespace;
                return(true);
            }
            SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute((object)type);

            if (cachedSoapAttribute.IsInteropXmlType())
            {
                xmlType          = cachedSoapAttribute.XmlTypeName;
                xmlTypeNamespace = cachedSoapAttribute.XmlTypeNamespace;
                return(true);
            }
            xmlType          = (string)null;
            xmlTypeNamespace = (string)null;
            return(false);
        }