コード例 #1
0
        /// <summary>
        /// 对象序列化
        /// </summary>
        /// <param name="serializer"></param>
        protected void toJson(AutoCSer.Json.Serializer serializer)
        {
            serializer.CustomWriteNextName("msgtype");
            serializer.CallSerialize(msgtype.ToString());
            serializer.CustomWriteNextName(msgtype.ToString());
            switch (msgtype)
            {
            case BulkMessageType.mpnews:
                serializer.TypeSerialize(ref mpnews);
                break;

            case BulkMessageType.text:
                serializer.TypeSerialize(ref text);
                break;

            case BulkMessageType.image:
                serializer.TypeSerialize(ref image);
                break;

            case BulkMessageType.voice:
                serializer.TypeSerialize(ref voice);
                break;

            case BulkMessageType.mpvideo:
                serializer.TypeSerialize(ref mpvideo);
                break;

            case BulkMessageType.wxcard:
                serializer.TypeSerialize(ref wxcard);
                break;
            }
            serializer.CustomObjectEnd();
        }
コード例 #2
0
 private void toJson(AutoCSer.Json.Serializer serializer)
 {
     serializer.CustomWriteFirstName("name");
     serializer.CallSerialize(name);
     if (type != MenuType.none)
     {
         serializer.CustomWriteNextName("type");
         serializer.TypeSerialize(ref type);
     }
     if (!string.IsNullOrEmpty(key))
     {
         serializer.CustomWriteNextName("key");
         serializer.CallSerialize(key);
     }
     if (!string.IsNullOrEmpty(url))
     {
         serializer.CustomWriteNextName("url");
         serializer.CallSerialize(url);
     }
     if (!string.IsNullOrEmpty(media_id))
     {
         serializer.CustomWriteNextName("media_id");
         serializer.CallSerialize(media_id);
     }
     if (sub_button.length() != 0)
     {
         serializer.CustomWriteNextName("sub_button");
         serializer.TypeSerialize(sub_button);
     }
     serializer.CustomObjectEnd();
 }
コード例 #3
0
ファイル: SceneId.cs プロジェクト: TandXiaoDong/CommonLibrary
 private void toJson(AutoCSer.Json.Serializer serializer)
 {
     if (scene_str == null)
     {
         serializer.CustomWriteFirstName("scene_id");
         serializer.CustomSerialize(scene_id);
     }
     else
     {
         serializer.CustomWriteFirstName("scene_str");
         serializer.CustomSerialize(scene_str);
     }
     serializer.CustomObjectEnd();
 }
コード例 #4
0
 private unsafe void toJson(AutoCSer.Json.Serializer serializer)
 {
     if (card_ext.signature == null)
     {
         AutoCSer.Log.Pub.Log.Add(Log.LogType.Debug | Log.LogType.Info, "卡券扩展 签名为空");
         serializer.CharStream.WriteJsonObject();
     }
     else
     {
         serializer.CustomWriteFirstName("card_id");
         serializer.CallSerialize(card_id);
         serializer.CustomWriteNextName("card_ext");
         serializer.CallSerialize(AutoCSer.Json.Serializer.Serialize(card_ext));
         serializer.CustomObjectEnd();
     }
 }
コード例 #5
0
 private void toJson(AutoCSer.Json.Serializer serializer)
 {
     serializer.CustomWriteFirstName("action_name");
     if (expire_seconds == 0)
     {
         serializer.CallSerialize(action_info.scene.scene_str == null ? "QR_LIMIT_SCENE" : "QR_LIMIT_STR_SCENE");
     }
     else
     {
         serializer.CallSerialize("QR_SCENE");
         serializer.CustomWriteNextName("expire_seconds");
         serializer.CallSerialize(expire_seconds);
     }
     serializer.CustomWriteNextName("action_info");
     serializer.TypeSerialize(ref action_info);
     serializer.CustomObjectEnd();
 }
コード例 #6
0
        /// <summary>
        /// 对象序列化
        /// </summary>
        /// <param name="serializer"></param>
        private void toJson(AutoCSer.Json.Serializer serializer)
        {
            serializer.CustomWriteFirstName("touser");
            serializer.CallSerialize(touser);
            serializer.CustomWriteNextName("msgtype");
            serializer.CallSerialize(msgtype.ToString());
            serializer.CustomWriteNextName(msgtype.ToString());
            switch (msgtype)
            {
            case MessageType.news:
                serializer.TypeSerialize(ref news);
                break;

            case MessageType.text:
                serializer.TypeSerialize(ref text);
                break;

            case MessageType.image:
                serializer.TypeSerialize(ref image);
                break;

            case MessageType.voice:
                serializer.TypeSerialize(ref voice);
                break;

            case MessageType.video:
                serializer.TypeSerialize(ref video);
                break;

            case MessageType.music:
                serializer.TypeSerialize(ref music);
                break;

            case MessageType.wxcard:
                serializer.TypeSerialize(ref wxcard);
                break;
            }
            if (customservice.kf_account != null)
            {
                serializer.CustomWriteNextName("customservice");
                serializer.TypeSerialize(ref customservice);
            }
            serializer.CustomObjectEnd();
        }
コード例 #7
0
        /// <summary>
        /// 对象序列化
        /// </summary>
        /// <param name="serializer"></param>
        private void toJson(AutoCSer.Json.Serializer serializer)
        {
            if (string.IsNullOrEmpty(towxname))
            {
                serializer.CustomWriteFirstName("touser");
                serializer.CustomSerialize(touser);
            }
            else
            {
                serializer.CustomWriteFirstName("towxname");
                serializer.CustomSerialize(towxname);
            }
            serializer.CustomWriteNextName("msgtype");
            serializer.CustomSerialize(msgtype.ToString());
            serializer.CustomWriteNextName(msgtype.ToString());
            switch (msgtype)
            {
            case BulkMessageType.text:
                serializer.CustomSerialize(text);
                break;

            case BulkMessageType.image:
                serializer.CustomSerialize(image);
                break;

            case BulkMessageType.voice:
                serializer.CustomSerialize(voice);
                break;

            case BulkMessageType.mpvideo:
                serializer.CustomSerialize(mpvideo);
                break;

            case BulkMessageType.mpnews:
                serializer.CustomSerialize(mpnews);
                break;

            case BulkMessageType.wxcard:
                serializer.CustomSerialize(wxcard);
                break;
            }
            serializer.CustomObjectEnd();
        }