简单验证软件版本和限定日期,通过网络上的XML

来源:互联网 发布:电子商务网络平台创业 编辑:程序博客网 时间:2024/05/17 09:07
XDocument xmlDoc = XDocument.Load("http://www.xxx.com/xxx.xml");            if (Convert.ToDateTime(xmlDoc.Root.Element("checkDate").Value) > DateTime.Now)            {                if (xmlDoc.Root.Element("chukushenheVelcheck").Value != dgdsoft.version)                {                    MessageBox.Show("您使用的软件版本不是最终版本,请联系开发者!");                    this.Dispose();                }                else                {                    menuStrip1.Enabled = false;                    this.toolStripStatusLabel1.Text = dgdsoft.softname + " " + dgdsoft.module + "  " + dgdsoft.version;                    this.toolStripStatusLabel2.Text = dgdsoft.companyName;                    changeTab(0);                    this.MaximizeBox = false;                }            }            else            {                MessageBox.Show("软件测试使用期限已过,请联系开发者!");                this.Dispose();            }

需要引用:

using System.Xml;
using System.Xml.Linq;

原创粉丝点击