A simple and easy-to-use automatic update component。 👉👉中文版
🤖 Upgrade Guide from v2.1 to v2.2
The core program is developed using .NET Framework 4.7
(x64
). Before using this component, make sure the client can run the program.
- 🔥 Component supports self-update - 🌈 Supports HTTP - 🌀 Supports FTP - ⭐ Prohibits running after version expiration
- 🕐 Download the update package from the server (if updates are available)
- 🕑 Close the main application
- 🕒 Extract the update package and copy the contents to the main application’s root directory
- 🕓 Restart the main application
🎈If the minimum version is specified and the main program version is lower than the minimum version, the automatic update program will not be allowed to skip this update. If the automatic update program is closed directly without updating, the main program will also be closed.
🎉 The update package only supports .zip
compressed packages
1️⃣ Import namespace
using JiuLing.AutoUpgrade.Shell;
2️⃣ Create upgrade app
// HTTP model
IUpgradeApp app = UpgradeFactory.CreateHttpApp("url");
// FTP model
IUpgradeApp app = UpgradeFactory.CreateFtpApp("path", "username", "password");
3️⃣ Do update
app.Run();
// or
await app.RunAsync();
🫧 Advanced
await UpgradeFactory.CreateHttpApp("url").RunAsync();
💠 The update API should return the following json format:
- Version: ❗[Required] The latest version number
- DownloadUrl: ❗[Required] The download URL of the application
- FileLength: File length (byte)
- MinVersion: The minimum version required for the application to run; versions below this will not be able to run
- Log: Update log
- CreateTime: Timestamp
- SignType: Signature type used for file verification
- SignValue: Signature value for file verification
{
"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"
}
await UpgradeFactory.CreateHttpApp("url")
.SetUpgrade(builder =>
{
builder.WithIcon("path")
.WithTimeout(60)
.WithBackgroundCheck(true)
.WithSignCheck(true)
.WithTheme(ThemeEnum.System)
.WithLang("zh")
.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
})
.RunAsync();
⚡ Set icon
setting.WithIcon("icon.ico");
🌀 Request timeout when checking for updates (default: 5 seconds)
setting.WithTimeout(60);
🎁 Whether to check for updates in the background (default: false
)
setting.WithBackgroundCheck(true);
⚽ Enable signature verification, supporting both MD5
and SHA1
methods.
setting.WithSignCheck(true);
🎲 Set the dark theme (default: follow the operating system).
setting.WithTheme(ThemeEnum.System);
// setting.WithTheme(ThemeEnum.Light);
// setting.WithTheme(ThemeEnum.Dark);
💎 Globalization (default: zh) (Only supports zh、en)
setting.WithLang("zh");
// setting.WithLang("en");
📌 Set the version number display format.
setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuildRevision);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinorBuild);
// setting.WithVersionFormat(VersionFormatEnum.MajorMinor);
// setting.WithVersionFormat(VersionFormatEnum.Major);
MIT License