Repository navigation
V1.0: Initial Version
Initial Version V1.0 | 初始V1.0版本
How to use?
In your application that requires updates, use a system call to invoke this .exe file. For example, in C language:
// The first parameter "3.2.1" represents the current version of the program. It's recommended to hardcode this in your program.
// The second parameter is your URL, which can be stored in a configuration file or hardcoded.
path = "path\\to\\dic\\Auto-Update-Checker.exe 3.2.1 \"http://xxx/xxx.json\""
// .data is used to pass a pointer
int result = system(path.data());
if(result == 1){
// This software will directly update. In the future, a popup will be added to confirm the update.
// When the result is returned, the file has already been downloaded,
// and the update will begin after 5 seconds. Please close the main program in time to avoid update failure.
printf("Updating...");
return 0; // Exit the program to avoid file occupation causing the update to fail.
}
Only three-segment version numbers are supported. If you only need two-segment version numbers, you can set the last segment to 0.
Return Values:
1: A new version has been downloaded. The update will start after 5 seconds. Please close all processes within 5 seconds.
0: The version is already up-to-date.
Note:
When downloading, remember to include the license file to comply with the Apache License terms.
How to use?
在你需要更新的应用程序中,使用系统的调用命令调用此exe,例如在C语言中:
// 第一个参数 3.2.1 为目前程序的版本号,建议硬编码进入程序
// 第二个参数为你的网址,可以放入配置文件中,或硬编码
path = "path\\to\\dic\\Auto-Update-Checker.exe 3.2.1 \"http://xxx/xxx.json\""
// .data为传递指针
int result = system(path.data());
if(result == 1){
// 本软件会直接更新,未来将加入弹窗来确认是否更新;
// 在result结果出来的时候,文件已经下载好,
// 并在5s后开始覆盖文件,请及时关闭主程序,避免更新失败。
printf("正在更新...");
return 0; //退出程序,避免占用导致更新失败
}
其中仅支持三位版本号,若仅使用两位版本号,可以直接把最后一位写为0即可。
返回值为1:新版本下载完成,5s后更新,请在5s内退出所有占用;
返回值为0:版本是最新版。