예제 #1
0
 internal void ParseXml(AutoCSer.XmlDeSerializer xmlDeSerializer)
 {
     if (MemberMap == null)
     {
         MemberMap = AutoCSer.Metadata.MemberMap <valueType> .NewEmpty();
     }
     xmlDeSerializer.MemberMap = MemberMap;
     xmlDeSerializer.TypeDeSerialize(ref Value);
 }
예제 #2
0
        private unsafe void deSerialize(AutoCSer.XmlDeSerializer xmlDeSerializer)
        {
            switch (xmlDeSerializer.TypeDeSerialize <int>())
            {
            case 1: Value = null; return;

            case 2: Value = string.Empty; return;

            default: xmlDeSerializer.MoveRead(-1); return;
            }
        }
예제 #3
0
        private static unsafe void deSerialize(AutoCSer.XmlDeSerializer parser, ref CustomClass value)
        {
            char *read = parser.CustomRead;

            if (parser.VerifyRead(1))
            {
                switch (*(char *)read)
                {
                case '1': value = new CustomClass {
                        Value = null
                }; return;

                case '2': value = new CustomClass {
                        Value = string.Empty
                }; return;

                default: parser.MoveRead(-1); return;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 代金券或立减优惠解析
        /// </summary>
        /// <param name="parser"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected unsafe bool parseCoupon(AutoCSer.XmlDeSerializer parser, char *name)
        {
            int  index;
            char code = *(name + 7);

            if (code == 'i')
            {
                if ((index = getCouponIndex("coupon_id_", name)) >= 0)
                {
                    return(parser.CustomDeSerialize(ref coupons[index].coupon_id));
                }
            }
            else if (code == 'f')
            {
                if ((index = getCouponIndex("coupon_fee_", name)) >= 0)
                {
                    return(parser.CustomDeSerialize(ref coupons[index].coupon_fee));
                }
            }
            return(parser.CustomIgnoreValue());
        }
예제 #5
0
        /// <summary>
        /// 退款信息
        /// </summary>
        /// <param name="parser"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        private unsafe bool parseRefund(AutoCSer.XmlDeSerializer parser, char *name)
        {
            int index, couponIndex = 0;

            switch (*name - 'c')
            {
            case 'c' - 'c':
                switch (*(name + 14) - 'b')
                {
                case 'f' - 'b':
                    if ((index = getCouponIndex("coupon_refund_fee_", name, ref couponIndex)) >= 0)
                    {
                        if (couponIndex >= 0)
                        {
                            return(parser.CustomDeSerialize(ref refunds[index].coupons[couponIndex].coupon_refund_fee));
                        }
                        else
                        {
                            return(parser.CustomDeSerialize(ref refunds[index].coupon_refund_fee));
                        }
                    }
                    break;

                case 'c' - 'b':
                    if ((index = getRefundIndex("coupon_refund_count_", name)) >= 0)
                    {
                        return(parser.CustomDeSerialize(ref refunds[index].coupon_refund_count));
                    }
                    break;

                case 'b' - 'b':
                    if ((index = getCouponIndex("coupon_refund_batch_id_", name, ref couponIndex)) >= 0 && couponIndex >= 0)
                    {
                        return(parser.CustomDeSerialize(ref refunds[index].coupons[couponIndex].coupon_refund_batch_id));
                    }
                    break;

                case 'i' - 'b':
                    if ((index = getCouponIndex("coupon_refund_id_", name, ref couponIndex)) >= 0 && couponIndex >= 0)
                    {
                        return(parser.CustomDeSerialize(ref refunds[index].coupons[couponIndex].coupon_refund_id));
                    }
                    break;
                }
                break;

            case 'r' - 'c':
                switch (*(name + 7) - 'c')
                {
                case 'i' - 'c':
                    if ((index = getRefundIndex("refund_id_", name)) >= 0)
                    {
                        return(parser.CustomDeSerialize(ref refunds[index].refund_id));
                    }
                    break;

                case 'c' - 'c':
                    if ((index = getRefundIndex("refund_channel_", name)) >= 0)
                    {
                        return(parser.CustomNullableEnum(ref refunds[index].refund_channel));
                    }
                    break;

                case 'f' - 'c':
                    if ((index = getRefundIndex("refund_fee_", name)) >= 0)
                    {
                        return(parser.CustomDeSerialize(ref refunds[index].refund_fee));
                    }
                    break;

                case 's' - 'c':
                    if ((index = getRefundIndex("refund_status_", name)) >= 0)
                    {
                        return(parser.CustomStruct(ref refunds[index].refund_status));
                    }
                    break;
                }
                break;

            case 'o' - 'c':
                if ((index = getRefundIndex("out_refund_no_", name)) >= 0)
                {
                    return(parser.CustomDeSerialize(ref refunds[index].out_refund_no));
                }
                break;
            }
            return(parser.CustomIgnoreValue());
        }
예제 #6
0
 private unsafe static bool parseRefund(AutoCSer.XmlDeSerializer parser, ref RefundResult value, ref AutoCSer.Memory.Pointer name)
 {
     return(value.parseRefund(parser, name.Char));
 }
예제 #7
0
 private unsafe static bool parseCoupon(AutoCSer.XmlDeSerializer parser, ref OrderResult value, ref AutoCSer.Memory.Pointer name)
 {
     return(value.parseCoupon(parser, name.Char));
 }