diff --git a/README.md b/README.md index 3477a6e61d60353f9b5a500b17a170bc087866d3..bc33e58cec330bb5ae1d3a5a21e459cf633267fe 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ | OSS | 支持 | 极简化更新,是一套独立的更新机制。只需要在文件服务器中放置version.json的版本配置文件。组件会根据配置文件中的版本信息进行更新下载。(支持Windows,MAUI Android) | | 回滚 | 待测试 | 逐版本更新时会备份每个版本,如果更新失败则逐版本回滚。 | | 驱动更新 | 待测试 | 逐版本更新时会备份每个版本的驱动文件(.inf),如果更新失败则逐版本回滚。 | -| 系统服务 | 待测试 | 开机时和升级时会检查升级是否成功,如果失败则根据遗言还原之前的备份。遗言是更新之前就已经自动创建在C:\generalupdate_willmessages目录下的will_message.json文件。will_message.json的内容是持久化回滚备份的文件目录相关信息。(需要部署GeneralUpdate.SystemService系统服务) | +| 遗言 | 待测试 | 开机时和升级时会检查升级是否成功,如果失败则根据遗言还原之前的备份。遗言是更新之前就已经自动创建在C:\generalupdate_willmessages目录下的will_message.json文件。will_message.json的内容是持久化回滚备份的文件目录相关信息。(需要部署GeneralUpdate.SystemService系统服务) | | 自定义方法列表 | 待测试 | 注入一个自定义方法集合,该集合会在更新启动前执行。执行自定义方法列表如果出现任何异常,将通过异常订阅通知。(推荐在更新之前检查当前软件环境) | diff --git a/README_en.md b/README_en.md index 0785198be120357df2d22ba974ba00008d2f1ae3..d0ffb77d1a4efe46689fe5e74b4fb2723171a622 100644 --- a/README_en.md +++ b/README_en.md @@ -25,10 +25,10 @@ | Skip updates | yes | Support injection pop-up window allows users to decide whether to update this release, and the update will not take effect when the server decides to force it. | | Upgrade each other | yes | The main program updates the upgrade program, and the upgrade program updates the main program. | | Black list | yes | Files and file extensions from the blacklist are skipped during the update process. | -| OSS(MAUI) | yes | Minimal updates require only the version configuration file of version.json to be placed on the file server. Components are updated and downloaded based on the version information in the configuration file.(Supported windows,MAUI Android) | +| OSS | yes | Minimal updates require only the version configuration file of version.json to be placed on the file server. Components are updated and downloaded based on the version information in the configuration file.(Supported windows,MAUI Android) | | Restore | test | Each version is backed up during a version-by-version update and rolled back version-by-version if the update fails. | | Driver upgrade | test | The driver file (.INF) of each version is backed up during the version-by-version update and is rolled back version-by-version if the update fails. | -| System service | test | The upgrade is checked for success at boot and upgrade, and if it fails, the previous backup is restored according to the last word. The last word is that the will_message.json file in the C:\generalupdate_willmessages directory was automatically created before the update. will_message.json is about the file directory of the persistent rollback backup.(need to deploy GeneralUpdate. SystemService system service) | +| Will message | test | The upgrade is checked for success at boot and upgrade, and if it fails, the previous backup is restored according to the last word. The last word is that the will_message.json file in the C:\generalupdate_willmessages directory was automatically created before the update. will_message.json is about the file directory of the persistent rollback backup.(need to deploy GeneralUpdate. SystemService system service) | | A list of custom methods | test | Inject a custom collection of methods that are executed before the update starts. Execute a custom method list, and if there are any exceptions, you will be notified by exception subscription.(It is recommended to check the current software environment before updating) | diff --git a/src/c#/GeneralUpdate.Client/MainPage.xaml.cs b/src/c#/GeneralUpdate.Client/MainPage.xaml.cs index 29de55e45aa4c84b814a9477f2c61eca600f3c90..5b5af282c0917c8d0632f678f7a2198c374fd682 100644 --- a/src/c#/GeneralUpdate.Client/MainPage.xaml.cs +++ b/src/c#/GeneralUpdate.Client/MainPage.xaml.cs @@ -71,11 +71,15 @@ namespace GeneralUpdate.Client .Option(UpdateOption.DownloadTimeOut, 60) .Option(UpdateOption.Encoding, Encoding.Default) .Option(UpdateOption.Format, Format.ZIP) + //开启驱动更新 .Option(UpdateOption.Drive, true) + //开启遗言功能,需要部署GeneralUpdate.SystemService Windows服务。 .Option(UpdateOption.WillMessage, true) .Strategy() //注入一个func让用户决定是否跳过本次更新,如果是强制更新则不生效 .SetCustomSkipOption(ShowCustomOption) + //注入一个自定义方法集合,该集合会在更新启动前执行。执行自定义方法列表如果出现任何异常,将通过异常订阅通知。(推荐在更新之前检查当前软件环境) + .AddCustomOption(new List>() { ()=> Check1(), () => Check2() }) //默认黑名单文件: { "Newtonsoft.Json.dll" } 默认黑名单文件扩展名: { ".patch", ".7z", ".zip", ".rar", ".tar" , ".json" } //如果不需要扩展,需要重新传入黑名单集合来覆盖。 .SetBlacklist(GetBlackFiles(), GetBlackFormats()) @@ -83,6 +87,10 @@ namespace GeneralUpdate.Client }); } + private bool Check1() => true; + + private bool Check2() => true; + private List GetBlackFiles() { var blackFiles = new List();