Exemplo n.º 1
0
        /*
         * .method public hidebysig newslot virtual final
         *  instance void  Read(class Sims3.SimIFace.FastStreamReader reader,
         *                      class Sims3.SimIFace.IPersistReader persistReader) cil managed
         *
         *
         *     object V_4,
         *     class [mscorlib]System.Type V_5,
         *     class [mscorlib]System.Reflection.MethodInfo V_6,
         *     object[] V_7)
         * IL_0000:  ldarg.2
         * IL_0001:  callvirt   instance object [SimIFace]Sims3.SimIFace.IPersistReader::ReadReference()
         * IL_0006:  castclass  [mscorlib]System.Type
         * IL_000b:  stloc.0
         * IL_000c:  ldarg.1
         * IL_000d:  callvirt   instance string [SimIFace]Sims3.SimIFace.FastStreamReader::ReadString()
         * IL_0012:  stloc.1
         * IL_0013:  ldarg.2
         * IL_0014:  callvirt   instance object [SimIFace]Sims3.SimIFace.IPersistReader::ReadReference()
         * IL_0019:  stloc.2
         * IL_001a:  ldloc.0
         * IL_001b:  brfalse.s  IL_0099
         *
         * IL_001d:  ldnull
         * IL_001e:  stloc.3
         * IL_001f:  ldloc.0
         * IL_0020:  ldloc.1
         * IL_0021:  ldc.i4.s   56
         * IL_0023:  callvirt   instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
         *                                                                                                      valuetype [mscorlib]System.Reflection.BindingFlags)
         * IL_0028:  stloc.3
         * IL_0029:  ldloc.3
         * IL_002a:  brfalse.s  IL_0099
         *
         * IL_002c:  ldloc.3
         * IL_002d:  callvirt   instance bool [mscorlib]System.Reflection.FieldInfo::get_IsStatic()
         * IL_0032:  brfalse.s  IL_0099
         *
         * IL_0034:  ldloc.3
         * IL_0035:  call       bool [SimIFace]Sims3.SimIFace.PersistStatic::IsFieldSerializable(class [mscorlib]System.Reflection.FieldInfo)
         * IL_003a:  brfalse.s  IL_0099
         *
         * .try
         * {
         * IL_003c:  ldloc.3
         * IL_003d:  ldnull
         * IL_003e:  ldloc.2
         * IL_003f:  callvirt   instance void [mscorlib]System.Reflection.FieldInfo::SetValue(object,
         *                                                                                 object)
         * IL_0044:  ldloc.3
         * IL_0045:  ldnull
         * IL_0046:  callvirt   instance object [mscorlib]System.Reflection.FieldInfo::GetValue(object)
         * IL_004b:  stloc.s    V_4
         * IL_004d:  ldstr      "ScriptCore.ExceptionTrap, ScriptCore"
         * IL_0052:  call       class [mscorlib]System.Type [mscorlib]System.Type::GetType(string)
         * IL_0057:  stloc.s    V_5
         * IL_0059:  ldloc.s    V_5
         * IL_005b:  brfalse.s  IL_0094
         *
         * IL_005d:  ldloc.s    V_5
         * IL_005f:  ldstr      "ExternalLoadReference"
         * IL_0064:  ldc.i4.s   24
         * IL_0066:  callvirt   instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Type::GetMethod(string,
         *                                                                                                          valuetype [mscorlib]System.Reflection.BindingFlags)
         * IL_006b:  stloc.s    V_6
         * IL_006d:  ldloc.s    V_6
         * IL_006f:  brfalse.s  IL_0094
         *
         * IL_0071:  ldloc.s    V_6
         * IL_0073:  ldnull
         * IL_0074:  ldc.i4.3
         * IL_0075:  newarr     [mscorlib]System.Object
         * IL_007a:  stloc.s    V_7
         * IL_007c:  ldloc.s    V_7
         * IL_007e:  ldc.i4.0
         * IL_007f:  ldloc.2
         * IL_0080:  stelem.ref
         * IL_0081:  ldloc.s    V_7
         * IL_0083:  ldc.i4.1
         * IL_0084:  ldloc.s    V_4
         * IL_0086:  stelem.ref
         * IL_0087:  ldloc.s    V_7
         * IL_0089:  ldc.i4.2
         * IL_008a:  ldloc.3
         * IL_008b:  stelem.ref
         * IL_008c:  ldloc.s    V_7
         * IL_008e:  callvirt   instance object [mscorlib]System.Reflection.MethodBase::Invoke(object,
         *                                                                                  object[])
         * IL_0093:  pop
         * IL_0094:  leave.s    IL_0099
         *
         * }  // end .try
         * catch [mscorlib]System.ArgumentException
         * {
         * IL_0096:  pop
         * IL_0097:  leave.s    IL_0099
         *
         * }  // end handler
         * IL_0099:  ret
         */
        public void Read(FastStreamReader reader, IPersistReader persistReader)
        {
            Type   type = (Type)persistReader.ReadReference();
            string name = reader.ReadString();
            object obj2 = persistReader.ReadReference();

            if (type != null)
            {
                FieldInfo fieldInfo = null;
                fieldInfo = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
                if (((fieldInfo != null) && fieldInfo.IsStatic) && PersistStatic.IsFieldSerializable(fieldInfo))
                {
                    try
                    {
                        fieldInfo.SetValue(null, obj2);

                        object parent = fieldInfo.GetValue(null);

                        Type exceptionTrap = Type.GetType("ScriptCore.ExceptionTrap, ScriptCore");
                        if (exceptionTrap != null)
                        {
                            MethodInfo loadReference = exceptionTrap.GetMethod("ExternalLoadReference", BindingFlags.Public | BindingFlags.Static);
                            if (loadReference != null)
                            {
                                loadReference.Invoke(null, new object[] { obj2, parent, fieldInfo });
                            }
                        }
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        /*  HashtableFormatter::Read
         * IL_002e:  callvirt   instance void [mscorlib]System.Collections.Hashtable::Add(object,
         *                                                                         object)
         * AL_1004:  ldloca V_3
         * AL_1005:  ldarg.1
         * AL_1007:  call       void ScriptCore.ExceptionTrap::LoadReference(object&,
         *                                                          object&)
         * AL_100c:  ldloca V_4
         * AL_100d:  ldarg.1
         * AL_100f:  call       void ScriptCore.ExceptionTrap::LoadReference(object&,
         *                                                          object&)
         */

        public new void Read(ref object obj, FastStreamReader reader, IPersistReader persistReader, Type type)
        {
            object key  = null;
            object obj3 = null;

            ExceptionTrap.LoadReference(ref key, ref obj);
            ExceptionTrap.LoadReference(ref obj3, ref obj);
        }
Exemplo n.º 3
0
 public void Read(FastStreamReader reader, IPersistReader persistReader)
 {
     int position = reader.Position;
     reader.ReadUInt32();
     uint num2 = reader.ReadUInt32();
     uint num3 = reader.ReadUInt32();
     uint num4 = reader.ReadUInt32();
     uint num5 = reader.ReadUInt32();
     int[] numArray = new int[num2];
     reader.Seek(position + ((int)num3), SeekOrigin.Begin);
     for (uint i = 0x0; i < num2; i++)
     {
         numArray[i] = reader.ReadInt32();
     }
     reader.Seek(position + ((int)num5), SeekOrigin.Begin);
     mMethodList.Capacity = (int)num4;
     mMethodList.Clear();
     for (uint j = 0x0; j < num4; j++)
     {
         MethodEntry entry;
         MethodInfo methodInfo = (MethodInfo)persistReader.ReadReferenceForceLive();
         if (ScriptCore.ExceptionTrap.GetOption("ResetTaskStates") == 1)
         {
             entry.checksum = 0;
         }
         else
         {
             entry.checksum = reader.ReadUInt32();
         }
         if (methodInfo != null)
         {
             uint num8;
             entry.handle = methodInfo.MethodHandle;
             if (!ScriptCore.TaskControl.GetMethodChecksum(entry.handle, out num8))
             {
                 entry.handle = new RuntimeMethodHandle();
             }
             else if (num8 != entry.checksum)
             {
                 entry.handle = new RuntimeMethodHandle();
             }
             else if (!this.IsMethodSaveSafe(methodInfo))
             {
             }
         }
         else
         {
             entry.handle = new RuntimeMethodHandle();
         }
         this.mMethodList.Add(entry);
     }
     this.mSavedTaskContexts = new ScriptCore.SavedTaskContext[num2];
     for (uint k = 0x0; k < num2; k++)
     {
         int num10 = numArray[k];
         if (num10 == 0x0)
         {
             this.mSavedTaskContexts[k] = InvalidSavedTaskContext;
         }
         else if (num10 >= 0x0)
         {
             reader.Seek(position + num10, SeekOrigin.Begin);
             ScriptCore.SavedTaskContext invalidSavedTaskContext = ReadTask(reader, persistReader);
             if (invalidSavedTaskContext == null)
             {
                 invalidSavedTaskContext = InvalidSavedTaskContext;
             }
             this.mSavedTaskContexts[k] = invalidSavedTaskContext;
         }
     }
 }
Exemplo n.º 4
0
        public void Read(FastStreamReader reader, IPersistReader persistReader)
        {
            int position = reader.Position;

            reader.ReadUInt32();
            uint num2 = reader.ReadUInt32();
            uint num3 = reader.ReadUInt32();
            uint num4 = reader.ReadUInt32();
            uint num5 = reader.ReadUInt32();

            int[] numArray = new int[num2];
            reader.Seek(position + ((int)num3), SeekOrigin.Begin);
            for (uint i = 0x0; i < num2; i++)
            {
                numArray[i] = reader.ReadInt32();
            }
            reader.Seek(position + ((int)num5), SeekOrigin.Begin);
            mMethodList.Capacity = (int)num4;
            mMethodList.Clear();
            for (uint j = 0x0; j < num4; j++)
            {
                MethodEntry entry;
                MethodInfo  methodInfo = (MethodInfo)persistReader.ReadReferenceForceLive();
                if (ScriptCore.ExceptionTrap.GetOption("ResetTaskStates") == 1)
                {
                    entry.checksum = 0;
                }
                else
                {
                    entry.checksum = reader.ReadUInt32();
                }
                if (methodInfo != null)
                {
                    uint num8;
                    entry.handle = methodInfo.MethodHandle;
                    if (!ScriptCore.TaskControl.GetMethodChecksum(entry.handle, out num8))
                    {
                        entry.handle = new RuntimeMethodHandle();
                    }
                    else if (num8 != entry.checksum)
                    {
                        entry.handle = new RuntimeMethodHandle();
                    }
                    else if (!this.IsMethodSaveSafe(methodInfo))
                    {
                    }
                }
                else
                {
                    entry.handle = new RuntimeMethodHandle();
                }
                this.mMethodList.Add(entry);
            }
            this.mSavedTaskContexts = new ScriptCore.SavedTaskContext[num2];
            for (uint k = 0x0; k < num2; k++)
            {
                int num10 = numArray[k];
                if (num10 == 0x0)
                {
                    this.mSavedTaskContexts[k] = InvalidSavedTaskContext;
                }
                else if (num10 >= 0x0)
                {
                    reader.Seek(position + num10, SeekOrigin.Begin);
                    ScriptCore.SavedTaskContext invalidSavedTaskContext = ReadTask(reader, persistReader);
                    if (invalidSavedTaskContext == null)
                    {
                        invalidSavedTaskContext = InvalidSavedTaskContext;
                    }
                    this.mSavedTaskContexts[k] = invalidSavedTaskContext;
                }
            }
        }
Exemplo n.º 5
0
        /*  ArrayListFormatter::Read
         * IL_001c:  callvirt   instance void [mscorlib]System.Collections.ArrayList::AddRange(class [mscorlib]System.Collections.ICollection)
         *
         * AL_1002:  ldloc.0
         * AL_1003:  ldarg.1
         * AL_1005:  call       void ScriptCore.ExceptionTrap::LoadReference<object>(!!0[],
         *                                                              object&)
         */

        public new void Read(ref object obj, FastStreamReader reader, IPersistReader persistReader, Type type)
        {
            object[] collection = null;

            ExceptionTrap.LoadReference(collection, ref obj);
        }
Exemplo n.º 6
0
        /*
    .method public hidebysig newslot virtual final 
            instance void  Read(class Sims3.SimIFace.FastStreamReader reader,
                                class Sims3.SimIFace.IPersistReader persistReader) cil managed
         * 
         * 
               object V_4,
               class [mscorlib]System.Type V_5,
               class [mscorlib]System.Reflection.MethodInfo V_6,
               object[] V_7)
      IL_0000:  ldarg.2
      IL_0001:  callvirt   instance object [SimIFace]Sims3.SimIFace.IPersistReader::ReadReference()
      IL_0006:  castclass  [mscorlib]System.Type
      IL_000b:  stloc.0
      IL_000c:  ldarg.1
      IL_000d:  callvirt   instance string [SimIFace]Sims3.SimIFace.FastStreamReader::ReadString()
      IL_0012:  stloc.1
      IL_0013:  ldarg.2
      IL_0014:  callvirt   instance object [SimIFace]Sims3.SimIFace.IPersistReader::ReadReference()
      IL_0019:  stloc.2
      IL_001a:  ldloc.0
      IL_001b:  brfalse.s  IL_0099

      IL_001d:  ldnull
      IL_001e:  stloc.3
      IL_001f:  ldloc.0
      IL_0020:  ldloc.1
      IL_0021:  ldc.i4.s   56
      IL_0023:  callvirt   instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
                                                                                                                valuetype [mscorlib]System.Reflection.BindingFlags)
      IL_0028:  stloc.3
      IL_0029:  ldloc.3
      IL_002a:  brfalse.s  IL_0099

      IL_002c:  ldloc.3
      IL_002d:  callvirt   instance bool [mscorlib]System.Reflection.FieldInfo::get_IsStatic()
      IL_0032:  brfalse.s  IL_0099

      IL_0034:  ldloc.3
      IL_0035:  call       bool [SimIFace]Sims3.SimIFace.PersistStatic::IsFieldSerializable(class [mscorlib]System.Reflection.FieldInfo)
      IL_003a:  brfalse.s  IL_0099

      .try
      {
        IL_003c:  ldloc.3
        IL_003d:  ldnull
        IL_003e:  ldloc.2
        IL_003f:  callvirt   instance void [mscorlib]System.Reflection.FieldInfo::SetValue(object,
                                                                                           object)
        IL_0044:  ldloc.3
        IL_0045:  ldnull
        IL_0046:  callvirt   instance object [mscorlib]System.Reflection.FieldInfo::GetValue(object)
        IL_004b:  stloc.s    V_4
        IL_004d:  ldstr      "ScriptCore.ExceptionTrap, ScriptCore"
        IL_0052:  call       class [mscorlib]System.Type [mscorlib]System.Type::GetType(string)
        IL_0057:  stloc.s    V_5
        IL_0059:  ldloc.s    V_5
        IL_005b:  brfalse.s  IL_0094

        IL_005d:  ldloc.s    V_5
        IL_005f:  ldstr      "ExternalLoadReference"
        IL_0064:  ldc.i4.s   24
        IL_0066:  callvirt   instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Type::GetMethod(string,
                                                                                                                    valuetype [mscorlib]System.Reflection.BindingFlags)
        IL_006b:  stloc.s    V_6
        IL_006d:  ldloc.s    V_6
        IL_006f:  brfalse.s  IL_0094

        IL_0071:  ldloc.s    V_6
        IL_0073:  ldnull
        IL_0074:  ldc.i4.3
        IL_0075:  newarr     [mscorlib]System.Object
        IL_007a:  stloc.s    V_7
        IL_007c:  ldloc.s    V_7
        IL_007e:  ldc.i4.0
        IL_007f:  ldloc.2
        IL_0080:  stelem.ref
        IL_0081:  ldloc.s    V_7
        IL_0083:  ldc.i4.1
        IL_0084:  ldloc.s    V_4
        IL_0086:  stelem.ref
        IL_0087:  ldloc.s    V_7
        IL_0089:  ldc.i4.2
        IL_008a:  ldloc.3
        IL_008b:  stelem.ref
        IL_008c:  ldloc.s    V_7
        IL_008e:  callvirt   instance object [mscorlib]System.Reflection.MethodBase::Invoke(object,
                                                                                            object[])
        IL_0093:  pop
        IL_0094:  leave.s    IL_0099

      }  // end .try
      catch [mscorlib]System.ArgumentException 
      {
        IL_0096:  pop
        IL_0097:  leave.s    IL_0099

      }  // end handler
      IL_0099:  ret
         */
        public void Read(FastStreamReader reader, IPersistReader persistReader)
        {
            Type type = (Type)persistReader.ReadReference();
            string name = reader.ReadString();
            object obj2 = persistReader.ReadReference();
            if (type != null)
            {
                FieldInfo fieldInfo = null;
                fieldInfo = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
                if (((fieldInfo != null) && fieldInfo.IsStatic) && PersistStatic.IsFieldSerializable(fieldInfo))
                {
                    try
                    {
                        fieldInfo.SetValue(null, obj2);

                        object parent = fieldInfo.GetValue(null);

                        Type exceptionTrap = Type.GetType("ScriptCore.ExceptionTrap, ScriptCore");
                        if (exceptionTrap != null)
                        {
                            MethodInfo loadReference = exceptionTrap.GetMethod("ExternalLoadReference", BindingFlags.Public | BindingFlags.Static);
                            if (loadReference != null)
                            {
                                loadReference.Invoke(null, new object[] { obj2, parent, fieldInfo });
                            }
                        }
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }
        }