Пример #1
0
        public void GenerateLoad(IILGen ilGenerator, Action <IILGen> pushReader, Action <IILGen> pushCtx,
                                 Action <IILGen> pushDescriptor, Type targetType)
        {
            pushCtx(ilGenerator);
            ilGenerator.Callvirt(() => ((ITypeBinaryDeserializerContext)null).LoadEncryptedString());
            if (targetType != typeof(object))
            {
                if (targetType != GetPreferedType())
                {
                    throw new ArgumentOutOfRangeException(nameof(targetType));
                }
                return;
            }

            ilGenerator.Box(GetPreferedType());
        }
Пример #2
0
 public void GenerateLoad(IILGen ilGenerator, Action <IILGen> pushReader, Action <IILGen> pushCtx, Action <IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_loader);
     if (targetType != typeof(object))
     {
         if (targetType != GetPreferedType())
         {
             throw new ArgumentOutOfRangeException(nameof(targetType));
         }
         return;
     }
     if (GetPreferedType().IsValueType)
     {
         ilGenerator.Box(GetPreferedType());
     }
     else
     {
         ilGenerator.Castclass(typeof(object));
     }
 }
Пример #3
0
 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_loader);
     if (targetType != typeof(object))
     {
         if (targetType != GetPreferedType())
             throw new ArgumentOutOfRangeException(nameof(targetType));
         return;
     }
     if (GetPreferedType().IsValueType)
     {
         ilGenerator.Box(GetPreferedType());
     }
     else
     {
         ilGenerator.Castclass(typeof(object));
     }
 }