資源簡介
WPF開發的通用升級更新程序。
原理:(下載壓縮包并解壓覆蓋。)
1、主程序啟動時調用 更新程序 exe
2、通過HTTP請求訪問 獲取最新程序版本號與 下載地址
3、比對當前程序版本是否一致
4、不一致則下載 對應地址的zip壓縮包。(必須是zip格式,主程序exe 必須在根目錄)
5、關閉主程序 解壓當zip 文件到跟新程序exe同目錄
6、自動重啟主程序。 退出更新程序
(進度條沒做好。自行優化吧。)

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Configuration;
using?System.Data;
using?System.Linq;
using?System.Windows;
namespace?AutoUpdate
{
????///?
????///?App.xaml?的交互邏輯
????///?
????public?partial?class?App?:?Application
????{
????????//重寫onstartup,獲得啟動程序??
????????//protected?override?void?onstartup(StartupEventArgs?e)
????????//{
????????//????if?(e.Args?!=?null?&&?e.Args.Count()?>?0)
????????//????{
????????//????????this.Properties[“startexe“]?=?e.Args[0];
????????//????????this.Properties[“version“]?=?e.Args[1];
????????//????}
????????//????base.onstartup(e);
????????//}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-24?10:24??AutoUpdate\
?????目錄???????????0??2018-08-11?14:41??AutoUpdate\.vs\
?????目錄???????????0??2018-08-11?14:41??AutoUpdate\.vs\AutoUpdate\
?????目錄???????????0??2018-08-11?14:42??AutoUpdate\.vs\AutoUpdate\v15\
?????文件???????63488??2018-08-24?10:29??AutoUpdate\.vs\AutoUpdate\v15\.suo
?????目錄???????????0??2018-08-11?14:42??AutoUpdate\.vs\AutoUpdate\v15\Server\
?????目錄???????????0??2018-08-11?14:42??AutoUpdate\.vs\AutoUpdate\v15\Server\sqlite3\
?????文件???????????0??2018-08-11?14:42??AutoUpdate\.vs\AutoUpdate\v15\Server\sqlite3\db.lock
?????文件?????1368064??2018-08-24?10:00??AutoUpdate\.vs\AutoUpdate\v15\Server\sqlite3\storage.ide
?????文件???????32768??2018-08-24?09:25??AutoUpdate\.vs\AutoUpdate\v15\Server\sqlite3\storage.ide-shm
?????文件?????4144752??2018-08-24?10:29??AutoUpdate\.vs\AutoUpdate\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2018-08-24?10:28??AutoUpdate\AutoUpdate\
?????文件????????1129??2018-08-11?14:41??AutoUpdate\AutoUpdate.sln
?????文件?????????625??2018-08-23?21:35??AutoUpdate\AutoUpdate\App.config
?????文件?????????374??2018-08-11?14:41??AutoUpdate\AutoUpdate\App.xaml
?????文件?????????691??2018-08-11?15:27??AutoUpdate\AutoUpdate\App.xaml.cs
?????文件????????5053??2018-08-24?10:25??AutoUpdate\AutoUpdate\AutoUpdate.csproj
?????文件?????????228??2018-08-23?20:34??AutoUpdate\AutoUpdate\AutoUpdate.csproj.user
?????目錄???????????0??2018-08-23?20:42??AutoUpdate\AutoUpdate\bin\
?????目錄???????????0??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\
?????文件???????????3??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\1.txt
?????文件???????25600??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\AutoUpdate.exe
?????文件?????????410??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\AutoUpdate.exe.Config
?????文件???????56832??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\AutoUpdate.pdb
?????文件??????188416??2012-09-20?16:50??AutoUpdate\AutoUpdate\bin\Debug\ICSharpCode.SharpZipLib.dll
?????目錄???????????0??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\Log\
?????文件??????????88??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\log.txt
?????文件?????????120??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\Log\20180824.log
?????文件??????540672??2018-03-24?17:44??AutoUpdate\AutoUpdate\bin\Debug\Newtonsoft.Json.dll
?????文件??????538481??2018-03-24?17:44??AutoUpdate\AutoUpdate\bin\Debug\Newtonsoft.Json.xm
?????目錄???????????0??2018-08-24?10:28??AutoUpdate\AutoUpdate\bin\Debug\Update_tmp\
............此處省略45個文件信息
- 上一篇:C# PDF操作工具
- 下一篇:asp.net 微信支付V3.7完整可用代碼和文檔
評論
共有 條評論