Beispiel #1
0
        /// <summary>
        /// 添加字段
        /// </summary>
        /// <param name="field">字段信息</param>
        public void Push(FieldSize field)
        {
            Label end = generator.DefineLabel();

            generator.memberMapIsMember(OpCodes.Ldarg_0, field.MemberIndex);
            generator.Emit(OpCodes.Brfalse_S, end);

            generator.Emit(OpCodes.Ldarg_1);
            if (isValueType)
            {
                generator.Emit(OpCodes.Ldarga_S, 2);
            }
            else
            {
                generator.Emit(OpCodes.Ldarg_2);
            }
            generator.Emit(OpCodes.Ldfld, field.Field);
            generator.call(BinarySerializer.GetMemberMapSerializeMethod(field.Field.FieldType) ?? SerializeMethodCache.GetMember(field.Field.FieldType));

            generator.MarkLabel(end);
        }
Beispiel #2
0
 /// <summary>
 /// 添加字段
 /// </summary>
 /// <param name="field">字段信息</param>
 public void Push(FieldSize field)
 {
     generator.Emit(OpCodes.Ldarg_0);
     if (isValueType)
     {
         generator.Emit(OpCodes.Ldarga_S, 1);
     }
     else
     {
         generator.Emit(OpCodes.Ldarg_1);
     }
     generator.Emit(OpCodes.Ldfld, field.Field);
     generator.call(BinarySerializer.GetMemberSerializeMethod(field.Field.FieldType) ?? SerializeMethodCache.GetMember(field.Field.FieldType));
 }
Beispiel #3
0
 /// <summary>
 /// 设置字段信息
 /// </summary>
 /// <param name="field"></param>
 internal void Set(FieldSize field)
 {
     Field           = field.Field;
     MemberIndex     = field.MemberIndex;
     SerializeMethod = (Action <Serializer, object>) typeof(AutoCSer.Reflection.InvokeMethod <,>).MakeGenericType(typeof(Serializer), Field.FieldType).GetMethod("getTypeObject", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { Serializer.GetMemberMapSerializeMethod(Field.FieldType) ?? SerializeMethodCache.GetMember(Field.FieldType) });
 }