diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Driver.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Driver.md index 38e71be..8d147e4 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Driver.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Driver.md @@ -2,42 +2,42 @@ sidebar_position: 3 --- -### Driver 驱动 +### Driver -#### (1)Windows平台 +#### (1) Windows Platform -##### 驱动安装 +##### Driver Installation -本组件内置使用的驱动安装工具为微软自带的工具PnPutil.exe或使用setupapi.dll来实现。 +The tool used for driver installation in this component is the Microsoft built-in tool PnPutil.exe or setupapi.dll. -驱动安装时需要注意的问题有两点: +There are two key points to note when installing drivers: -| 名称 | 说明 | -| ---- | ---------------------------------- | -| 安装 | 驱动证书安装,需要在驱动之前安装。 | -| 版本 | 区分x86 , x64版本。 | +| Name | Description | +| ------- | ------------------------------------------------------------ | +| Install | Driver certificate installation should occur before the driver installation. | +| Version | Differentiate between x86 and x64 versions. | -**PnPUtil实现:** +**PnPUtil Implementation:** -PnPUtil是一个命令行实用程序,它可以用来管理Windows的驱动程序商店。你可以使用它来添加、删除和列出驱动程序。 +PnPUtil is a command line utility that can be used to manage the Windows driver store. You can use it to add, delete, and list drivers. -以下是如何使用PnPUtil来安装驱动程序的步骤: +Here are the steps to install drivers using PnPUtil: -1. 打开命令提示符(以管理员身份)。 +1. Open Command Prompt as an administrator. -2. 导航到包含驱动程序的INF文件的目录。 +2. Navigate to the directory containing the driver's INF file. -3. 运行以下命令: +3. Run the following command: - `pnputil /add-driver ` + `pnputil /add-driver ` - 例如,如果你的INF文件名为`mydriver.inf`,那么你应该运行`pnputil /add-driver mydriver.inf`。 + For example, if your INF file name is `mydriver.inf`, you should run `pnputil /add-driver mydriver.inf`. -4. PnPUtil将会添加驱动程序到驱动程序商店,并尝试为任何匹配的设备安装驱动程序。 +4. PnPUtil will add the driver to the driver store and attempt to install the driver for any matching devices. -注意,PnPUtil需要管理员权限才能运行。 +Note that PnPUtil requires administrator privileges to run. -在C#中,你可以使用System.Diagnostics.Process类来运行PnPUtil。以下是一个例子: +In C#, you can use the System.Diagnostics.Process class to run PnPUtil. Here is an example: ```c# using System.Diagnostics; @@ -51,7 +51,7 @@ public class Program Process process = new Process(); process.StartInfo.FileName = "pnputil.exe"; process.StartInfo.Arguments = "/add-driver " + infPath; - process.StartInfo.Verb = "runas"; // 运行为管理员 + process.StartInfo.Verb = "runas"; // Run as administrator process.Start(); process.WaitForExit(); @@ -59,9 +59,7 @@ public class Program } ``` - - -**setupapi.dll实现:** +**setupapi.dll Implementation:** ```c# using System; @@ -69,7 +67,7 @@ using System.Runtime.InteropServices; public class Program { - // 定义 SetupCopyOEMInf 函数的 P/Invoke 签名 + // Define the P/Invoke signature for the SetupCopyOEMInf function [DllImport("setupapi.dll", EntryPoint = "SetupCopyOEMInf", SetLastError = true)] public static extern bool SetupCopyOEMInf( string SourceInfFileName, @@ -95,28 +93,24 @@ public class Program } ``` +##### Driver Certificate +This component uses Windows certificate management tools (CertMgr.exe) or the X509Store class in the .NET framework. -##### 驱动证书 - -本组件内置使用Windows的证书管理工具(CertMgr.exe)或者使用.NET框架中的X509Store类来实现。 - -**CertMgr.exe实现:** +**CertMgr.exe Implementation:** -`CertMgr.exe` 是一个命令行工具,它是微软的.NET Framework的一部分。你可以在.NET Framework的安装目录中找到它。 +`CertMgr.exe` is a command line tool that is part of the Microsoft .NET Framework. You can find it in the .NET Framework installation directory. -对于大多数系统,它的位置通常是在以下目录之一: +For most systems, it is typically located in one of the following directories: - `C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin` - `C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin` -如果你找不到它,你可以使用Windows的搜索功能来搜索`CertMgr.exe`。 +If you cannot find it, you can use Windows search to locate `CertMgr.exe`. -注意,`CertMgr.exe`是一个命令行工具,你需要在命令提示符或PowerShell中运行它。你也可以在你的C#代码中使用`System.Diagnostics.Process.Start()`方法来调用它。 +Note that `CertMgr.exe` is a command line tool and must be run in Command Prompt or PowerShell. You can also call it in your C# code using the `System.Diagnostics.Process.Start()` method. - - -**X509Store实现:** +**X509Store Implementation:** ```c# using System; @@ -128,19 +122,18 @@ public class Example { string CertificatePath = "Path to your certificate file"; - // 创建一个新的X509证书实例 + // Create a new X509 certificate instance X509Certificate2 certificate = new X509Certificate2(CertificatePath); - // 打开当前用户的个人证书存储区 + // Open the current user's personal certificate store X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser); - // 将新证书添加到存储区 + // Add the new certificate to the store store.Open(OpenFlags.ReadWrite); store.Add(certificate); store.Close(); } } - ``` diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Dump.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Dump.md index 6b99217..023adb4 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Dump.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Dump.md @@ -2,13 +2,13 @@ sidebar_position: 4 --- -### Dump 转储文件 +### Dump Files -在自动升级的过程中如果更新失败,或程序更新完成之后运行崩溃都可以使用ProcDump工具辅助导出dump文件。ProcDump 是一个命令行实用工具,其主要用途是监视应用程序的 CPU 峰值,并在出现峰值期间生成故障转储,管理员或开发人员可以使用这些转储来确定出现峰值的原因。 ProcDump 还支持挂起窗口监视(使用与 Windows 和任务管理器使用的窗口挂起相同的定义)、未处理的异常监视,并且可以根据系统性能计数器的值生成转储。 它还可用作可嵌入到其他脚本中的常规进程转储实用工具。 +During the process of automatic updates, if an update fails or if the program crashes after the update, you can use the ProcDump tool to help export dump files. ProcDump is a command-line utility primarily used to monitor an application's CPU spikes and generate crash dumps during these spikes. Administrators or developers can use these dumps to determine the cause of the spikes. ProcDump also supports hung window monitoring (using the same definition as Windows and Task Manager), unhandled exception monitoring, and can generate dumps based on system performance counter values. It can also be used as a general-purpose process dump utility that can be embedded into other scripts. -##### (1)Windows平台 +##### (1) Windows Platform -C#实现调用: +C# Implementation for Calling ProcDump: ```c# using System; @@ -19,7 +19,7 @@ public class Program public static void Main() { var procDumpPath = @"C:\Path\To\procdump.exe"; - var processId = 1234; // 您要转储的进程的ID + var processId = 1234; // The ID of the process you want to dump var dumpFilePath = @"C:\Path\To\dumpfile.dmp"; var startInfo = new ProcessStartInfo @@ -45,8 +45,6 @@ public class Program } ``` - - -参考资料: +References: - https://learn.microsoft.com/zh-cn/sysinternals/downloads/procdump \ No newline at end of file diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/File occupancy.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/File occupancy.md index a5d28e1..0686e0f 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/File occupancy.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/File occupancy.md @@ -2,11 +2,11 @@ sidebar_position: 2 --- -### File occupancy 文件占用 +### File Occupancy -#### (1)Windows平台 +#### (1) Windows Platform -虽然在自动升级时会关闭应用程序,如果出现特殊情况出现文件占用通常是进程还在运行导致的。这时候可以使用微软官方提供的handle.exe检测工具来查看指定目录下是否有进程在运行"handle.exe"是一款由微软提供的命令行工具,可以用来显示哪些进程打开了哪些文件。在C#中调用handle.exe,我们可以使用`System.Diagnostics.Process`类,如果检测到则会返回该目录下正在运行的进程列表。 +Even though applications are closed during automatic upgrades, file occupancy can occur if processes are still running due to special circumstances. In such cases, you can use Microsoft's handle.exe tool to check if there are any processes running in a specified directory. "handle.exe" is a command-line tool provided by Microsoft that displays which processes have opened specific files. In C#, you can invoke handle.exe using the `System.Diagnostics.Process` class. If a process is detected, it will return a list of processes running in that directory. ```c# using System; @@ -18,7 +18,7 @@ class Program { Process process = new Process(); process.StartInfo.FileName = "handle.exe"; - process.StartInfo.Arguments = "filename"; + process.StartInfo.Arguments = "filename"; // Replace 'filename' with the actual file or directory process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); @@ -31,8 +31,5 @@ class Program } ``` - - -参考资料: - +References: - https://learn.microsoft.com/zh-cn/sysinternals/downloads/handle diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Permission.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Permission.md index 4789c2b..9398fc3 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Permission.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Permission.md @@ -2,46 +2,42 @@ sidebar_position: 1 --- -### Permission 权限 +### Permissions -#### (1)Windows平台 +#### (1) Windows Platform ![](imgs\UAC.png) -在使用GeneralUpdate实现自动升级的时候,如果更新目录在C盘实现文件替换或打文件补丁时会出现权限问题。又因为windows11操作系统推出在C盘特定的目录相比之前推出的windows的操作系统加强了权限管理。 +When using GeneralUpdate for automatic updates, you may encounter permission issues if the update directory is on the C drive, especially when replacing files or applying patches. With the introduction of Windows 11, permission management for certain directories on the C drive has become more stringent compared to previous Windows operating systems. -那么稍微不注意将会触碰到权限管理的边界,接下来我们看看操作哪些目录会导致出现权限问题: +It's important to be aware of which directories might trigger permission issues: -| 名称 | 目录 | -| -------------- | ------------------------------------------ | -| 系统文件夹 | C:\Windows | -| 注册表配置文件 | C:\Windows\System32\config | -| 驱动文件夹 | C:\Windows\System32\drivers | -| 程序文件夹 | C:\Program Files 和 C:\Program Files (x86) | +| Name | Directory | +| --------------- | ------------------------------------------- | +| System Folder | C:\Windows | +| Registry Config | C:\Windows\System32\config | +| Driver Folder | C:\Windows\System32\drivers | +| Program Folder | C:\Program Files and C:\Program Files (x86) | -推荐使用目录,避免权限问题: +Recommended directories to avoid permission issues: -| 名称 | 目录 | -| ------------ | ------- | -| 用户数据目录 | AppData | -| 系统临时目录 | Temp | +| Name | Directory | +| -------------------------- | --------- | +| User Data Directory | AppData | +| System Temporary Directory | Temp | +### Lowering UAC +The following method is not recommended for use in production environments as it may cause issues for users. If you encounter UAC (User Account Control) prompts or permission/access denied issues during updates, you might consider lowering the UAC control level. This can be done by modifying the registry as follows: -### UAC降权 +| Registry Name | New Value | Default Value | +| -------------------------- | --------- | ------------- | +| enableLUA | 0 | 1 | +| ConsentPromptBehaviorAdmin | 0 | 5 | -以下方法不推荐在生产环境中使用,以免给用户造成损失。如果在更新过程中出现UAC (User Account Control)提示或无权限、拒绝访问的情况可以考虑降低UAC控制等级,这个思路在代码层面可以通过修改以下注册表达到目的: +Modify the above registry settings before the update (effective after restarting the computer), and be sure to restore them after the update is complete. -| 注册表名称 | 修改值 | 默认值 | -| -------------------------- | ------ | ------ | -| enableLUA | 0 | 1 | -| ConsentPromptBehaviorAdmin | 0 | 5 | - -更新之前修改以上注册表(重启计算机生效),切记更新完成之后需要恢复该内容。 - - - -c#修改注册表: +C# code to modify the registry: ```c# using Microsoft.Win32; @@ -61,9 +57,7 @@ public void UpdateRegistry() } ``` - - -bat批处理修改注册表: +Batch script to modify the registry: ```bat @echo off @@ -71,9 +65,6 @@ REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v Enab REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f ``` - - -参考资料: - +References: - https://learn.microsoft.com/zh-cn/windows/security/application-security/application-control/user-account-control/how-it-works - https://blog.walterlv.com/post/windows-user-account-control.html \ No newline at end of file diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/System infomation.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/System infomation.md index 8f3e9ea..1a57a26 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/System infomation.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/System infomation.md @@ -2,35 +2,36 @@ sidebar_position: 6 --- -### System infomation 系统信息 +### System Information -#### (1)Windows平台 +#### (1) Windows Platform -当更新失败时,并不清楚是因为操作系统的原因还是其他原因导致的启动失败。这个时候可以使用PsInfo导出当前操作系统的信息,供开发人员进行问题排查。*PsInfo* 是一个命令行工具,它可用于收集有关本地或远程 Windows NT/2000 系统的关键信息,包括安装类型、内核版本、已注册的组织和所有者、处理器数量及其类型、物理内存量、系统的安装日期以及到期日期(如果为试用版)。 +When an update fails, it might not be clear whether the failure is due to the operating system or other reasons. In such cases, you can use PsInfo to export information about the current operating system, which can help developers troubleshoot the issue. *PsInfo* is a command-line tool that can be used to collect critical information about local or remote Windows NT/2000 systems, including installation type, kernel version, registered organization and owner, number and type of processors, amount of physical memory, system installation date, and expiration date (if it is a trial version). -#### 使用 PsInfo +#### Using PsInfo -默认情况下,*PsInfo* 会显示本地系统的信息。 指定远程计算机名称以从远程系统获取信息。 由于 *PsInfo* 依赖于远程注册表访问来获取其数据,因此远程系统必须运行远程注册表服务,并且运行 *PsInfo* 的帐户必须有权访问远程注册表的 HKLM\System 部分。 +By default, *PsInfo* displays information about the local system. Specify a remote computer name to retrieve information from a remote system. Since *PsInfo* relies on remote registry access to gather its data, the remote system must have the remote registry service running, and the account running *PsInfo* must have access to the HKLM\System section of the remote registry. -为了帮助自动更新 Service Pack,*PsInfo* 会返回系统的 Service Pack 数的值(例如 0 表示无 Service Pack,1 表示 SP 1 等)。 +To assist in automating Service Pack updates, *PsInfo* returns the system's Service Pack number (e.g., 0 for no Service Pack, 1 for SP 1, etc.). -**用法: psinfo [[\\computer[,computer[,..] | @file [-u user -[-p psswd]]] [-h] [-s] [-d] [-c [-t delimiter]] [filter]** +**Usage: psinfo [[\\computer[,computer[,..] | @file [-u user [-p psswd]]] [-h] [-s] [-d] [-c [-t delimiter]] [filter]** -| 参数 | 说明 | -| :------------- | :----------------------------------------------------------- | -| **\\computer** | 在指定的远程计算机上执行命令。 如果省略计算机名称,则命令在本地系统上运行,如果指定通配符 (\\*),则命令将在当前域中的所有计算机上运行。 | -| **@file** | 在指定的文本文件中列出的每台计算机上运行命令。 | -| **-u** | 指定登录远程计算机的可选用户名。 | -| **-p** | 指定用户名的可选密码。 如果省略此内容,系统将提示你输入隐藏密码。 | -| **-h** | 显示已安装的修补程序的列表。 | -| **-s** | 显示已安装的应用程序的列表。 | -| **-d** | 显示磁盘卷信息。 | -| **-c** | 以 CSV 格式打印。 | -| **-t** | -c 选项的默认分隔符为逗号,但可以使用指定的字符替代。 | -| **filter** | Psinfo 将仅显示与筛选器匹配的字段的数据。 例如,“psinfo service”仅列出 service pack 字段。 | +| Parameter | Description | +| -------------- | ------------------------------------------------------------ | +| **\\computer** | Execute the command on the specified remote computer(s). If the computer name is omitted, the command runs on the local system. If a wildcard (\\*) is specified, the command runs on all computers in the current domain. | +| **@file** | Run the command on each computer listed in the specified text file. | +| **-u** | Specify an optional username for logging onto the remote computer. | +| **-p** | Specify an optional password for the username. If omitted, you will be prompted to enter a hidden password. | +| **-h** | Show a list of installed hotfixes. | +| **-s** | Show a list of installed applications. | +| **-d** | Show disk volume information. | +| **-c** | Print in CSV format. | +| **-t** | The default delimiter for the -c option is a comma, but you can specify a different character. | +| **filter** | PsInfo will only display data for fields that match the filter. For example, "psinfo service" will only list the service pack field. | -#### 示例输出 +#### Example Output + +When you run PsInfo, it will output information about the system in a structured format. This information can be used to diagnose and address any issues that may arise during the update process. ```c# C:\> psinfo \\development -h -d @@ -81,4 +82,4 @@ Sysinternals - www.sysinternals.com -官方文档:https://learn.microsoft.com/zh-cn/sysinternals/downloads/psinfo \ No newline at end of file +References:https://learn.microsoft.com/zh-cn/sysinternals/downloads/psinfo \ No newline at end of file diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Systemlog.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Systemlog.md index fb48082..627b9e3 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Systemlog.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/guide/Systemlog.md @@ -2,41 +2,39 @@ sidebar_position: 5 --- -### System log 系统日志 +### System Log -升级失败时可能会出现运行启动失败、驱动安装失败等问题。那么可以使用Sysmon工具导出系统事件日志。*系统监视器* (*Sysmon*) 是一项 Windows 系统服务,也是一个设备驱动程序,一旦安装在系统上,就会在系统重新启动后一直驻留,以监视系统活动并将其记录到 Windows 事件日志中。 它提供有关进程创建、网络连接和文件创建时间更改的详细信息。 通过使用 [Windows 事件收集](https://msdn.microsoft.com/library/windows/desktop/bb427443(v=vs.85).aspx)或 [SIEM](https://en.wikipedia.org/wiki/security_information_and_event_management) 代理收集生成的事件,然后对事件进行分析,你可识别恶意或异常活动,并了解入侵者和恶意软件如何在网络上运行。 该服务作为[受保护的进程](https://learn.microsoft.com/windows/win32/services/protecting-anti-malware-services-#system-protected-process)运行,从而禁止广泛的用户模式交互。 +When an upgrade fails, issues such as startup failures or driver installation failures may occur. The Sysmon tool can be used to export system event logs. *System Monitor* (*Sysmon*) is a Windows system service and device driver that, once installed on a system, remains resident across system reboots to monitor and log system activity to the Windows event log. It provides detailed information about process creations, network connections, and file creation time changes. By using [Windows Event Collection](https://msdn.microsoft.com/library/windows/desktop/bb427443(v=vs.85).aspx) or [SIEM](https://en.wikipedia.org/wiki/security_information_and_event_management) agents to collect the generated events, and then analyzing these events, you can identify malicious or anomalous activity and understand how intruders and malware operate on your network. The service runs as a [protected process](https://learn.microsoft.com/windows/win32/services/protecting-anti-malware-services-#system-protected-process), preventing broad user-mode interaction. +### Sysmon Features Overview +*Sysmon* includes the following features: -### Sysmon 功能概述 +- Logs processes created with their full command line, along with their parent process. +- Logs hashes of process image files using SHA1 (default), MD5, SHA256, or IMPHASH. +- Supports multiple hashes used simultaneously. +- Includes a process GUID in process creation events to allow correlation of events even when Windows reuses process IDs. +- Includes a session GUID in each event to allow correlation of events on the same logon session. +- Logs the loading of drivers or DLLs with their signatures and hashes. +- Logs raw read access attempts to disks and volumes. +- (Optional) Logs network connections, including source process, IP addresses, port numbers, hostnames, and port names for each connection. +- Detects file creation time changes to determine the true creation time of a file. Modifying file creation timestamps is a common malware tactic to hide its tracks. +- Automatically reloads configuration if changes are made to the registry. +- Performs rule filtering to dynamically include or exclude certain events. +- Generates events at the start of the process to capture activities performed by sophisticated kernel-mode malware. -*Sysmon* 包括以下功能: +Sysmon can be a valuable tool for monitoring system activities and diagnosing issues that arise during system updates or when troubleshooting security incidents. -- 记录当前进程和父进程中使用完整命令行创建的进程。 -- 记录使用 SHA1(默认)、MD5、SHA256 或 IMPHASH 的进程映像文件的哈希。 -- 可以同时使用多个哈希。 -- 在进程内创建事件之中包含一个进程 GUID,当 Windows 重新使用进程 ID 时,允许事件的相关性。 -- 在每个事件中包含会话 GUID,允许同一登录会话上事件的相关性。 -- 记录驱动程序或 DLL 的加载及其签名与哈希。 -- 记录磁盘和卷的原始读取访问打开次数。 -- (可选)记录网络连接,包括每个连接的源进程、IP 地址、端口数量、主机名和端口名称。 -- 检测文件创建时间的更改,以了解文件真正创建的时间。 修改文件创建时间戳是恶意软件惯用的伎俩来掩盖其轨道。 -- 如果注册表中发生更改,则自动化重新加载配置。 -- 进行规则筛选以动态包含或不包含某些事件。 -- 在启动进程之初生成事件,以捕获相当复杂的内核模式恶意软件进行的活动。 +#### (1)Windows -#### (1)Windows平台 +address: https://download.sysinternals.com/files/Sysmon.zip -下载地址: https://download.sysinternals.com/files/Sysmon.zip +#### (2)Linux -#### (2)Linux平台 +address:https://github.com/Sysinternals/SysmonForLinux -下载地址:https://github.com/Sysinternals/SysmonForLinux - - - -官方文档:https://learn.microsoft.com/zh-cn/sysinternals/downloads/sysmon +doc:https://learn.microsoft.com/zh-cn/sysinternals/downloads/sysmon diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/quickstart/Quik start.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/quickstart/Quik start.md index 3c69dd1..eec20e8 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/quickstart/Quik start.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/quickstart/Quik start.md @@ -9,29 +9,27 @@ tags: [quikstart] ## Step1 -在Github上下载Sample仓库,使用示例前请确保本地安装了.NET 8的运行环境。 +Download the Sample repository from GitHub. Before using the sample, make sure you have .NET 8 runtime environment installed locally. - https://github.com/GeneralLibrary/GeneralUpdate-Samples -仓库目录内容如下: +The repository directory contents are as follows: ![](imgs\content.png) -| 名称 | 说明 | -| ------------ | -------------------------------- | -| Client | 主客户端示例程序 | -| Server | 服务端示例程序 | -| StartManager | 更新流程控制台 | -| Upgrade | 升级端示例程序 | -| process.bat | 无需关注 | -| resource.bat | 无需关注 | -| start.cmd | 启动更新示例的脚本,一切从它开始 | - - +| Name | Description | +| ------------ | ------------------------------------------------------------ | +| Client | Main client sample program | +| Server | Server sample program | +| StartManager | Update process console | +| Upgrade | Upgrade client sample program | +| process.bat | Not required for attention | +| resource.bat | Not required for attention | +| start.cmd | Script to start the update sample, everything begins with this | ## Step2 -找到文件目录,并双击(每次启动start.cmd脚本都会重置本地目录所以无需手动管理文件目录): +Locate the file directory and double-click (the start.cmd script resets the local directory each time it is launched, so manual directory management is unnecessary): ```shell ...\GeneralUpdate-Samples\src\start.cmd @@ -41,7 +39,7 @@ tags: [quikstart] -如下图所示,自动开始编译并拷贝所有相关项目的bin目录到app目录下: +The automatic process will begin compiling and copying all related project bin directories to the app directory: ``` ...\GeneralUpdate-Samples\src\run\app @@ -51,13 +49,13 @@ tags: [quikstart] -这时候就会出现StartManager.exe的界面,所有的选项均为字面意思,我们先别着急输入1这时候先看看app目录更新之前的装备后续方便我们验证更新结果。 +At this point, the StartManager.exe interface will appear. All options are self-explanatory. Before entering option 1, let's first examine the app directory to verify the pre-update setup, which will help us confirm the update results later. ![](imgs\manager.png) -我们进入到app目录之后,可以看到这是没有升级之前的目录。 +Upon entering the app directory, you will see the setup prior to the upgrade. ![](imgs\rundir.png) @@ -65,20 +63,20 @@ tags: [quikstart] ## Step3 -检查完app目录之后: +After checking the app directory: -- 输入选项1然后回车 -- 服务端示例程序启动 -- 主客户端示例程序启动,开始请求更新(主客户端程序更新完成之后会自动关闭)。 +- Enter option 1 and press Enter +- The server sample program will start +- The main client sample program will start, initiating the update request (once the main client program update is complete, it will close automatically). ![](imgs\upgrade.png) -看到主客户端程序自动关闭,我们再去检查一下run\app目录。会发现多了一个备份目录“app-1.0.0.0”和一个“Congratulations on the update.txt”。 +Once the main client program closes automatically, check the run\app directory again. You will notice a new backup directory named "app-1.0.0.0" and a file named "Congratulations on the update.txt". ![](imgs\rundir2.png) -看到这里代表您已经成功的完成了一次升级,Congratulations! +Seeing this indicates that you have successfully completed an upgrade. Congratulations! ![](imgs\result.png) diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/releaselog/GeneralUpdateReleaselog.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/releaselog/GeneralUpdateReleaselog.md index 21c7666..07734b2 100644 --- a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/releaselog/GeneralUpdateReleaselog.md +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/releaselog/GeneralUpdateReleaselog.md @@ -11,299 +11,268 @@ tags: [log] ## 📍2024-11-28 -- 更新所有组件C#语法均升级至C#13。 +- Upgrade all components to C# 13 syntax. -- 优化、重构、精简代码,以最少的代码实现功能降低代码阅读难度。 +- Optimize, refactor, and simplify code to achieve functionality with minimal code, reducing the difficulty of code reading. -- 简化了GeneralClientBootstrap的传入参数复杂度。 +- Simplified the complexity of input parameters for GeneralClientBootstrap. -- 移除Strategys参数设置,内置在组件内可自推断所在操作系统平台切换更新策略,开发者无需再关心更新策略设置。 +- Removed Strategys parameter settings; these are now built into the component, automatically deducing the operating system platform to switch update strategies, so developers no longer need to manage update strategy settings. -- 新增驱动更新、备份、安装功能。 +- Added features for driver updates, backups, and installations. -- 优化了自动升级流程,更新状态的四种工作流: +- Optimized the automatic upgrade process with four types of update workflows: - 1.客户端需要升级、升级端需要升级 + 1. Client needs an upgrade, update server needs an upgrade. + + 2. Client does not need an upgrade, update server does not need an upgrade. + + 3. Client does not need an upgrade, update server needs an upgrade. + + 4. Client needs an upgrade, update server does not need an upgrade. - 2.客户端不需要升级、升级端不需要升级 +- If an update fails, the version will be stored locally, and upon rollback, the failed version will be skipped on subsequent attempts. - 3.客户端不需要升级、升级端需要升级 +- GeneralUpdate's OSS feature currently supports only Windows and only the zip compression format. - 4.客户端需要升级、升级端不需要升级 +- Removed all event notifications from GeneralUpdateOSS. -- 如果更新失败的版本将会存储在本地,回滚之后再遇到失败版本则跳过更新。 +- Introduced the GeneralUpdate.Bowl component. -- GeneralUpdate的OSS功能目前仅支持windows,仅支持zip压缩格式。 +- GeneralUpdate.Bowl includes rollback, monitoring, and dump export functionalities (Only for Windows; Linux support will be added gradually). -- 移除GeneralUpdateOSS通知所有事件。 +- Introduced the GeneralUpdate.Common component. -- 新增GeneralUpdate.Bowl组件 +- Removed the GeneralUpdate.Zip component. -- GeneralUpdate.Bowl包含回滚、监测、导出dump功能(Only windows,linux会陆续开放)。 +- Removed the GeneralUpdate.AspnetCore component. -- 新增GeneralUpdate.Common组件 +- Removed the MultiDownloadProgressChangedEvent, merging its notification content into the MultiDownloadStatisticsEvent. -- 移除GeneralUpdate.Zip组件 +- Removed the legacy feature, replaced by GeneralUpdate.Bowl. -- 移除GeneralUpdate.AspnetCore组件 +- Removed support for the 7z compression format; only zip compression is supported now. -- 移除MultiDownloadProgressChangedEvent,将该事件的通知内容合并至MultiDownloadStatisticsEvent。 +- Removed ProgressType notification event parameters for various working modes. -- 移除遗言功能,由GeneralUpdate.Bowl代替。 +- Replaced VersionHub with UpgradeHubService (push functionality). -- 移除7z压缩格式支持,仅支持zip压缩格式。 +- Updated all hash value-related checks and generation within components to the SHA256 algorithm, removing the MD5 algorithm. -- 移除ProgressType几种工作模式通知事件参数。 +- Added functionality to back up all current program files before updating. -- 移除VersionHub,由UpgradeHubService替代(推送功能)。 +- Added support for the Ubuntu operating system. -- 更新组件内所有Hash值相关校验、生成均为SHA256算法,移除MD5算法。 +- Compatible with and supports AOT compilation, removing or refactoring all code detrimental to AOT compilation or usage. -- 新增更新前备份当前程序所有文件内容。 +- All component version numbers follow the .NET Core framework version number, sharing a unified version number instead of maintaining separate ones. -- 支持Ubuntu操作系统。 +- Updated Sample example updates, allowing for one-click generation using bat scripts. -- 兼容并支持AOT编译,移除或重构所有不利于AOT编译或使用的代码。 +- Fixed several bugs reported in issues. -- 所有组件版本号跟随.NET Core的框架版本号。并且统一共享一个版本号,不再各自维护单独的版本号。 +- Moved GeneralUpdate.Maui.OSS and GeneralUpdate.OSS libraries to a new repository GeneralUpdate.Maui. -- 更新Sample示例更新,使用bat脚本一键生成。 +- GeneralUpdate.Differential removed the GeneralUpdate.Zip reference and all compression package handling capabilities. -- 修复了若干issue中提出的bug。 +- Added reporting of the upgrade process to the server with statuses like pending update, update failed, and update successful. -- 转移GeneralUpdate.Maui.OSS和GeneralUpdate.OSS类库至新仓库GeneralUpdate.Maui。 - -- GeneralUpdate.Differential移除GeneralUpdate.Zip引用,并且移除所有压缩包处理能力。 - -- 新增升级流程上报服务器升级状态,升级状态为待更新、更新失败、更新成功。 - -- 重构GeneralUpdate.Tools为Avalonia版本,适配在Linux操作系统上制作差分补丁包。 +- Refactored GeneralUpdate.Tools to an Avalonia version, adapting it for creating differential patch packages on Linux operating systems. ## 📍2023-08-05 -在企业产品发布到市场之前需要对功能进行测试,在大部分公司里自动升级功能不像产品功能一样有需求文档或者业务说明等文档。通常的要求就是能正常升级公司产品或能增量更新节约流量即可。这时候对测试经验不足的人员来说测试不充分或者大家都没有考虑到将会造成很多麻烦。(这里只是提供一种测试的思路,并非专业测试指导请辩证看待) - -1.测试版本升级顺序 - -假设市场上所有的客户现在使用的程序版本是v1.0.0.0,我们即将发布v2.0.0.0。在发布之前就需要在测试环境中将两个版本升级测试一下。 +Before releasing an enterprise product to the market, it's crucial to test its features. In many companies, the auto-update feature often lacks documentation such as requirement documents or business specifications, unlike other product features. Typically, the main requirement is that the product can be updated smoothly or incrementally to save bandwidth. For testers with insufficient experience, this can lead to inadequate testing or overlooked issues, causing numerous problems. (This is just a testing approach and not professional testing guidance, so please consider it critically.) -- 下载更新包时 -- 正在更新文件时 -- 强制中断程序运行、断网、直接断电、模拟弱网、模拟崩溃等 +1. **Testing Version Upgrade Order** -2.加密文件无法升级 + Assume all customers are currently using version v1.0.0.0, and we are about to release v2.0.0.0. Before release, both versions need to be tested in a test environment. -在GeneralUpdate中在两个版本中提取二进制差分更新补丁文件时,会出现加密文件无法被差分算法识别的情况这个时候需要考虑在生成差分补丁包时,将加密过的文件加入到(SetBlacklist)黑名单中或者考虑直接覆盖(直接打在压缩包里)。 + - While downloading the update package + - During file updates + - Simulate program interruption, network disconnection, power outages, weak network conditions, crashes, etc. -3.失败回滚或者重新升级? +2. **Encrypted Files Cannot Be Upgraded** -这方面也是企业中大家最在意的一点,自动升级虽然能带来诸多好处。但是升级失败会直接导致客户端根本没法使用这是非常致命的,后续我会考虑在GeneralUpdate中新增两种策略来解决这个问题。 + In GeneralUpdate, when extracting binary differential update patches between two versions, encrypted files may not be recognized by the differential algorithm. Consider adding encrypted files to a blacklist (SetBlacklist) or directly including them in the compressed package. -- 策略一 +3. **Failure Rollback or Re-upgrade?** -升级之前将需要被更新的文件或目录进行备份,如果更新失败第二次启动则会将备份文件还原至原来的目录,并关闭自动升级的开关以防止文件还原之后再次进行自动升级。 + This is a major concern in enterprises. While auto-updates offer many benefits, a failed update can render the client unusable, which is critical. I plan to add two strategies in GeneralUpdate to address this issue. -- 策略二 + - **Strategy One:** + Back up files or directories to be updated before the upgrade. If the update fails, the backup files will be restored upon the second startup, and the auto-update will be disabled to prevent further updates after restoration. -这个是我内心中比较推荐的升级方式,因为自动升级程序的意义就是升级而不是回滚。目前初步的想法是新增遗言机制。为解决在更新时遇到异常情况,导致文件损坏更新的问题。1.每次更新完成,需返回给服务器更新状态。如果客户端在30分钟内没有任何反馈则判定为毁坏性更新失败。(文件损坏)2.升级程序每次启动时会读取上一次更新的遗言,如果上次更新为失败自动化下载、安装客户端安装包(压缩包)3.或者新增更新守护进程接收实时推送自动化下载、安装客户端安装包(压缩包) + - **Strategy Two:** + This is my preferred method. The essence of auto-updates is to upgrade, not roll back. The initial idea is to introduce a "last words" mechanism. To handle exceptions during updates that may corrupt files, the program should report the update status to the server after each update. If the client doesn't respond within 30 minutes, it is considered a destructive update failure (file corruption). Upon each startup, the upgrade program reads the last update's status. If the previous update failed, it automatically downloads and installs the client package (compressed package). Alternatively, introduce an update daemon process to receive real-time push notifications for automated downloads and installations. -4.项目结构调整 +4. **Project Structure Adjustments** -如果开发人员对项目结构发生了一些结构性质的修改。例如基于IoC思想搭建的客户端程序,例如Prism框架如果开发人员把其中的一个Module更换了文件夹的位置或者文件夹名称修改了,导致用户的客户端更新了之后IoC容器启动之后找不到该DLL的异常情况。更新时需要考虑到文件路径变化的问题。测试人员也有责任例行询问是否有该种类的变化。 + If developers make structural changes to the project, such as moving or renaming modules in a client program based on IoC principles (e.g., Prism framework), it may lead to exceptions where the IoC container can't find the DLL after an update. Consider file path changes during updates, and testers should routinely inquire about such changes. -5.作为最后闭环流程再测试 +5. **Final Testing as a Closed-Loop Process** -这个事项是非常需要注意的,如果前面就把自动升级先测试了。如果后续有bug修复或者其他变动都有可能会造成未知的异常情况出现。所以作为最后的闭环流程进行测试是比较推荐的(如有特殊情况按需要调整即可)。 + This is crucial. If auto-updates are tested early, subsequent bug fixes or changes may introduce unknown issues. Therefore, conducting tests as the final closed-loop process is recommended (adjust as needed for special cases). -6.弱网环境测试 +6. **Weak Network Environment Testing** -弱网环境模拟可以借助NetLimiter和Clumsy来进行测试,具体使用方法可以参考我的这篇文章。 + Use tools like NetLimiter and Clumsy to simulate weak network conditions. For detailed usage, refer to my article: [Link](https://mp.weixin.qq.com/s?__biz=MzI5MTg4NzIyNg==&mid=2247486705&idx=1&sn=b2eac543ea7f738bdbe8c3cc63da3488&chksm=ec088de4db7f04f25e5603d2309d61279b0f94ee6eef34129801755a86cf406f863896214b3c&token=1809721461&lang=zh_CN#rd). -[https://mp.weixin.qq.com/s?__biz=MzI5MTg4NzIyNg==&mid=2247486705&idx=1&sn=b2eac543ea7f738bdbe8c3cc63da3488&chksm=ec088de4db7f04f25e5603d2309d61279b0f94ee6eef34129801755a86cf406f863896214b3c&token=1809721461&lang=zh_CN#rd](https://mp.weixin.qq.com/s?__biz=MzI5MTg4NzIyNg==&mid=2247486705&idx=1&sn=b2eac543ea7f738bdbe8c3cc63da3488&chksm=ec088de4db7f04f25e5603d2309d61279b0f94ee6eef34129801755a86cf406f863896214b3c&token=1809721461&lang=zh_CN&scene=21#wechat_redirect) +7. **Gray Release** -7.灰度发布 + Before releasing a version, thorough testing is necessary. -版本发布之前就需要做好测试。 + - For large customer bases, conduct a small-scale gray release before full release to all customers. + - For gray upgrades, avoid setting the version as mandatory; let users choose whether to upgrade. -- 如果面对的客户群体庞大则需要小范围的灰度发布,如果没有问题再选择发布给市场上所有客户。 -- 如果是灰度升级版本,这个时候就不要设置为强制更新的版本了。让用户自己选择是否升级。 +8. **Targeted Upgrades** -8.精准升级 + GeneralUpdate currently supports receiving push notifications of the latest version updates via Signal R. If a client with multiple devices has one device experiencing issues due to hardware or software environment problems, targeted fixes are necessary. In this case, use one-to-one upgrades for precise updates on the problematic device. -在GeneralUpdate中目前已有的基于Signal R接收推送最新版本更新的方式。假设在市场上有很多客户,每个客户有很多台设备。那么其中客户A有10台电脑,只有其中一台电脑因为硬件或者软件环境出现了问题导致客户端的功能异常。这个时候需要紧急针对该台设备的情况进行修复,这个时候并不清楚这个修改会不会对现在已经正常运行的客户端程序有影响。这个时候可以考虑使用一对一的升级方式精准升级某台出问题的电脑。 +9. **Compatibility of Old Configurations with New Versions** -9.老配置兼容新版本 + When different branches of a version exist in the market, consider local configuration files during auto-update upgrades. If the new version's program requires reading configuration files, incompatible old version configurations may cause issues. Testers should be aware of this scenario. -在市场上如果存在各个分支的版本时,每次自动更新升级还需要考虑到本地配置文件的问题。如果升级到新版本的程序之后需要读配置文件这个时候,老版本的配置文件兼容不了也会造成问题。这个时候测试人员也需要注意该种场景。 + To avoid such issues, store frequently changing configurations on the server to be read at each login, while storing stable configurations locally. -规避这种问题的方式可以把大部分容易变动的配置放到服务端每次登录的时候去读取。把不容易变化的配置保存到本地。 +10. **Automated Testing** -10.自动化测试 - -自动升级的自动测试化测试的脚本编写也非常重要,在多分支、多版本的升级测试中节省时间,增加测试的准确性。 + Writing scripts for automated testing of auto-updates is crucial. It saves time and increases accuracy in multi-branch and multi-version upgrade testing. ## 📍2023-07-23 -开发者提问: - -- (1)在更新过程中出现了断网、断电、电脑死机、突然蓝屏、程序假死等意外情况,导致应用程序无法正常进行更新或者无法正常启动如何解决?能否让更新程序回滚到这次更新之前? - -答:这个问题分两块回答,(1)意外情况可以尝试重启应用程序断点下载更新,目前的情况来说如果在更新过程中出现文件损坏无法只能重新安装。后续会考虑增加一种机制处理更新异常情况无法启动客户端应用程序的问题。(2)不能,因为目前的想法来说自动升级程序的核心意义就是升级,如果回滚回去了升级可能就失去了意义。可能会希望及时发现问题,然后紧急更新一个安全的更新包让客户端逐版本更新直到成功。 - - +Developer Questions: -- (2)如果更新包打包本身(更新包里本身就有异常文件)就有问题,更新完成之后程序无法正常启动。能不能回滚或者备份? +1. **What should be done if unexpected situations like network disconnection, power outage, computer crash, sudden blue screen, or program freeze occur during the update process, causing the application to fail to update or start properly? Can the update program roll back to the previous version?** - 答:不能,在该版本发布之前就需要做好测试。如果面对的客户群体庞大则需要小范围的灰度发布,如果没有问题再选择发布给市场上所有客户。 + **Answer:** This question can be divided into two parts: + + (1) In the event of unexpected situations, you can try restarting the application to resume the update download from the breakpoint. Currently, if files become corrupted during the update, reinstallation is the only option. In the future, we plan to introduce a mechanism to handle situations where the client application cannot start due to update anomalies. + + (2) Rolling back is not possible because the core purpose of the auto-update program is to facilitate updates. Rolling back could negate the purpose of the update. It is preferable to quickly identify issues and urgently release a safe update package to allow clients to update incrementally until successful. +2. **What if the update package itself contains issues (e.g., abnormal files), causing the program to fail to start after the update? Can it roll back or back up?** + **Answer:** No, comprehensive testing must be conducted before the version is released. For a large customer base, a small-scale gray release should be conducted first. If no issues arise, then the release can be extended to all customers in the market. -- (3)如果客户端本地保存了一些数据文件,在保留之前的数据的文件基础上需要新增一些内容,例如sqlite的.db文件更新之后被之前的.db文件被覆盖,如何解决?或者增量更新是否可以正常更新这些文件? - -答:之前有开发过这样的功能,效果不好暂时下线了;后续需要重新设计再启用该类功能。组件目前的功能完成度暂时无法解决这个问题,只能覆盖。增量更新也有极大的可能更新不了这种情况。 - +3. **If the client locally stores some data files and needs to add new content while retaining previous data (e.g., updating a SQLite .db file without overwriting the old .db file), how can this be resolved? Can incremental updates handle such files?** + **Answer:** We previously developed such a feature, but it was ineffective and has been temporarily discontinued. It will require a redesign before being reinstated. Currently, the component's functionality cannot address this issue, and the only option is to overwrite. Incremental updates are also unlikely to handle this situation effectively. ## 📍2023-04-23 -使用技术更新 - -黑名单功能,OSS新功能发布,针对windows和.NET MAUI Android 版本。修复了部分bug和重构了组件整体的事件管理通知机制。 - -1.发布内容 - -| 组件名称 | 版本号(old) | 版本号(new) | 状态 | -| -------------------------- | ------------- | ------------- | ------ | -| GeneralUpdate.AspNetCore | 1.4.1 | - | - | -| GeneralUpdate.ClientCore | 2.8.9 | 2.12.9 | 新版本 | -| GeneralUpdate.Core | 4.11.18 | 4.14.18 | 新版本 | -| GeneralUpdate.Differential | 1.3.0 | 1.4.1 | 新版本 | -| GeneralUpdate.Zip | 1.3.0 | - | - | -| GeneralUpdate.Tool | 2.2.5 | 2.3.5 | 新版本 | -| GeneralUpdate.Single | 1.0.0 | - | - | -| GeneralUpdate.Maui.OSS | 1.0.0 | 1.0.0 | 新版本 | - - - -【1】组件GeneralUpdate.ClientCore +### Technical Update Overview -1.新增OSS更新功能 +**New Features: Blacklist Functionality and OSS Support for Windows and .NET MAUI Android Versions** -2.新增黑名单功能 +This update focuses on bug fixes and a complete refactoring of the event management notification system across components. -3.重构事件,添加事件管理机制 +#### Release Details -4.修复,增量包只能识别新增,不能识别删除 +| Component Name | Version (Old) | Version (New) | Status | +| -------------------------- | ------------- | ------------- | ------- | +| GeneralUpdate.AspNetCore | 1.4.1 | - | - | +| GeneralUpdate.ClientCore | 2.8.9 | 2.12.9 | Updated | +| GeneralUpdate.Core | 4.11.18 | 4.14.18 | Updated | +| GeneralUpdate.Differential | 1.3.0 | 1.4.1 | Updated | +| GeneralUpdate.Zip | 1.3.0 | - | - | +| GeneralUpdate.Tool | 2.2.5 | 2.3.5 | Updated | +| GeneralUpdate.Single | 1.0.0 | - | - | +| GeneralUpdate.Maui.OSS | 1.0.0 | 1.0.0 | New | +#### Component Updates +**1. GeneralUpdate.ClientCore** -【2】组件GeneralUpdate.Core +- Added OSS update functionality. +- Introduced blacklist functionality. +- Refactored events with a new event management mechanism. +- Fixed issue where incremental packages could only recognize additions, not deletions. -1.新增OSS更新功能 +**2. GeneralUpdate.Core** -2.重构事件,添加事件管理机制 +- Added OSS update functionality. +- Refactored events with a new event management mechanism. +- Fixed issue where incremental packages could only recognize additions, not deletions. -3.修复,增量包只能识别新增,不能识别删除 +**3. GeneralUpdate.Differential** +- Fixed issue where incremental packages could only recognize additions, not deletions. +#### Changes in GeneralUpdate.ClientCore and GeneralUpdate.Core -【3】组件GeneralUpdate.Differential +1. **Event Subscription Mechanism** + - The event subscription mechanism is refactored. Instead of using `event +=`, events are now managed through an `EventManager`. This requires minimal code changes for developers and reduces the component's codebase by favoring composition over inheritance. -1.修复,增量包只能识别新增,不能识别删除 +2. **Blacklist Management** + - Added the `SetBlacklist` method to manage files you don't want to update. The component has built-in default blacklist files: `{ "Newtonsoft.Json.dll" }` and default blacklist file extensions: `{ ".patch", ".7z", ".zip", ".rar", ".tar" , ".json" }`. -2.1 组件GeneralUpdate.ClientCore、组件GeneralUpdate.Core改动 - -1.事件订阅机制重构之后不再使用event+=订阅方式,通过事件EventManger添加事件监听。对于开发者来说只需要轻微的代码修改即可适应新版本。对于组件本身而言减少大量的代码,组合优于继承。 - -2.添加黑名单管理SetBlacklist方法,可以设置不想更新的某个具体文件或者某个类型的文件,组件内置默认黑名单文件:{ "Newtonsoft.Json.dll" } 默认黑名单文件扩展名:{ ".patch", ".7z", ".zip", ".rar", ".tar" , ".json" }。 - -```c# - Task.Run(async () => - { - //ClientStrategy该更新策略将完成1.自动升级组件自更新 2.启动更新组件 3.配置好ClientParameter无需再像之前的版本写args数组进程通讯了。 - //generalClientBootstrap.Config(baseUrl, "B8A7FADD-386C-46B0-B283-C9F963420C7C"). - var configinfo = GetWindowsConfiginfo(); - var generalClientBootstrap = await new GeneralClientBootstrap() - //单个或多个更新包下载通知事件 - .AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged) - //单个或多个更新包下载速度、剩余下载事件、当前下载版本信息通知事件 - .AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics) - //单个或多个更新包下载完成 - .AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted) - //完成所有的下载任务通知 - .AddListenerMultiAllDownloadCompleted(OnMultiAllDownloadCompleted) - //下载过程出现的异常通知 - .AddListenerMultiDownloadError(OnMultiDownloadError) - //整个更新过程出现的任何问题都会通过这个事件通知 - .AddListenerException(OnException) - .Config(configinfo) - .Option(UpdateOption.DownloadTimeOut, 60) - .Option(UpdateOption.Encoding, Encoding.Default) - .Option(UpdateOption.Format, Format.ZIP) - .Strategy() - //注入一个func让用户决定是否跳过本次更新,如果是强制更新则不生效 - .SetCustomOption(ShowCustomOption) - //默认黑名单文件:{ "Newtonsoft.Json.dll" } 默认黑名单文件扩展名:{ ".patch", ".7z", ".zip", ".rar", ".tar" , ".json" } - //如果不需要扩展,需要重新传入黑名单集合来覆盖。 - .SetBlacklist(GetBlackFiles(), GetBlackFormats()) - .LaunchTaskAsync(); - }); +```csharp +Task.Run(async () => +{ + var configinfo = GetWindowsConfiginfo(); + var generalClientBootstrap = await new GeneralClientBootstrap() + .AddListenerMultiDownloadProgress(OnMultiDownloadProgressChanged) + .AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics) + .AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted) + .AddListenerMultiAllDownloadCompleted(OnMultiAllDownloadCompleted) + .AddListenerMultiDownloadError(OnMultiDownloadError) + .AddListenerException(OnException) + .Config(configinfo) + .Option(UpdateOption.DownloadTimeOut, 60) + .Option(UpdateOption.Encoding, Encoding.Default) + .Option(UpdateOption.Format, Format.ZIP) + .Strategy() + .SetCustomOption(ShowCustomOption) + .SetBlacklist(GetBlackFiles(), GetBlackFormats()) + .LaunchTaskAsync(); +}); ``` +#### New OSS Functionality +**OSS (Object Storage Service)** is a familiar concept for backend developers, provided by major cloud service providers like Alibaba Cloud OSS, Tencent Cloud COS, and Huawei Cloud OBS. The update component adopts OSS for its naming and functionality, making it intuitive for developers to understand its purpose. -1.新增OSS功能 - -OSS的全称是对象存储服务(Object Storage Service),做服务端技术栈开发的小伙伴肯定对这个不陌生在各大云服务器厂商都会提供类似的服务,说简单点就是一个文件服务器。例如:阿里云OSS、腾讯云COS、华为云OBS,其实它们只是名字不一样功能服务都差不多。然后本更新组件新功能的实现思路非常相似那么就选择了OSS来为该功能命名,而且方便开发者一眼能get到这个功能的作用(需要使用组件GeneralUpdate.ClientCore、GeneralUpdate.Core)。 - - +**GeneralUpdate.OSS Operation Principle:** -2.GeneralUpdate.OSS运行原理 - -1.准备version.json版本信息配置文件,更新文件(update.zip)更新文件和之前的打包方式一样。 +1. Prepare a `version.json` configuration file and an update file (`update.zip`) as usual. ```json [ -{ -"PubTime": 1680443321, -"Name": "generalupdate.ossclient", -"MD5": "9bf414990a67e74f11752d03f49b15d8", -"Version": "1.0.4", -"Url": "http://192.168.50.203/update.zip" -}, -{ -"PubTime": 1680444916, -"Name": "generalupdate.ossclient", -"MD5": "JXC122DFXCZXZNMRFf11752d03f49b15d8", -"Version": "1.0.5", -"Url": "http://192.168.50.203/update2.zip" -} + { + "PubTime": 1680443321, + "Name": "generalupdate.ossclient", + "MD5": "9bf414990a67e74f11752d03f49b15d8", + "Version": "1.0.4", + "Url": "http://192.168.50.203/update.zip" + }, + { + "PubTime": 1680444916, + "Name": "generalupdate.ossclient", + "MD5": "JXC122DFXCZXZNMRFf11752d03f49b15d8", + "Version": "1.0.5", + "Url": "http://192.168.50.203/update2.zip" + } ] ``` -2.Client启动时直接请求OSS服务器或文件服务器,下载version.json文件。 - -3.下载到本地之后解析版本信息内容判断是否需要更新,如果将信息通过进程启动传递Upgrade(Client自我关闭)。 - -4.Upgrade启动之后直接去下载update.zip,下载到本地之后直接解压覆盖本地文件。 +2. The client requests the OSS server or file server to download the `version.json` file at startup. +3. Upon downloading, it parses the version information to decide if an update is necessary. If so, it passes the info through the process to start `Upgrade` (the client self-closes). +4. `Upgrade` then downloads `update.zip`, extracts it, and overwrites local files. +5. Once the update completes, `Upgrade` restarts the client and self-closes. The update is finished. -5.Upgrade更新完成之后把Client启动起来,自我关闭。更新结束。 +**GeneralUpdateOSS** is easier to use compared to GeneralUpdateBootstrap. It downloads `version.json` and updates incrementally based on its content. -GeneralUpdateOSS的功能和GeneralUpdateBootstrap功能对比来说,使用的门槛非常低如果公司对自动更新的要求不高的话可以使用这个功能。一句话概括这个功能就是下载version.json根据文件里的内容去逐版本下载更新包,下载下来之后直接解压更新就结束了。 +#### Quick Start +**Client (Main Client) Code Example:** - -3.快速启动 - -Client(主客户端)使用代码示例: - -```c# +```csharp Task.Run(async () => { var url = "http://192.168.50.203"; @@ -315,75 +284,54 @@ Task.Run(async () => }); ``` +**Upgrade (Upgrade Assistant) Code Example:** - -Upgrade(升级助手)使用代码示例: - -```c# +```csharp private static void Main(string[] args) { - Task.Run(async () => - { - //var url = "http://192.168.50.203"; - //var appName = "GeneralUpdate.Client"; - //var version = "1.0.0"; - //var versionFileName = "version.json"; - //SerializeUtil.Deserialize(args[0]); - //ParamsOSS @params = new ParamsOSS(url, appName, version, versionFileName); - ParamsOSS @params = SerializeUtil.Deserialize(args[0]); - await GeneralUpdateOSS.Start(@params,Encoding.Default); - }); + Task.Run(async () => + { + ParamsOSS @params = SerializeUtil.Deserialize(args[0]); + await GeneralUpdateOSS.Start(@params, Encoding.Default); + }); } ``` +**Event Notification Subscription:** - -4.事件通知订阅 - -在OSS的更新过程中,保留了更新事件的参数和之前一样。 - -```c# -//code... +```csharp GeneralUpdateOSS.AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics); private static void OnMultiDownloadStatistics(object sender, MultiDownloadStatisticsEventArgs e) { - Console.WriteLine($" {e.Speed} , {e.Remaining.ToShortTimeString()}"); + Console.WriteLine($" {e.Speed} , {e.Remaining.ToShortTimeString()}"); } ``` +#### .NET MAUI OSS +The MAUI OSS functionality is similar to the OSS described above but is specifically for .NET MAUI, focusing on the Android platform. -2.3 .NET MAUI OSS - -MAUI OSS功能介绍和 11.OSS中介绍的是一样的。但是它是针对.NET MAUI编写的更新,使用的组件库是GeneralUpdate.Maui.OSS。目前只实现了MAUI Andorid平台的自动更新。 - -1.准备version.json版本信息配置文件,更新文件(update.apk)更新文件就直接是新版本的apk了(或.abb)。 +1. Prepare a `version.json` configuration file and an update file (`update.apk`), which is the new version's APK. ```json { -"PubTime": 1680444916, -"Name": "com.companyname.generalupdate.ossclient", -"MD5": "9bf414990a67e74f11752d03f49b15d8", -"Version": "1.0.5", -"Url": "http://192.168.50.203/com.companyname.generalupdate.ossclient.apk" + "PubTime": 1680444916, + "Name": "com.companyname.generalupdate.ossclient", + "MD5": "9bf414990a67e74f11752d03f49b15d8", + "Version": "1.0.5", + "Url": "http://192.168.50.203/com.companyname.generalupdate.ossclient.apk" } ``` -2.Client启动时直接请求OSS服务器或文件服务器,下载version.json文件。 - -3.下载到本地之后解析版本信息内容,判断是否需要更新。 - -4.需要更新则下载update.apk。 - -5.下载完成之后执行安装,这一步就交给了安卓操作系统执行。执行完成之后运行新版本app。 - +2. The client requests the OSS server or file server to download the `version.json` file at startup. +3. After downloading, it parses the version information to decide if an update is necessary. +4. If an update is needed, it downloads `update.apk`. +5. Upon download completion, the Android OS handles the installation, and the new app version runs. +**Quick Start:** -2.快速启动 - -```c# -//http://192.168.50.203/version.json +```csharp string url = "http://192.168.50.203"; string appName = "MainApplication.exe"; string currentVersion = "1.1.1.1"; @@ -393,272 +341,179 @@ GeneralUpdateOSS.AddListenerException(OnException); await GeneralUpdateOSS.Start(new ParamsAndroid(url, appName, "123456789", currentVersion, versionFileName)); ``` +**Event Notification Subscription:** - -3.事件通知订阅 - -```c# +```csharp GeneralUpdateOSS.AddListenerDownloadProcess(OnOSSDownload); GeneralUpdateOSS.AddListenerException(OnException); private void OnOSSDownload(object sender, OSSDownloadArgs e) { - Console.WriteLine($"{e.ReadLength},{e.TotalLength}"); + Console.WriteLine($"{e.ReadLength},{e.TotalLength}"); } private void OnException(object sender, ExceptionEventArgs exception) { - Console.WriteLine(exception.Exception.Message); + Console.WriteLine(exception.Exception.Message); } ``` +**Guidance Articles for .NET MAUI Android Related Queries:** +- [Blog Post on .NET MAUI Android](https://www.cnblogs.com/MASA/p/16612541.html) +- [Microsoft Documentation on .NET MAUI Android Deployment](https://learn.microsoft.com/zh-cn/dotnet/maui/android/deployment/?view=net-maui-7.0) +- [Stack Overflow: Android 8 Cleartext HTTP Traffic Not Permitted](https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted) +- [Youdao Note](https://note.youdao.com/ynoteshare/mobile.html?id=5c5d5cf8fe1d67419b09024255ff239c) -4. .NET MAUI Android 相关疑问处理引导文章 - -https://www.cnblogs.com/MASA/p/16612541.html - -https://learn.microsoft.com/zh-cn/dotnet/maui/android/deployment/?view=net-maui-7.0 - -https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted - -https://note.youdao.com/ynoteshare/mobile.html?id=5c5d5cf8fe1d67419b09024255ff239c - - - -5.运行效果 - -目前已运行测试机型、平台 。 - -1.在华为荣耀Px30非鸿蒙系统手机可运行。 - -2.Visual studio 2022 preview Pixe 5 - API33 (Android 13.0 - API 33) 可运行。 - +**Current Testing Devices and Platforms:** +1. Huawei Honor Px30 (non-HarmonyOS) - operational. +2. Visual Studio 2022 Preview on Pixel 5 - API 33 (Android 13.0 - API 33) - operational. ## 📍2023-01-17 -开源项目调整 +### Open Source Project Reorganization -在github和gitee的两个开源平台分别建立了General开源组织,会将具有一定代码贡献的小伙伴邀请到组织中来并分配奖励。 +We have established the "General" open source organization on both GitHub and Gitee platforms. Contributors with significant code contributions will be invited to join the organization and receive rewards. -将原有的GeneralUpdate 拆分成了三个项目,分别是: +The original GeneralUpdate project has been split into three separate projects: -- https://gitee.com/GeneralLibrary +1. **GeneralLibrary on Gitee:** + - Main organization page: [GeneralLibrary](https://gitee.com/GeneralLibrary) -- 自动升级项目 https://gitee.com/GeneralLibrary/GeneralUpdate -- 差分补丁包打包工具 https://gitee.com/GeneralLibrary/GeneralUpdate.Tools -- 使用示例 https://gitee.com/GeneralLibrary/GeneralUpdate-Samples +2. **Projects under GeneralLibrary:** + - **Automatic Update Project:** [GeneralUpdate](https://gitee.com/GeneralLibrary/GeneralUpdate) + - **Differential Patch Packaging Tool:** [GeneralUpdate.Tools](https://gitee.com/GeneralLibrary/GeneralUpdate.Tools) + - **Usage Examples:** [GeneralUpdate-Samples](https://gitee.com/GeneralLibrary/GeneralUpdate-Samples) ## 📍2022-10-09 -发布内容 - -| 组件名称 | 版本号(old) | 版本号(new) | 状态 | -| -------------------------- | ------------- | ------------- | ---- | -| GeneralUpdate.AspNetCore | 1.1.0 | 1.4.1 | 正常 | -| GeneralUpdate.ClientCore | 2.3.6 | 2.8.9 | 正常 | -| GeneralUpdate.Core | 4.10.12 | 4.11.18 | 正常 | -| GeneralUpdate.Differential | 1.0.0 | 1.3.0 | 正常 | -| GeneralUpdate.Zip | 1.0.0 | 1.3.0 | 正常 | -| GeneralUpdate.Tool | 1.0.0 | 2.1.5 | 正常 | -| GeneralUpdate.Single | 1.0.0 | - | 正常 | - - - -【1】组件GeneralUpdate.AspNetCore - -(1)重构:将之前的version和validate方法合并为Update方法,将这一个方法完成版本验证和返回更新信息功能。 - -(2)新增:为配合GeneralUpdate.PacktTool自动上传发布功能,新增了upload方法。完成版本信息入库和更新包落文件服务器。 - -GeneralUpdate.AspNetCore组件添加文件上传接口 · Issue #I55NFC · Juster.zhu/GeneralUpdate - Gitee.com - -(3)新增:该方法是为了配合客户端即使推送重要版本或服务端服务之间的更新,新增的push调用一次之后会通过Signal R推送更新信息。 - - - -【2】组件GeneralUpdate.ClientCore - -(1)修复:AutoUpdate.Core与AutoUpdate.ClientCore文件冲突问题 · Issue #I5F2YM · Juster.zhu/GeneralUpdate - Gitee.com - -(2)修复:更新组件无需更新报错 · Issue #I5F1VN · Juster.zhu/GeneralUpdate - Gitee.com - -(3)重构:更新机制需适配多个操作系统平台 · Issue #I5LYQZ · Juster.zhu/GeneralUpdate - Gitee.com - -(4)重构:重构版本验证机制 · Issue #I5LYQY · Juster.zhu/GeneralUpdate - Gitee.com - -(5)新增:配置适应MAUI - Windows machice · Issue #I4TGJC · Juster.zhu/GeneralUpdate - Gitee.com - -(6)修复:当主程序已经是最新时,是不是应该先判断,这时候就不用启动升级软件吧? · Issue #I5O53P · Juster.zhu/GeneralUpdate - Gitee.com - -(7)重构: - -将 - -``` -public GeneralClientBootstrap Config(ClientParmeter info) -``` - -修改为: - -``` -public GeneralClientBootstrap Config(Configinfo info) -``` - -只是改变了类名称,字段内容删除validaterul和versionurl。 - -(8)新增: - -用户自定义方法,决定是否跳过本次更新的Task版本方法。 - -```c# -public GeneralClientBootstrap SetCustomOption(Func> func) -``` - -(9)新增: - -在更新配置中新增了枚举,将原来的字符串“.zip”修改为枚举Format.ZIP,防止用户输入字符串错误。 - -```c# -Option(UpdateOption.Format, Format.ZIP) -``` - - - -【3】组件GeneralUpdate.Core - -(1)重构:更新机制需适配多个操作系统平台 · Issue #I5LYQZ · Juster.zhu/GeneralUpdate - Gitee.com - -(2)重构:重构版本验证机制 · Issue #I5LYQY · Juster.zhu/GeneralUpdate - Gitee.com - -(3)修复:当主程序已经是最新时,是不是应该先判断,这时候就不用启动升级软件吧? · Issue #I5O53P · Juster.zhu/GeneralUpdate - Gitee.com - -(4)修复:BUG: "GeneralUpdate.Core\Utils\FileUtil.cs" GetFileMD5 函数异常 · Issue #I5J0KA · Juster.zhu/GeneralUpdate - Gitee.com - -(5)修复:多级文件夹结构更新失败问题 · Issue #I59QRI · Juster.zhu/GeneralUpdate - Gitee.com - -(6)新增:在更新体系中添加客户端唯一标识 · Issue #I55NFP · Juster.zhu/GeneralUpdate - Gitee.com - -(7)下线:json配置文件更新功能,将直接覆盖。等待重构完成再次上线。影响范围如下: - -老哥,一点点建议 · Issue #I556BK · Juster.zhu/GeneralUpdate - Gitee.com - -报错 · Issue #I53XYX · Juster.zhu/GeneralUpdate - Gitee.com - -(8)调研:可行。 - -调研Mac环境下是否可以正常运行 · Issue #I4TGKK · Juster.zhu/GeneralUpdate - Gitee.com - -(9)修复:bug:"GeneralUpdate\src\GeneralUpdate.Core\Download\AbstractTask.cs" 第143行 · Issue #I4WQQ0 · Juster.zhu/GeneralUpdate - Gitee.com - - - -【4】组件GeneralUpdate.Differential - -重构:递归查找需更新文件,防止一些文件没有更新检测到。添加树形结构管理更新文件目录结构。 - -修复:只能更新第一层文件bug,现在可以递归更新所有目录下的文件夹和子文件夹内的文件列表。 - -修复:打包工具打包文件包含两个名称相同但后缀不同的文件时会出错 · Issue #I5O4OD · Juster.zhu/GeneralUpdate - Gitee.com - - - -【5】组件GeneralUpdate.Zip - -(1)修复:关于文件压缩的几个问题 · Issue #I5J4Y6 · Juster.zhu/GeneralUpdate - Gitee.com - -(2)修复:word文件乱码 · Issue #I5O4S6 · Juster.zhu/GeneralUpdate - Gitee.com - -(3)修复:下载包解压在C盘下Program Files (x86)时,没有权限操作怎么处理? · Issue #I4ZKQ4 · Juster.zhu/GeneralUpdate - Gitee.com - - - -【6】GeneralUpdate.PacketTool - -(1)修复:打包工具打包时,没有考虑有子文件夹的问题 · Issue #I5O4P8 · Juster.zhu/GeneralUpdate - Gitee.com - -(2)重构:重构文件功能体系 · Issue #I59Q5W · Juster.zhu/GeneralUpdate - Gitee.com - -(3)重构:打包工具迁移到MAUI · Issue #I5QOLG · Juster.zhu/GeneralUpdate - Gitee.com - -(4)新增:GeneralUpdate.Tool添加上传功能 · Issue #I55NF1 · Juster.zhu/GeneralUpdate - Gitee.com - -(5)修复:当只修改文件内容时,PacketTool打包功能无效 · Issue #I5BERJ · Juster.zhu/GeneralUpdate - Gitee.com - -(6)修复:文件解压后中文名显示乱码 · Issue #I502QQ · Juster.zhu/GeneralUpdate - Gitee.com - - - -【7】测试用例 、示例代码 - -示例代码: - -src/c#/GeneralUpdate.Api/Program.cs · Juster.zhu/GeneralUpdate - Gitee.com +Release Notes -src/c#/GeneralUpdate.Client/MainPage.xaml.cs · Juster.zhu/GeneralUpdate - Gitee.com - -src/c#/GeneralUpdate.Upgrad/Program.cs · Juster.zhu/GeneralUpdate - Gitee.com - -测试用例(还在完善): - -src/c#/TestClientCore/UnitTest1.cs · Juster.zhu/GeneralUpdate - Gitee.com - -src/c#/TestDifferential/UnitTest1.cs · Juster.zhu/GeneralUpdate - Gitee.com - -src/c#/TestMD5/UnitTest1.cs · Juster.zhu/GeneralUpdate - Gitee.com - -src/c#/TestService/Program.cs · Juster.zhu/GeneralUpdate - Gitee.com - -src/c#/TestZIP/UnitTest1.cs · Juster.zhu/GeneralUpdate - Gitee.com +| Component Name | Version (old) | Version (new) | Status | +| -------------------------- | ------------- | ------------- | ------ | +| GeneralUpdate.AspNetCore | 1.1.0 | 1.4.1 | Normal | +| GeneralUpdate.ClientCore | 2.3.6 | 2.8.9 | Normal | +| GeneralUpdate.Core | 4.10.12 | 4.11.18 | Normal | +| GeneralUpdate.Differential | 1.0.0 | 1.3.0 | Normal | +| GeneralUpdate.Zip | 1.0.0 | 1.3.0 | Normal | +| GeneralUpdate.Tool | 1.0.0 | 2.1.5 | Normal | +| GeneralUpdate.Single | 1.0.0 | - | Normal | + +**[1] Component GeneralUpdate.AspNetCore** + +1. Refactor: Merged previous version and validate methods into a single Update method to perform version validation and return update information. +2. New: Added an upload method to support the automatic upload release function of GeneralUpdate.PacktTool. This method completes the storage of version information and the placement of update packages on the file server. +3. New: Added a push method to support immediate push of important versions or updates between server services to the client, using Signal R to push update information after a single call. + +**[2] Component GeneralUpdate.ClientCore** + +1. Fix: Resolved file conflict issue between AutoUpdate.Core and AutoUpdate.ClientCore. +2. Fix: Resolved error when components do not require an update. +3. Refactor: Updated mechanism to support multiple operating system platforms. +4. Refactor: Refactored version validation mechanism. +5. New: Configuration adaptation for MAUI - Windows machine. +6. Fix: When the main program is already the latest, should it first check to avoid launching the upgrade software unnecessarily? +7. Refactor: Changed the method signature for configuration from `public GeneralClientBootstrap Config(ClientParmeter info)` to `public GeneralClientBootstrap Config(Configinfo info)`, removing the fields validaterul and versionurl. +8. New: Added a user-defined method to decide whether to skip the current update using a Task version method. +9. New: Added an enumeration to the update configuration, changing the original string ".zip" to the enumeration Format.ZIP to prevent user input errors. + +**[3] Component GeneralUpdate.Core** + +1. Refactor: Updated mechanism to support multiple operating system platforms. +2. Refactor: Refactored version validation mechanism. +3. Fix: When the main program is already the latest, should it first check to avoid launching the upgrade software unnecessarily? +4. Fix: Bug in "GeneralUpdate.Core\Utils\FileUtil.cs" GetFileMD5 function. +5. Fix: Issue with multi-level folder structure updates failing. +6. New: Added a unique client identifier in the update system. +7. Offline: JSON configuration file update function will be directly overwritten. Will be back online after refactoring. Affected areas include: + - Suggestions from users. + - Error reports. +8. Research: Feasibility of running normally in a Mac environment. +9. Fix: Bug in "GeneralUpdate\src\GeneralUpdate.Core\Download\AbstractTask.cs" at line 143. + +**[4] Component GeneralUpdate.Differential** + +- Refactor: Recursively search for files to update to prevent missing update detections. Added a tree structure to manage the update file directory structure. +- Fix: Bug where only the first layer of files could be updated. Now all directories and subdirectories can be recursively updated. +- Fix: Error when the packaging tool includes two files with the same name but different extensions. + +**[5] Component GeneralUpdate.Zip** + +1. Fix: Several issues related to file compression. +2. Fix: Garbled characters in Word files. +3. Fix: Permission issues when extracting downloaded packages in C:\Program Files (x86). + +**[6] GeneralUpdate.PacketTool** + +1. Fix: Packaging tool did not consider subfolder issues during packaging. +2. Refactor: Refactored the file functionality system. +3. Refactor: Migrated packaging tool to MAUI. +4. New: Added upload functionality to GeneralUpdate.Tool. +5. Fix: PacketTool's packaging function was ineffective when only file content was modified. +6. Fix: Garbled characters in Chinese filenames after file extraction. + +**[7] Test Cases and Example Code** + +Example Code: +- src/c#/GeneralUpdate.Api/Program.cs +- src/c#/GeneralUpdate.Client/MainPage.xaml.cs +- src/c#/GeneralUpdate.Upgrad/Program.cs + +Test Cases (still in progress): +- src/c#/TestClientCore/UnitTest1.cs +- src/c#/TestDifferential/UnitTest1.cs +- src/c#/TestMD5/UnitTest1.cs +- src/c#/TestService/Program.cs +- src/c#/TestZIP/UnitTest1.cs ## 📍2022-04-03 -(1)主程序和升级程序之间是否支持相互升级? +(1) Does the main program support mutual upgrades with the update program? -答:支持。 +Answer: Yes, it does. -(2)是否需要开发者写代码关闭进程的时机或者其他代码? +(2) Do developers need to write code to manage the timing of process closure or any other code? -答:不需要,组件已经将整个更新流程考虑到了。所以除了组件代码以外,不需要开发者额外多写任何辅助代码。 +Answer: No, they don't. The component already considers the entire update process, so developers don't need to write any additional auxiliary code beyond the component code. -(3)更新程序是否需要和主程序放在同一个目录下? +(3) Does the update program need to be in the same directory as the main program? -答:是的,需要。但一定要保持升级程序不能引用主程序的里的任何代码。否则会更新失败。 +Answer: Yes, it does. However, make sure that the update program does not reference any code from the main program; otherwise, the update will fail. -(4)更新完成之后会删除更新包的补丁文件吗? +(4) Will the update package's patch files be deleted after the update is complete? -答:会的,组件更新完成之后会保证文件列表干净,不会出现冗余文件污染、磁盘空间占用的情况。 +Answer: Yes, they will. The component ensures a clean file list after the update, avoiding redundant files and unnecessary disk space usage. -(5)可以运用在服务端吗?就是服务与服务之间的升级。 +(5) Can this be used on the server side, for instance, for upgrades between services? -答:理论上支持的,作者没有实际这么使用过。据反馈有的小伙伴已经这么干了。本次分享是针对C/S架构的场景。 +Answer: Theoretically, it is supported, although the author has not used it this way personally. Feedback indicates that some users have done this. This sharing is focused on C/S architecture scenarios. -(6)怎么获取更新包的MD5码? +(6) How can I get the MD5 checksum of the update package? -答:使用项目源码里的,AutoUpdate.MD5工程。 +Answer: Use the AutoUpdate.MD5 project from the source code. -(7)怎么制作一个更新包? +(7) How do I create an update package? -答:使用GeneralUpdate.PacketTool工具生成即可。在源码仓库的release中可以看到打包好的安装程序。 +Answer: Use the GeneralUpdate.PacketTool to generate it. You can find the packaged installation program in the release section of the source code repository. -(8)关于组件的其他内容如何了解到? +(8) How can I learn more about other aspects of the component? -答:可以通过官方网站、或者相关Q群、以及我gitee或github的issue中与我交流。 +Answer: You can learn more through the official website, relevant QQ groups, or by discussing with me on Gitee or GitHub issues. -(9)下载包解压在C盘下Program Files (x86)时,没有权限操作怎么处理? +(9) How to handle lack of permissions when extracting the download package in C:\Program Files (x86)? -答:https://gitee.com/Juster-zhu/GeneralUpdate/issues/I4ZKQ4 +Answer: [Link to issue](https://gitee.com/Juster-zhu/GeneralUpdate/issues/I4ZKQ4) -(10)更新文件较小时,下载速度显示为:0B/S 。 +(10) When the update file is small, the download speed shows as 0B/S. -答:https://gitee.com/Juster-zhu/GeneralUpdate/issues/I3POMG +Answer: [Link to issue](https://gitee.com/Juster-zhu/GeneralUpdate/issues/I3POMG) @@ -666,36 +521,32 @@ src/c#/TestZIP/UnitTest1.cs · Juster.zhu/GeneralUpdate - Gitee.com ## 📍2022-03-23 -说明 - -- 在线帮助文档:http://justerzhu.cn/ (后续将会按组件拆分成对应的文档) -- Nuget版本管理参考标准:https://docs.microsoft.com/zh-cn/nuget/concepts/package-versioning -- 应用程序集版本管理参考标准:https://docs.microsoft.com/zh-cn/dotnet/standard/assembly/versioning (被组件更新的客户端程序,说通俗点就是你公司的产品;组件的操作将按照这个标准执行。) -- 本次版本发布会有很多改变,不是平滑升级(追求稳定或不想改动慎用)。本项目正在逐渐稳定后续将会平滑升级避免开发者再度修改。 -- 如果发生“乌龙事件” 例如:发布更新包内容自身错误或更新过程中发生意外,不可回滚。目前解决方案(1)重新请求更新,(2)通过推送机制发送紧急修复版本更新包;来解决此类问题。 -- 关于“不可回滚”这个问题,如果有更好的办法希望各位可以直接在issues中提出您的看法;目前社区中有两种声音(1)出现意外情况希望组件可以将本地程序回滚至原来的版本,保证哪怕更新失败也要用户可用。(2)更新组件的意义就是将组件推向新的版本让本次的版本发布有效,如果更新失败那么让它更新成功为止;只许前进不许退 - +Instructions +- Online Help Documentation: [http://justerzhu.cn/](http://justerzhu.cn/) (Will be divided into separate documents by component in the future) +- NuGet Versioning Standards Reference: [NuGet Package Versioning](https://docs.microsoft.com/en-us/nuget/concepts/package-versioning) +- Application Assembly Versioning Standards Reference: [Assembly Versioning](https://docs.microsoft.com/en-us/dotnet/standard/assembly/versioning) (The client program updated by the component is essentially your company's product; the component's operations will follow this standard.) +- This release includes many changes and is not a smooth upgrade (use with caution if stability is crucial or if modifications are undesirable). The project is gradually stabilizing, and future updates will aim for smooth upgrades to avoid requiring further developer modifications. +- In case of a "blunder" such as incorrect update package content or unforeseen events during the update, rollback is not currently supported. The current solutions are (1) request the update again, or (2) send an emergency fix update package via the push mechanism. +- Regarding the "non-rollback" issue, if you have better solutions, please share your thoughts in the issues section. Currently, there are two opinions in the community: (1) In case of unexpected events, the component should roll back the local program to the previous version to ensure usability even if the update fails. (2) The purpose of the update component is to push the component to a new version, making the release effective. If the update fails, it should continue until it succeeds; only forward, no retreat. -发布内容 +Release Content -这里先看看发布的版本号以及这次大版本的更新发生了哪些改动(共8个部分)。 +Let's first look at the version numbers and the changes made in this major release (8 sections in total). -| 组件名称 | 版本号(old) | 版本号(new) | 状态 | -| -------------------------- | ------------- | ------------- | ---- | -| GeneralUpdate.AspNetCore | 1.0.0 | 1.1.0 | 正常 | -| GeneralUpdate.ClientCore | 1.1.2 | 2.3.6 | 正常 | -| GeneralUpdate.Core | 3.6.10 | 4.10.12 | 正常 | -| GeneralUpdate.Differential | - | 1.0.0 | 正常 | -| GeneralUpdate.Common | 1.0.0 | - | 移除 | +| Component Name | Version (old) | Version (new) | Status | +| -------------------------- | ------------- | ------------- | ------- | +| GeneralUpdate.AspNetCore | 1.0.0 | 1.1.0 | Normal | +| GeneralUpdate.ClientCore | 1.1.2 | 2.3.6 | Normal | +| GeneralUpdate.Core | 3.6.10 | 4.10.12 | Normal | +| GeneralUpdate.Differential | - | 1.0.0 | Normal | +| GeneralUpdate.Common | 1.0.0 | - | Removed | +**[1] Component GeneralUpdate.AspNetCore** +1. [NEW] Added latest version push functionality with the VersionHub object. This primarily addresses the need to push urgent bug fix versions temporarily. -【1】组件GeneralUpdate.AspNetCore - -(1)[NEW] 添加了最新版本推送功能,VersionHub对象。主要解决临时需要推送紧急修复重大bug的版本。 - -```c# +```csharp var builder = WebApplication.CreateBuilder(args); builder.Services.AddSingleton(); builder.Services.AddSignalR(); @@ -719,59 +570,44 @@ async Task CommonHubContextMethod(IHubContext context) } ``` +**[2] Component GeneralUpdate.ClientCore** +1. [NEW] Overloaded configuration method in GeneralClientBootstrap, simplifying it to require only the remote server address, such as http://127.0.0.1, and the update program name, reducing developer concern over parameters as they are automatically obtained within the component. -【2】组件GeneralUpdate.ClientCore - -(1)[NEW] 在GeneralClientBootstrap中重载了配置方式,该方法简化为只需要传递远程服务器地址例如http://127.0.0.1 和更新程序名称即可,简化了开发者需要关心的参数组件内自动获取。 - -```c# +```csharp public GeneralClientBootstrap Config(string url, string appName = "AutoUpdate.Core"); ``` -(2)[NEW] 添加了最新版本接收推送功能,VersionHub对象。主要解决临时需要接收紧急修复重大bug的版本,可以在GetMessage回调函数中可添加更新操作。 +2. [NEW] Added latest version reception push functionality with the VersionHub object. This primarily addresses the need to receive urgent bug fix versions temporarily, allowing update operations in the GetMessage callback function. -```c# +```csharp VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", new Action(GetMessage)); ``` +**[3] Component GeneralUpdate.Core** +1. [FIX] Fixed issue where a download interruption due to network disconnection did not throw an exception after the timeout period. +2. [REFACTOR] Refactored multi-task download design. +3. [FIX] Fixed issue where FileUtil.Update32Or64Libs would throw exceptions under certain conditions. +4. [REFACTOR] Refactored default update strategy design. +5. [NEW] Added latest version reception push functionality with the VersionHub object. This primarily addresses the need to receive urgent bug fix versions temporarily, allowing update operations in the GetMessage callback function. -【3】组件GeneralUpdate.Core - -(1)[FIX] 修复下载中途断网,到达超时时间没有异常上抛问题。 - -(2)[REFACTOR] 重构多任务下载设计。 - -(3)[FIX] 修复FileUtil.Update32Or64Libs在某些情况下会抛出异常。 - -(4)[REFACTOR] 重构默认更新策略设计。 - -(5)[NEW] 添加了最新版本接收推送功能,VersionHub对象。主要解决临时需要接收紧急修复重大bug的版本。开发者可以在GetMessage回调函数中可添加更新操作。 - -```c# +```csharp VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", new Action(GetMessage)); ``` -(6)[NEW] 支持7z压缩包的解压功能。 - -(7)[REMOVE] 移除了GeneralUpdate.Core与GeneralUpdate.ClientCore 中重复代码,通用代码通过链接文件解决冗余问题。 - -(8)[NEW] 支持增量更新功能,例如:只更新了一个文件,那么就只将该文件打包。 - -(9)[NEW] 支持二进制差分功能,例如:temp.dll 发生了修改产生了新版本的文件,那么将会把temp.dll的新版本文件和老版本文件做一个差分。最后生成一个.patch的补丁文件,按照正常项目迭代那么这个.patch的补丁将会是kb级的。再配合7z的高压缩将更新包的大小做到目前状态下的极致节省流量和带宽占用。特别需要说明的是,如果在新版本中添加了新文件还是会将新增文件原封不动的打包到更新包中。 - - +6. [NEW] Added support for extracting 7z compressed files. +7. [REMOVE] Removed duplicate code between GeneralUpdate.Core and GeneralUpdate.ClientCore, addressing redundancy through linked files. +8. [NEW] Added support for incremental updates. For example, if only one file is updated, only that file will be packaged. +9. [NEW] Added support for binary differential functionality. For example, if a file like temp.dll is modified to create a new version, a .patch file will be created from the differences between the new and old versions. With normal project iteration, this .patch file will typically be only a few kilobytes. Combined with 7z's high compression, the update package size is minimized to save bandwidth and data usage. It should be noted that if new files are added in the new version, they will be included in the update package as they are. -【4】组件[NEW]GeneralUpdate.Differential +**[4] Component [NEW] GeneralUpdate.Differential** -在GeneralUpdate中新增组件Differential,该组件主要提供以下功能: +Added the Differential component in GeneralUpdate, which mainly provides the following functionalities: -(1)[NEW] 新增二进制差分更新,生成.patch补丁文件。 - -(2)[NEW] 新增增量更新,例如:version 1.1.1.1原有10个文件这次版本发布修改了其中3个文件那么只会将修改的文件进行打包。 - -(3)[NEW] 更新配置文件(目前只支持.json配置文件且内容深度为1级),例如:客户端程序使用.json格式文件作为配置文件,那么将会保留客户端原有配置内容的前提下更新配置文件内容。假设客户端原有配置文件(.json)中包含内容: +1. [NEW] Added binary differential updates, generating .patch files. +2. [NEW] Added incremental updates. For example, if version 1.1.1.1 originally had 10 files and this release modified 3 of them, only the modified files will be packaged. +3. [NEW] Updated configuration files (currently only supports .json configuration files with a depth of 1 level). For example, if the client program uses a .json file as a configuration file, the original configuration content will be preserved while updating the configuration file. Assuming the client's original configuration file (.json) contains: ```json { @@ -780,7 +616,7 @@ VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", ne } ``` -服务端新的配置文件结构为: +The server's new configuration file structure is: ```json { @@ -790,7 +626,7 @@ VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", ne } ``` -那么将会把,“path”字段更新到客户端本地配置文件中并保留原有内容为: +The "path" field will be updated into the client's local configuration file, preserving the original content as: ```json { @@ -800,31 +636,22 @@ VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", ne } ``` +**[5] Component GeneralUpdate.Zip** +1. [REFACTOR] Refactored compression component design to support .zip and .7z archive formats. +2. [NEW] Added 7z extraction functionality. -【5】组件GeneralUpdate.Zip - -(1)[REFACTOR] 重构压缩组件设计,将支持.zip和.7z压缩包格式。 - -(2)[NEW] 添加7z解压功能。 - - - -【6】组件[REMOVE]GeneralUpdate.Common - -(1)移除该组件,解除GeneralUpdate.Core与GeneralUpdate.ClientCore 耦合,发现目前版本并不需要。 - +**[6] Component [REMOVE] GeneralUpdate.Common** +1. Removed this component, decoupling GeneralUpdate.Core and GeneralUpdate.ClientCore as it was deemed unnecessary for the current version. -【7】组件GeneralUpdate.Single +**[7] Component GeneralUpdate.Single** -本次未更新实际功能。 +No functional updates in this release. +**[8] Test Cases Example** - -【8】测试用例 Example - -为简化开发者在验证、测试过程中编写用例开发工作。在GeneralUpdate解决方案中添加了以下测试用例: +To simplify developers' work in writing test cases during validation and testing, the following test cases have been added to the GeneralUpdate solution: - AutoUpdate.ClientCore - AutoUpdate.Core @@ -836,44 +663,40 @@ VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", ne - - ## 📍2022-02-16 -目前框架支持 - -理论支撑:https://docs.microsoft.com/zh-cn/dotnet/standard/net-standard - -| 框架名称 | 是否支持 | -| ------------------------------------- | ---------------- | -| .NET Core 2.0 | 支持 | -| .NET 5 6 7 | 支持 | -| .NET Framework 4.6.1 | 支持 | -| Mono 5.4 | 理论支持,未验证 | -| Xamarin.iOS | 理论支持,未验证 | -| Xamarin.Mac | 理论支持,未验证 | -| Xamarin.Android | 理论支持,未验证 | -| Universal Windows Platform 10.0.16299 | 理论支持,未验证 | -| Unity 2018.1 | 理论支持,未验证 | - -| UI框架名称 | 是否支持 | -| ----------------- | ------------------ | -| WPF | 支持 | -| UWP | 未验证,等待反馈 | -| MAUI | 暂不支持,正在兼容 | -| Avalonia | 未验证,等待反馈 | -| WinUI | 未验证,等待反馈 | -| Console(控制台) | 支持 | - -| 操作系统名称 | 是否支持 | -| ------------ | -------- | -| Windows | 支持 | -| Linux | 未验证 | -| Mac | 未验证 | -| iOS | 暂不支持 | -| Android | 暂不支持 | - - +Current Framework Support + +Theoretical Support: [Microsoft .NET Standard Documentation](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) + +| Framework Name | Support Status | +| ------------------------------------- | ----------------------------------- | +| .NET Core 2.0 | Supported | +| .NET 5, 6, 7 | Supported | +| .NET Framework 4.6.1 | Supported | +| Mono 5.4 | Theoretically supported, unverified | +| Xamarin.iOS | Theoretically supported, unverified | +| Xamarin.Mac | Theoretically supported, unverified | +| Xamarin.Android | Theoretically supported, unverified | +| Universal Windows Platform 10.0.16299 | Theoretically supported, unverified | +| Unity 2018.1 | Theoretically supported, unverified | + +| UI Framework Name | Support Status | +| ----------------- | -------------------------------------------- | +| WPF | Supported | +| UWP | Unverified, awaiting feedback | +| MAUI | Not supported, in progress for compatibility | +| Avalonia | Unverified, awaiting feedback | +| WinUI | Unverified, awaiting feedback | +| Console | Supported | + +| Operating System Name | Support Status | +| --------------------- | -------------- | +| Windows | Supported | +| Linux | Unverified | +| Mac | Unverified | +| iOS | Not supported | +| Android | Not supported | @@ -881,201 +704,196 @@ VersionHub.Instance.Subscribe($"{ baseUrl }/{ hubName }", "TESTNAME", ne Notice -- 预计会使用Blazor开发GeneralUpdate官网,介绍组件结构、更新流程、快速启动、参数等内容。 +- The GeneralUpdate website is expected to be developed using Blazor. It will introduce component structure, update processes, quick start guides, parameters, and more. -![图片](imgs/udpate_flow.jpg) +![Image](imgs/udpate_flow.jpg) - 1.主程序启动时检测升级程序是否需要更新 - 2.需要更新则把升级程序版本号上传并逐版本更新 - 3.升级程序更完成后或不需要更新,则进行判断主程序 - 是否需要更新如果需要更新则启动升级程序 - 4.请求主程序更新版本 - 5.请求到主版本多个更新包并逐版本更新 - 6.更新完成后关闭升级程序启动主程序 + 1. When the main program starts, it checks if the updater needs to be updated. + 2. If an update is needed, it uploads the version number of the updater and updates it incrementally. + 3. Once the updater is updated or if no update is needed, it checks if the main program needs an update. If so, the updater is launched. + 4. Requests the main program update version. + 5. Receives multiple update packages for the main version and updates incrementally. + 6. After updating, the updater is closed, and the main program is started. -![图片](imgs/supporting_relationships.jpg) +![Image](imgs/supporting_relationships.jpg) -- 以上更新、下载过程均支持断点续传和逐版本更新。 -- 逐版本下载功能是根据版本发布时间进行排序的发布时间越早的版本越先更新(具体信息见源码中的sql脚本字段内容)。 -- 逐版本下载的更新包最大测试过1G更新内容。 +- The above update and download processes support resuming from breakpoints and incremental updates. +- Incremental download functionality is sorted by the release date of versions, with earlier versions being updated first (see the SQL script field content in the source code for details). +- The maximum tested update content for incremental downloads is 1GB. +2. Nuget - -2.Nuget - -- (New)https://www.nuget.org/packages/GeneralUpdate.Common/ -- (New)https://www.nuget.org/packages/GeneralUpdate.ClientCore/ -- (New)https://www.nuget.org/packages/GeneralUpdate.AspNetCore/ +- (New) https://www.nuget.org/packages/GeneralUpdate.Common/ +- (New) https://www.nuget.org/packages/GeneralUpdate.ClientCore/ +- (New) https://www.nuget.org/packages/GeneralUpdate.AspNetCore/ - https://www.nuget.org/packages/GeneralUpdate.Zip/ - https://www.nuget.org/packages/GeneralUpdate.Single/ -- (Update)https://www.nuget.org/packages/GeneralUpdate.Core/ +- (Update) https://www.nuget.org/packages/GeneralUpdate.Core/ -3.Issues & Git 、Gitee +3. Issues & Git, Gitee -欢迎在以下地址提出issues提出时尽可能的描述清楚异常发生的原因或缺陷详情,check周期为每周的周五。 +Feel free to raise issues at the following addresses. Please describe the cause of the anomaly or defect details as clearly as possible. The checking cycle is every Friday. - https://gitee.com/Juster-zhu/GeneralUpdate - https://github.com/WELL-E/AutoUpdater/tree/autoupdate2 - https://github.com/WELL-E/AutoUpdater/issues - https://gitee.com/Juster-zhu/GeneralUpdate/issues -4.New - -- GeneralUpdate.Core添加逐版本更新功能 -- GeneralUpdate.Core新增事件ExceptionEvent、MutiDownloadStatisticsEvent、MutiDownloadErrorEvent、MutiDownloadCompletedEvent、MutiDownloadProgressEvent、MutiAllDownloadCompletedEvent。 -- GeneralUpdate.Core新增RemoteAddressBase64方法。 -- 新增ClientParameter类,用于组件之间进程通讯传递参数。 -- 新增组件GeneralUpdate.AspNetCore,具有根据升级类型返回更新版本信息的功能并支持管道依赖注入使用,但需要自己编写查库的方法。 -- 新增组件GeneralUpdate.ClientCore, - - (1)具有更新升级组件版本功能(更新程序更新自己) - - (2)支持升级组件的逐版本更新(多更新包同时下载) - - (3)便捷启动升级程序,摆脱之前的繁琐进程启动和传参。 -- 新增组件GeneralUpdate.Common 该库整合了组件内使用的所有公共类和辅助方法(该组件为必须组件,该组件更新频率非常低不推荐打包在更新包中)。 -- 新增mysql脚本,用于创建GeneralUpdate.AspNetCore服务端使用的update_version表。 - -5.Remove - -- 移除GeneralUpdate.Core中所有的通知事件替换为MutixxxxEvent. -- 移除GeneralUpdate.Core中GeneralUpdateBootstrap启动中通过进程传递参数的方法RemoteAddress方法。 -- 移除更新失败版本回滚功能,该功能导致在C盘回滚更新时因权限不够发生致命异常问题,该功能考虑后续开放。 - -6.Fix - -- 修复https ssl访问失败问题。 -- 修复其他.net框架版本注册事件begininvoke通知异常问题。 -- 修改多处类名单词拼写错误问题。 -- 对若干Model类删除了不必要字段。 - -7.Quick Start - -**(1) Example GeneralUpdate.ClientCore** - -``` - //Clinet version. - var mainVersion = "1.1.1"; - var mianType = 1; - - //Updater version - clientParameter = new ClientParameter(); - clientParameter.ClientVersion = "1.1.1"; - clientParameter.ClientType = 2; - clientParameter.AppName = "AutoUpdate.ConsoleApp"; - clientParameter.MainAppName = "AutoUpdate.Test"; - clientParameter.InstallPath = @"D:\update_test"; - clientParameter.UpdateLogUrl = "https://www.baidu.com/"; - clientParameter.ValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }"; - clientParameter.UpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }"; - clientParameter.MainValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ mianType }/{ mainVersion }"; - clientParameter.MainUpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ mianType }/{ mainVersion }"; - - generalClientBootstrap = new GeneralClientBootstrap(); - generalClientBootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged; - generalClientBootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics; - generalClientBootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted; - generalClientBootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted; - generalClientBootstrap.MutiDownloadError += OnMutiDownloadError; - generalClientBootstrap.Exception += OnException; - generalClientBootstrap.Config(clientParameter). - Strategy(); - await generalClientBootstrap.LaunchTaskAsync(); +4. New + +- GeneralUpdate.Core adds incremental update functionality. +- GeneralUpdate.Core introduces new events: ExceptionEvent, MutiDownloadStatisticsEvent, MutiDownloadErrorEvent, MutiDownloadCompletedEvent, MutiDownloadProgressEvent, MutiAllDownloadCompletedEvent. +- GeneralUpdate.Core adds the RemoteAddressBase64 method. +- A new ClientParameter class is added for inter-process communication to pass parameters between components. +- A new component, GeneralUpdate.AspNetCore, is added, which provides update version information based on update type and supports pipeline dependency injection. However, you need to write your own methods for database queries. +- A new component, GeneralUpdate.ClientCore, is added: + - (1) It can update the version of the update component itself. + - (2) It supports incremental updates for update components (multiple update packages can be downloaded simultaneously). + - (3) It simplifies the launch of the updater, eliminating the previous cumbersome process of starting and passing parameters. +- A new component, GeneralUpdate.Common, is added. This library integrates all common classes and helper methods used within the components (this component is mandatory, and its update frequency is very low, so it's not recommended to package it in update packages). +- A new MySQL script is added to create the update_version table for the GeneralUpdate.AspNetCore server. + +5. Remove + +- All notification events in GeneralUpdate.Core are replaced with MutiXXXXEvent. +- The method RemoteAddress in GeneralUpdateBootstrap for passing parameters through processes is removed from GeneralUpdate.Core. +- The feature for rolling back failed updates is removed, as it caused fatal exceptions due to insufficient permissions when rolling back updates on the C drive. This feature may be reopened in the future. + +6. Fix + +- Fixed the issue with HTTPS SSL access failures. +- Fixed notification exceptions related to event registration with begininvoke in other .NET framework versions. +- Corrected multiple class name spelling errors. +- Removed unnecessary fields from several Model classes. + +7. Quick Start + +**(1) Example GeneralUpdate.ClientCore** + +```csharp +// Client version. +var mainVersion = "1.1.1"; +var mianType = 1; + +// Updater version +clientParameter = new ClientParameter(); +clientParameter.ClientVersion = "1.1.1"; +clientParameter.ClientType = 2; +clientParameter.AppName = "AutoUpdate.ConsoleApp"; +clientParameter.MainAppName = "AutoUpdate.Test"; +clientParameter.InstallPath = @"D:\update_test"; +clientParameter.UpdateLogUrl = "https://www.baidu.com/"; +clientParameter.ValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }"; +clientParameter.UpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }"; +clientParameter.MainValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ mianType }/{ mainVersion }"; +clientParameter.MainUpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ mianType }/{ mainVersion }"; + +generalClientBootstrap = new GeneralClientBootstrap(); +generalClientBootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged; +generalClientBootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics; +generalClientBootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted; +generalClientBootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted; +generalClientBootstrap.MutiDownloadError += OnMutiDownloadError; +generalClientBootstrap.Exception += OnException; +generalClientBootstrap.Config(clientParameter). + Strategy(); +await generalClientBootstrap.LaunchTaskAsync(); ``` -**(2) Example GeneralUpdate.Core** +**(2) Example GeneralUpdate.Core** -``` - static void Main(string[] args) - { - var resultBase64 = args[0]; - var bootstrap = new GeneralUpdateBootstrap(); - bootstrap.Exception += OnException; - bootstrap.MutiDownloadError += OnMutiDownloadError; - bootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted; - bootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics; - bootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged; - bootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted; - bootstrap.Strategy(). - Option(UpdateOption.DownloadTimeOut, 60). - RemoteAddressBase64(resultBase64). - LaunchAsync(); - } +```csharp +static void Main(string[] args) +{ + var resultBase64 = args[0]; + var bootstrap = new GeneralUpdateBootstrap(); + bootstrap.Exception += OnException; + bootstrap.MutiDownloadError += OnMutiDownloadError; + bootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted; + bootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics; + bootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged; + bootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted; + bootstrap.Strategy(). + Option(UpdateOption.DownloadTimeOut, 60). + RemoteAddressBase64(resultBase64). + LaunchAsync(); +} ``` -**(3) Example GeneralUpdate.AspNetCore** +**(3) Example GeneralUpdate.AspNetCore** -```c# - Startup.cs - public void ConfigureServices(IServiceCollection services) - { - services.AddControllers(); - services.AddSingleton(); - } +```csharp +Startup.cs +public void ConfigureServices(IServiceCollection services) +{ + services.AddControllers(); + services.AddSingleton(); +} - UpdateController.cs +UpdateController.cs - private readonly ILogger _logger; - private readonly IUpdateService _updateService; +private readonly ILogger _logger; +private readonly IUpdateService _updateService; - public UpdateController(ILogger logger, IUpdateService updateService) - { - _logger = logger; - _updateService = updateService; - } +public UpdateController(ILogger logger, IUpdateService updateService) +{ + _logger = logger; + _updateService = updateService; +} - /// - /// https://localhost:5001/api/update/getUpdateVersions/1/1.1.1 - /// - /// 1:ClientApp 2:UpdateApp - /// - /// - [HttpGet("getUpdateVersions/{clientType}/{clientVersion}")] - public async Task GetUpdateVersions(int clientType, string clientVersion) - { - _logger.LogInformation("Client request 'GetUpdateVersions'."); - var resultJson = await _updateService.UpdateVersionsTaskAsync(clientType, clientVersion, UpdateVersions); - return Ok(resultJson); - } +/// +/// https://localhost:5001/api/update/getUpdateVersions/1/1.1.1 +/// +/// 1:ClientApp 2:UpdateApp +/// +/// +[HttpGet("getUpdateVersions/{clientType}/{clientVersion}")] +public async Task GetUpdateVersions(int clientType, string clientVersion) +{ + _logger.LogInformation("Client request 'GetUpdateVersions'."); + var resultJson = await _updateService.UpdateVersionsTaskAsync(clientType, clientVersion, UpdateVersions); + return Ok(resultJson); +} - /// - /// https://localhost:5001/api/update/getUpdateValidate/1/1.1.1 - /// - /// 1:ClientApp 2:UpdateApp - /// - /// - [HttpGet("getUpdateValidate/{clientType}/{clientVersion}")] - public async Task GetUpdateValidate(int clientType, string clientVersion) - { - _logger.LogInformation("Client request 'GetUpdateValidate'."); - var lastVersion = GetLastVersion(); - var resultJson = await _updateService.UpdateValidateTaskAsync(clientType, clientVersion, lastVersion, true, GetValidateInfos); - return Ok(resultJson); - } +/// +/// https://localhost:5001/api/update/getUpdateValidate/1/1.1.1 +/// +/// 1:ClientApp 2:UpdateApp +/// +/// +[HttpGet("getUpdateValidate/{clientType}/{clientVersion}")] +public async Task GetUpdateValidate(int clientType, string clientVersion) +{ + _logger.LogInformation("Client request 'GetUpdateValidate'."); + var lastVersion = GetLastVersion(); + var resultJson = await _updateService.UpdateValidateTaskAsync(clientType, clientVersion, lastVersion, true, GetValidateInfos); + return Ok(resultJson); +} ``` ## 📍2021-03-18 -声明 - -1. 本组件将支持以下框架开发的应用程序。.NET Framework 4.6.1 | .NET Core 2.0 | .NET 5 -2. GeneralUpdate.Single组件目前仅支持wpf和.NET Framework框架。 +Statement -新增 +1. This component will support applications developed with the following frameworks: .NET Framework 4.6.1, .NET Core 2.0, and .NET 5. +2. The GeneralUpdate.Single component currently only supports WPF and the .NET Framework. -1. GeneralUpdate.Core-3.2.1版本,新增更新失败回滚功能。 -2. 新增了组件 GeneralUpdate.Zip-1.0.0,它将为程序带来压缩文件和解压压缩包的功能且能独立使用。 +Additions -修复、修改 +1. GeneralUpdate.Core version 3.2.1 introduces a new feature for rollback on update failure. +2. A new component, GeneralUpdate.Zip version 1.0.0, has been added, providing functionality for compressing and decompressing files, and it can be used independently. -1. 修复事件多线程操作时,不通知问题。 -2. 组件的框架版本从.NET Framework4.5.2修改为.net standard 2.0。(支持框架参考:https://docs.microsoft.com/zh-cn/dotnet/standard/net-standard) +Fixes and Modifications -移除 - -1. 移除7zip第三方组件的依赖 -2. 移除RegistryUtil工具类 +1. Fixed the issue where events were not being notified during multithreaded operations. +2. The component framework version has been changed from .NET Framework 4.5.2 to .NET Standard 2.0. (Supported frameworks reference: https://docs.microsoft.com/en-us/dotnet/standard/net-standard) +Removals +1. Removed the dependency on the third-party component 7zip. +2. Removed the RegistryUtil utility class. GeneralUpdate Quick start @@ -1104,26 +922,24 @@ GeneralUpdate Quick start ## 📍2020-08-30 -新增内容 - -1. 在新的发布中,GeneralUpdate.Core-2.1.0版本新增断点续传功能。 -2. 在新的发布中,新增了组件 GeneralUpdate.Single-1.0.0,它将为程序带来单例运行功能,防止自动更新程序开启多个。 - -更新流程 +New Additions -1.客户端程序启动,向服务器获取更新信息解析并比对是否需要更新。 +1. In the new release, GeneralUpdate.Core version 2.1.0 adds support for resuming downloads. +2. In the new release, a new component, GeneralUpdate.Single version 1.0.0, has been added. It provides singleton functionality to prevent multiple instances of the auto-update program from starting. -2.解析进程传参。例如:本机版本号、最新版本号、下载地址、解压路径、安装路径等。 +Update Process -3.客户端程序启动更新程序(GeneralUpdate),关闭自身(客户端把自己关掉)。 +1. The client program starts and retrieves update information from the server, then parses and compares it to determine if an update is needed. -4.自动更新程序(GeneralUpdate)根据传递的更新信息进行, (1)下载、(2)MD5校验、(3)解压、(4)删除更新文件、(5)替换更新文件、(6)关闭更新程序自身、(7)启动客户端。 +2. Parses process parameters, such as local version number, latest version number, download URL, extraction path, installation path, etc. -5.完成更新 +3. The client program launches the updater (GeneralUpdate) and closes itself. +4. The auto-update program (GeneralUpdate) performs the following based on the passed update information: (1) download, (2) MD5 checksum, (3) extraction, (4) delete update files, (5) replace update files, (6) close the update program itself, (7) start the client program. +5. Update is completed. -进程之间相互调用 +Inter-process Communication ``` using System; @@ -1187,89 +1003,84 @@ namespace MyProcessSample } ``` - - -GeneralUpdate.Core-2.1.0使用方式 - -```c# - #region Launch1 - args = new string[6] { - "0.0.0.0", - "1.1.1.1", - "https://github.com/WELL-E", - "http://192.168.50.225:7000/update.zip", - @"E:\PlatformPath", - "509f0ede227de4a662763a4abe3d8470", - }; - - GeneralUpdateBootstrap bootstrap = new GeneralUpdateBootstrap();//自动更新引导类 - bootstrap.DownloadStatistics += OnDownloadStatistics;//下载进度通知事件 - bootstrap.ProgressChanged += OnProgressChanged;//更新进度通知事件 - bootstrap.Strategy().//注册策略,可自定义更新流程 - Option(UpdateOption.Format, "zip").//指定更新包的格式,目前只支持zip - Option(UpdateOption.MainApp, "your application name").//指定更新完成后需要启动的主程序名称不需要加.exe直接写名称即可 - Option(UpdateOption.DownloadTimeOut,60).//下载超时时间(单位:秒),如果不指定则默认超时时间为30秒。 - RemoteAddress(args).//这里的参数保留了之前的参数数组集合 - Launch();//启动更新 - - #endregion - - #region Launch2 - - /* - * Launch2 - * 新增了第二种启动方式 - * 流程: - * 1.指定更新地址,https://api.com/GeneralUpdate?version=1.0.0.1 在webapi中传入客户端当前版本号 - * 2.如果需要更新api返回给你所有的更新信息(详情内容参考 /Models/UpdateInfo.cs) - * 3.拿到更新信息之后则开始http请求更新包 - * 4.下载 - * 5.解压 - * 6.更新本地文件 - * 7.关闭更新程序 - * 8.启动配置好主程序 - * 更新程序必须跟主程序放在同级目录下 - */ - - //GeneralUpdateBootstrap bootstrap2 = new GeneralUpdateBootstrap(); - //bootstrap2.DownloadStatistics += OnDownloadStatistics; - //bootstrap2.ProgressChanged += OnProgressChanged; - //bootstrap2.Strategy(). - // Option(UpdateOption.Format, "zip"). - // Option(UpdateOption.MainApp, ""). - // Option(UpdateOption.DownloadTimeOut,60).//下载超时时间(单位:秒),如果不指定则默认超时时间为30秒。 - // RemoteAddress(@"https://api.com/GeneralUpdate?version=1.0.0.1").//指定更新地址 - // Launch(); - - #endregion - - private static void OnProgressChanged(object sender, ProgressChangedEventArgs e) +Using GeneralUpdate.Core-2.1.0 + +```csharp +#region Launch1 +args = new string[6] { + "0.0.0.0", + "1.1.1.1", + "https://github.com/WELL-E", + "http://192.168.50.225:7000/update.zip", + @"E:\PlatformPath", + "509f0ede227de4a662763a4abe3d8470", +}; + +GeneralUpdateBootstrap bootstrap = new GeneralUpdateBootstrap(); // Auto-update bootstrap class +bootstrap.DownloadStatistics += OnDownloadStatistics; // Download progress notification event +bootstrap.ProgressChanged += OnProgressChanged; // Update progress notification event +bootstrap.Strategy() // Register strategy, can customize update process + .Option(UpdateOption.Format, "zip") // Specify the format of the update package, currently only zip is supported + .Option(UpdateOption.MainApp, "your application name") // Specify the main program name to start after the update, no need to add .exe, just the name + .Option(UpdateOption.DownloadTimeOut, 60) // Download timeout (seconds), default is 30 seconds if not specified + .RemoteAddress(args) // Use the previous parameter array + .Launch(); // Start the update +#endregion + +#region Launch2 + +/* + * Launch2 + * Added a second launch method + * Process: + * 1. Specify the update address, e.g., https://api.com/GeneralUpdate?version=1.0.0.1, passing the current client version in the web API + * 2. If an update is needed, the API returns all update information (details in /Models/UpdateInfo.cs) + * 3. After obtaining the update information, start the HTTP request for the update package + * 4. Download + * 5. Extract + * 6. Update local files + * 7. Close the update program + * 8. Start the configured main program + * The update program must be placed in the same directory as the main program + */ + +//GeneralUpdateBootstrap bootstrap2 = new GeneralUpdateBootstrap(); +//bootstrap2.DownloadStatistics += OnDownloadStatistics; +//bootstrap2.ProgressChanged += OnProgressChanged; +//bootstrap2.Strategy() +// .Option(UpdateOption.Format, "zip") +// .Option(UpdateOption.MainApp, "") +// .Option(UpdateOption.DownloadTimeOut, 60) // Download timeout (seconds), default is 30 seconds if not specified +// .RemoteAddress(@"https://api.com/GeneralUpdate?version=1.0.0.1") // Specify update address +// .Launch(); + +#endregion + +private static void OnProgressChanged(object sender, ProgressChangedEventArgs e) +{ + if (e.Type == ProgressType.Updatefile) { - if (e.Type == ProgressType.Updatefile) - { - var str = $"当前更新第:{e.ProgressValue}个,更新文件总数:{e.TotalSize}"; - Console.WriteLine(str); - } - - if (e.Type == ProgressType.Done) - { - Console.WriteLine("更新完成"); - } + var str = $"Currently updating file: {e.ProgressValue}, total files to update: {e.TotalSize}"; + Console.WriteLine(str); } - private static void OnDownloadStatistics(object sender, DownloadStatisticsEventArgs e) + if (e.Type == ProgressType.Done) { - Console.WriteLine($"下载速度:{e.Speed},剩余时间:{e.Remaining.Minute}:{e.Remaining.Second}"); + Console.WriteLine("Update completed"); } -``` - +} +private static void OnDownloadStatistics(object sender, DownloadStatisticsEventArgs e) +{ + Console.WriteLine($"Download speed: {e.Speed}, remaining time: {e.Remaining.Minute}:{e.Remaining.Second}"); +} +``` -GeneralUpdate.Single-1.0.0使用方式 +Using GeneralUpdate.Single-1.0.0 -``` +```csharp /// -/// App.xaml 的交互逻辑 +/// Interaction logic for App.xaml /// public partial class App : Application, ISingleInstanceApp { @@ -1283,13 +1094,13 @@ public partial class App : Application, ISingleInstanceApp if (e.Args == null || e.Args.Length == 0) { resultArgs = new string[6] { - "0.0.0.0", - "1.1.1.1", - "https://github.com/WELL-E", - "http://192.168.50.225:7000/update.zip", - @"E:\PlatformPath", - "509f0ede227de4a662763a4abe3d8470", - }; + "0.0.0.0", + "1.1.1.1", + "https://github.com/WELL-E", + "http://192.168.50.225:7000/update.zip", + @"E:\PlatformPath", + "509f0ede227de4a662763a4abe3d8470", + }; } else { @@ -1323,54 +1134,52 @@ public partial class App : Application, ISingleInstanceApp } ``` +Q&A +1. What should be done if there are multiple version iterations and cross-version updates? -问答Q&A - -1.如果版本迭代多次,跨版本更新,该怎么办呢? - -​ 只要不是框架级别的更新都是可以更新的。不管你迭代多少次跨了多少个版本,你把最终的包放到服务器上就行了。这个里面没有涉及到增量更新,所以你更新多了直接把所有的新文件覆盖上去就行了。 - -2.GeneralUpdate是跟客户端是一个整体吗? - -​ 不是,GeneralUpdate是一个独立于客户端的程序。 + As long as it's not a framework-level update, updates can be applied. Regardless of how many iterations or versions you cross, you just need to place the final package on the server. There is no incremental update involved here, so if there are many updates, you can simply overwrite all the new files. -3.能不能增量更新、失败自动回滚、更新本地数据或配置文件? +2. Is GeneralUpdate integrated with the client as a whole? -​ 目前不能。(该功能已在开发计划当中)。 + No, GeneralUpdate is a program independent of the client. -4.GeneralUpdate是如何更新的? +3. Can it perform incremental updates, automatic rollback on failure, or update local data or configuration files? -​ 更新的方式为把本地原有的客户端文件进行覆盖。 + Currently, it cannot. (This feature is in the development plan.) +4. How does GeneralUpdate perform updates? + The update method involves overwriting the existing client files locally. ## 📍2020-05-03 -1.简洁启动代码 如下:Launch1 Launch2 +Here is the translation of your content into English: -| 名称 | 类型 | 备注 | -| ---------------------- | -------- | ---------------------------------- | -| UpdateOption.Format | 配置参数 | 更新包的压缩格式(目前只支持zip) | -| UpdateOption.MainApp | 配置参数 | 更新完成后需要启动的主程序名称 | -| DownloadStatistics | 事件 | 更新包下载通知事件 | -| ProgressChanged | 事件 | 更新进度通知事件 | -| Strategy() | 方法 | 策略注入 | -| RemoteAddress() | 方法 | 远程地址配置,如果没有则传入args[] | -| Launch | 方法 | 启动更新 | -| GeneralUpdateBootstrap | 类 | 更新引导类 | +1. Concise launch code as follows: Launch1 Launch2 -2.新增Strategy(更新策略),更新策略是开放出来让大家可以在不改动源码的情况下自由扩展更新方式将不会仅限于默认的更新策略。 +| Name | Type | Remarks | +| ---------------------- | ---------------- | ------------------------------------------------------------ | +| UpdateOption.Format | Config Parameter | Compression format of the update package (currently only supports zip) | +| UpdateOption.MainApp | Config Parameter | Name of the main application to launch after the update | +| DownloadStatistics | Event | Event notification for update package download | +| ProgressChanged | Event | Event notification for update progress | +| Strategy() | Method | Strategy injection | +| RemoteAddress() | Method | Remote address configuration, pass in args[] if not available | +| Launch | Method | Start update | +| GeneralUpdateBootstrap | Class | Update bootstrap class | -3.更新本地文件时,会有更新通知事件。明确的告知更新文件总数和当前更新到第几个文件 +2. Added Strategy (update strategy), which is open for everyone to freely extend the update method without modifying the source code, not limited to the default update strategy. -4.新增更新状态 Check(检查更新),Donwload(下载更新包),Updatefile(更新文件),Done(更新完成),Fail(更新失败)。开发者可以直接通过一系列枚举值直接判断当前运行状态做出相应的处理 +3. When updating local files, there will be an update notification event, clearly indicating the total number of files to update and the current file being updated. -5.新增若干启动配置参数的验证 +4. Added new update statuses: Check (check for updates), Download (download update package), UpdateFile (update files), Done (update completed), Fail (update failed). Developers can directly use a series of enumeration values to determine the current running status and make corresponding handling. -```c# +5. Added validation for several startup configuration parameters. + +```csharp if (args != null) { if (args.Length == 0) @@ -1401,80 +1210,81 @@ if (string.IsNullOrWhiteSpace(InstallPath)) if (string.IsNullOrWhiteSpace(MD5)) { - throw new NullReferenceException("install path not set"); + throw new NullReferenceException("MD5 not set"); } ``` -6.下载更新进度通知事件,将会提供剩余下载时间(Remaining)和下载速度(Speed) - -```c# - #region Launch1 +6. Download update progress notification event will provide remaining download time (Remaining) and download speed (Speed). + +```csharp +#region Launch1 + +args = new string[6] { + "0.0.0.0", + "1.1.1.1", + "https://github.com/WELL-E", + "http://192.168.50.225:7000/update.zip", + @"E:\PlatformPath", + "509f0ede227de4a662763a4abe3d8470", +}; + +GeneralUpdateBootstrap bootstrap = new GeneralUpdateBootstrap(); +bootstrap.DownloadStatistics += OnDownloadStatistics; +bootstrap.ProgressChanged += OnProgressChanged; +bootstrap.Strategy(). + Option(UpdateOption.Format, "zip"). // Specify the format of the update package, currently only supports zip + Option(UpdateOption.MainApp, "your application name"). // Specify the name of the main application to launch after the update, no need to add .exe, just the name + RemoteAddress(args). // Retains the previous parameter array collection + Launch(); + +#endregion + +#region Launch2 + +/* + * Launch2 + * Added a second launch method + * Process: + * 1. Specify the update address, e.g., https://api.com/GeneralUpdate?version=1.0.0.1, passing the current client version to the web API + * 2. If an update is needed, the API returns all update information (refer to /Models/UpdateInfo.cs for details) + * 3. After obtaining the update information, start an HTTP request for the update package + * 4. Download + * 5. Unzip + * 6. Update local files + * 7. Close the update program + * 8. Start the configured main program + * The update program must be in the same directory as the main program + */ + +// GeneralUpdateBootstrap bootstrap2 = new GeneralUpdateBootstrap(); +// bootstrap2.DownloadStatistics += OnDownloadStatistics; +// bootstrap2.ProgressChanged += OnProgressChanged; +// bootstrap2.Strategy(). +// Option(UpdateOption.Format, "zip"). +// Option(UpdateOption.MainApp, "KGS.CPP"). +// RemoteAddress(@"https://api.com/GeneralUpdate?version=1.0.0.1"). // Specify the update address +// Launch(); + +#endregion + +private static void OnProgressChanged(object sender, ProgressChangedEventArgs e) +{ + if (e.Type == ProgressType.Updatefile) + { + var str = $"Currently updating file: {e.ProgressValue}, Total number of files to update: {e.TotalSize}"; + Console.WriteLine(str); + } - args = new string[6] { - "0.0.0.0", - "1.1.1.1", - "https://github.com/WELL-E", - "http://192.168.50.225:7000/update.zip", - @"E:\PlatformPath", - "509f0ede227de4a662763a4abe3d8470", - }; - - GeneralUpdateBootstrap bootstrap = new GeneralUpdateBootstrap(); - bootstrap.DownloadStatistics += OnDownloadStatistics; - bootstrap.ProgressChanged += OnProgressChanged; - bootstrap.Strategy(). - Option(UpdateOption.Format, "zip").//指定更新包的格式,目前只支持zip - Option(UpdateOption.MainApp, "your application name").//指定更新完成后需要启动的主程序名称不需要加.exe直接写名称即可 - RemoteAddress(args).//这里的参数保留了之前的参数数组集合 - Launch(); - - #endregion - - #region Launch2 - - /* - * Launch2 - * 新增了第二种启动方式 - * 流程: - * 1.指定更新地址,https://api.com/GeneralUpdate?version=1.0.0.1 在webapi中传入客户端当前版本号 - * 2.如果需要更新api返回给你所有的更新信息(详情内容参考 /Models/UpdateInfo.cs) - * 3.拿到更新信息之后则开始http请求更新包 - * 4.下载 - * 5.解压 - * 6.更新本地文件 - * 7.关闭更新程序 - * 8.启动配置好主程序 - * 更新程序必须跟主程序放在同级目录下 - */ - - //GeneralUpdateBootstrap bootstrap2 = new GeneralUpdateBootstrap(); - //bootstrap2.DownloadStatistics += OnDownloadStatistics; - //bootstrap2.ProgressChanged += OnProgressChanged; - //bootstrap2.Strategy(). - // Option(UpdateOption.Format, "zip"). - // Option(UpdateOption.MainApp, "KGS.CPP"). - // RemoteAddress(@"https://api.com/GeneralUpdate?version=1.0.0.1").//指定更新地址 - // Launch(); - - #endregion - - - private static void OnProgressChanged(object sender, ProgressChangedEventArgs e) - { - if (e.Type == ProgressType.Updatefile) - { - var str = $"当前更新第:{e.ProgressValue}个,更新文件总数:{e.TotalSize}"; - Console.WriteLine(str); - } - - if (e.Type == ProgressType.Done) - { - Console.WriteLine("更新完成"); - } - } + if (e.Type == ProgressType.Done) + { + Console.WriteLine("Update completed"); + } +} - private static void OnDownloadStatistics(object sender, DownloadStatisticsEventArgs e) - { - Console.WriteLine($"下载速度:{e.Speed},剩余时间:{e.Remaining.Minute}:{e.Remaining.Second}"); - } +private static void OnDownloadStatistics(object sender, DownloadStatisticsEventArgs e) +{ + Console.WriteLine($"Download speed: {e.Speed}, Remaining time: {e.Remaining.Minutes}:{e.Remaining.Seconds}"); +} ``` + +Let me know if you need further assistance!