コード例 #1
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();
 }
コード例 #2
0
ファイル: SceneId.cs プロジェクト: zhangzheng1205/AutoCSer
 private void toJson(AutoCSer.Json.Serializer serializer)
 {
     if (scene_str == null)
     {
         serializer.CustomWriteFirstName("scene_id");
         serializer.CallSerialize(scene_id);
     }
     else
     {
         serializer.CustomWriteFirstName("scene_str");
         serializer.CallSerialize(scene_str);
     }
     serializer.CustomObjectEnd();
 }
コード例 #3
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();
     }
 }
コード例 #4
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();
        }
コード例 #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
 private void serialize(AutoCSer.Json.Serializer serializer)
 {
     serializer.CharStream.Write('[');
     serializer.CallSerialize(ClientNodeId);
     serializer.CharStream.Write(',');
     Node.Serialize(serializer, Checker);
     serializer.CharStream.Write(']');
 }
コード例 #7
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();
        }
コード例 #8
0
        /// <summary>
        /// 对象序列化
        /// </summary>
        /// <param name="serializer"></param>
        private void toJson(AutoCSer.Json.Serializer serializer)
        {
            if (string.IsNullOrEmpty(towxname))
            {
                serializer.CustomWriteFirstName("touser");
                serializer.CallSerialize(touser);
            }
            else
            {
                serializer.CustomWriteFirstName("towxname");
                serializer.CallSerialize(towxname);
            }
            serializer.CustomWriteNextName("msgtype");
            serializer.CallSerialize(msgtype.ToString());
            serializer.CustomWriteNextName(msgtype.ToString());
            switch (msgtype)
            {
            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.mpnews:
                serializer.TypeSerialize(ref mpnews);
                break;

            case BulkMessageType.wxcard:
                serializer.TypeSerialize(ref wxcard);
                break;
            }
            serializer.CustomObjectEnd();
        }
コード例 #9
0
 private static void serialize(AutoCSer.Json.Serializer serializer, ReturnValue value)
 {
     if (value == null)
     {
         serializer.CharStream.WriteJsonArray();
     }
     else
     {
         CharStream jsonStream = serializer.CharStream;
         jsonStream.Write('[');
         serializer.CallSerialize(value.ClientNodeId);
         jsonStream.Write(',');
         value.serialize(serializer);
         jsonStream.Write(']');
     }
 }
コード例 #10
0
 protected void serializeStart(AutoCSer.Json.Serializer serializer, ServerNodeIdChecker checker)
 {
     serializer.CharStream.Write('[');
     serializer.CallSerialize(checker.ServerNodeIds[GetType()]);
 }
コード例 #11
0
 internal void Serialize(AutoCSer.Json.Serializer serializer)
 {
     serializer.CallSerialize(Value == null ? 1 : 2);
 }