# GeneralUpdate-Samples
**Repository Path**: GeneralLibrary/GeneralUpdate-Samples
## Basic Information
- **Project Name**: GeneralUpdate-Samples
- **Description**: GeneralUpdate-Samples
- **Primary Language**: C#
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 16
- **Forks**: 4
- **Created**: 2023-01-14
- **Last Updated**: 2026-06-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# GeneralUpdate-Samples
**Usage Examples and Quick Start Repository for GeneralUpdate**
[](https://github.com/GeneralLibrary/GeneralUpdate-Samples)
[](https://gitee.com/GeneralLibrary/GeneralUpdate-Samples)
[](LICENSE)
[](https://dotnet.microsoft.com/)
[English](README.md) | [ไธญๆๆๆกฃ](README_zh.md)
---
## ๐ Table of Contents
- [Overview](#-overview)
- [Key Features](#-key-features)
- [Repository Structure](#-repository-structure)
- [Quick Start](#-quick-start)
- [Interactive Sample Browser](#-interactive-sample-browser)
- [Sample Catalog](#-sample-catalog)
- [UI Framework Samples](#-ui-framework-samples)
- [Related Repositories](#-related-repositories)
- [Documentation](#-documentation)
- [Requirements](#-requirements)
- [Contributing](#-contributing)
- [Support](#-support)
- [License](#-license)
---
## ๐ Overview
**GeneralUpdate-Samples** is the official sample repository for the [GeneralUpdate](https://github.com/GeneralLibrary/GeneralUpdate) project, an Apache 2.0 licensed, cross-platform application automatic update component built on .NET. This repository provides a unified **interactive sample browser (Hub)** that lets you explore and test every major feature through a clean console menu โ no manual project setup required.
**GeneralUpdate** supports a wide range of update mechanisms:
- โ
Resume Download
- โ
Version-by-Version Update
- โ
Binary Differential Update
- โ
Incremental Update
- โ
Forced Update
- โ
Multi-Branch Update
- โ
OSS (Object Storage Service) Updates
- โ
Rollback and Backup
- โ
AOT (Ahead-of-Time) Compilation Support
- โ
Driver Update (via Drivelution)
---
## ๐ฏ Key Features
This repository provides self-contained, runnable samples for all major features of GeneralUpdate:
| Feature | Sample | Description |
|---------|--------|-------------|
| **Full Update** | `CompleteUpdateSample` | Version discovery โ download โ apply. The classic client-server upgrade flow |
| **Silent Update** | `SilentUpdateSample` | Background polling with pre-exit preparation for zero-user-interaction upgrades |
| **OSS Update** | `OssSample` | Simplified update using a file server and `versions.json` โ no server-side app needed |
| **Binary Differential** | `DifferentialSample` | Generate and apply binary patches between versions to minimize download size |
| **Push Notification** | `PushSample` | Real-time update notifications powered by SignalR |
| **Process Guardian** | `BowlSample` | Crash detection, dump file export, and automatic recovery |
| **Plugin System** | `ExtensionSample` | Custom plugin installation, management, and compatibility checking |
| **Driver Update** | `ImDiskQuickInstallSample` | Driver package installation and update using ImDisk |
| **Compression** | `CompressSample` | Format-agnostic compression, decompression, and integrity verification |
---
## ๐ Repository Structure
```
GeneralUpdate-Samples/
โโโ src/ # Source code and samples
โ โโโ Hub/ # Interactive sample browser (main entry point)
โ โ โโโ Program.cs # Menu loop, server lifecycle, sample discovery
โ โ โโโ AppConfig.cs # Configuration model (appsettings.json)
โ โ โโโ Samples/ # Individual sample implementations
โ โ โโโ ISample.cs # Sample interface (auto-discovered by Hub)
โ โ โโโ CompleteUpdateSample.cs
โ โ โโโ SilentUpdateSample.cs
โ โ โโโ OssSample.cs
โ โ โโโ DifferentialSample.cs
โ โ โโโ PushSample.cs
โ โ โโโ BowlSample.cs
โ โ โโโ ExtensionSample.cs
โ โ โโโ ImDiskQuickInstallSample.cs
โ โ โโโ CompressSample.cs
โ โโโ Server/ # Minimal API server for update delivery
โ โ โโโ Program.cs # Verification, report & file download endpoints
โ โ โโโ DTOs/ # Request/response data transfer objects
โ โ โโโ wwwroot/packages/ # Update package storage
โ โโโ content/ # Intermediate version content (v1.0.0.1, v1.0.0.2)
โ โโโ content_client/ # Client app base content (v1.0.0.0, v2.0.0.0)
โ โโโ content_upgrade/ # Upgrade app base content (v1.0.0.0, v2.0.0.0)
โ โโโ ImDiskDriver/ # ImDisk driver binaries (for driver update demo)
โ โโโ gen_packages.ps1 # Script to generate test update packages
โ โโโ Run.cmd # Windows launcher (double-click to start)
โ โโโ Run.ps1 # PowerShell launcher with -BuildLibs support
โ โโโ GeneralUpdate-Samples.slnx # Solution file (new .slnx format)
โโโ UI/ # UI framework integration samples
โ โโโ AntdUI/ # AntdUI framework sample (WinForms)
โ โโโ LayUI/ # LayUI framework sample (WPF)
โ โโโ SemiUrsa/ # Semi Ursa sample (Avalonia, cross-platform)
โ โโโ WPFDevelopers/ # WPF with custom developer controls
โโโ website/ # Official website source (Docusaurus)
โโโ .github/workflows/ # CI/CD pipelines
โ โโโ dotnet.yml # .NET build workflow
โ โโโ az-swa-deploy.yml # Azure Static Web App deployment (docs site)
โโโ imgs/ # Documentation images
โโโ global.json # .NET SDK version pinning
โโโ Directory.Build.props # Shared MSBuild properties
โโโ LICENSE # Apache 2.0 License
โโโ README.md # This file
```
---
## ๐ Quick Start
### Prerequisites
- [.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) or later
- Windows, Linux, or macOS (Windows recommended for driver and UI samples)
### One-Click Launch
1. **Clone the repository**
```bash
git clone https://github.com/GeneralLibrary/GeneralUpdate-Samples.git
cd GeneralUpdate-Samples/src
```
2. **Run the interactive sample browser**
**On Windows (double-click or terminal):**
```cmd
Run.cmd
```
**On any platform (PowerShell):**
```powershell
.\Run.ps1
```
For contributors who need to rebuild component DLLs from source:
```powershell
.\Run.ps1 -BuildLibs
```
3. **What happens next:**
- The Hub builds and starts the Server automatically
- An interactive menu appears with numbered samples
- Select a sample by number to run it
- The Hub manages server lifecycle: starts before each server-dependent sample, stops afterward
- Type `0` or `q` to exit
### Generating Test Packages
Before running update-dependent samples for the first time, generate test packages:
```powershell
cd src
.\gen_packages.ps1
```
This creates update packages in `src/Server/wwwroot/packages/` with a `versions.json` manifest.
---
## ๐ฅ๏ธ Interactive Sample Browser
The **Hub** (`src/Hub/`) is the central entry point. Instead of launching separate projects manually, you interact with a single console menu:
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GeneralUpdate ็คบไพๆต่งๅจ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. ๅฎๆดๆดๆฐ โ ็ๆฌๅ็ฐโไธ่ฝฝโๅบ็จ
2. ้้ปๆดๆฐ โ ๅๅฐ่ฝฎ่ฏขยท้ๅบๅๅๅค
3. OSS ๆจกๅผ โ ๅฏน่ฑกๅญๅจๆดๆฐ
4. ไบ่ฟๅถๅทฎๅ โ ็ๆยทๅบ็จยทๆ ก้ช
5. SignalR ๆจ้ โ ๅฎๆถๆถๆฏๆฅๆถ
6. ่ฟ็จๅฎๆค โ ๅดฉๆบ็ๆงยทDumpๅฏผๅบ
7. ๆไปถ็ณป็ป โ ๅฎ่ฃ
ยท็ฎก็ยทๅ
ผๅฎนๆง
8. Driver Update
9. ๅ็ผฉๅทฅๅ
ท โ ๅ็ผฉยท่งฃๅยทๆ ก้ช
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
0. ้ๅบ (Exit)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Architecture
- **Samples implement `ISample`** and are auto-discovered via reflection โ no wiring needed
- **Server lifecycle is automatic**: `RequiresServer = true` samples get an isolated Server process started/stopped on demand
- **Clean paths** are reset before each run, ensuring reproducible demos
- **Configuration** is centralized in `src/Hub/appsettings.json`
### Key Code (CompleteUpdateSample)
```csharp
var request = new UpdateRequest
{
UpdateUrl = $"{config.ServerUrl}/Upgrade/Verification",
ReportUrl = $"{config.ServerUrl}/Upgrade/Report",
AppSecretKey = config.AppSecretKey,
InstallPath = mockAppDir,
ClientVersion = config.ClientVersion,
MainAppName = config.MainAppName,
ProductId = config.ProductId
};
var bootstrap = new GeneralUpdateBootstrap()
.SetConfig(request)
.SetOption(Option.AppType, AppType.Client)
.AddListenerUpdateInfo((_, e) => { /* handle version discovery */ })
.AddListenerMultiDownloadStatistics((_, e) => { /* handle progress */ })
.AddListenerMultiDownloadCompleted((_, e) => { /* handle completion */ })
.AddListenerException((_, e) => { /* handle errors */ });
await bootstrap.LaunchAsync();
```
---
## ๐ฆ Sample Catalog
| # | Sample | Requires Server | What It Demonstrates |
|---|--------|:---:|----------------------|
| 1 | **Full Update** | โ
| Complete update pipeline: version check โ download โ apply. Simulates a v1.0.0.0 app upgrading to v2.0.0.0 with file additions, modifications, and deletions |
| 2 | **Silent Update** | โ
| Background polling with configurable intervals. Polls for updates without user interaction, prepares on app exit |
| 3 | **OSS Update** | โ
| Object storage update mode using `versions.json` on a file server. Supports AOT compilation scenarios |
| 4 | **Binary Differential** | โ | Patch generation between two version folders. Identifies changed, new, and deleted files. Validates patch application with SHA256 |
| 5 | **SignalR Push** | โ | Real-time update push via a self-hosted SignalR Hub. Demonstrates client-server messaging for instant update notifications |
| 6 | **Process Guardian** | โ | Bowl integration: crash monitoring, automatic dump file export, system information collection, and driver enumeration |
| 7 | **Plugin System** | โ | Extension plugin installation lifecycle: download โ extract โ validate โ install. Demonstrates compatibility checking and plugin management |
| 8 | **Driver Update** | โ | ImDisk virtual disk driver installation. Demonstrates GeneralUpdate.Drivelution for driver package deployment |
| 9 | **Compression** | โ | Format-agnostic compression and decompression. Tests data integrity with random content verification across all supported compression formats |
---
## ๐จ UI Framework Samples
The `UI/` directory contains integration examples for popular UI frameworks:
| Framework | Path | Type | Platform |
|-----------|------|------|----------|
| **AntdUI** | `UI/AntdUI/Upgrade/` | WinForms with modern Ant Design components | Windows |
| **LayUI** | `UI/LayUI/Upgrade/` | WPF with LayUI styling | Windows |
| **SemiUrsa** | `UI/SemiUrsa/` | Avalonia with Semi design system | Cross-platform |
| **WPFDevelopers** | `UI/WPFDevelopers/Upgrade/` | WPF with custom developer controls | Windows |
Each UI sample demonstrates how to integrate GeneralUpdate's upgrade workflow with specific UI frameworks and design patterns.
---
## ๐ Related Repositories
The GeneralUpdate ecosystem consists of multiple repositories:
| Repository | Description | Links |
|------------|-------------|-------|
| **GeneralUpdate** | Core automatic update component | [GitHub](https://github.com/GeneralLibrary/GeneralUpdate) โข [Gitee](https://gitee.com/GeneralLibrary/GeneralUpdate) โข [GitCode](https://gitcode.com/GeneralLibrary/GeneralUpdate) |
| **GeneralUpdate.Maui** | MAUI updates (Android platform) | [GitHub](https://github.com/GeneralLibrary/GeneralUpdate.Maui) โข [Gitee](https://gitee.com/GeneralLibrary/GeneralUpdate.Maui) |
| **GeneralUpdate.Tools** | Patch creation and packaging tools | [GitHub](https://github.com/GeneralLibrary/GeneralUpdate.Tools) โข [Gitee](https://gitee.com/GeneralLibrary/GeneralUpdate.Tools) |
| **GeneralUpdate-Samples** | Usage examples (this repository) | [GitHub](https://github.com/GeneralLibrary/GeneralUpdate-Samples) โข [Gitee](https://gitee.com/GeneralLibrary/GeneralUpdate-Samples) |
---
## ๐ Documentation
### Official Documentation
- ๐ **Official Website**: [https://www.justerzhu.cn/](https://www.justerzhu.cn/)
- ๐ **Quick Start Guide**: [https://www.justerzhu.cn/docs/quickstart/quickstart](https://www.justerzhu.cn/docs/quickstart/quickstart)
- ๐ฅ **Video Tutorial**: [Bilibili](https://www.bilibili.com/video/BV1c8iyYZE7P)
### Documentation in this Repository
The `website/` directory contains the full documentation source built with [Docusaurus](https://docusaurus.io/):
```bash
cd website
# Install dependencies
npm install
# Start local development server
npm run start
# Build for production
npm run build
```
**Documentation Structure:**
- `website/docs/doc/` - Component documentation
- `website/docs/quickstart/` - Quick start guides
- `website/docs/guide/` - Advanced guides
- `website/docs/releaselog/` - Release notes
- `website/i18n/` - Internationalization (English, Chinese)
---
## ๐ป Requirements
### Runtime Requirements
- **.NET 10.0 Runtime** or later
- **Operating Systems**: Windows, Linux, macOS, Android (with MAUI)
- **Supported Platforms**: x64, ARM64, LoongArch
### Supported Frameworks
- .NET 8.0+
- .NET Framework 4.6.1+
### Supported UI Frameworks
- WPF (Windows Presentation Foundation)
- WinForms (Windows Forms)
- Avalonia (Cross-platform)
- MAUI (Android)
- WinUI 3
- Console Applications
### Tested Operating Systems
- โ
Windows 10/11
- โ
Windows Server 2016+
- โ
Linux (Ubuntu, Debian, CentOS)
- โ
macOS (including M1/M2)
- โ
Android (via MAUI)
- โ
Kylin V10 (ARM and x64)
- โ
UOS (Union Operating System)
- โ
Huawei EulerOS
- โ
Loongson (LoongArch)
---
## ๐ค Contributing
Contributions are welcome! Here's how you can help:
1. **Fork the repository**
2. **Create a feature branch**
```bash
git checkout -b feature/your-feature-name
```
3. **Commit your changes**
```bash
git commit -am 'Add some feature'
```
4. **Push to the branch**
```bash
git push origin feature/your-feature-name
```
5. **Open a Pull Request**
### Guidelines
- Add new samples by implementing `ISample` (see `src/Hub/Samples/ISample.cs`)
- Give your sample a unique `Index` number and descriptive `Name`
- Set `RequiresServer` appropriately
- Specify `CleanPaths` to ensure reproducible runs
- Follow existing code style and patterns
- Update documentation as needed
---
## ๐ฌ Support
### Free Support
- ๐ **Issues**: [GitHub Issues](https://github.com/GeneralLibrary/GeneralUpdate/issues)
- ๐ฌ **Discussion Group**: QQ Group 748744489 (GeneralUpdate Discussion)
- ๐ ๏ธ **Technical Exchange**: QQ Group 341349660 (.NET Technical Exchange)
### Contact
- ๐ง **Email**: zhuzhen723723@outlook.com
- ๐ **Official Website**: [https://www.justerzhu.cn/](https://www.justerzhu.cn/)
### Commercial Support
For customized development, technical consultation, or sponsorship opportunities, please contact the author via email or official website.
---
## ๐ License
This project is licensed under the **Apache License 2.0** - see the [LICENSE](LICENSE) file for details.
```
Copyright 2025 Juster Zhu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
---
## ๐ Acknowledgments
Special thanks to all [contributors](https://github.com/GeneralLibrary/GeneralUpdate-Samples/graphs/contributors) and the community for their support and contributions to the GeneralUpdate project.
### Project Maintainer
- **Juster Zhu** - *Initial work and maintenance* - [GitHub](https://github.com/JusterZhu)
---
**โญ If you find this project useful, please consider giving it a star! โญ**
**Updates limitless, upgrades boundless.**