System.UnitySerializationHolder
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
using System.Reflection;
namespace System
{
[Serializable]
private class UnitySerializationHolder:System.Object,System.Runtime.Serialization.ISerializable,System.Runtime.Serialization.IObjectReference
{
internal const int EmptyUnity = 0x00000001;
internal const int NullUnity = 0x00000002;
internal const int MissingUnity = 0x00000003;
internal const int RuntimeTypeUnity = 0x00000004;
internal const int ModuleUnity = 0x00000005;
internal const int AssemblyUnity = 0x00000006;
internal const int GenericParameterTypeUnity = 0x00000007;
internal const int PartialInstantiationTypeUnity = 0x00000008;
internal const int Pointer = 0x00000001;
internal const int Array = 0x00000002;
internal const int SzArray = 0x00000003;
internal const int ByRef = 0x00000004;
private System.Type[] m_instantiation;
private int[] m_elementTypes;
private int m_genericParameterPosition;
private System.Type m_declaringType;
private System.Reflection.MethodBase m_declaringMethod;
private string m_data;
private string m_assemblyName;
private int m_unityType;
internal static void GetUnitySerializationInfo(System.Runtime.Serialization.SerializationInfo info,System.Reflection.Missing missing)
{
// 代码大小 29 (0x1d)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldtoken System.UnitySerializationHolder
//IL_0006: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_000b: callvirt instance void System.Runtime.Serialization.SerializationInfo::SetType(class System.Type)
//IL_0010: ldarg.0
//IL_0011: ldstr "UnityType"
//IL_0016: ldc.i4.3
//IL_0017: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// int32)
//IL_001c: ret
info.SetType(typeof(System.UnitySerializationHolder));
info.AddValue("UnityType", 3);
}
internal static System.Type AddElementTypes(System.Runtime.Serialization.SerializationInfo info,System.Type @type)
{
// 代码大小 131 (0x83)
//.maxstack 4
//.locals init (class System.Collections.Generic.List`1<int32> V_0)
//IL_0000: newobj instance void class System.Collections.Generic.List`1<int32>::.ctor()
//IL_0005: stloc.0
//IL_0006: br.s IL_005e
//IL_0008: ldarg.1
//IL_0009: callvirt instance bool System.Type::get_IsSzArray()
//IL_000e: brfalse.s IL_0019
//IL_0010: ldloc.0
//IL_0011: ldc.i4.3
//IL_0012: callvirt instance void class System.Collections.Generic.List`1<int32>::Add(!0)
//IL_0017: br.s IL_0056
//IL_0019: ldarg.1
//IL_001a: callvirt instance bool System.Type::get_IsArray()
//IL_001f: brfalse.s IL_0036
//IL_0021: ldloc.0
//IL_0022: ldarg.1
//IL_0023: callvirt instance int32 System.Type::GetArrayRank()
//IL_0028: callvirt instance void class System.Collections.Generic.List`1<int32>::Add(!0)
//IL_002d: ldloc.0
//IL_002e: ldc.i4.2
//IL_002f: callvirt instance void class System.Collections.Generic.List`1<int32>::Add(!0)
//IL_0034: br.s IL_0056
//IL_0036: ldarg.1
//IL_0037: callvirt instance bool System.Type::get_IsPointer()
//IL_003c: brfalse.s IL_0047
//IL_003e: ldloc.0
//IL_003f: ldc.i4.1
//IL_0040: callvirt instance void class System.Collections.Generic.List`1<int32>::Add(!0)
//IL_0045: br.s IL_0056
//IL_0047: ldarg.1
//IL_0048: callvirt instance bool System.Type::get_IsByRef()
//IL_004d: brfalse.s IL_0056
//IL_004f: ldloc.0
//IL_0050: ldc.i4.4
//IL_0051: callvirt instance void class System.Collections.Generic.List`1<int32>::Add(!0)
//IL_0056: ldarg.1
//IL_0057: callvirt instance class System.Type System.Type::GetElementType()
//IL_005c: starg.s 'type'
//IL_005e: ldarg.1
//IL_005f: callvirt instance bool System.Type::get_HasElementType()
//IL_0064: brtrue.s IL_0008
//IL_0066: ldarg.0
//IL_0067: ldstr "ElementTypes"
//IL_006c: ldloc.0
//IL_006d: callvirt instance !0[] class System.Collections.Generic.List`1<int32>::ToArray()
//IL_0072: ldtoken int32[]
//IL_0077: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_007c: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object,
// class System.Type)
//IL_0081: ldarg.1
//IL_0082: ret
List<int> V_0 = new List<int>();
while (@type.HasElementType)//IL_005e
{
//IL_0008
if(@type.IsSzArray)
{
//IL_0010
V_0.Add(3);
//无条件跳往IL_0056
}
else if (@type.IsArray)
{
//IL_0021
V_0.Add(@type.GetArrayRank());
V_0.Add(2);
//直接跳往IL_0056
}
else if (@type.IsPointer)
{
//IL_003e
V_0.Add(1);
//直接跳往IL_0056
}
else if (@type.IsByRef)
{
//IL_004f
V_0.Add(4);
//IL_0056
}
//IL_0056
@type = @type.GetElementType();
//IL_005e
}
info.AddValue("ElementTypes", V_0.ToArray(), typeof(int[]));
return @type;
}
internal System.Type MakeElementTypes(System.Type @type)
{
// 代码大小 117 (0x75)
//.maxstack 4
//.locals init (int32 V_0)
//IL_0000: ldarg.0
//IL_0001: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_0006: ldlen
//IL_0007: conv.i4
//IL_0008: ldc.i4.1
//IL_0009: sub
//IL_000a: stloc.0
//IL_000b: br.s IL_006f
//IL_000d: ldarg.0
//IL_000e: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_0013: ldloc.0
//IL_0014: ldelem.i4
//IL_0015: ldc.i4.3
//IL_0016: bne.un.s IL_0022
//IL_0018: ldarg.1
//IL_0019: callvirt instance class System.Type System.Type::MakeArrayType()
//IL_001e: starg.s 'type'
//IL_0020: br.s IL_006b
//IL_0022: ldarg.0
//IL_0023: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_0028: ldloc.0
//IL_0029: ldelem.i4
//IL_002a: ldc.i4.2
//IL_002b: bne.un.s IL_0043
//IL_002d: ldarg.1
//IL_002e: ldarg.0
//IL_002f: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_0034: ldloc.0
//IL_0035: ldc.i4.1
//IL_0036: sub
//IL_0037: dup
//IL_0038: stloc.0
//IL_0039: ldelem.i4
//IL_003a: callvirt instance class System.Type System.Type::MakeArrayType(int32)
//IL_003f: starg.s 'type'
//IL_0041: br.s IL_006b
//IL_0043: ldarg.0
//IL_0044: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_0049: ldloc.0
//IL_004a: ldelem.i4
//IL_004b: ldc.i4.1
//IL_004c: bne.un.s IL_0058
//IL_004e: ldarg.1
//IL_004f: callvirt instance class System.Type System.Type::MakePointerType()
//IL_0054: starg.s 'type'
//IL_0056: br.s IL_006b
//IL_0058: ldarg.0
//IL_0059: ldfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_005e: ldloc.0
//IL_005f: ldelem.i4
//IL_0060: ldc.i4.4
//IL_0061: bne.un.s IL_006b
//IL_0063: ldarg.1
//IL_0064: callvirt instance class System.Type System.Type::MakeByRefType()
//IL_0069: starg.s 'type'
//IL_006b: ldloc.0
//IL_006c: ldc.i4.1
//IL_006d: sub
//IL_006e: stloc.0
//IL_006f: ldloc.0
//IL_0070: ldc.i4.0
//IL_0071: bge.s IL_000d
//IL_0073: ldarg.1
//IL_0074: ret
int V_0;
V_0 = this.m_elementTypes.Length - 1;
//直接跳往IL_006f
while (V_0 >= 0)//IL_006f
{
//IL_000d
if(this.m_elementTypes[V_0]==3)
{
//IL_0018
@type = @type.MakeArrayType();
//直接跳往IL_006b
}
else if (this.m_elementTypes[V_0] == 2)
{
//IL_002d
V_0 = V_0 - 1;
@type = @type.MakeArrayType(this.m_elementTypes[V_0]);
//直接跳往IL_006b
}
else if (this.m_elementTypes[V_0] == 1)
{
//IL_004e
@type = @type.MakePointerType();
//直接跳往IL_006b
}
else if (this.m_elementTypes[V_0] == 4)
{
//IL_0063
@type = @type.MakeByRefType();
//IL_006b
}
//IL_006b
V_0 = V_0 - 1;
//IL_006f
}
return @type;
}
internal static void GetUnitySerializationInfo(System.Runtime.Serialization.SerializationInfo info,System.Type @type)
{
// 代码大小 206 (0xce)
//.maxstack 4
//.locals init (int32 V_0)
//IL_0000: ldarg.1
//IL_0001: callvirt instance class System.Type System.Type::GetRootElementType()
//IL_0006: callvirt instance bool System.Type::get_IsGenericParameter()
//IL_000b: brfalse.s IL_007a
//IL_000d: ldarg.0
//IL_000e: ldarg.1
//IL_000f: call class System.Type System.UnitySerializationHolder::AddElementTypes(class System.Runtime.Serialization.SerializationInfo,
// class System.Type)
//IL_0014: starg.s 'type'
//IL_0016: ldarg.0
//IL_0017: ldtoken System.UnitySerializationHolder
//IL_001c: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0021: callvirt instance void System.Runtime.Serialization.SerializationInfo::SetType(class System.Type)
//IL_0026: ldarg.0
//IL_0027: ldstr "UnityType"
//IL_002c: ldc.i4.7
//IL_002d: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// int32)
//IL_0032: ldarg.0
//IL_0033: ldstr "GenericParameterPosition"
//IL_0038: ldarg.1
//IL_0039: callvirt instance int32 System.Type::get_GenericParameterPosition()
//IL_003e: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// int32)
//IL_0043: ldarg.0
//IL_0044: ldstr "DeclaringMethod"
//IL_0049: ldarg.1
//IL_004a: callvirt instance class System.Reflection.MethodBase System.Type::get_DeclaringMethod()
//IL_004f: ldtoken System.Reflection.MethodBase
//IL_0054: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0059: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object,
// class System.Type)
//IL_005e: ldarg.0
//IL_005f: ldstr "DeclaringType"
//IL_0064: ldarg.1
//IL_0065: callvirt instance class System.Type System.Reflection.MemberInfo::get_DeclaringType()
//IL_006a: ldtoken System.Type
//IL_006f: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0074: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object,
// class System.Type)
//IL_0079: ret
//IL_007a: ldc.i4.4
//IL_007b: stloc.0
//IL_007c: ldarg.1
//IL_007d: callvirt instance bool System.Type::get_IsGenericTypeDefinition()
//IL_0082: brtrue.s IL_00ba
//IL_0084: ldarg.1
//IL_0085: callvirt instance bool System.Type::get_ContainsGenericParameters()
//IL_008a: brfalse.s IL_00ba
//IL_008c: ldc.i4.8
//IL_008d: stloc.0
//IL_008e: ldarg.0
//IL_008f: ldarg.1
//IL_0090: call class System.Type System.UnitySerializationHolder::AddElementTypes(class System.Runtime.Serialization.SerializationInfo,
// class System.Type)
//IL_0095: starg.s 'type'
//IL_0097: ldarg.0
//IL_0098: ldstr "GenericArguments"
//IL_009d: ldarg.1
//IL_009e: callvirt instance class System.Type[] System.Type::GetGenericArguments()
//IL_00a3: ldtoken class System.Type[]
//IL_00a8: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_00ad: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object,
// class System.Type)
//IL_00b2: ldarg.1
//IL_00b3: callvirt instance class System.Type System.Type::GetGenericTypeDefinition()
//IL_00b8: starg.s 'type'
//IL_00ba: ldarg.0
//IL_00b: ldloc.0
//IL_00bc: ldarg.1
//IL_00bd: callvirt instance string System.Type::get_FullName()
//IL_00c2: ldarg.1
//IL_00c3: call class System.Reflection.Assembly System.Reflection.Assembly::GetAssembly(class System.Type)
//IL_00c8: call void System.UnitySerializationHolder::GetUnitySerializationInfo(class System.Runtime.Serialization.SerializationInfo,
// int32,
// string,
// class System.Reflection.Assembly)
//IL_00cd: ret
int V_0;
if(@type.GetRootElementType().IsGenericParameter)
{
//IL_000d
@type = UnitySerializationHolder.AddElementTypes(info, @type);
info.SetType(typeof(System.UnitySerializationHolder));
info.AddValue("UnityType", 7);
info.AddValue("GenericParameterPosition", @type.GenericParameterPosition);
info.AddValue("DeclaringMethod", @type.DeclaringMethod, typeof(System.Reflection.MethodBase));
info.AddValue("DeclaringType", @type.DeclaringType, typeof(System.Type));
return;
}
else
{
//IL_007a
V_0=4;
if(!@type.IsGenericTypeDefinition&&@type.ContainsGenericParameters)
{
//IL_008c
V_0 = 8;
@type = UnitySerializationHolder.AddElementTypes(info, @type);
info.AddValue("GenericArguments", @type.GetGenericArguments(), typeof(Type[]));
@type = @type.GetGenericTypeDefinition();
}
//IL_00ba
UnitySerializationHolder.GetUnitySerializationInfo(info, V_0, @type.FullName, System.Reflection.Assembly.GetAssembly(@type));
}
}
internal static void GetUnitySerializationInfo(System.Runtime.Serialization.SerializationInfo info,int unityType,string data,System.Reflection.Assembly @assembly)
{
// 代码大小 81 (0x51)
//.maxstack 4
//.locals init (string V_0)
//IL_0000: ldarg.0
//IL_0001: ldtoken System.UnitySerializationHolder
//IL_0006: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_000b: callvirt instance void System.Runtime.Serialization.SerializationInfo::SetType(class System.Type)
//IL_0010: ldarg.0
//IL_0011: ldstr "Data"
//IL_0016: ldarg.2
//IL_0017: ldtoken System.String
//IL_001c: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0021: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object,
// class System.Type)
//IL_0026: ldarg.0
//IL_0027: ldstr "UnityType"
//IL_002c: ldarg.1
//IL_002d: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// int32)
//IL_0032: ldarg.3
//IL_0033: brtrue.s IL_003d
//IL_0035: ldsfld string System.String::Empty
//IL_003a: stloc.0
//IL_003b: br.s IL_0044
//IL_003d: ldarg.3
//IL_003e: callvirt instance string System.Reflection.Assembly::get_FullName()
//IL_0043: stloc.0
//IL_0044: ldarg.0
//IL_0045: ldstr "AssemblyName"
//IL_004a: ldloc.0
//IL_004b: callvirt instance void System.Runtime.Serialization.SerializationInfo::AddValue(string,
// object)
//IL_0050: ret
string V_0;
info.SetType(typeof(UnitySerializationHolder));
info.AddValue("Data", data, typeof(string));
info.AddValue("UnityType", unityType);
if(@assembly==null)
{
//IL_0035
V_0 = String.Empty;
//直接跳往IL_0044
}
else
{
//IL_003d
V_0 = @assembly.FullName;
//IL_0044
}
info.AddValue("AssemblyName", V_0);
}
internal UnitySerializationHolder(System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context):base()
{
// 代码大小 278 (0x116)
//.maxstack 4
//IL_0000: ldarg.0
//IL_0001: call instance void System.Object::.ctor()
//IL_0006: ldarg.1
//IL_0007: brtrue.s IL_0014
//IL_0009: ldstr "info"
//IL_000e: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_0013: throw
//IL_0014: ldarg.0
//IL_0015: ldarg.1
//IL_0016: ldstr "UnityType"
//IL_001b: callvirt instance int32 System.Runtime.Serialization.SerializationInfo::GetInt32(string)
//IL_0020: stfld int32 System.UnitySerializationHolder::m_unityType
//IL_0025: ldarg.0
//IL_0026: ldfld int32 System.UnitySerializationHolder::m_unityType
//IL_002b: ldc.i4.3
//IL_002c: bne.un.s IL_002f
//IL_002e: ret
//IL_002f: ldarg.0
//IL_0030: ldfld int32 System.UnitySerializationHolder::m_unityType
//IL_0035: ldc.i4.7
//IL_0036: bne.un.s IL_00aa
//IL_0038: ldarg.0
//IL_0039: ldarg.1
//IL_003a: ldstr "DeclaringMethod"
//IL_003f: ldtoken System.Reflection.MethodBase
//IL_0044: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0049: callvirt instance object System.Runtime.Serialization.SerializationInfo::GetValue(string,
// class System.Type)
//IL_004e: isinst System.Reflection.MethodBase
//IL_0053: stfld class System.Reflection.MethodBase System.UnitySerializationHolder::m_declaringMethod
//IL_0058: ldarg.0
//IL_0059: ldarg.1
//IL_005a: ldstr "DeclaringType"
//IL_005f: ldtoken System.Type
//IL_0064: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_0069: callvirt instance object System.Runtime.Serialization.SerializationInfo::GetValue(string,
// class System.Type)
//IL_006e: isinst System.Type
//IL_0073: stfld class System.Type System.UnitySerializationHolder::m_declaringType
//IL_0078: ldarg.0
//IL_0079: ldarg.1
//IL_007a: ldstr "GenericParameterPosition"
//IL_007f: callvirt instance int32 System.Runtime.Serialization.SerializationInfo::GetInt32(string)
//IL_0084: stfld int32 System.UnitySerializationHolder::m_genericParameterPosition
//IL_0089: ldarg.0
//IL_008a: ldarg.1
//IL_008b: ldstr "ElementTypes"
//IL_0090: ldtoken int32[]
//IL_0095: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_009a: callvirt instance object System.Runtime.Serialization.SerializationInfo::GetValue(string,
// class System.Type)
//IL_009f: isinst int32[]
//IL_00a4: stfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_00a9: ret
//IL_00aa: ldarg.0
//IL_00ab: ldfld int32 System.UnitySerializationHolder::m_unityType
//IL_00b0: ldc.i4.8
//IL_00b1: bne.un.s IL_00f3
//IL_00b3: ldarg.0
//IL_00b4: ldarg.1
//IL_00b5: ldstr "GenericArguments"
//IL_00ba: ldtoken class System.Type[]
//IL_00bf: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_00c4: callvirt instance object System.Runtime.Serialization.SerializationInfo::GetValue(string,
// class System.Type)
//IL_00c9: isinst class System.Type[]
//IL_00ce: stfld class System.Type[] System.UnitySerializationHolder::m_instantiation
//IL_00d3: ldarg.0
//IL_00d4: ldarg.1
//IL_00d5: ldstr "ElementTypes"
//IL_00da: ldtoken int32[]
//IL_00df: call class System.Type System.Type::GetTypeFromHandle(valuetype System.RuntimeTypeHandle)
//IL_00e4: callvirt instance object System.Runtime.Serialization.SerializationInfo::GetValue(string,
// class System.Type)
//IL_00e9: isinst int32[]
//IL_00ee: stfld int32[] System.UnitySerializationHolder::m_elementTypes
//IL_00f3: ldarg.0
//IL_00f4: ldarg.1
//IL_00f5: ldstr "Data"
//IL_00fa: callvirt instance string System.Runtime.Serialization.SerializationInfo::GetString(string)
//IL_00ff: stfld string System.UnitySerializationHolder::m_data
//IL_0104: ldarg.0
//IL_0105: ldarg.1
//IL_0106: ldstr "AssemblyName"
//IL_010b: callvirt instance string System.Runtime.Serialization.SerializationInfo::GetString(string)
//IL_0110: stfld string System.UnitySerializationHolder::m_assemblyName
//IL_0115: ret
if(info==null)
{
throw new ArgumentNullException("info");
}
else
{
//IL_0014
this.m_unityType=info.GetInt32("UnityType");
if(this.m_unityType==3)
{
return;
}
else if (this.m_unityType == 7)
{
//IL_0038
this.m_declaringMethod = info.GetValue("DeclaringMethod", typeof(System.Reflection.MethodBase)) as System.Reflection.MethodBase;
this.m_declaringType = info.GetValue("DeclaringType", typeof(System.Type)) as System.Type;
this.m_genericParameterPosition = info.GetInt32("GenericParameterPosition");
this.m_elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
}
else if (this.m_unityType == 8)
{
//IL_00b3
this.m_instantiation = info.GetValue("GenericArguments", typeof(System.Type)) as System.Type;
this.m_elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
this.m_data = info.GetString("Data");
this.m_assemblyName = info.GetString("AssemblyName");
}
else
{
//IL_00f
this.m_data = info.GetString("Data");
this.m_assemblyName = info.GetString("AssemblyName");
}
}
}
private void ThrowInsufficientInformation(string @field)
{
// 代码大小 38 (0x26)
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "Serialization_InsufficientDeserializationState"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.1
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldarg.1
//IL_0019: stelem.ref
//IL_001a: ldloc.0
//IL_001b: call string System.String::Format(class System.IFormatProvider,
// string,
// object[])
//IL_0020: newobj instance void System.Runtime.Serialization.SerializationException::.ctor(string)
//IL_0025: throw
object[] V_0;
V_0 = new object[1]();
V_0[0] = @field;
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, System.Environment.GetResourceString("Serialization_InsufficientDeserializationState"), V_0));
}
public new virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info,System.Runtime.Serialization.StreamingContext context)
{
// 代码大小 16 (0x10)
//.maxstack 8
//IL_0000: ldstr "NotSupported_UnitySerHolder"
//IL_0005: call string System.Environment::GetResourceString(string)
//IL_000a: newobj instance void System.NotSupportedException::.ctor(string)
//IL_000f: throw
throw new System.NotSupportedException(System.Environment.GetResourceString("NotSupported_UnitySerHolder"));
}
public new virtual object GetRealObject(System.Runtime.Serialization.StreamingContext context)
{
#region IL
// 代码大小 534 (0x216)
//.maxstack 5
//.locals init (class System.Reflection.Assembly V_0,
// class System.Type V_1,
// class System.Type V_2,
// class System.Reflection.Module V_3,
// int32 V_4,
// object[] V_5)
//IL_0000: ldarg.0
//IL_0001: ldfld int32 System.UnitySerializationHolder::m_unityType
//IL_0006: stloc.s V_4
//IL_0008: ldloc.s V_4
//IL_000a: ldc.i4.1
//IL_000b: sub
//IL_000c: switch (
// IL_0036,
// IL_003c,
// IL_0042,
// IL_00d1,
// IL_013c,
// IL_01c5,
// IL_0082,
// IL_0048)
//IL_0031: br IL_0206
//IL_0036: ldsfld class System.Empty System.Empty::Value
//IL_003b: ret
//IL_003c: ldsfld class System.DBNull System.DBNull::Value
//IL_0041: ret
//IL_0042: ldsfld class System.Reflection.Missing System.Reflection.Missing::Value
//IL_0047: ret
//IL_0048: ldarg.0
//IL_0049: ldc.i4.4
//IL_004a: stfld int32 System.UnitySerializationHolder::m_unityType
//IL_004f: ldarg.0
//IL_0050: ldarg.1
//IL_0051: callvirt instance object System.UnitySerializationHolder::GetRealObject(valuetype System.Runtime.Serialization.StreamingContext)
//IL_0056: isinst System.Type
//IL_005b: stloc.1
//IL_005c: ldarg.0
//IL_005d: ldc.i4.8
//IL_005e: stfld int32 System.UnitySerializationHolder::m_unityType
//IL_0063: ldarg.0
//IL_0064: ldfld class System.Type[] System.UnitySerializationHolder::m_instantiation
//IL_0069: ldc.i4.0
//IL_006a: ldelem.ref
//IL_006b: brtrue.s IL_006f
//IL_006d: ldnull
//IL_006e: ret
//IL_006f: ldarg.0
//IL_0070: ldloc.1
//IL_0071: ldarg.0
//IL_0072: ldfld class System.Type[] System.UnitySerializationHolder::m_instantiation
//IL_0077: callvirt instance class System.Type System.Type::MakeGenericType(class System.Type[])
//IL_007c: call instance class System.Type System.UnitySerializationHolder::MakeElementTypes(class System.Type)
//IL_0081: ret
//IL_0082: ldarg.0
//IL_0083: ldfld class System.Reflection.MethodBase System.UnitySerializationHolder::m_declaringMethod
//IL_0088: brtrue.s IL_009d
//IL_008a: ldarg.0
//IL_008b: ldfld class System.Type System.UnitySerializationHolder::m_declaringType
//IL_0090: brtrue.s IL_009d
//IL_0092: ldarg.0
//IL_0093: ldstr "DeclaringMember"
//IL_0098: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_009d: ldarg.0
//IL_009e: ldfld class System.Reflection.MethodBase System.UnitySerializationHolder::m_declaringMethod
//IL_00a3: brfalse.s IL_00b8
//IL_00a5: ldarg.0
//IL_00a6: ldfld class System.Reflection.MethodBase System.UnitySerializationHolder::m_declaringMethod
//IL_00ab: callvirt instance class System.Type[] System.Reflection.MethodBase::GetGenericArguments()
//IL_00b0: ldarg.0
//IL_00b1: ldfld int32 System.UnitySerializationHolder::m_genericParameterPosition
//IL_00b6: ldelem.ref
//IL_00b7: ret
//IL_00b8: ldarg.0
//IL_00b9: ldarg.0
//IL_00ba: ldfld class System.Type System.UnitySerializationHolder::m_declaringType
//IL_00bf: callvirt instance class System.Type[] System.Type::GetGenericArguments()
//IL_00c4: ldarg.0
//IL_00c5: ldfld int32 System.UnitySerializationHolder::m_genericParameterPosition
//IL_00ca: ldelem.ref
//IL_00cb: call instance class System.Type System.UnitySerializationHolder::MakeElementTypes(class System.Type)
//IL_00d0: ret
//IL_00d1: ldarg.0
//IL_00d2: ldfld string System.UnitySerializationHolder::m_data
//IL_00d7: brfalse.s IL_00e6
//IL_00d9: ldarg.0
//IL_00da: ldfld string System.UnitySerializationHolder::m_data
//IL_00df: callvirt instance int32 System.String::get_Length()
//IL_00e4: brtrue.s IL_00f1
//IL_00e6: ldarg.0
//IL_00e7: ldstr "Data"
//IL_00ec: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_00f1: ldarg.0
//IL_00f2: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_00f7: brtrue.s IL_0104
//IL_00f9: ldarg.0
//IL_00fa: ldstr "AssemblyName"
//IL_00ff: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_0104: ldarg.0
//IL_0105: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_010a: callvirt instance int32 System.String::get_Length()
//IL_010f: brtrue.s IL_011f
//IL_0111: larg.0
//IL_0112: ldfld string System.UnitySerializationHolder::m_data
//IL_0117: ldc.i4.1
//IL_0118: ldc.i4.0
//IL_0119: call class System.Type System.Type::GetType(string,
// bool,
// bool)
//IL_011e: ret
//IL_011f: ldarg.0
//IL_0120: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_0125: call class System.Reflection.Assembly System.Reflection.Assembly::Load(string)
//IL_012a: stloc.0
//IL_012b: ldloc.0
//IL_012c: ldarg.0
//IL_012d: ldfld string System.UnitySerializationHolder::m_data
//IL_0132: ldc.i4.1
//IL_0133: ldc.i4.0
//IL_0134: callvirt instance class System.Type System.Reflection.Assembly::GetType(string,
// bool,
// bool)
//IL_0139: stloc.2
//IL_013a: ldloc.2
//IL_013b: ret
//IL_013c: ldarg.0
//IL_013d: ldfld string System.UnitySerializationHolder::m_data
//IL_0142: brfalse.s IL_0151
//IL_0144: ldarg.0
//IL_0145: ldfld string System.UnitySerializationHolder::m_data
//IL_014a: callvirt instance int32 System.String::get_Length()
//IL_014f: brtrue.s IL_015c
//IL_0151: ldarg.0
//IL_0152: ldstr "Data"
//IL_0157: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_015c: ldarg.0
//IL_015d: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_0162: brtrue.s IL_016f
//IL_0164: ldarg.0
//IL_0165: ldstr "AssemblyName"
//IL_016a: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_016f: ldarg.0
//IL_0170: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_0175: call class System.Reflection.Assembly System.Reflection.Assembly::Load(string)
//IL_017a: stloc.0
//IL_017b: ldloc.0
//IL_017c: ldarg.0
//IL_017d: ldfld string System.UnitySerializationHolder::m_data
//IL_0182: callvirt instance class System.Reflection.Module System.Reflection.Assembly::GetModule(string)
//IL_0187: stloc.3
//IL_0188: ldloc.3
//IL_0189: brtrue.s IL_01c3
//IL_018b: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0190: ldstr "Serialization_UnableToFindModule"
//IL_0195: call string System.Environment::GetResourceString(string)
//IL_019a: ldc.i4.2
//IL_019b: newarr System.Object
//IL_01a0: stloc.s V_5
//IL_01a2: ldloc.s V_5
//IL_01a4: ldc.i4.0
//IL_01a5: ldarg.0
//IL_01a6: ldfld string System.UnitySerializationHolder::m_data
//IL_01ab: stelem.ref
//IL_01ac: ldloc.s V_5
//IL_01ae: ldc.i4.1
//IL_01af: ldarg.0
//IL_01b0: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_01b5: stelem.ref
//IL_01b6: ldloc.s V_5
//IL_01b8: call string System.String::Format(class System.IFormatProvider,
// string,
// object[])
//IL_01bd: newobj instance void System.Runtime.Serialization.SerializationException::.ctor(string)
//I_01c2: throw
//IL_01c3: ldloc.3
//IL_01c4: ret
//IL_01c5: ldarg.0
//IL_01c6: ldfld string System.UnitySerializationHolder::m_data
//IL_01cb: brfalse.s IL_01da
//IL_01cd: ldarg.0
//IL_01ce: ldfld string System.UnitySerializationHolder::m_data
//IL_01d3: callvirt instance int32 System.String::get_Length()
//IL_01d8: brtrue.s IL_01e5
//IL_01da: ldarg.0
//IL_01db: ldstr "Data"
//IL_01e0: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_01e5: ldarg.0
//IL_01e6: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_01eb: brtrue.s IL_01f8
//IL_01ed: ldarg.0
//IL_01ee: ldstr "AssemblyName"
//IL_01f3: call instance void System.UnitySerializationHolder::ThrowInsufficientInformation(string)
//IL_01f8: ldarg.0
//IL_01f9: ldfld string System.UnitySerializationHolder::m_assemblyName
//IL_01fe: call class System.Reflection.Assembly System.Reflection.Assembly::Load(string)
//IL_0203: stloc.0
//IL_0204: ldloc.0
//IL_0205: ret
//IL_0206: ldstr "Argument_InvalidUnity"
//IL_020b: call string System.Environment::GetResourceString(string)
//IL_0210: newobj instance void System.ArgumentException::.ctor(string)
//IL_0215: throw
#endregion
Assembly V_0;
type V_1, V_2;
Module V_3;
int V_4;
object[] V_5;
V_4=this.m_unityType;
switch(V_4-1)
{
case 0:
{
return System.Empty.Value;
//IL_0036,
}
case 1:
{
return System.DBNull.Value;
//IL_003c,
}
case 2:
{
return System.Reflection.Missing.Value;
//IL_0042,
}
case 3:
{
//RuntimeTypeUnity = 0x00000004
if(this.m_data!=null &&this.m_data.Length!=0)
{
//IL_00f1
if(this.m_assemblyName==null)
{
this.ThrowInsufficientInformation("AssemblyName");
}
else
{
if(this.m_assemblyName.Length==0)
{
//IL_0111
return System.Type.GetType(this.m_data, true, false);
}
else
{
//IL_011f
V_0 = System.Reflection.Assembly.Load(this.m_assemblyName);
V_2 = V_0.GetType(this.m_data, true, false);
return V_2;
}
}
}
//IL_00e6
UnitySerializationHolder.ThrowInsufficientInformation("Data");
//IL_00d1,
}
case 4:
{
//ModuleUnity = 0x00000005;
if(this.m_data!=null&&this.m_data.Length!=0)
{
//IL_015c
if(this.m_assemblyName==null)
{
this.ThrowInsufficientInformation("AssemblyName");
}
else
{
//IL_016f
V_0=System.Reflection.Assembly.Loa(this.m_assemblyName);
V_3=V_0.GetModule(this.m_data);
if(V_3==null)
{
//IL_018b
V_5 = new object[2]();
V_5[0] = this.m_data;
V_5[1] = this.m_assemblyName;
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, System.Environment.GetResourceString("Serialization_UnableToFindModule"), V_5));
}
else
{
return V_3;
}
}
}
//IL_0151
this.ThrowInsufficientInformation("Data");
//IL_013c,
}
case 5:
{
//AssemblyUnity = 0x00000006;
if(this.m_data!=null&&this.m_data.Length!=0)
{
//IL_01e5
if (this.m_assemblyName == null)
{
this.ThrowInsufficientInformation("AssemblyName");
}
else
{
V_0 = System.Reflection.Assembly.Load(this.m_assemblyName);
return V_0;
}
}
//IL_01da
this.ThrowInsufficientInformation("Data");
//IL_01c5,
}
case 6:
{
//GenericParameterTypeUnity = 0x00000007;
if(this.m_declaringMethod==null)//不满足跳往IL_009d
{
//IL_008a
if(this.m_declaringType==null)//不满足跳往IL_009d
{
//IL_0092
this.ThrowInsufficientInformation("DeclaringMember");
}
}
//IL_009d
if(this.m_declaringMethod!=null)
{
//IL_00a5
return this.m_declaringMethod.GetGenericArguments()[this.m_genericParameterPosition];
}
else
{
//IL_00b8
return this.MakeElementTypes(this.m_declaringType.GetGenericArguments()[this.m_genericParameterPosition]);
}
//IL_0082,
}
case 7:
{
//PartialInstantiationTypeUnity = 0x00000008;
this.m_unityType=4;
V_1=this.GetRealObject(context) as type;
this.m_unityType=8;
if(this.m_instantiation[0]==null)
{
return null;
}
else
{
//IL_006f
return this.MakeElementTypes(V_1.MakeGenericType(this.m_instantiation));
}
//IL_0048
}
default:
{
throw new System.ArgumentException(System.Environment.GetResourceString("Argument_InvalidUnity"));
//默认跳往IL_0206
}
}
}
}
}