2023年11月26日发(作者:)

精品文档

系统自动更新分为插件更新和系统主程序更新,其中插件更新需要用户手动

检查,系统主程序更新在程序启动时检查。

系统主程序更新

1.可更新除外的所有文件。

一般情况下不更新主程序配置文件,因为主程序配置文件里包含了用户个性化配置,

如果更新主程序配置文件就会清空用户配置。

2.更新的前提条件如下:

1)需要配置IIS服务器提供Web服务,供从服务器上下载更新

文件。

2)在程序中设置配置文件的路径:

192.168.1.100/UFVideo/CSFiles/

配置文件的内容如下:

1

欢迎下载

精品文档

13

192.168.1.100//UFVideo/CSFiles/

配置文件提供了两个值一是最新的版本号13,二是更新文件的下载路

192.168.1.100//UFVideo/CSFiles/

的工作流程

1)系统登录时主程序检查版本,主程序根据设置配置文件的服务器XML路径

查比较自身版本和服务器提供版本是否一致,如果低于服务器版本就提示用户更新。

2)用户根据提示同意更新后由主程序启动,并且在启动时提供

三个参

:最新的版本号、主程序名称、下载文件路径。

3启动后就开始根据提供的下载路径参数下载更新文件。

4)更新文件下载完成后解压到自身的启动目录中,完成文件更新。

5)更新主程序配置文件中的版本号。

6)重新启动主程序,完成更新任务。

using System;

using c;

using entModel;

using ;

using g;

using ;

using ;

using ;

using itors;

精品文档

osition = Screen;

}

static string HttpPath = "";

static string Ver = "";

static string strProcName = "";

static class Program

{

[STAThread]

static void Main(string[] agr)

{

精品文档

{

string FilePath = TempPath + "" +

ing(dexOf("/") + 1);

NewHttpDown nhd = new NewHttpDown();

= ;

// SystemNewVer = (NewVer);

for (int i = 0; i < ; i++)

{ = 150 + i * 30; } //新增控件布局

Controls += new Controlsdelegate(下载完

执行);

Name = FilePath;

= HttpPath;

(nhd);

}

else

{

("更新地址不正确,请咨询IT部获取

正确的更新地址。", "操作提示");

}

}

catch { }

}

public delegate void 下载delegate(erControl b);

下载delegate 下载OK;

public void 下载完执行(erControl b)

{

try

{

精品文档

ment =

;

+= new andler(link);

for (int i = 0; i < ; i++)

{ = i * 30; } //生成一个类似超链接的按钮,打开文件下载的位置

(bt);

}

(b);

// ("本次升级任务完成,自动重启

主程序。", "提示", , ation);

WriteConfig(pPath + "" + strProcName + ".exe",

"Version", Ver);

(pPath + "" +

strProcName + ".exe");

KillProcess("AutoUpdate");

}

精品文档

{

lass sc = new lass();

SrcFolder = ace(SourcePath);

DestFolder = ace(DestinationPath);

Items items = ();

re(items, 20);

}

finally

{

//FileInfo fo = new FileInfo(SourcePath);

//if ()

//{ (); }

}

}

catch { }

}

public string ReadXML(string Filepath, string Attribute)

精品文档

}

}

///

/// 写入主程序配置文件

///

///

///

///

精品文档

欢迎您的下载,

资料仅供参考!

致力为企业和个人提供合同协议,策划案计划书,学习资料等等

打造全网一站式需求

8

欢迎下载