internal static void GenerateReadPrimitive(ReaderGenerationContext context, Type type) { context.PushPrimitiveReaderOntoStack(); var mname = string.Concat("Read", type.Name); var readMethod = typeof(PrimitiveReader).GetMethod(mname); if (readMethod == null) { throw new ArgumentException("Method <<" + mname + ">> not found"); } context.Generator.Emit(OpCodes.Call, readMethod); }
private static void GenerateUpdateElements(ReaderGenerationContext context, Type formalType, LocalBuilder objectIdLocal) { if (typeof(ISpeciallySerializable).IsAssignableFrom(formalType)) { context.PushDeserializedObjectOntoStack(objectIdLocal); context.Generator.Emit(OpCodes.Castclass, typeof(ISpeciallySerializable)); context.PushPrimitiveReaderOntoStack(); context.Generator.GenerateCodeCall <ISpeciallySerializable, PrimitiveReader>(ObjectReader.LoadAndVerifySpeciallySerializableAndVerify); return; } CollectionMetaToken collectionToken; if (!CollectionMetaToken.TryGetCollectionMetaToken(formalType, out collectionToken)) { throw new InvalidOperationException(InternalErrorMessage); } GenerateFillCollection(context, collectionToken, formalType, objectIdLocal); }