From 168f15da75601737f0c83eece493e6ef672b0b14 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 10:58:31 +0000 Subject: [PATCH 1/3] Initial plan From 287137780328db4c65062fa4c95e0f51aa3226f4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 11:08:56 +0000 Subject: [PATCH 2/3] Add bilingual documentation for GeneralUpdate.Drivelution Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com> --- website/docs/doc/GeneralUpdate.Drivelution.md | 748 ++++++++++++++++++ .../current/doc/GeneralUpdate.Drivelution.md | 748 ++++++++++++++++++ 2 files changed, 1496 insertions(+) create mode 100644 website/docs/doc/GeneralUpdate.Drivelution.md create mode 100644 website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/doc/GeneralUpdate.Drivelution.md diff --git a/website/docs/doc/GeneralUpdate.Drivelution.md b/website/docs/doc/GeneralUpdate.Drivelution.md new file mode 100644 index 0000000..b6d5f18 --- /dev/null +++ b/website/docs/doc/GeneralUpdate.Drivelution.md @@ -0,0 +1,748 @@ +--- +sidebar_position: 12 +--- + +### Definition + +Namespace: GeneralUpdate.Drivelution + +Assembly: GeneralUpdate.Drivelution.dll + + + +GeneralUpdate.Drivelution is a cross-platform driver update component that provides automatic detection, validation, backup, installation, and rollback capabilities for device drivers. It supports Windows, Linux, and MacOS platforms and offers a unified API interface to simplify the driver update process while ensuring security and reliability. + +```c# +public static class GeneralDrivelution +``` + + + +### Applicable Scenarios + +GeneralUpdate.Drivelution is suitable for the following scenarios: + +- **Enterprise device management**: Batch update drivers for multiple devices in corporate environments +- **IoT device updates**: Remote driver updates for embedded systems and IoT devices +- **Hardware vendor software**: Integrate driver update functionality into hardware vendor applications +- **System maintenance tools**: Build automated driver update and maintenance tools +- **Cross-platform applications**: Applications that need to manage drivers on multiple operating systems + + + +### Installation & Configuration + +#### Installation + +Install via NuGet package manager: + +```bash +dotnet add package GeneralUpdate.Drivelution +``` + +Or add the following to your project file: + +```xml + +``` + +#### Configuration + +Create a configuration options object (optional, defaults are used if not specified): + +```c# +var options = new DrivelutionOptions +{ + LogLevel = "Info", // Log level (Debug/Info/Warn/Error/Fatal) + LogFilePath = "./Logs/drivelution-.log", // Log file path + EnableConsoleLogging = true, // Enable console logging + EnableFileLogging = true, // Enable file logging + DefaultBackupPath = "./DriverBackups", // Default backup path + DefaultRetryCount = 3, // Default retry count + DefaultRetryIntervalSeconds = 5, // Default retry interval (seconds) + DefaultTimeoutSeconds = 300, // Default timeout (seconds) + AutoCleanupBackups = true, // Auto cleanup old backups + BackupsToKeep = 5 // Number of backups to keep +}; +``` + + + +### Quick Start + +#### Basic Usage (Hello World) + +The simplest driver update example: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; + +// 1. Create driver information +var driverInfo = new DriverInfo +{ + Name = "MyDevice Driver", + Version = "1.2.0", + FilePath = "C:\\Drivers\\mydevice.inf", // Windows: .inf, Linux: .ko, MacOS: .kext + TargetOS = "Windows", + Architecture = "x64", + Hash = "abc123...", // SHA256 hash of the driver file + HashAlgorithm = "SHA256" +}; + +// 2. Quick update with default settings +var result = await GeneralDrivelution.QuickUpdateAsync(driverInfo); + +// 3. Check result +if (result.Success) +{ + Console.WriteLine("Driver updated successfully!"); + Console.WriteLine($"Duration: {result.DurationMs}ms"); +} +else +{ + Console.WriteLine($"Update failed: {result.Error?.Message}"); +} +``` + +#### Advanced Usage with Custom Strategy + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; + +// 1. Create configuration options +var options = new DrivelutionOptions +{ + LogLevel = "Debug", + DefaultBackupPath = "C:\\DriverBackups" +}; + +// 2. Create updater instance +var updater = GeneralDrivelution.Create(options); + +// 3. Define driver information +var driverInfo = new DriverInfo +{ + Name = "Graphics Driver", + Version = "2.1.0", + FilePath = "C:\\Drivers\\graphics.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "def456...", + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_10DE&DEV_1234", + Description = "NVIDIA Graphics Driver" +}; + +// 4. Define update strategy +var strategy = new UpdateStrategy +{ + RequireBackup = true, // Enable backup + BackupPath = "C:\\DriverBackups\\graphics", + RetryCount = 3, // Retry 3 times on failure + RetryIntervalSeconds = 5, // Wait 5 seconds between retries + RestartMode = RestartMode.Prompt, // Prompt user to restart + SkipSignatureValidation = false, // Enable signature validation + TimeoutSeconds = 600 // 10-minute timeout +}; + +// 5. Execute update +var result = await updater.UpdateAsync(driverInfo, strategy); + +// 6. Handle result +if (result.Success) +{ + Console.WriteLine($"✓ Update succeeded in {result.DurationMs}ms"); + if (!string.IsNullOrEmpty(result.BackupPath)) + { + Console.WriteLine($"✓ Backup saved to: {result.BackupPath}"); + } +} +else +{ + Console.WriteLine($"✗ Update failed: {result.Error?.Code}"); + Console.WriteLine($" Message: {result.Error?.Message}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ System rolled back to previous state"); + } +} +``` + + + +### Core Modules & API Description + +#### Main Entry Class: GeneralDrivelution + +The static entry class provides the following methods: + +| Method | Description | +| ------ | ----------- | +| `Create(options?)` | Creates a driver updater instance with automatic platform detection | +| `Create(logger, options?)` | Creates a driver updater instance with custom logger | +| `QuickUpdateAsync(driverInfo)` | Quick driver update with default settings | +| `QuickUpdateAsync(driverInfo, strategy)` | Quick driver update with custom strategy | +| `ValidateAsync(driverInfo)` | Validates driver file | +| `GetPlatformInfo()` | Gets current platform information | +| `GetDriversFromDirectoryAsync(path)` | Reads driver information from local directory | + +#### Core Interface: IGeneralDrivelution + +The updater interface provides the following capabilities: + +| Method | Description | +| ------ | ----------- | +| `UpdateAsync(driverInfo, strategy, token?)` | Updates driver asynchronously | +| `ValidateAsync(driverInfo, token?)` | Validates driver asynchronously | +| `BackupAsync(driverInfo, backupPath, token?)` | Backs up driver asynchronously | +| `RollbackAsync(backupPath, token?)` | Rolls back driver asynchronously | +| `GetDriversFromDirectoryAsync(path, pattern?, token?)` | Reads driver information from directory | + +#### Data Models + +##### DriverInfo + +Driver information model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Name` | string | Driver name | +| `Version` | string | Driver version (follows SemVer 2.0) | +| `FilePath` | string | Driver file path | +| `TargetOS` | string | Target operating system | +| `Architecture` | string | System architecture (x86, x64, ARM, ARM64) | +| `HardwareId` | string | Hardware ID (Windows hardware ID or Linux PCI/USB device ID) | +| `Hash` | string | File hash for integrity validation | +| `HashAlgorithm` | string | Hash algorithm (SHA256, MD5) | +| `TrustedPublishers` | List\ | Trusted publishers list | +| `Description` | string | Driver description | +| `ReleaseDate` | DateTime | Driver release date | +| `Metadata` | Dictionary | Additional metadata | + +##### UpdateStrategy + +Update strategy model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Mode` | UpdateMode | Update mode (Full/Incremental) | +| `ForceUpdate` | bool | Whether to force update | +| `RequireBackup` | bool | Whether backup is required | +| `BackupPath` | string | Backup path | +| `RetryCount` | int | Retry count on failure | +| `RetryIntervalSeconds` | int | Retry interval (seconds) | +| `Priority` | int | Update priority (for batch updates) | +| `RestartMode` | RestartMode | Restart mode after update | +| `SkipSignatureValidation` | bool | Skip signature validation (debug mode only) | +| `SkipHashValidation` | bool | Skip hash validation (debug mode only) | +| `TimeoutSeconds` | int | Timeout (seconds) | + +##### UpdateResult + +Update result model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Success` | bool | Whether update succeeded | +| `Status` | UpdateStatus | Update status | +| `Error` | ErrorInfo? | Error information | +| `StartTime` | DateTime | Update start time | +| `EndTime` | DateTime | Update end time | +| `DurationMs` | long | Update duration (milliseconds) | +| `BackupPath` | string? | Backup path (if backed up) | +| `RolledBack` | bool | Whether rolled back | +| `Message` | string | Additional message | +| `StepLogs` | List\ | Update step logs | + +##### DrivelutionOptions + +Configuration options: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `DefaultBackupPath` | string | Default backup path | +| `LogLevel` | string | Log level (Debug/Info/Warn/Error/Fatal) | +| `LogFilePath` | string | Log file path | +| `EnableConsoleLogging` | bool | Enable console logging | +| `EnableFileLogging` | bool | Enable file logging | +| `DefaultRetryCount` | int | Default retry count | +| `DefaultRetryIntervalSeconds` | int | Default retry interval (seconds) | +| `DefaultTimeoutSeconds` | int | Default timeout (seconds) | +| `DebugModeSkipSignature` | bool | Skip signature validation in debug mode | +| `DebugModeSkipHash` | bool | Skip hash validation in debug mode | +| `ForceTerminateOnPermissionFailure` | bool | Force terminate on permission check failure | +| `AutoCleanupBackups` | bool | Auto cleanup old backups | +| `BackupsToKeep` | int | Number of backups to keep | +| `TrustedCertificateThumbprints` | List\ | Trusted certificate thumbprints (for signature validation) | +| `TrustedGpgKeys` | List\ | Trusted GPG public keys (for Linux) | + + + +### Cross-Platform Usage + +GeneralUpdate.Drivelution supports Windows, Linux, and MacOS platforms with automatic platform detection and adaptation. + +#### Windows Platform + +**Supported Driver Types:** +- INF-based drivers (*.inf) +- PnP drivers +- Kernel-mode drivers +- User-mode drivers + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "USB Device Driver", + Version = "3.0.1", + FilePath = "C:\\Drivers\\usbdevice.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "sha256_hash_here", + HardwareId = "USB\\VID_1234&PID_5678" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Windows-Specific Features:** +- Automatic signature validation using Windows Authenticode +- Hardware ID matching for device drivers +- Integration with Windows Driver Store +- Support for driver installation via PnPUtil + +#### Linux Platform + +**Supported Driver Types:** +- Kernel modules (*.ko) +- Device Tree overlays +- Firmware files + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "Network Adapter Driver", + Version = "1.5.0", + FilePath = "/lib/modules/drivers/netadapter.ko", + TargetOS = "Linux", + Architecture = "x64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Delayed // Delay restart for Linux systems +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Linux-Specific Features:** +- GPG signature validation +- Kernel module dependency checking +- Integration with modprobe and insmod +- Support for DKMS (Dynamic Kernel Module Support) + +**Required Permissions:** +```bash +# Run with sudo or root privileges +sudo dotnet run MyApp.dll +``` + +#### MacOS Platform + +**Supported Driver Types:** +- Kernel extensions (*.kext) +- DriverKit extensions + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "Audio Device Driver", + Version = "2.3.0", + FilePath = "/Library/Extensions/AudioDevice.kext", + TargetOS = "MacOS", + Architecture = "ARM64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**MacOS-Specific Features:** +- Code signature validation using codesign +- System Integrity Protection (SIP) awareness +- Support for notarized drivers +- Integration with kextutil + +**Required Permissions:** +```bash +# Run with administrator privileges +sudo dotnet run MyApp.dll +``` + +#### Platform Detection + +Automatically detect current platform: + +```c# +var platformInfo = GeneralDrivelution.GetPlatformInfo(); + +Console.WriteLine($"Platform: {platformInfo.Platform}"); +Console.WriteLine($"OS: {platformInfo.OperatingSystem}"); +Console.WriteLine($"Architecture: {platformInfo.Architecture}"); +Console.WriteLine($"Supported: {platformInfo.IsSupported}"); +``` + +#### Cross-Platform Code Example + +Write once, run everywhere: + +```c# +// This code works on Windows, Linux, and MacOS +var updater = GeneralDrivelution.Create(); + +// Platform-specific driver paths can be determined at runtime +var driverPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? "C:\\Drivers\\device.inf" + : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) + ? "/lib/modules/device.ko" + : "/Library/Extensions/device.kext"; + +var driverInfo = new DriverInfo +{ + Name = "Device Driver", + Version = "1.0.0", + FilePath = driverPath, + Hash = "calculated_hash" +}; + +var result = await updater.UpdateAsync(driverInfo, new UpdateStrategy()); +``` + + + +### Frequently Asked Questions (FAQ) + +#### Q1: What platforms are supported? + +**A:** GeneralUpdate.Drivelution supports Windows (7/8/10/11/Server), Linux (various distributions), and MacOS (10.13+). The component automatically detects the platform and uses the appropriate driver update strategy. + +#### Q2: Do I need administrator/root privileges? + +**A:** Yes, driver updates require elevated privileges on all platforms: +- **Windows**: Run as Administrator +- **Linux**: Run with sudo or as root +- **MacOS**: Run with sudo or as root + +#### Q3: How do I calculate the driver file hash? + +**A:** You can use built-in utilities or the following code: + +```c# +using System.Security.Cryptography; + +string CalculateFileHash(string filePath) +{ + using var sha256 = SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); +} +``` + +#### Q4: What happens if the update fails? + +**A:** If `RequireBackup` is enabled in the update strategy, the system will automatically roll back to the previous driver version. The `UpdateResult` object will contain detailed error information. + +#### Q5: Can I update multiple drivers at once? + +**A:** Yes, you can update multiple drivers sequentially or in parallel: + +```c# +var drivers = new List { driver1, driver2, driver3 }; +var tasks = drivers.Select(d => updater.UpdateAsync(d, strategy)); +var results = await Task.WhenAll(tasks); +``` + +#### Q6: How do I handle driver signature validation? + +**A:** By default, signature validation is enabled. To skip validation (not recommended in production): + +```c# +var strategy = new UpdateStrategy +{ + SkipSignatureValidation = true // Only for testing! +}; +``` + +For production, ensure drivers are properly signed: +- **Windows**: Use Microsoft Authenticode +- **Linux**: Use GPG signing +- **MacOS**: Use Apple code signing + +#### Q7: Does the system need to restart after updating drivers? + +**A:** It depends on the driver type and platform. You can control restart behavior via `RestartMode`: +- `RestartMode.None`: No restart required +- `RestartMode.Prompt`: Prompt user to restart +- `RestartMode.Delayed`: Schedule restart for later +- `RestartMode.Immediate`: Restart immediately + +#### Q8: How do I validate a driver before updating? + +**A:** Use the `ValidateAsync` method: + +```c# +var isValid = await updater.ValidateAsync(driverInfo); +if (isValid) +{ + // Proceed with update + var result = await updater.UpdateAsync(driverInfo, strategy); +} +``` + +#### Q9: Can I customize logging? + +**A:** Yes, you can provide a custom Serilog logger: + +```c# +var logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log") + .CreateLogger(); + +var updater = GeneralDrivelution.Create(logger, options); +``` + +#### Q10: Where are driver backups stored? + +**A:** Backups are stored in the path specified by: +1. `UpdateStrategy.BackupPath` (if specified) +2. `DrivelutionOptions.DefaultBackupPath` (if configured) +3. Default: `./DriverBackups` directory + +Old backups are automatically cleaned up if `AutoCleanupBackups` is enabled. + +#### Q11: How do I get driver information from a directory? + +**A:** Use the `GetDriversFromDirectoryAsync` method: + +```c# +// Get all drivers from directory +var drivers = await updater.GetDriversFromDirectoryAsync("C:\\Drivers"); + +// Get drivers with specific pattern +var infDrivers = await updater.GetDriversFromDirectoryAsync( + "C:\\Drivers", + "*.inf" +); +``` + +#### Q12: Is the component thread-safe? + +**A:** Yes, you can safely use the updater instance across multiple threads. Each update operation is independent and can run concurrently. + +#### Q13: What .NET versions are supported? + +**A:** GeneralUpdate.Drivelution targets .NET 8.0 and is compatible with: +- .NET 8.0+ +- Supports AOT (Ahead-of-Time) compilation +- Supports trimming for smaller deployments + + + +### Example + +Complete example with error handling and logging: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; +using Serilog; + +public class DriverUpdateExample +{ + public static async Task Main(string[] args) + { + // Configure logging + var logger = new LoggerConfiguration() + .MinimumLevel.Information() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log", rollingInterval: RollingInterval.Day) + .CreateLogger(); + + // Configure options + var options = new DrivelutionOptions + { + LogLevel = "Info", + DefaultBackupPath = "C:\\DriverBackups", + AutoCleanupBackups = true, + BackupsToKeep = 5 + }; + + try + { + // Create updater + var updater = GeneralDrivelution.Create(logger, options); + + // Get platform info + var platformInfo = GeneralDrivelution.GetPlatformInfo(); + Console.WriteLine($"Platform: {platformInfo}"); + + // Define driver information + var driverInfo = new DriverInfo + { + Name = "Sample Device Driver", + Version = "2.0.0", + FilePath = "C:\\Drivers\\sample.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = CalculateFileHash("C:\\Drivers\\sample.inf"), + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_1234&DEV_5678", + Description = "Sample device driver for demonstration" + }; + + // Validate driver first + Console.WriteLine("Validating driver..."); + var isValid = await updater.ValidateAsync(driverInfo); + if (!isValid) + { + Console.WriteLine("Driver validation failed!"); + return; + } + + // Define update strategy + var strategy = new UpdateStrategy + { + RequireBackup = true, + RetryCount = 3, + RetryIntervalSeconds = 5, + RestartMode = RestartMode.Prompt, + TimeoutSeconds = 600 + }; + + // Execute update + Console.WriteLine("Starting driver update..."); + var result = await updater.UpdateAsync(driverInfo, strategy); + + // Handle result + if (result.Success) + { + Console.WriteLine($"✓ Driver updated successfully in {result.DurationMs}ms"); + Console.WriteLine($"✓ Backup: {result.BackupPath}"); + + foreach (var log in result.StepLogs) + { + Console.WriteLine($" - {log}"); + } + } + else + { + Console.WriteLine($"✗ Update failed: {result.Error?.Message}"); + Console.WriteLine($" Error Code: {result.Error?.Code}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ System rolled back successfully"); + } + } + } + catch (Exception ex) + { + Console.WriteLine($"Unexpected error: {ex.Message}"); + logger.Error(ex, "Driver update failed"); + } + } + + private static string CalculateFileHash(string filePath) + { + using var sha256 = System.Security.Cryptography.SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + } +} +``` + + + +### Annotations + +GeneralDrivelution provides a complete driver update solution with the following key features: + +#### Security Features +- ✓ Driver signature validation (platform-specific) +- ✓ File hash integrity checking +- ✓ Hardware ID matching +- ✓ Publisher trust validation +- ✓ Permission checking before operations + +#### Reliability Features +- ✓ Automatic backup before updates +- ✓ Rollback on failure +- ✓ Retry mechanism with configurable attempts +- ✓ Timeout protection +- ✓ Comprehensive error handling and logging + +#### Platform Features +- ✓ Windows: INF driver installation, PnPUtil integration +- ✓ Linux: Kernel module management, modprobe integration +- ✓ MacOS: KEXT installation, System Integrity Protection awareness + +#### Developer Features +- ✓ Simple and intuitive API +- ✓ Async/await support +- ✓ Comprehensive logging with Serilog +- ✓ Detailed error information +- ✓ Progress tracking and step logs + + + +### Applicable to + +| Product | Versions | +| -------------- | ------------- | +| .NET | 8, 9 | +| .NET Standard | N/A | +| .NET Core | N/A | +| .NET Framework | N/A | + +**Platform Support:** + +| Platform | Support Level | +| -------------- | ------------- | +| Windows | ✓ Full | +| Linux | ✓ Full | +| MacOS | ✓ Full | + +**Note:** Requires elevated privileges (Administrator/root) on all platforms for driver operations. diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/doc/GeneralUpdate.Drivelution.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/doc/GeneralUpdate.Drivelution.md new file mode 100644 index 0000000..8c06456 --- /dev/null +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/doc/GeneralUpdate.Drivelution.md @@ -0,0 +1,748 @@ +--- +sidebar_position: 12 +--- + +### 定义 + +命名空间:GeneralUpdate.Drivelution + +程序集:GeneralUpdate.Drivelution.dll + + + +GeneralUpdate.Drivelution 是一个跨平台的驱动更新组件,提供设备驱动的自动检测、验证、备份、安装和回滚功能。它支持 Windows、Linux 和 MacOS 平台,并提供统一的 API 接口,简化驱动更新流程的同时确保安全性和可靠性。 + +```c# +public static class GeneralDrivelution +``` + + + +### 适用场景 + +GeneralUpdate.Drivelution 适用于以下场景: + +- **企业设备管理**:在企业环境中批量更新多个设备的驱动程序 +- **IoT 设备更新**:为嵌入式系统和物联网设备提供远程驱动更新 +- **硬件厂商软件**:将驱动更新功能集成到硬件厂商的应用程序中 +- **系统维护工具**:构建自动化的驱动更新和维护工具 +- **跨平台应用**:需要在多个操作系统上管理驱动的应用程序 + + + +### 安装与配置 + +#### 安装 + +通过 NuGet 包管理器安装: + +```bash +dotnet add package GeneralUpdate.Drivelution +``` + +或在项目文件中添加: + +```xml + +``` + +#### 配置 + +创建配置选项对象(可选,不指定时使用默认值): + +```c# +var options = new DrivelutionOptions +{ + LogLevel = "Info", // 日志级别(Debug/Info/Warn/Error/Fatal) + LogFilePath = "./Logs/drivelution-.log", // 日志文件路径 + EnableConsoleLogging = true, // 启用控制台日志 + EnableFileLogging = true, // 启用文件日志 + DefaultBackupPath = "./DriverBackups", // 默认备份路径 + DefaultRetryCount = 3, // 默认重试次数 + DefaultRetryIntervalSeconds = 5, // 默认重试间隔(秒) + DefaultTimeoutSeconds = 300, // 默认超时时间(秒) + AutoCleanupBackups = true, // 自动清理旧备份 + BackupsToKeep = 5 // 保留的备份数量 +}; +``` + + + +### 快速开始 + +#### 基础用法(Hello World) + +最简单的驱动更新示例: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; + +// 1. 创建驱动信息 +var driverInfo = new DriverInfo +{ + Name = "我的设备驱动", + Version = "1.2.0", + FilePath = "C:\\Drivers\\mydevice.inf", // Windows: .inf, Linux: .ko, MacOS: .kext + TargetOS = "Windows", + Architecture = "x64", + Hash = "abc123...", // 驱动文件的 SHA256 哈希值 + HashAlgorithm = "SHA256" +}; + +// 2. 使用默认设置快速更新 +var result = await GeneralDrivelution.QuickUpdateAsync(driverInfo); + +// 3. 检查结果 +if (result.Success) +{ + Console.WriteLine("驱动更新成功!"); + Console.WriteLine($"耗时: {result.DurationMs}毫秒"); +} +else +{ + Console.WriteLine($"更新失败: {result.Error?.Message}"); +} +``` + +#### 高级用法(自定义策略) + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; + +// 1. 创建配置选项 +var options = new DrivelutionOptions +{ + LogLevel = "Debug", + DefaultBackupPath = "C:\\DriverBackups" +}; + +// 2. 创建更新器实例 +var updater = GeneralDrivelution.Create(options); + +// 3. 定义驱动信息 +var driverInfo = new DriverInfo +{ + Name = "显卡驱动", + Version = "2.1.0", + FilePath = "C:\\Drivers\\graphics.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "def456...", + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_10DE&DEV_1234", + Description = "NVIDIA 显卡驱动" +}; + +// 4. 定义更新策略 +var strategy = new UpdateStrategy +{ + RequireBackup = true, // 启用备份 + BackupPath = "C:\\DriverBackups\\graphics", + RetryCount = 3, // 失败时重试 3 次 + RetryIntervalSeconds = 5, // 重试间隔 5 秒 + RestartMode = RestartMode.Prompt, // 提示用户重启 + SkipSignatureValidation = false, // 启用签名验证 + TimeoutSeconds = 600 // 10 分钟超时 +}; + +// 5. 执行更新 +var result = await updater.UpdateAsync(driverInfo, strategy); + +// 6. 处理结果 +if (result.Success) +{ + Console.WriteLine($"✓ 更新成功,耗时 {result.DurationMs} 毫秒"); + if (!string.IsNullOrEmpty(result.BackupPath)) + { + Console.WriteLine($"✓ 备份保存至: {result.BackupPath}"); + } +} +else +{ + Console.WriteLine($"✗ 更新失败: {result.Error?.Code}"); + Console.WriteLine($" 消息: {result.Error?.Message}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ 系统已回滚至之前状态"); + } +} +``` + + + +### 核心模块与 API 说明 + +#### 主入口类:GeneralDrivelution + +静态入口类提供以下方法: + +| 方法 | 说明 | +| ---- | ---- | +| `Create(options?)` | 创建驱动更新器实例(自动检测平台) | +| `Create(logger, options?)` | 使用自定义日志器创建驱动更新器实例 | +| `QuickUpdateAsync(driverInfo)` | 使用默认设置快速更新驱动 | +| `QuickUpdateAsync(driverInfo, strategy)` | 使用自定义策略快速更新驱动 | +| `ValidateAsync(driverInfo)` | 验证驱动文件 | +| `GetPlatformInfo()` | 获取当前平台信息 | +| `GetDriversFromDirectoryAsync(path)` | 从本地目录读取驱动信息 | + +#### 核心接口:IGeneralDrivelution + +更新器接口提供以下能力: + +| 方法 | 说明 | +| ---- | ---- | +| `UpdateAsync(driverInfo, strategy, token?)` | 异步更新驱动 | +| `ValidateAsync(driverInfo, token?)` | 异步验证驱动 | +| `BackupAsync(driverInfo, backupPath, token?)` | 异步备份驱动 | +| `RollbackAsync(backupPath, token?)` | 异步回滚驱动 | +| `GetDriversFromDirectoryAsync(path, pattern?, token?)` | 从目录读取驱动信息 | + +#### 数据模型 + +##### DriverInfo + +驱动信息模型: + +| 属性 | 类型 | 说明 | +| ---- | ---- | ---- | +| `Name` | string | 驱动名称 | +| `Version` | string | 驱动版本(遵循 SemVer 2.0) | +| `FilePath` | string | 驱动文件路径 | +| `TargetOS` | string | 目标操作系统 | +| `Architecture` | string | 系统架构(x86、x64、ARM、ARM64) | +| `HardwareId` | string | 硬件 ID(Windows 硬件 ID 或 Linux PCI/USB 设备 ID) | +| `Hash` | string | 文件哈希值(用于完整性验证) | +| `HashAlgorithm` | string | 哈希算法(SHA256、MD5) | +| `TrustedPublishers` | List\ | 可信发布者列表 | +| `Description` | string | 驱动描述 | +| `ReleaseDate` | DateTime | 驱动发布日期 | +| `Metadata` | Dictionary | 附加元数据 | + +##### UpdateStrategy + +更新策略模型: + +| 属性 | 类型 | 说明 | +| ---- | ---- | ---- | +| `Mode` | UpdateMode | 更新模式(全量/增量) | +| `ForceUpdate` | bool | 是否强制更新 | +| `RequireBackup` | bool | 是否需要备份 | +| `BackupPath` | string | 备份路径 | +| `RetryCount` | int | 失败重试次数 | +| `RetryIntervalSeconds` | int | 重试间隔(秒) | +| `Priority` | int | 更新优先级(用于批量更新) | +| `RestartMode` | RestartMode | 更新后重启模式 | +| `SkipSignatureValidation` | bool | 跳过签名验证(仅调试模式) | +| `SkipHashValidation` | bool | 跳过哈希验证(仅调试模式) | +| `TimeoutSeconds` | int | 超时时间(秒) | + +##### UpdateResult + +更新结果模型: + +| 属性 | 类型 | 说明 | +| ---- | ---- | ---- | +| `Success` | bool | 更新是否成功 | +| `Status` | UpdateStatus | 更新状态 | +| `Error` | ErrorInfo? | 错误信息 | +| `StartTime` | DateTime | 更新开始时间 | +| `EndTime` | DateTime | 更新结束时间 | +| `DurationMs` | long | 更新耗时(毫秒) | +| `BackupPath` | string? | 备份路径(如果有备份) | +| `RolledBack` | bool | 是否已回滚 | +| `Message` | string | 附加消息 | +| `StepLogs` | List\ | 更新步骤日志 | + +##### DrivelutionOptions + +配置选项: + +| 属性 | 类型 | 说明 | +| ---- | ---- | ---- | +| `DefaultBackupPath` | string | 默认备份路径 | +| `LogLevel` | string | 日志级别(Debug/Info/Warn/Error/Fatal) | +| `LogFilePath` | string | 日志文件路径 | +| `EnableConsoleLogging` | bool | 启用控制台日志 | +| `EnableFileLogging` | bool | 启用文件日志 | +| `DefaultRetryCount` | int | 默认重试次数 | +| `DefaultRetryIntervalSeconds` | int | 默认重试间隔(秒) | +| `DefaultTimeoutSeconds` | int | 默认超时时间(秒) | +| `DebugModeSkipSignature` | bool | 调试模式下跳过签名验证 | +| `DebugModeSkipHash` | bool | 调试模式下跳过哈希验证 | +| `ForceTerminateOnPermissionFailure` | bool | 权限检查失败时强制终止 | +| `AutoCleanupBackups` | bool | 自动清理旧备份 | +| `BackupsToKeep` | int | 保留的备份数量 | +| `TrustedCertificateThumbprints` | List\ | 可信证书指纹列表(用于签名验证) | +| `TrustedGpgKeys` | List\ | 可信 GPG 公钥列表(Linux 用) | + + + +### 跨平台使用 + +GeneralUpdate.Drivelution 支持 Windows、Linux 和 MacOS 平台,具有自动平台检测和适配功能。 + +#### Windows 平台 + +**支持的驱动类型:** +- INF 驱动(*.inf) +- PnP 驱动 +- 内核模式驱动 +- 用户模式驱动 + +**示例:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "USB 设备驱动", + Version = "3.0.1", + FilePath = "C:\\Drivers\\usbdevice.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "sha256_hash_here", + HardwareId = "USB\\VID_1234&PID_5678" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Windows 平台特性:** +- 使用 Windows Authenticode 自动进行签名验证 +- 设备驱动的硬件 ID 匹配 +- 与 Windows 驱动存储集成 +- 通过 PnPUtil 支持驱动安装 + +#### Linux 平台 + +**支持的驱动类型:** +- 内核模块(*.ko) +- 设备树覆盖 +- 固件文件 + +**示例:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "网卡驱动", + Version = "1.5.0", + FilePath = "/lib/modules/drivers/netadapter.ko", + TargetOS = "Linux", + Architecture = "x64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Delayed // Linux 系统延迟重启 +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Linux 平台特性:** +- GPG 签名验证 +- 内核模块依赖检查 +- 与 modprobe 和 insmod 集成 +- 支持 DKMS(动态内核模块支持) + +**所需权限:** +```bash +# 使用 sudo 或 root 权限运行 +sudo dotnet run MyApp.dll +``` + +#### MacOS 平台 + +**支持的驱动类型:** +- 内核扩展(*.kext) +- DriverKit 扩展 + +**示例:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "音频设备驱动", + Version = "2.3.0", + FilePath = "/Library/Extensions/AudioDevice.kext", + TargetOS = "MacOS", + Architecture = "ARM64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**MacOS 平台特性:** +- 使用 codesign 进行代码签名验证 +- 系统完整性保护(SIP)感知 +- 支持公证驱动 +- 与 kextutil 集成 + +**所需权限:** +```bash +# 使用管理员权限运行 +sudo dotnet run MyApp.dll +``` + +#### 平台检测 + +自动检测当前平台: + +```c# +var platformInfo = GeneralDrivelution.GetPlatformInfo(); + +Console.WriteLine($"平台: {platformInfo.Platform}"); +Console.WriteLine($"操作系统: {platformInfo.OperatingSystem}"); +Console.WriteLine($"架构: {platformInfo.Architecture}"); +Console.WriteLine($"是否支持: {platformInfo.IsSupported}"); +``` + +#### 跨平台代码示例 + +编写一次,到处运行: + +```c# +// 此代码在 Windows、Linux 和 MacOS 上均可运行 +var updater = GeneralDrivelution.Create(); + +// 平台特定的驱动路径可以在运行时确定 +var driverPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? "C:\\Drivers\\device.inf" + : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) + ? "/lib/modules/device.ko" + : "/Library/Extensions/device.kext"; + +var driverInfo = new DriverInfo +{ + Name = "设备驱动", + Version = "1.0.0", + FilePath = driverPath, + Hash = "calculated_hash" +}; + +var result = await updater.UpdateAsync(driverInfo, new UpdateStrategy()); +``` + + + +### 常见问题(FAQ) + +#### Q1: 支持哪些平台? + +**A:** GeneralUpdate.Drivelution 支持 Windows(7/8/10/11/Server)、Linux(各种发行版)和 MacOS(10.13+)。组件会自动检测平台并使用适当的驱动更新策略。 + +#### Q2: 是否需要管理员/root 权限? + +**A:** 是的,驱动更新在所有平台上都需要提升权限: +- **Windows**:以管理员身份运行 +- **Linux**:使用 sudo 或以 root 身份运行 +- **MacOS**:使用 sudo 或以 root 身份运行 + +#### Q3: 如何计算驱动文件哈希值? + +**A:** 可以使用内置工具或以下代码: + +```c# +using System.Security.Cryptography; + +string CalculateFileHash(string filePath) +{ + using var sha256 = SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); +} +``` + +#### Q4: 如果更新失败会怎样? + +**A:** 如果在更新策略中启用了 `RequireBackup`,系统将自动回滚到之前的驱动版本。`UpdateResult` 对象将包含详细的错误信息。 + +#### Q5: 可以同时更新多个驱动吗? + +**A:** 可以,您可以顺序或并行更新多个驱动: + +```c# +var drivers = new List { driver1, driver2, driver3 }; +var tasks = drivers.Select(d => updater.UpdateAsync(d, strategy)); +var results = await Task.WhenAll(tasks); +``` + +#### Q6: 如何处理驱动签名验证? + +**A:** 默认情况下启用签名验证。要跳过验证(生产环境不推荐): + +```c# +var strategy = new UpdateStrategy +{ + SkipSignatureValidation = true // 仅用于测试! +}; +``` + +对于生产环境,请确保驱动已正确签名: +- **Windows**:使用 Microsoft Authenticode +- **Linux**:使用 GPG 签名 +- **MacOS**:使用 Apple 代码签名 + +#### Q7: 更新驱动后系统是否需要重启? + +**A:** 这取决于驱动类型和平台。您可以通过 `RestartMode` 控制重启行为: +- `RestartMode.None`:不需要重启 +- `RestartMode.Prompt`:提示用户重启 +- `RestartMode.Delayed`:稍后安排重启 +- `RestartMode.Immediate`:立即重启 + +#### Q8: 如何在更新前验证驱动? + +**A:** 使用 `ValidateAsync` 方法: + +```c# +var isValid = await updater.ValidateAsync(driverInfo); +if (isValid) +{ + // 继续更新 + var result = await updater.UpdateAsync(driverInfo, strategy); +} +``` + +#### Q9: 可以自定义日志吗? + +**A:** 可以,您可以提供自定义的 Serilog 日志器: + +```c# +var logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log") + .CreateLogger(); + +var updater = GeneralDrivelution.Create(logger, options); +``` + +#### Q10: 驱动备份存储在哪里? + +**A:** 备份存储在以下路径(按优先级): +1. `UpdateStrategy.BackupPath`(如果指定) +2. `DrivelutionOptions.DefaultBackupPath`(如果配置) +3. 默认:`./DriverBackups` 目录 + +如果启用了 `AutoCleanupBackups`,旧备份会自动清理。 + +#### Q11: 如何从目录获取驱动信息? + +**A:** 使用 `GetDriversFromDirectoryAsync` 方法: + +```c# +// 从目录获取所有驱动 +var drivers = await updater.GetDriversFromDirectoryAsync("C:\\Drivers"); + +// 获取特定模式的驱动 +var infDrivers = await updater.GetDriversFromDirectoryAsync( + "C:\\Drivers", + "*.inf" +); +``` + +#### Q12: 组件是否线程安全? + +**A:** 是的,您可以安全地在多个线程之间使用更新器实例。每个更新操作都是独立的,可以并发运行。 + +#### Q13: 支持哪些 .NET 版本? + +**A:** GeneralUpdate.Drivelution 目标是 .NET 8.0,兼容: +- .NET 8.0+ +- 支持 AOT(提前编译) +- 支持裁剪以实现更小的部署包 + + + +### 示例 + +包含错误处理和日志记录的完整示例: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; +using Serilog; + +public class DriverUpdateExample +{ + public static async Task Main(string[] args) + { + // 配置日志 + var logger = new LoggerConfiguration() + .MinimumLevel.Information() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log", rollingInterval: RollingInterval.Day) + .CreateLogger(); + + // 配置选项 + var options = new DrivelutionOptions + { + LogLevel = "Info", + DefaultBackupPath = "C:\\DriverBackups", + AutoCleanupBackups = true, + BackupsToKeep = 5 + }; + + try + { + // 创建更新器 + var updater = GeneralDrivelution.Create(logger, options); + + // 获取平台信息 + var platformInfo = GeneralDrivelution.GetPlatformInfo(); + Console.WriteLine($"平台: {platformInfo}"); + + // 定义驱动信息 + var driverInfo = new DriverInfo + { + Name = "示例设备驱动", + Version = "2.0.0", + FilePath = "C:\\Drivers\\sample.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = CalculateFileHash("C:\\Drivers\\sample.inf"), + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_1234&DEV_5678", + Description = "用于演示的示例设备驱动" + }; + + // 先验证驱动 + Console.WriteLine("验证驱动中..."); + var isValid = await updater.ValidateAsync(driverInfo); + if (!isValid) + { + Console.WriteLine("驱动验证失败!"); + return; + } + + // 定义更新策略 + var strategy = new UpdateStrategy + { + RequireBackup = true, + RetryCount = 3, + RetryIntervalSeconds = 5, + RestartMode = RestartMode.Prompt, + TimeoutSeconds = 600 + }; + + // 执行更新 + Console.WriteLine("开始驱动更新..."); + var result = await updater.UpdateAsync(driverInfo, strategy); + + // 处理结果 + if (result.Success) + { + Console.WriteLine($"✓ 驱动更新成功,耗时 {result.DurationMs} 毫秒"); + Console.WriteLine($"✓ 备份: {result.BackupPath}"); + + foreach (var log in result.StepLogs) + { + Console.WriteLine($" - {log}"); + } + } + else + { + Console.WriteLine($"✗ 更新失败: {result.Error?.Message}"); + Console.WriteLine($" 错误代码: {result.Error?.Code}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ 系统回滚成功"); + } + } + } + catch (Exception ex) + { + Console.WriteLine($"意外错误: {ex.Message}"); + logger.Error(ex, "驱动更新失败"); + } + } + + private static string CalculateFileHash(string filePath) + { + using var sha256 = System.Security.Cryptography.SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + } +} +``` + + + +### 注解 + +GeneralDrivelution 提供完整的驱动更新解决方案,具有以下关键特性: + +#### 安全特性 +- ✓ 驱动签名验证(平台特定) +- ✓ 文件哈希完整性检查 +- ✓ 硬件 ID 匹配 +- ✓ 发布者信任验证 +- ✓ 操作前权限检查 + +#### 可靠性特性 +- ✓ 更新前自动备份 +- ✓ 失败时回滚 +- ✓ 可配置尝试次数的重试机制 +- ✓ 超时保护 +- ✓ 全面的错误处理和日志记录 + +#### 平台特性 +- ✓ Windows:INF 驱动安装、PnPUtil 集成 +- ✓ Linux:内核模块管理、modprobe 集成 +- ✓ MacOS:KEXT 安装、系统完整性保护感知 + +#### 开发者特性 +- ✓ 简单直观的 API +- ✓ Async/await 支持 +- ✓ 使用 Serilog 的全面日志记录 +- ✓ 详细的错误信息 +- ✓ 进度跟踪和步骤日志 + + + +### 适用于 + +| 产品 | 版本 | +| -------------- | ------------- | +| .NET | 8、9 | +| .NET Standard | 不适用 | +| .NET Core | 不适用 | +| .NET Framework | 不适用 | + +**平台支持:** + +| 平台 | 支持级别 | +| -------------- | ------------- | +| Windows | ✓ 完全支持 | +| Linux | ✓ 完全支持 | +| MacOS | ✓ 完全支持 | + +**注意:** 在所有平台上进行驱动操作都需要提升权限(管理员/root)。 From b980b83b114087c5ceaaeb9a7c2a713d448e11d5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:21:49 +0000 Subject: [PATCH 3/3] Add English i18n documentation for GeneralUpdate.Drivelution Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com> --- .../docs/doc/GeneralUpdate.Drivelution.md | 748 ++++++++++++++++++ website/package-lock.json | 19 + 2 files changed, 767 insertions(+) create mode 100644 website/i18n/en/docusaurus-plugin-content-docs/current/docs/doc/GeneralUpdate.Drivelution.md diff --git a/website/i18n/en/docusaurus-plugin-content-docs/current/docs/doc/GeneralUpdate.Drivelution.md b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/doc/GeneralUpdate.Drivelution.md new file mode 100644 index 0000000..b6d5f18 --- /dev/null +++ b/website/i18n/en/docusaurus-plugin-content-docs/current/docs/doc/GeneralUpdate.Drivelution.md @@ -0,0 +1,748 @@ +--- +sidebar_position: 12 +--- + +### Definition + +Namespace: GeneralUpdate.Drivelution + +Assembly: GeneralUpdate.Drivelution.dll + + + +GeneralUpdate.Drivelution is a cross-platform driver update component that provides automatic detection, validation, backup, installation, and rollback capabilities for device drivers. It supports Windows, Linux, and MacOS platforms and offers a unified API interface to simplify the driver update process while ensuring security and reliability. + +```c# +public static class GeneralDrivelution +``` + + + +### Applicable Scenarios + +GeneralUpdate.Drivelution is suitable for the following scenarios: + +- **Enterprise device management**: Batch update drivers for multiple devices in corporate environments +- **IoT device updates**: Remote driver updates for embedded systems and IoT devices +- **Hardware vendor software**: Integrate driver update functionality into hardware vendor applications +- **System maintenance tools**: Build automated driver update and maintenance tools +- **Cross-platform applications**: Applications that need to manage drivers on multiple operating systems + + + +### Installation & Configuration + +#### Installation + +Install via NuGet package manager: + +```bash +dotnet add package GeneralUpdate.Drivelution +``` + +Or add the following to your project file: + +```xml + +``` + +#### Configuration + +Create a configuration options object (optional, defaults are used if not specified): + +```c# +var options = new DrivelutionOptions +{ + LogLevel = "Info", // Log level (Debug/Info/Warn/Error/Fatal) + LogFilePath = "./Logs/drivelution-.log", // Log file path + EnableConsoleLogging = true, // Enable console logging + EnableFileLogging = true, // Enable file logging + DefaultBackupPath = "./DriverBackups", // Default backup path + DefaultRetryCount = 3, // Default retry count + DefaultRetryIntervalSeconds = 5, // Default retry interval (seconds) + DefaultTimeoutSeconds = 300, // Default timeout (seconds) + AutoCleanupBackups = true, // Auto cleanup old backups + BackupsToKeep = 5 // Number of backups to keep +}; +``` + + + +### Quick Start + +#### Basic Usage (Hello World) + +The simplest driver update example: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; + +// 1. Create driver information +var driverInfo = new DriverInfo +{ + Name = "MyDevice Driver", + Version = "1.2.0", + FilePath = "C:\\Drivers\\mydevice.inf", // Windows: .inf, Linux: .ko, MacOS: .kext + TargetOS = "Windows", + Architecture = "x64", + Hash = "abc123...", // SHA256 hash of the driver file + HashAlgorithm = "SHA256" +}; + +// 2. Quick update with default settings +var result = await GeneralDrivelution.QuickUpdateAsync(driverInfo); + +// 3. Check result +if (result.Success) +{ + Console.WriteLine("Driver updated successfully!"); + Console.WriteLine($"Duration: {result.DurationMs}ms"); +} +else +{ + Console.WriteLine($"Update failed: {result.Error?.Message}"); +} +``` + +#### Advanced Usage with Custom Strategy + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; + +// 1. Create configuration options +var options = new DrivelutionOptions +{ + LogLevel = "Debug", + DefaultBackupPath = "C:\\DriverBackups" +}; + +// 2. Create updater instance +var updater = GeneralDrivelution.Create(options); + +// 3. Define driver information +var driverInfo = new DriverInfo +{ + Name = "Graphics Driver", + Version = "2.1.0", + FilePath = "C:\\Drivers\\graphics.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "def456...", + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_10DE&DEV_1234", + Description = "NVIDIA Graphics Driver" +}; + +// 4. Define update strategy +var strategy = new UpdateStrategy +{ + RequireBackup = true, // Enable backup + BackupPath = "C:\\DriverBackups\\graphics", + RetryCount = 3, // Retry 3 times on failure + RetryIntervalSeconds = 5, // Wait 5 seconds between retries + RestartMode = RestartMode.Prompt, // Prompt user to restart + SkipSignatureValidation = false, // Enable signature validation + TimeoutSeconds = 600 // 10-minute timeout +}; + +// 5. Execute update +var result = await updater.UpdateAsync(driverInfo, strategy); + +// 6. Handle result +if (result.Success) +{ + Console.WriteLine($"✓ Update succeeded in {result.DurationMs}ms"); + if (!string.IsNullOrEmpty(result.BackupPath)) + { + Console.WriteLine($"✓ Backup saved to: {result.BackupPath}"); + } +} +else +{ + Console.WriteLine($"✗ Update failed: {result.Error?.Code}"); + Console.WriteLine($" Message: {result.Error?.Message}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ System rolled back to previous state"); + } +} +``` + + + +### Core Modules & API Description + +#### Main Entry Class: GeneralDrivelution + +The static entry class provides the following methods: + +| Method | Description | +| ------ | ----------- | +| `Create(options?)` | Creates a driver updater instance with automatic platform detection | +| `Create(logger, options?)` | Creates a driver updater instance with custom logger | +| `QuickUpdateAsync(driverInfo)` | Quick driver update with default settings | +| `QuickUpdateAsync(driverInfo, strategy)` | Quick driver update with custom strategy | +| `ValidateAsync(driverInfo)` | Validates driver file | +| `GetPlatformInfo()` | Gets current platform information | +| `GetDriversFromDirectoryAsync(path)` | Reads driver information from local directory | + +#### Core Interface: IGeneralDrivelution + +The updater interface provides the following capabilities: + +| Method | Description | +| ------ | ----------- | +| `UpdateAsync(driverInfo, strategy, token?)` | Updates driver asynchronously | +| `ValidateAsync(driverInfo, token?)` | Validates driver asynchronously | +| `BackupAsync(driverInfo, backupPath, token?)` | Backs up driver asynchronously | +| `RollbackAsync(backupPath, token?)` | Rolls back driver asynchronously | +| `GetDriversFromDirectoryAsync(path, pattern?, token?)` | Reads driver information from directory | + +#### Data Models + +##### DriverInfo + +Driver information model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Name` | string | Driver name | +| `Version` | string | Driver version (follows SemVer 2.0) | +| `FilePath` | string | Driver file path | +| `TargetOS` | string | Target operating system | +| `Architecture` | string | System architecture (x86, x64, ARM, ARM64) | +| `HardwareId` | string | Hardware ID (Windows hardware ID or Linux PCI/USB device ID) | +| `Hash` | string | File hash for integrity validation | +| `HashAlgorithm` | string | Hash algorithm (SHA256, MD5) | +| `TrustedPublishers` | List\ | Trusted publishers list | +| `Description` | string | Driver description | +| `ReleaseDate` | DateTime | Driver release date | +| `Metadata` | Dictionary | Additional metadata | + +##### UpdateStrategy + +Update strategy model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Mode` | UpdateMode | Update mode (Full/Incremental) | +| `ForceUpdate` | bool | Whether to force update | +| `RequireBackup` | bool | Whether backup is required | +| `BackupPath` | string | Backup path | +| `RetryCount` | int | Retry count on failure | +| `RetryIntervalSeconds` | int | Retry interval (seconds) | +| `Priority` | int | Update priority (for batch updates) | +| `RestartMode` | RestartMode | Restart mode after update | +| `SkipSignatureValidation` | bool | Skip signature validation (debug mode only) | +| `SkipHashValidation` | bool | Skip hash validation (debug mode only) | +| `TimeoutSeconds` | int | Timeout (seconds) | + +##### UpdateResult + +Update result model: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `Success` | bool | Whether update succeeded | +| `Status` | UpdateStatus | Update status | +| `Error` | ErrorInfo? | Error information | +| `StartTime` | DateTime | Update start time | +| `EndTime` | DateTime | Update end time | +| `DurationMs` | long | Update duration (milliseconds) | +| `BackupPath` | string? | Backup path (if backed up) | +| `RolledBack` | bool | Whether rolled back | +| `Message` | string | Additional message | +| `StepLogs` | List\ | Update step logs | + +##### DrivelutionOptions + +Configuration options: + +| Property | Type | Description | +| -------- | ---- | ----------- | +| `DefaultBackupPath` | string | Default backup path | +| `LogLevel` | string | Log level (Debug/Info/Warn/Error/Fatal) | +| `LogFilePath` | string | Log file path | +| `EnableConsoleLogging` | bool | Enable console logging | +| `EnableFileLogging` | bool | Enable file logging | +| `DefaultRetryCount` | int | Default retry count | +| `DefaultRetryIntervalSeconds` | int | Default retry interval (seconds) | +| `DefaultTimeoutSeconds` | int | Default timeout (seconds) | +| `DebugModeSkipSignature` | bool | Skip signature validation in debug mode | +| `DebugModeSkipHash` | bool | Skip hash validation in debug mode | +| `ForceTerminateOnPermissionFailure` | bool | Force terminate on permission check failure | +| `AutoCleanupBackups` | bool | Auto cleanup old backups | +| `BackupsToKeep` | int | Number of backups to keep | +| `TrustedCertificateThumbprints` | List\ | Trusted certificate thumbprints (for signature validation) | +| `TrustedGpgKeys` | List\ | Trusted GPG public keys (for Linux) | + + + +### Cross-Platform Usage + +GeneralUpdate.Drivelution supports Windows, Linux, and MacOS platforms with automatic platform detection and adaptation. + +#### Windows Platform + +**Supported Driver Types:** +- INF-based drivers (*.inf) +- PnP drivers +- Kernel-mode drivers +- User-mode drivers + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "USB Device Driver", + Version = "3.0.1", + FilePath = "C:\\Drivers\\usbdevice.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = "sha256_hash_here", + HardwareId = "USB\\VID_1234&PID_5678" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Windows-Specific Features:** +- Automatic signature validation using Windows Authenticode +- Hardware ID matching for device drivers +- Integration with Windows Driver Store +- Support for driver installation via PnPUtil + +#### Linux Platform + +**Supported Driver Types:** +- Kernel modules (*.ko) +- Device Tree overlays +- Firmware files + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "Network Adapter Driver", + Version = "1.5.0", + FilePath = "/lib/modules/drivers/netadapter.ko", + TargetOS = "Linux", + Architecture = "x64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Delayed // Delay restart for Linux systems +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**Linux-Specific Features:** +- GPG signature validation +- Kernel module dependency checking +- Integration with modprobe and insmod +- Support for DKMS (Dynamic Kernel Module Support) + +**Required Permissions:** +```bash +# Run with sudo or root privileges +sudo dotnet run MyApp.dll +``` + +#### MacOS Platform + +**Supported Driver Types:** +- Kernel extensions (*.kext) +- DriverKit extensions + +**Example:** + +```c# +var driverInfo = new DriverInfo +{ + Name = "Audio Device Driver", + Version = "2.3.0", + FilePath = "/Library/Extensions/AudioDevice.kext", + TargetOS = "MacOS", + Architecture = "ARM64", + Hash = "sha256_hash_here" +}; + +var strategy = new UpdateStrategy +{ + RequireBackup = true, + RestartMode = RestartMode.Prompt +}; + +var updater = GeneralDrivelution.Create(); +var result = await updater.UpdateAsync(driverInfo, strategy); +``` + +**MacOS-Specific Features:** +- Code signature validation using codesign +- System Integrity Protection (SIP) awareness +- Support for notarized drivers +- Integration with kextutil + +**Required Permissions:** +```bash +# Run with administrator privileges +sudo dotnet run MyApp.dll +``` + +#### Platform Detection + +Automatically detect current platform: + +```c# +var platformInfo = GeneralDrivelution.GetPlatformInfo(); + +Console.WriteLine($"Platform: {platformInfo.Platform}"); +Console.WriteLine($"OS: {platformInfo.OperatingSystem}"); +Console.WriteLine($"Architecture: {platformInfo.Architecture}"); +Console.WriteLine($"Supported: {platformInfo.IsSupported}"); +``` + +#### Cross-Platform Code Example + +Write once, run everywhere: + +```c# +// This code works on Windows, Linux, and MacOS +var updater = GeneralDrivelution.Create(); + +// Platform-specific driver paths can be determined at runtime +var driverPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? "C:\\Drivers\\device.inf" + : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) + ? "/lib/modules/device.ko" + : "/Library/Extensions/device.kext"; + +var driverInfo = new DriverInfo +{ + Name = "Device Driver", + Version = "1.0.0", + FilePath = driverPath, + Hash = "calculated_hash" +}; + +var result = await updater.UpdateAsync(driverInfo, new UpdateStrategy()); +``` + + + +### Frequently Asked Questions (FAQ) + +#### Q1: What platforms are supported? + +**A:** GeneralUpdate.Drivelution supports Windows (7/8/10/11/Server), Linux (various distributions), and MacOS (10.13+). The component automatically detects the platform and uses the appropriate driver update strategy. + +#### Q2: Do I need administrator/root privileges? + +**A:** Yes, driver updates require elevated privileges on all platforms: +- **Windows**: Run as Administrator +- **Linux**: Run with sudo or as root +- **MacOS**: Run with sudo or as root + +#### Q3: How do I calculate the driver file hash? + +**A:** You can use built-in utilities or the following code: + +```c# +using System.Security.Cryptography; + +string CalculateFileHash(string filePath) +{ + using var sha256 = SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); +} +``` + +#### Q4: What happens if the update fails? + +**A:** If `RequireBackup` is enabled in the update strategy, the system will automatically roll back to the previous driver version. The `UpdateResult` object will contain detailed error information. + +#### Q5: Can I update multiple drivers at once? + +**A:** Yes, you can update multiple drivers sequentially or in parallel: + +```c# +var drivers = new List { driver1, driver2, driver3 }; +var tasks = drivers.Select(d => updater.UpdateAsync(d, strategy)); +var results = await Task.WhenAll(tasks); +``` + +#### Q6: How do I handle driver signature validation? + +**A:** By default, signature validation is enabled. To skip validation (not recommended in production): + +```c# +var strategy = new UpdateStrategy +{ + SkipSignatureValidation = true // Only for testing! +}; +``` + +For production, ensure drivers are properly signed: +- **Windows**: Use Microsoft Authenticode +- **Linux**: Use GPG signing +- **MacOS**: Use Apple code signing + +#### Q7: Does the system need to restart after updating drivers? + +**A:** It depends on the driver type and platform. You can control restart behavior via `RestartMode`: +- `RestartMode.None`: No restart required +- `RestartMode.Prompt`: Prompt user to restart +- `RestartMode.Delayed`: Schedule restart for later +- `RestartMode.Immediate`: Restart immediately + +#### Q8: How do I validate a driver before updating? + +**A:** Use the `ValidateAsync` method: + +```c# +var isValid = await updater.ValidateAsync(driverInfo); +if (isValid) +{ + // Proceed with update + var result = await updater.UpdateAsync(driverInfo, strategy); +} +``` + +#### Q9: Can I customize logging? + +**A:** Yes, you can provide a custom Serilog logger: + +```c# +var logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log") + .CreateLogger(); + +var updater = GeneralDrivelution.Create(logger, options); +``` + +#### Q10: Where are driver backups stored? + +**A:** Backups are stored in the path specified by: +1. `UpdateStrategy.BackupPath` (if specified) +2. `DrivelutionOptions.DefaultBackupPath` (if configured) +3. Default: `./DriverBackups` directory + +Old backups are automatically cleaned up if `AutoCleanupBackups` is enabled. + +#### Q11: How do I get driver information from a directory? + +**A:** Use the `GetDriversFromDirectoryAsync` method: + +```c# +// Get all drivers from directory +var drivers = await updater.GetDriversFromDirectoryAsync("C:\\Drivers"); + +// Get drivers with specific pattern +var infDrivers = await updater.GetDriversFromDirectoryAsync( + "C:\\Drivers", + "*.inf" +); +``` + +#### Q12: Is the component thread-safe? + +**A:** Yes, you can safely use the updater instance across multiple threads. Each update operation is independent and can run concurrently. + +#### Q13: What .NET versions are supported? + +**A:** GeneralUpdate.Drivelution targets .NET 8.0 and is compatible with: +- .NET 8.0+ +- Supports AOT (Ahead-of-Time) compilation +- Supports trimming for smaller deployments + + + +### Example + +Complete example with error handling and logging: + +```c# +using GeneralUpdate.Drivelution; +using GeneralUpdate.Drivelution.Abstractions.Models; +using GeneralUpdate.Drivelution.Abstractions.Configuration; +using Serilog; + +public class DriverUpdateExample +{ + public static async Task Main(string[] args) + { + // Configure logging + var logger = new LoggerConfiguration() + .MinimumLevel.Information() + .WriteTo.Console() + .WriteTo.File("logs/driver-update.log", rollingInterval: RollingInterval.Day) + .CreateLogger(); + + // Configure options + var options = new DrivelutionOptions + { + LogLevel = "Info", + DefaultBackupPath = "C:\\DriverBackups", + AutoCleanupBackups = true, + BackupsToKeep = 5 + }; + + try + { + // Create updater + var updater = GeneralDrivelution.Create(logger, options); + + // Get platform info + var platformInfo = GeneralDrivelution.GetPlatformInfo(); + Console.WriteLine($"Platform: {platformInfo}"); + + // Define driver information + var driverInfo = new DriverInfo + { + Name = "Sample Device Driver", + Version = "2.0.0", + FilePath = "C:\\Drivers\\sample.inf", + TargetOS = "Windows", + Architecture = "x64", + Hash = CalculateFileHash("C:\\Drivers\\sample.inf"), + HashAlgorithm = "SHA256", + HardwareId = "PCI\\VEN_1234&DEV_5678", + Description = "Sample device driver for demonstration" + }; + + // Validate driver first + Console.WriteLine("Validating driver..."); + var isValid = await updater.ValidateAsync(driverInfo); + if (!isValid) + { + Console.WriteLine("Driver validation failed!"); + return; + } + + // Define update strategy + var strategy = new UpdateStrategy + { + RequireBackup = true, + RetryCount = 3, + RetryIntervalSeconds = 5, + RestartMode = RestartMode.Prompt, + TimeoutSeconds = 600 + }; + + // Execute update + Console.WriteLine("Starting driver update..."); + var result = await updater.UpdateAsync(driverInfo, strategy); + + // Handle result + if (result.Success) + { + Console.WriteLine($"✓ Driver updated successfully in {result.DurationMs}ms"); + Console.WriteLine($"✓ Backup: {result.BackupPath}"); + + foreach (var log in result.StepLogs) + { + Console.WriteLine($" - {log}"); + } + } + else + { + Console.WriteLine($"✗ Update failed: {result.Error?.Message}"); + Console.WriteLine($" Error Code: {result.Error?.Code}"); + + if (result.RolledBack) + { + Console.WriteLine("✓ System rolled back successfully"); + } + } + } + catch (Exception ex) + { + Console.WriteLine($"Unexpected error: {ex.Message}"); + logger.Error(ex, "Driver update failed"); + } + } + + private static string CalculateFileHash(string filePath) + { + using var sha256 = System.Security.Cryptography.SHA256.Create(); + using var stream = File.OpenRead(filePath); + var hash = sha256.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + } +} +``` + + + +### Annotations + +GeneralDrivelution provides a complete driver update solution with the following key features: + +#### Security Features +- ✓ Driver signature validation (platform-specific) +- ✓ File hash integrity checking +- ✓ Hardware ID matching +- ✓ Publisher trust validation +- ✓ Permission checking before operations + +#### Reliability Features +- ✓ Automatic backup before updates +- ✓ Rollback on failure +- ✓ Retry mechanism with configurable attempts +- ✓ Timeout protection +- ✓ Comprehensive error handling and logging + +#### Platform Features +- ✓ Windows: INF driver installation, PnPUtil integration +- ✓ Linux: Kernel module management, modprobe integration +- ✓ MacOS: KEXT installation, System Integrity Protection awareness + +#### Developer Features +- ✓ Simple and intuitive API +- ✓ Async/await support +- ✓ Comprehensive logging with Serilog +- ✓ Detailed error information +- ✓ Progress tracking and step logs + + + +### Applicable to + +| Product | Versions | +| -------------- | ------------- | +| .NET | 8, 9 | +| .NET Standard | N/A | +| .NET Core | N/A | +| .NET Framework | N/A | + +**Platform Support:** + +| Platform | Support Level | +| -------------- | ------------- | +| Windows | ✓ Full | +| Linux | ✓ Full | +| MacOS | ✓ Full | + +**Note:** Requires elevated privileges (Administrator/root) on all platforms for driver operations. diff --git a/website/package-lock.json b/website/package-lock.json index 7a10580..eaf4825 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -130,6 +130,7 @@ "version": "4.22.1", "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.22.1.tgz", "integrity": "sha512-yb05NA4tNaOgx3+rOxAmFztgMTtGBi97X7PC3jyNeGiwkAjOZc2QrdZBYyIdcDLoI09N0gjtpClcackoTN0gPA==", + "peer": true, "dependencies": { "@algolia/client-common": "4.22.1", "@algolia/requester-common": "4.22.1", @@ -285,6 +286,7 @@ "version": "7.24.0", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz", "integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.23.5", @@ -3177,6 +3179,7 @@ "version": "6.5.1", "resolved": "https://registry.npmjs.org/@svgr/core/-/core-6.5.1.tgz", "integrity": "sha512-/xdLSWxK5QkqG524ONSjvg3V/FkNyCv538OIBdQqPNaAta3AsXj/Bd2FbvR87yMbXO2hFSWiAe/Q6IkVPDw+mw==", + "peer": true, "dependencies": { "@babel/core": "^7.19.6", "@svgr/babel-preset": "^6.5.1", @@ -3528,6 +3531,7 @@ "version": "18.2.66", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.66.tgz", "integrity": "sha512-OYTmMI4UigXeFMF/j4uv0lBBEbongSgptPrHBxqME44h9+yNov+oL6Z3ocJKo0WyXR84sQUNeyIp9MRfckvZpg==", + "peer": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -3823,6 +3827,7 @@ "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3878,6 +3883,7 @@ "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -3920,6 +3926,7 @@ "version": "4.22.1", "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.22.1.tgz", "integrity": "sha512-jwydKFQJKIx9kIZ8Jm44SdpigFwRGPESaxZBaHSV0XWN2yBJAOT4mT7ppvlrpA4UGzz92pqFnVKr/kaZXrcreg==", + "peer": true, "dependencies": { "@algolia/cache-browser-local-storage": "4.22.1", "@algolia/cache-common": "4.22.1", @@ -4344,6 +4351,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001587", "electron-to-chromium": "^1.4.668", @@ -6254,6 +6262,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -6443,6 +6452,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -10997,6 +11007,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", @@ -11803,6 +11814,7 @@ "version": "18.2.0", "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -11932,6 +11944,7 @@ "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.0" @@ -11987,6 +12000,7 @@ "version": "5.5.2", "resolved": "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz", "integrity": "sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==", + "peer": true, "dependencies": { "@types/react": "*", "prop-types": "^15.6.2" @@ -12014,6 +12028,7 @@ "version": "5.3.4", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz", "integrity": "sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==", + "peer": true, "dependencies": { "@babel/runtime": "^7.12.13", "history": "^4.9.0", @@ -13473,6 +13488,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -14017,6 +14033,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -14197,6 +14214,7 @@ "version": "5.90.3", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", "integrity": "sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", @@ -14425,6 +14443,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0",