اطلاع از بروز رسانی نرم افزار ساخته شده
نویسنده: رضابیات
تاریخ: ۱۳۹۲/۰۵/۱۶ ۱۴:۵۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
<?xml version="1.0" encoding="utf-8"?> <AccountingApplication> <Version>1.5.2</Version> <URL>http://www.myappsupport.ir</URL> </AccountingApplication>
...
using System.Xml;
namespace CheckUpdateApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void CheckUpdate_Click(object sender, EventArgs e)
{
Version NewVersion = null;
string DownloadPath = "";
try
{
XmlTextReader xmlRead = new XmlTextReader("http://www.myappsupport.ir/AccUpdateVersion.xml");
xmlRead.MoveToContent();
string elmName = "";
if ((xmlRead.NodeType == XmlNodeType.Element) && (xmlRead.Name == "AccountingApplication"))
{
while (xmlRead.Read())
{
if (xmlRead.NodeType == XmlNodeType.Element)
{
elmName = xmlRead.Name;
}
else
{
if ((xmlRead.NodeType == XmlNodeType.Text) && (xmlRead.HasValue))
{
switch (elmName)
{
case "Version":
NewVersion = new Version(xmlRead.Value);
break;
case "URL":
DownloadPath = xmlRead.Value;
break;
}
}
}
}
}
Version AppVertion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (AppVertion.CompareTo(NewVersion) < 0)
{
DialogResult Result = MessageBox.Show("نسخه " +
NewVersion.Major.ToString() + "." +
NewVersion.Minor.ToString() + "." +
NewVersion.Build.ToString() + " در دسترس میباشد مایل به دانلود هستید؟", "نسخه جدید",
MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (Result == DialogResult.Yes)
{
System.Diagnostics.Process.Start(DownloadPath);
}
}
else
{
MessageBox.Show("نرم افزار بروز میباشد");
}
}
catch (Exception E)
{
MessageBox.Show(E.Message);
}
}
}
}
ممنون از شما. یک روش برای اینکه مستقیما با XML Reader کار نکنیم میتونه استفاده از روشهای سریالایز کردن کلاسها باشه. دردسرش کمتره.
یک سؤال: این فلشهای انحنا دار رو با چه برنامهای ایجاد کردید؟