JiuLing.AutoUpgrade
2.3.0
dotnet add package JiuLing.AutoUpgrade --version 2.3.0
NuGet\Install-Package JiuLing.AutoUpgrade -Version 2.3.0
<PackageReference Include="JiuLing.AutoUpgrade" Version="2.3.0" />
<PackageVersion Include="JiuLing.AutoUpgrade" Version="2.3.0" />
<PackageReference Include="JiuLing.AutoUpgrade" />
paket add JiuLing.AutoUpgrade --version 2.3.0
#r "nuget: JiuLing.AutoUpgrade, 2.3.0"
#:package JiuLing.AutoUpgrade@2.3.0
#addin nuget:?package=JiuLing.AutoUpgrade&version=2.3.0
#tool nuget:?package=JiuLing.AutoUpgrade&version=2.3.0
<p align="center"> <a href="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade" target="_blank"><img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/logo.png" ></a> </p>
<div align="center">
</div>
👾 一个简单、易用的自动更新组件。 👉👉English Version
<div align="center"> <img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/demo1.png" width="40%"> <img src="https://github.com/JiuLing-zhang/JiuLing.AutoUpgrade/raw/main/docs/resources/images/demo2.png" width="40%"> </div>
介绍
更新程序的核心程序是基于 .NET Framework 4.7
开发的 x64
格式的程序,所以使用此组件之前,请先确保客户端环境能够运行该程序。
- 🔥 组件支持自更新
- 🌈 支持 HTTP
- 🌀 支持 FTP
- ⚡ 支持 GitHub Release
- ⭐ 版本过期后禁止运行
运行方式
- 🕐 去服务端下载更新包(如果有更新可用)
- 🕑 关闭主程序
- 🕒 将更新包的内容解压后复制到主程序根目录
- 🕓 重启主程序
🎈 检查更新时,如果指定了最小运行版本,并且主程序版本低于最小版本,那么自动更新程序将不允许跳过本次更新,不更新直接关闭自动更新程序时,同时也会关闭主程序
🎉 更新包仅支持 .zip
压缩包。
安装
🟢 通过 Nuget
安装。
🟢 通过 Release
下载。
使用
1️⃣ 导入命名空间
using JiuLing.AutoUpgrade.Shell;
2️⃣ 创建更新程序
// HTTP 方式
IUpgradeApp app = UpgradeFactory.CreateHttpApp("url");
// FTP 方式
IUpgradeApp app = UpgradeFactory.CreateFtpApp("path", "username", "password");
// GitHub Release 方式
// assetName: update.zip
IUpgradeApp app = UpgradeFactory.CreateGitHubApp("owner", "repo", "assetName");
3️⃣ 启动
app.Run();
// or
await app.RunAsync();
🫧 链式写法
await UpgradeFactory.CreateHttpApp("url").RunAsync();
4️⃣ 服务端配置
HTTP
和FTP
方式
💠 自动更新接口需要返回如下格式的json
内容。- Version: ❗[必须] 最新的版本号
- DownloadUrl: ❗[必须] 程序的下载路径
- FileLength: 文件大小,字节
- MinVersion: 程序运行的最低版本号,低于此版本将无法运行
- Log: 更新日志
- CreateTime: 时间
- SignType: 文件校验的签名方式
- SignValue: 文件校验的签名值
{ "Version": "1.2.0", "DownloadUrl": "xxxxx/update.zip", "FileLength": 1887436, "MinVersion": "1.1.0", "Log": "1、修复了若干bug。2、新增了若干需求。", "CreateTime": "2022-01-16 12:12:12", "SignType": "MD5", "SignValue": "f42c6cb229a0a1237c9945448342d59e" }
GitHub Release
方式- 版本号: 获取
Release
的名称 - 程序下载路径: 获取
Release
中Assets Name
匹配的文件地址
- 版本号: 获取
🔨 高级设置
await UpgradeFactory.CreateHttpApp("url")
.SetUpgrade(builder =>
{
builder.WithIcon("path")
.WithTimeout(60)
.WithBackgroundCheck(true)
.WithSignCheck(true)
.WithTheme(ThemeEnum.System)
.WithLang("zh")
.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
})
.RunAsync();
⚡ 设置图标
setting.WithIcon("icon.ico");
🌀 检查更新时的请求超时时间(默认 5 秒)
setting.WithTimeout(60);
🎁 是否在后台进行更新检查(默认为否)
setting.WithBackgroundCheck(true);
⚽ 对下载的文件启用签名校验,支持 MD5
和 SHA1
两种方式(默认为不启用)
setting.WithSignCheck(true);
🎲 设置主题,支持“跟随系统”、“浅色主题”、“深色主题”(默认为跟随系统)
setting.WithTheme(ThemeEnum.System);
// setting.WithTheme(ThemeEnum.Light);
// setting.WithTheme(ThemeEnum.Dark);
💎 设置多语言,支持中文、英文(默认为中文)。
setting.WithLang("zh");
// setting.WithLang("en");
📌 设置版本号显示格式。
setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuildRevision);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinor);
// setting.WithVersionFormat(VersionFormatEnum.Major);
项目说明
src
├─JiuLing.AutoUpgrade 核心程序
├─JiuLing.AutoUpgrade.Shell 启动程序,用来启动核心更新程序
│ └─Resources 通过动态资源的形式加载核心程序,使得核心程序可以实现自身更新。项目编译前,会先从Librarys.tmp文件夹拷贝核心程序
│ └─JiuLing.AutoUpgrade.exe
├─JiuLing.AutoUpgrade.Shared 核心程序和启动程序所共享的代码片段
├─JiuLing.AutoUpgrade.Test 测试程序
│ ├─JiuLing.AutoUpgrade.Test.csproj
│ ├─UpgradePackage1.2.0.zip
│ └─测试环境配置说明.txt
├─Librarys.tmp 临时目录,核心程序编译完成后将自身发布到该目录
│ └─JiuLing.AutoUpgrade.exe
└─JiuLing.AutoUpgrade.sln 项目解决方案
License
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on JiuLing.AutoUpgrade:
Repository | Stars |
---|---|
JiuLing-zhang/ComputerLock
透明锁屏-锁屏时保持屏幕内容可见!防止误操作,保护隐私。适用于展示、娱乐和安全场景。
|
Version | Downloads | Last Updated |
---|---|---|
2.3.0 | 323 | 2/10/2025 |
2.2.6 | 329 | 9/25/2024 |
2.2.5 | 168 | 9/23/2024 |
2.2.4 | 159 | 9/23/2024 |
2.2.3 | 162 | 9/22/2024 |
2.2.2 | 162 | 9/22/2024 |
2.2.1 | 159 | 9/22/2024 |
2.1.7 | 221 | 9/10/2024 |
2.1.6 | 559 | 1/16/2024 |
2.1.5 | 464 | 1/4/2024 |
2.1.4 | 446 | 1/3/2024 |
2.1.3 | 567 | 12/20/2023 |
2.1.2 | 577 | 12/8/2023 |
2.1.1 | 478 | 11/9/2023 |
2.1.0 | 528 | 11/4/2023 |
2.0.0 | 572 | 9/13/2023 |
1.2.9 | 887 | 1/9/2023 |
1.2.8 | 857 | 1/3/2023 |
1.2.7 | 819 | 11/21/2022 |
1.2.4 | 977 | 3/1/2022 |
1.2.3 | 1,023 | 2/27/2022 |
1.2.2 | 950 | 2/21/2022 |
1.2.1 | 948 | 2/19/2022 |
1.2.0 | 904 | 2/18/2022 |
1.1.5 | 937 | 2/14/2022 |
1.1.4 | 960 | 2/10/2022 |
1.1.3 | 1,014 | 2/10/2022 |
1.1.1 | 955 | 2/7/2022 |
1.1.0 | 978 | 1/28/2022 |
1.0.8 | 976 | 1/27/2022 |
1.0.7 | 987 | 1/26/2022 |
1.0.6 | 1,012 | 1/25/2022 |
1.0.5 | 930 | 1/25/2022 |
1.0.4 | 914 | 1/22/2022 |
1.0.3 | 949 | 1/22/2022 |
1.0.2 | 972 | 1/21/2022 |
1.0.1 | 947 | 1/21/2022 |
1.0.0 | 1,007 | 1/21/2022 |
0.0.7 | 1,007 | 1/21/2022 |
0.0.3 | 952 | 1/21/2022 |
0.0.2 | 971 | 1/21/2022 |
0.0.1 | 975 | 1/20/2022 |