12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Dynamic;
- using System.Xml.Linq;
- using System.Xml;
- using Codeplex.Data;
- using Tencent;
- namespace LYFZ.Weixin.SDK
- {
-
-
-
- public class AcceptMessageAPI
- {
-
-
-
-
-
-
-
- public static WeixinMessage Parse(string message)
- {
- var msg = new WeixinMessage();
- msg.Body = new DynamicXml(message);
- string msgType = msg.Body.MsgType.Value;
- switch (msgType)
- {
- case "text":
- msg.Type = WeixinMessageType.Text;
- break;
- case "image":
- msg.Type = WeixinMessageType.Image;
- break;
- case "voice":
- msg.Type = WeixinMessageType.Voice;
- break;
- case "video":
- msg.Type = WeixinMessageType.Video;
- break;
- case "location":
- msg.Type = WeixinMessageType.Location;
- break;
- case "link":
- msg.Type = WeixinMessageType.Link;
- break;
- case "event":
- msg.Type = WeixinMessageType.Event;
- break;
- default: throw new Exception("does not support this message type:" + msgType);
- }
- return msg;
- }
- }
- }
|