Example #1
0
 private static void toJson(fastCSharp.emit.jsonSerializer toJsoner, menu value)
 {
     toJsoner.UnsafeWriteFirstName("name");
     toJsoner.UnsafeToJson(value.name);
     if (value.type != menuType.none)
     {
         toJsoner.UnsafeWriteNextName("type");
         toJsoner.UnsafeToJsonNotNull(value.type);
     }
     if (!string.IsNullOrEmpty(value.key))
     {
         toJsoner.UnsafeWriteNextName("key");
         toJsoner.UnsafeToJsonNotNull(value.key);
     }
     if (!string.IsNullOrEmpty(value.url))
     {
         toJsoner.UnsafeWriteNextName("url");
         toJsoner.UnsafeToJsonNotNull(value.url);
     }
     if (!string.IsNullOrEmpty(value.media_id))
     {
         toJsoner.UnsafeWriteNextName("media_id");
         toJsoner.UnsafeToJsonNotNull(value.media_id);
     }
     if (value.sub_button.length() != 0)
     {
         toJsoner.UnsafeWriteNextName("sub_button");
         toJsoner.UnsafeToJsonNotNull(value.sub_button);
     }
     toJsoner.UnsafeCharStream.Write('}');
 }
Example #2
0
            private static unsafe void toJson(fastCSharp.emit.jsonSerializer toJsoner, cardMessage value)
            {
                if (value.card_ext.signature == null)
                {
                    log.Default.Add("卡券扩展 签名为空", new System.Diagnostics.StackFrame(), true);
                    fastCSharp.web.ajax.WriteObject(toJsoner.UnsafeCharStream);
                }
                else
                {
                    toJsoner.UnsafeWriteFirstName("card_id");
                    toJsoner.UnsafeToJson(value.card_id);
                    toJsoner.UnsafeWriteNextName("card_ext");
                    fastCSharp.emit.jsonSerializer cardToJsoner = typePool <fastCSharp.emit.jsonSerializer> .Pop() ?? new fastCSharp.emit.jsonSerializer();

                    pointer buffer = fastCSharp.unmanagedPool.StreamBuffers.Get();
                    try
                    {
                        using (charStream cardJsonStream = cardToJsoner.UnsafeCharStream)
                        {
                            cardJsonStream.UnsafeReset((byte *)buffer.Char, fastCSharp.unmanagedPool.StreamBuffers.Size);
                            cardToJsoner.UnsafeToJsonNotNull(value.card_ext, toJsoner.UnsafeConfig);
                            fastCSharp.web.ajax.UnsafeFormatJavascript(cardJsonStream, toJsoner.UnsafeCharStream);
                        }
                    }
                    finally
                    {
                        fastCSharp.unmanagedPool.StreamBuffers.Push(ref buffer);
                        toJsoner.UnsafeFree();
                    }
                    toJsoner.UnsafeCharStream.Write('}');
                }
            }
Example #3
0
        private static void toJson(fastCSharp.emit.jsonSerializer toJsoner, previewMessage value)
        {
            if (string.IsNullOrEmpty(value.towxname))
            {
                toJsoner.UnsafeWriteFirstName("touser");
                toJsoner.UnsafeToJson(value.touser);
            }
            else
            {
                toJsoner.UnsafeWriteFirstName("towxname");
                toJsoner.UnsafeToJson(value.towxname);
            }
            toJsoner.UnsafeWriteNextName("msgtype");
            toJsoner.UnsafeToJsonNotNull(value.msgtype.ToString());
            toJsoner.UnsafeWriteNextName(value.msgtype.ToString());
            switch (value.msgtype)
            {
            case bulkMessageBase.type.text:
                toJsoner.UnsafeToJsonNotNull(value.text);
                break;

            case bulkMessageBase.type.image:
                toJsoner.UnsafeToJsonNotNull(value.image);
                break;

            case bulkMessageBase.type.voice:
                toJsoner.UnsafeToJsonNotNull(value.voice);
                break;

            case bulkMessageBase.type.mpvideo:
                toJsoner.UnsafeToJsonNotNull(value.mpvideo);
                break;

            case bulkMessageBase.type.mpnews:
                toJsoner.UnsafeToJsonNotNull(value.mpnews);
                break;

            case bulkMessageBase.type.wxcard:
                toJsoner.UnsafeToJsonNotNull(value.wxcard);
                break;
            }
            toJsoner.UnsafeCharStream.Write('}');
        }
Example #4
0
        private static void toJson(fastCSharp.emit.jsonSerializer toJsoner, message value)
        {
            toJsoner.UnsafeWriteFirstName("touser");
            toJsoner.UnsafeToJson(value.touser);
            toJsoner.UnsafeWriteNextName("msgtype");
            toJsoner.UnsafeToJsonNotNull(value.msgtype.ToString());
            toJsoner.UnsafeWriteNextName(value.msgtype.ToString());
            switch (value.msgtype)
            {
            case type.news:
                toJsoner.UnsafeToJsonNotNull(value.news);
                break;

            case type.text:
                toJsoner.UnsafeToJsonNotNull(value.text);
                break;

            case type.image:
                toJsoner.UnsafeToJsonNotNull(value.image);
                break;

            case type.voice:
                toJsoner.UnsafeToJsonNotNull(value.voice);
                break;

            case type.video:
                toJsoner.UnsafeToJsonNotNull(value.video);
                break;

            case type.music:
                toJsoner.UnsafeToJsonNotNull(value.music);
                break;

            case type.wxcard:
                toJsoner.UnsafeToJsonNotNull(value.wxcard);
                break;
            }
            if (value.customservice.kf_account != null)
            {
                toJsoner.UnsafeWriteNextName("customservice");
                toJsoner.UnsafeToJsonNotNull(value.customservice);
            }
            toJsoner.UnsafeCharStream.Write('}');
        }
Example #5
0
 private static void toJson(fastCSharp.emit.jsonSerializer toJsoner, bulkMessage value)
 {
     toJsoner.UnsafeWriteFirstName("filter");
     toJsoner.UnsafeToJson(value.filter);
     value.toJson(toJsoner);
 }