【发布时间】:2011-04-20 22:09:13
【问题描述】:
在你问我是否看过谷歌之前,让我回答是的,我已经阅读了一页又一页。一个接一个的站点,无法获得我需要的信息。
我正在尝试为我的应用程序制作一个非常简单的更新检查器。一种将解析在线 xml 文件,并在某些地方显示数据的工具。以及能够解析下载位置的链接(不会是 ftp 或其他任何东西,但类似于文件主机,因为我的托管计划不允许我 ftp 超过 3MB 的文件)
无论如何,这就是我目前所得到的:
XML 代码:
<code>
<Info>
<Version>2.8.0.0</Version>
<Link>www.filehost.com</Link>
<Description>Added New Features To GUI</Description>
</Info>
</code>
这是应用程序代码,以及我希望它显示和执行的操作。
using System;
using System.Windows.Forms;
using System.Xml;
namespace SAM
{
public partial class UpdateCheck : DevExpress.XtraEditors.XtraForm
{
public UpdateCheck()
{
InitializeComponent();
lblCurrentVersion.Text = "Current Version: " + Application.ProductVersion;
}
private void MainForm_Shown(object sender, EventArgs e)
{
BringToFront();
}
private void BtnChkUpdate_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load("http://www.crimson-downloads.com/SAM/UpdateCheck.xml");
}
}
}
我希望应用程序以这种方式解析 xml。
<Version>2.8.0.0</Version> Will change the text for "lblUpdateVersion" like how I got the current version label set in the InitializeComponent();
<Description>Added New Features To GUI</Description> to be parsed out into the "textDescription" Which I can probably do myself.
<Link>www.filehost.com</Link> Will parse into the button control so when pressed will open up the users default browser and follow the link.
【问题讨论】:
-
您使用的是哪个版本的 .NET?
标签: c# xml parsing auto-update