WmptWeixin/event.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace WMPT.Weixin
{
    /// <summary>
    /// 事件消息
    /// </summary>
    public class Event : BaseNotice
    {
        /// <summary>
        /// 根据xml返回对像
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public override BaseNotice LoadXml(string xml)
        {
            Event notice = new Event();

            //<xml><ToUserName><![CDATA[toUser]]></ToUserName>
            //<FromUserName><![CDATA[FromUser]]></FromUserName>
            //<CreateTime>123456789</CreateTime>
            //<MsgType><![CDATA[event]]></MsgType>
            //<Event><![CDATA[EVENT]]></Event>
            //<EventKey><![CDATA[EVENTKEY]]></EventKey>
            //</xml>



            System.Xml.XmlDocument d = new System.Xml.XmlDocument();
            d.LoadXml(xml);
            System.Xml.XmlCDataSection n = d.SelectSingleNode("/xml/ToUserName").FirstChild as System.Xml.XmlCDataSection;

            notice.ToUserName = n.Value;

            n = d.SelectSingleNode("/xml/FromUserName").FirstChild as System.Xml.XmlCDataSection;
            notice.FromUserName = n.Value;


            n = d.SelectSingleNode("/xml/MsgType").FirstChild as System.Xml.XmlCDataSection;
            notice.MsgType = n.Value;

            n = d.SelectSingleNode("/xml/Event").FirstChild as System.Xml.XmlCDataSection;
            notice.EventType = n.Value;

            XmlNode node = d.SelectSingleNode("/xml/EventKey");
            if (node != null)
            {
                n = node.FirstChild as System.Xml.XmlCDataSection;
                notice.EventKey = n.Value;
            }

            node = d.SelectSingleNode("/xml/Latitude");
            if (node != null)
            {
                node = node.FirstChild as System.Xml.XmlNode;
                notice.Latitude = node.Value;
后面还有 49 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。