Files
2026-06-04 11:42:34 +02:00

644 lines
35 KiB
C#

using System;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata;
namespace System.Runtime.Remoting
{
/// <summary>Provides several methods for using and publishing remoted objects in SOAP format.</summary>
// Token: 0x02000454 RID: 1108
[ComVisible(true)]
public class SoapServices
{
// Token: 0x06002AAE RID: 10926 RVA: 0x0008A4F0 File Offset: 0x000886F0
private SoapServices()
{
}
/// <summary>Gets the XML namespace prefix for common language runtime types.</summary>
/// <returns>The XML namespace prefix for common language runtime types.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000866 RID: 2150
// (get) Token: 0x06002AB0 RID: 10928 RVA: 0x0008A538 File Offset: 0x00088738
public static string XmlNsForClrType
{
get
{
return "http://schemas.microsoft.com/clr/";
}
}
/// <summary>Gets the default XML namespace prefix that should be used for XML encoding of a common language runtime class that has an assembly, but no native namespace.</summary>
/// <returns>The default XML namespace prefix that should be used for XML encoding of a common language runtime class that has an assembly, but no native namespace.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000867 RID: 2151
// (get) Token: 0x06002AB1 RID: 10929 RVA: 0x0008A540 File Offset: 0x00088740
public static string XmlNsForClrTypeWithAssembly
{
get
{
return "http://schemas.microsoft.com/clr/assem/";
}
}
/// <summary>Gets the XML namespace prefix that should be used for XML encoding of a common language runtime class that is part of the mscorlib.dll file.</summary>
/// <returns>The XML namespace prefix that should be used for XML encoding of a common language runtime class that is part of the mscorlib.dll file.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000868 RID: 2152
// (get) Token: 0x06002AB2 RID: 10930 RVA: 0x0008A548 File Offset: 0x00088748
public static string XmlNsForClrTypeWithNs
{
get
{
return "http://schemas.microsoft.com/clr/ns/";
}
}
/// <summary>Gets the default XML namespace prefix that should be used for XML encoding of a common language runtime class that has both a common language runtime namespace and an assembly.</summary>
/// <returns>The default XML namespace prefix that should be used for XML encoding of a common language runtime class that has both a common language runtime namespace and an assembly.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000869 RID: 2153
// (get) Token: 0x06002AB3 RID: 10931 RVA: 0x0008A550 File Offset: 0x00088750
public static string XmlNsForClrTypeWithNsAndAssembly
{
get
{
return "http://schemas.microsoft.com/clr/nsassem/";
}
}
/// <summary>Returns the common language runtime type namespace name from the provided namespace and assembly names.</summary>
/// <returns>The common language runtime type namespace name from the provided namespace and assembly names.</returns>
/// <param name="typeNamespace">The namespace that is to be coded. </param>
/// <param name="assemblyName">The name of the assembly that is to be coded. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="assemblyName" /> and <paramref name="typeNamespace" /> parameters are both either null or empty. </exception>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AB4 RID: 10932 RVA: 0x0008A558 File Offset: 0x00088758
public static string CodeXmlNamespaceForClrTypeNamespace(string typeNamespace, string assemblyName)
{
if (assemblyName == string.Empty)
{
return SoapServices.XmlNsForClrTypeWithNs + typeNamespace;
}
if (typeNamespace == string.Empty)
{
return SoapServices.EncodeNs(SoapServices.XmlNsForClrTypeWithAssembly + assemblyName);
}
return SoapServices.EncodeNs(SoapServices.XmlNsForClrTypeWithNsAndAssembly + typeNamespace + "/" + assemblyName);
}
/// <summary>Decodes the XML namespace and assembly names from the provided common language runtime namespace.</summary>
/// <returns>true if the namespace and assembly names were successfully decoded; otherwise, false.</returns>
/// <param name="inNamespace">The common language runtime namespace. </param>
/// <param name="typeNamespace">When this method returns, contains a <see cref="T:System.String" /> that holds the decoded namespace name. This parameter is passed uninitialized. </param>
/// <param name="assemblyName">When this method returns, contains a <see cref="T:System.String" /> that holds the decoded assembly name. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="inNamespace" /> parameter is null or empty. </exception>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AB5 RID: 10933 RVA: 0x0008A5B8 File Offset: 0x000887B8
public static bool DecodeXmlNamespaceForClrTypeNamespace(string inNamespace, out string typeNamespace, out string assemblyName)
{
if (inNamespace == null)
{
throw new ArgumentNullException("inNamespace");
}
inNamespace = SoapServices.DecodeNs(inNamespace);
typeNamespace = null;
assemblyName = null;
if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithNsAndAssembly))
{
int length = SoapServices.XmlNsForClrTypeWithNsAndAssembly.Length;
if (length >= inNamespace.Length)
{
return false;
}
int num = inNamespace.IndexOf('/', length + 1);
if (num == -1)
{
return false;
}
typeNamespace = inNamespace.Substring(length, num - length);
assemblyName = inNamespace.Substring(num + 1);
return true;
}
else
{
if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithNs))
{
int length2 = SoapServices.XmlNsForClrTypeWithNs.Length;
typeNamespace = inNamespace.Substring(length2);
return true;
}
if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithAssembly))
{
int length3 = SoapServices.XmlNsForClrTypeWithAssembly.Length;
assemblyName = inNamespace.Substring(length3);
return true;
}
return false;
}
}
/// <summary>Retrieves field type from XML attribute name, namespace, and the <see cref="T:System.Type" /> of the containing object.</summary>
/// <param name="containingType">The <see cref="T:System.Type" /> of the object that contains the field. </param>
/// <param name="xmlAttribute">The XML attribute name of the field type. </param>
/// <param name="xmlNamespace">The XML namespace of the field type. </param>
/// <param name="type">When this method returns, contains a <see cref="T:System.Type" /> of the field. This parameter is passed uninitialized. </param>
/// <param name="name">When this method returns, contains a <see cref="T:System.String" /> that holds the name of the field. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AB6 RID: 10934 RVA: 0x0008A688 File Offset: 0x00088888
public static void GetInteropFieldTypeAndNameFromXmlAttribute(Type containingType, string xmlAttribute, string xmlNamespace, out Type type, out string name)
{
SoapServices.TypeInfo typeInfo = (SoapServices.TypeInfo)SoapServices._typeInfos[containingType];
Hashtable hashtable = ((typeInfo == null) ? null : typeInfo.Attributes);
SoapServices.GetInteropFieldInfo(hashtable, xmlAttribute, xmlNamespace, out type, out name);
}
/// <summary>Retrieves the <see cref="T:System.Type" /> and name of a field from the provided XML element name, namespace, and the containing type.</summary>
/// <param name="containingType">The <see cref="T:System.Type" /> of the object that contains the field. </param>
/// <param name="xmlElement">The XML element name of field. </param>
/// <param name="xmlNamespace">The XML namespace of the field type. </param>
/// <param name="type">When this method returns, contains a <see cref="T:System.Type" /> of the field. This parameter is passed uninitialized. </param>
/// <param name="name">When this method returns, contains a <see cref="T:System.String" /> that holds the name of the field. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AB7 RID: 10935 RVA: 0x0008A6C4 File Offset: 0x000888C4
public static void GetInteropFieldTypeAndNameFromXmlElement(Type containingType, string xmlElement, string xmlNamespace, out Type type, out string name)
{
SoapServices.TypeInfo typeInfo = (SoapServices.TypeInfo)SoapServices._typeInfos[containingType];
Hashtable hashtable = ((typeInfo == null) ? null : typeInfo.Elements);
SoapServices.GetInteropFieldInfo(hashtable, xmlElement, xmlNamespace, out type, out name);
}
// Token: 0x06002AB8 RID: 10936 RVA: 0x0008A700 File Offset: 0x00088900
private static void GetInteropFieldInfo(Hashtable fields, string xmlName, string xmlNamespace, out Type type, out string name)
{
if (fields != null)
{
FieldInfo fieldInfo = (FieldInfo)fields[SoapServices.GetNameKey(xmlName, xmlNamespace)];
if (fieldInfo != null)
{
type = fieldInfo.FieldType;
name = fieldInfo.Name;
return;
}
}
type = null;
name = null;
}
// Token: 0x06002AB9 RID: 10937 RVA: 0x0008A748 File Offset: 0x00088948
private static string GetNameKey(string name, string namspace)
{
if (namspace == null)
{
return name;
}
return name + " " + namspace;
}
/// <summary>Retrieves the <see cref="T:System.Type" /> that should be used during deserialization of an unrecognized object type with the given XML element name and namespace.</summary>
/// <returns>The <see cref="T:System.Type" /> of object associated with the specified XML element name and namespace.</returns>
/// <param name="xmlElement">The XML element name of the unknown object type. </param>
/// <param name="xmlNamespace">The XML namespace of the unknown object type. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ABA RID: 10938 RVA: 0x0008A760 File Offset: 0x00088960
public static Type GetInteropTypeFromXmlElement(string xmlElement, string xmlNamespace)
{
object syncRoot = SoapServices._xmlElements.SyncRoot;
Type type;
lock (syncRoot)
{
type = (Type)SoapServices._xmlElements[xmlElement + " " + xmlNamespace];
}
return type;
}
/// <summary>Retrieves the object <see cref="T:System.Type" /> that should be used during deserialization of an unrecognized object type with the given XML type name and namespace.</summary>
/// <returns>The <see cref="T:System.Type" /> of object associated with the specified XML type name and namespace.</returns>
/// <param name="xmlType">The XML type of the unknown object type. </param>
/// <param name="xmlTypeNamespace">The XML type namespace of the unknown object type. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ABB RID: 10939 RVA: 0x0008A7C8 File Offset: 0x000889C8
public static Type GetInteropTypeFromXmlType(string xmlType, string xmlTypeNamespace)
{
object syncRoot = SoapServices._xmlTypes.SyncRoot;
Type type;
lock (syncRoot)
{
type = (Type)SoapServices._xmlTypes[xmlType + " " + xmlTypeNamespace];
}
return type;
}
// Token: 0x06002ABC RID: 10940 RVA: 0x0008A830 File Offset: 0x00088A30
private static string GetAssemblyName(MethodBase mb)
{
if (mb.DeclaringType.Assembly == typeof(object).Assembly)
{
return string.Empty;
}
return mb.DeclaringType.Assembly.GetName().Name;
}
/// <summary>Returns the SOAPAction value associated with the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</summary>
/// <returns>The SOAPAction value associated with the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</returns>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> that contains the method for which a SOAPAction is requested. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ABD RID: 10941 RVA: 0x0008A878 File Offset: 0x00088A78
public static string GetSoapActionFromMethodBase(MethodBase mb)
{
return SoapServices.InternalGetSoapAction(mb);
}
/// <summary>Determines the type and method name of the method associated with the specified SOAPAction value.</summary>
/// <returns>true if the type and method name were successfully recovered; otherwise, false.</returns>
/// <param name="soapAction">The SOAPAction of the method for which the type and method names were requested. </param>
/// <param name="typeName">When this method returns, contains a <see cref="T:System.String" /> that holds the type name of the method in question. This parameter is passed uninitialized. </param>
/// <param name="methodName">When this method returns, contains a <see cref="T:System.String" /> that holds the method name of the method in question. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.Runtime.Remoting.RemotingException">The SOAPAction value does not start and end with quotes. </exception>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ABE RID: 10942 RVA: 0x0008A880 File Offset: 0x00088A80
public static bool GetTypeAndMethodNameFromSoapAction(string soapAction, out string typeName, out string methodName)
{
object syncRoot = SoapServices._soapActions.SyncRoot;
lock (syncRoot)
{
MethodBase methodBase = (MethodBase)SoapServices._soapActionsMethods[soapAction];
if (methodBase != null)
{
typeName = methodBase.DeclaringType.AssemblyQualifiedName;
methodName = methodBase.Name;
return true;
}
}
typeName = null;
methodName = null;
int num = soapAction.LastIndexOf('#');
if (num == -1)
{
return false;
}
methodName = soapAction.Substring(num + 1);
string text;
string text2;
if (!SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapAction.Substring(0, num), out text, out text2))
{
return false;
}
if (text2 == null)
{
typeName = text + ", " + typeof(object).Assembly.GetName().Name;
}
else
{
typeName = text + ", " + text2;
}
return true;
}
/// <summary>Returns XML element information that should be used when serializing the given type.</summary>
/// <returns>true if the requested values have been set flagged with <see cref="T:System.Runtime.Remoting.Metadata.SoapTypeAttribute" />; otherwise, false.</returns>
/// <param name="type">The object <see cref="T:System.Type" /> for which the XML element and namespace names were requested. </param>
/// <param name="xmlElement">When this method returns, contains a <see cref="T:System.String" /> that holds the XML element name of the specified object type. This parameter is passed uninitialized. </param>
/// <param name="xmlNamespace">When this method returns, contains a <see cref="T:System.String" /> that holds the XML namespace name of the specified object type. This parameter is passed uninitialized. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ABF RID: 10943 RVA: 0x0008A97C File Offset: 0x00088B7C
public static bool GetXmlElementForInteropType(Type type, out string xmlElement, out string xmlNamespace)
{
SoapTypeAttribute soapTypeAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);
if (!soapTypeAttribute.IsInteropXmlElement)
{
xmlElement = null;
xmlNamespace = null;
return false;
}
xmlElement = soapTypeAttribute.XmlElementName;
xmlNamespace = soapTypeAttribute.XmlNamespace;
return true;
}
/// <summary>Retrieves the XML namespace used during remote calls of the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</summary>
/// <returns>The XML namespace used during remote calls of the specified method.</returns>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> of the method for which the XML namespace was requested. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC0 RID: 10944 RVA: 0x0008A9BC File Offset: 0x00088BBC
public static string GetXmlNamespaceForMethodCall(MethodBase mb)
{
return SoapServices.CodeXmlNamespaceForClrTypeNamespace(mb.DeclaringType.FullName, SoapServices.GetAssemblyName(mb));
}
/// <summary>Retrieves the XML namespace used during the generation of responses to the remote call to the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</summary>
/// <returns>The XML namespace used during the generation of responses to a remote method call.</returns>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> of the method for which the XML namespace was requested. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC1 RID: 10945 RVA: 0x0008A9D4 File Offset: 0x00088BD4
public static string GetXmlNamespaceForMethodResponse(MethodBase mb)
{
return SoapServices.CodeXmlNamespaceForClrTypeNamespace(mb.DeclaringType.FullName, SoapServices.GetAssemblyName(mb));
}
/// <summary>Returns XML type information that should be used when serializing the given <see cref="T:System.Type" />.</summary>
/// <returns>true if the requested values have been set flagged with <see cref="T:System.Runtime.Remoting.Metadata.SoapTypeAttribute" />; otherwise, false.</returns>
/// <param name="type">The object <see cref="T:System.Type" /> for which the XML element and namespace names were requested. </param>
/// <param name="xmlType">The XML type of the specified object <see cref="T:System.Type" />. </param>
/// <param name="xmlTypeNamespace">The XML type namespace of the specified object <see cref="T:System.Type" />. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC2 RID: 10946 RVA: 0x0008A9EC File Offset: 0x00088BEC
public static bool GetXmlTypeForInteropType(Type type, out string xmlType, out string xmlTypeNamespace)
{
SoapTypeAttribute soapTypeAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);
if (!soapTypeAttribute.IsInteropXmlType)
{
xmlType = null;
xmlTypeNamespace = null;
return false;
}
xmlType = soapTypeAttribute.XmlTypeName;
xmlTypeNamespace = soapTypeAttribute.XmlTypeNamespace;
return true;
}
/// <summary>Returns a Boolean value that indicates whether the specified namespace is native to the common language runtime.</summary>
/// <returns>true if the given namespace is native to the common language runtime; otherwise, false.</returns>
/// <param name="namespaceString">The namespace to check in the common language runtime. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC3 RID: 10947 RVA: 0x0008AA2C File Offset: 0x00088C2C
public static bool IsClrTypeNamespace(string namespaceString)
{
return namespaceString.StartsWith(SoapServices.XmlNsForClrType);
}
/// <summary>Determines if the specified SOAPAction is acceptable for a given <see cref="T:System.Reflection.MethodBase" />.</summary>
/// <returns>true if the specified SOAPAction is acceptable for a given <see cref="T:System.Reflection.MethodBase" />; otherwise, false.</returns>
/// <param name="soapAction">The SOAPAction to check against the given <see cref="T:System.Reflection.MethodBase" />. </param>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> the specified SOAPAction is checked against. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC4 RID: 10948 RVA: 0x0008AA3C File Offset: 0x00088C3C
public static bool IsSoapActionValidForMethodBase(string soapAction, MethodBase mb)
{
string text;
string text2;
SoapServices.GetTypeAndMethodNameFromSoapAction(soapAction, out text, out text2);
if (text2 != mb.Name)
{
return false;
}
string assemblyQualifiedName = mb.DeclaringType.AssemblyQualifiedName;
return text == assemblyQualifiedName;
}
/// <summary>Preloads every <see cref="T:System.Type" /> found in the specified <see cref="T:System.Reflection.Assembly" /> from the information found in the <see cref="T:System.Runtime.Remoting.Metadata.SoapTypeAttribute" /> associated with each type.</summary>
/// <param name="assembly">The <see cref="T:System.Reflection.Assembly" /> for each type of which to call <see cref="M:System.Runtime.Remoting.SoapServices.PreLoad(System.Type)" />. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC5 RID: 10949 RVA: 0x0008AA7C File Offset: 0x00088C7C
public static void PreLoad(Assembly assembly)
{
foreach (Type type in assembly.GetTypes())
{
SoapServices.PreLoad(type);
}
}
/// <summary>Preloads the given <see cref="T:System.Type" /> based on values set in a <see cref="T:System.Runtime.Remoting.Metadata.SoapTypeAttribute" /> on the type.</summary>
/// <param name="type">The <see cref="T:System.Type" /> to preload. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC6 RID: 10950 RVA: 0x0008AAB0 File Offset: 0x00088CB0
public static void PreLoad(Type type)
{
SoapServices.TypeInfo typeInfo = SoapServices._typeInfos[type] as SoapServices.TypeInfo;
if (typeInfo != null)
{
return;
}
string text;
string text2;
if (SoapServices.GetXmlTypeForInteropType(type, out text, out text2))
{
SoapServices.RegisterInteropXmlType(text, text2, type);
}
if (SoapServices.GetXmlElementForInteropType(type, out text, out text2))
{
SoapServices.RegisterInteropXmlElement(text, text2, type);
}
object syncRoot = SoapServices._typeInfos.SyncRoot;
lock (syncRoot)
{
typeInfo = new SoapServices.TypeInfo();
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (FieldInfo fieldInfo in fields)
{
SoapFieldAttribute soapFieldAttribute = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute(fieldInfo);
if (soapFieldAttribute.IsInteropXmlElement())
{
string nameKey = SoapServices.GetNameKey(soapFieldAttribute.XmlElementName, soapFieldAttribute.XmlNamespace);
if (soapFieldAttribute.UseAttribute)
{
if (typeInfo.Attributes == null)
{
typeInfo.Attributes = new Hashtable();
}
typeInfo.Attributes[nameKey] = fieldInfo;
}
else
{
if (typeInfo.Elements == null)
{
typeInfo.Elements = new Hashtable();
}
typeInfo.Elements[nameKey] = fieldInfo;
}
}
}
SoapServices._typeInfos[type] = typeInfo;
}
}
/// <summary>Associates the given XML element name and namespace with a run-time type that should be used for deserialization.</summary>
/// <param name="xmlElement">The XML element name to use in deserialization. </param>
/// <param name="xmlNamespace">The XML namespace to use in deserialization. </param>
/// <param name="type">The run-time <see cref="T:System.Type" /> to use in deserialization. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC7 RID: 10951 RVA: 0x0008AC0C File Offset: 0x00088E0C
public static void RegisterInteropXmlElement(string xmlElement, string xmlNamespace, Type type)
{
object syncRoot = SoapServices._xmlElements.SyncRoot;
lock (syncRoot)
{
SoapServices._xmlElements[xmlElement + " " + xmlNamespace] = type;
}
}
/// <summary>Associates the given XML type name and namespace with the run-time type that should be used for deserialization.</summary>
/// <param name="xmlType">The XML type to use in deserialization. </param>
/// <param name="xmlTypeNamespace">The XML namespace to use in deserialization. </param>
/// <param name="type">The run-time <see cref="T:System.Type" /> to use in deserialization. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC8 RID: 10952 RVA: 0x0008AC6C File Offset: 0x00088E6C
public static void RegisterInteropXmlType(string xmlType, string xmlTypeNamespace, Type type)
{
object syncRoot = SoapServices._xmlTypes.SyncRoot;
lock (syncRoot)
{
SoapServices._xmlTypes[xmlType + " " + xmlTypeNamespace] = type;
}
}
/// <summary>Associates the specified <see cref="T:System.Reflection.MethodBase" /> with the SOAPAction cached with it.</summary>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> of the method to associate with the SOAPAction cached with it. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002AC9 RID: 10953 RVA: 0x0008ACCC File Offset: 0x00088ECC
public static void RegisterSoapActionForMethodBase(MethodBase mb)
{
SoapServices.InternalGetSoapAction(mb);
}
// Token: 0x06002ACA RID: 10954 RVA: 0x0008ACD8 File Offset: 0x00088ED8
private static string InternalGetSoapAction(MethodBase mb)
{
object syncRoot = SoapServices._soapActions.SyncRoot;
string text2;
lock (syncRoot)
{
string text = (string)SoapServices._soapActions[mb];
if (text == null)
{
SoapMethodAttribute soapMethodAttribute = (SoapMethodAttribute)InternalRemotingServices.GetCachedSoapAttribute(mb);
text = soapMethodAttribute.SoapAction;
SoapServices._soapActions[mb] = text;
SoapServices._soapActionsMethods[text] = mb;
}
text2 = text;
}
return text2;
}
/// <summary>Associates the provided SOAPAction value with the given <see cref="T:System.Reflection.MethodBase" /> for use in channel sinks.</summary>
/// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> to associate with the provided SOAPAction. </param>
/// <param name="soapAction">The SOAPAction value to associate with the given <see cref="T:System.Reflection.MethodBase" />. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002ACB RID: 10955 RVA: 0x0008AD68 File Offset: 0x00088F68
public static void RegisterSoapActionForMethodBase(MethodBase mb, string soapAction)
{
object syncRoot = SoapServices._soapActions.SyncRoot;
lock (syncRoot)
{
SoapServices._soapActions[mb] = soapAction;
SoapServices._soapActionsMethods[soapAction] = mb;
}
}
// Token: 0x06002ACC RID: 10956 RVA: 0x0008ADC8 File Offset: 0x00088FC8
private static string EncodeNs(string ns)
{
ns = ns.Replace(",", "%2C");
ns = ns.Replace(" ", "%20");
return ns.Replace("=", "%3D");
}
// Token: 0x06002ACD RID: 10957 RVA: 0x0008AE0C File Offset: 0x0008900C
private static string DecodeNs(string ns)
{
ns = ns.Replace("%2C", ",");
ns = ns.Replace("%20", " ");
return ns.Replace("%3D", "=");
}
// Token: 0x04001053 RID: 4179
private static Hashtable _xmlTypes = new Hashtable();
// Token: 0x04001054 RID: 4180
private static Hashtable _xmlElements = new Hashtable();
// Token: 0x04001055 RID: 4181
private static Hashtable _soapActions = new Hashtable();
// Token: 0x04001056 RID: 4182
private static Hashtable _soapActionsMethods = new Hashtable();
// Token: 0x04001057 RID: 4183
private static Hashtable _typeInfos = new Hashtable();
// Token: 0x02000455 RID: 1109
private class TypeInfo
{
// Token: 0x04001058 RID: 4184
public Hashtable Attributes;
// Token: 0x04001059 RID: 4185
public Hashtable Elements;
}
}
}