示例#1
0
 private void CallDeserializationMethod(FieldReference fieldDef)
 {
     if (MethodEmitterBase.IsIUnitySerializable(base.TypeOf(fieldDef)))
     {
         base.EmitWithDepthCheck <FieldReference>(new Action <FieldReference>(this.InlinedDeserializeInvocationFor), fieldDef);
     }
     else
     {
         this.EmitDeserializationFor(fieldDef);
     }
 }
示例#2
0
 private void EmitDeserializeOfItem(FieldReference fieldDef, TypeReference elementTypeRef)
 {
     if (!MethodEmitterBase.IsIUnitySerializable(elementTypeRef))
     {
         TypeReference type = base.TypeOf(fieldDef);
         if (CecilUtils.IsGenericList(type))
         {
             base.EmitLoadField(fieldDef);
             base.LoadStateInstance(this.SerializedStateReaderInterface);
             this.CallReaderMethod(this.ReadMethodNameFor(elementTypeRef), null);
             if (!elementTypeRef.IsValueType)
             {
                 base.Isinst(elementTypeRef);
                 base.Callvirt(this.AddMethodRefFor(type));
             }
             else
             {
                 base.Callvirt(this.AddMethodRefFor(type));
             }
         }
         else
         {
             base.EmitLoadField(fieldDef);
             base.EmitLoadItemIndex();
             base.LoadStateInstance(this.SerializedStateReaderInterface);
             this.CallReaderMethod(this.ReadMethodNameFor(elementTypeRef), null);
             if (!elementTypeRef.IsValueType)
             {
                 base.Isinst(elementTypeRef);
                 base.Stelem_Ref();
             }
             else
             {
                 this.Stelem_Any(elementTypeRef);
             }
         }
     }
     else
     {
         this.EmitDeserializeOfIUnitySerializableItem(fieldDef, elementTypeRef);
     }
 }