嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
自动更新模板
public partial class UpdateForm : Form
{
public UpdateForm()
{
InitializeComponent();
InitCheckUpdate();
}
void InitCheckUpdate()
{
#region check and download new version program
bool bHasError = false;
IAutoUpdater autoUpdater = new KnightsWarriorAutoupdater.AutoUpdater();
try
{
autoUpdater.Update();
}
catch (WebException exp)
{
MessageBox.Show("服务器连接失败");
bHasError = true;
}
catch (XmlException exp)
{
bHasError = true;
MessageBox.Show("下载更新文件错误");
}
catch (NotSupportedException exp)
{
bHasError = true;
MessageBox.Show("升级文件配置错误");
}
catch (ArgumentException exp)
{
bHasError = true;
MessageBox.Show("下载升级文件错误");
}
catch (Exception exp)
{
bHasError = true;
MessageBox.Show("更新过程中出现错误");
}
finally
{
if (bHasError == true)
{
try
{
autoUpdater.RollBack();
}
catch (Exception)
{
//Log the message to your file or database
}
}
OperProcess op = new OperProcess();
//启动进程
op.StartProcess();
}
#endregion
}
}