Skip to content

GeneralLibrary/GeneralUpdate-Samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

247 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GeneralUpdate-Samples

Usage Examples and Quick Start Repository for GeneralUpdate

GitHub Gitee License .NET

English | δΈ­ζ–‡ζ–‡ζ‘£


πŸ“– Table of Contents


🌟 Overview

GeneralUpdate-Samples is the official sample repository for the GeneralUpdate project, which is an open-source cross-platform application automatic update component based on .NET Standard 2.0. This repository provides comprehensive code examples, demonstrations, and quick start guides to help developers understand and integrate automatic update functionality into their applications.

GeneralUpdate supports various update mechanisms including:

  • βœ… 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

🎯 Key Features

This repository provides working examples for all major features of GeneralUpdate:

Feature Description Sample Location
Standard Update Traditional client-server update mechanism src/Client, src/Server, src/Upgrade
OSS Update Simplified update using file server and version.json src/OSS
Differential Update Binary patch generation and application src/Diff
Process Monitoring Crash detection and diagnostic information export src/Bowl
Push Updates Real-time update notifications using SignalR src/Push
Compression Compression capability testing and debugging src/Compress
Driver Update Driver package update capabilities src/Drivelution
Extension Custom extension development examples src/Extension

πŸ“ Repository Structure

GeneralUpdate-Samples/
β”œβ”€β”€ src/                          # Source code and samples
β”‚   β”œβ”€β”€ Client/                   # Main client application sample
β”‚   β”œβ”€β”€ Server/                   # Server application (Minimal API)
β”‚   β”œβ”€β”€ Upgrade/                  # Upgrade assistant sample
β”‚   β”œβ”€β”€ OSS/                      # OSS update samples
β”‚   β”‚   β”œβ”€β”€ OSSClientSample/      # OSS client sample
β”‚   β”‚   └── OSSUpgradeSample/     # OSS upgrade sample
β”‚   β”œβ”€β”€ Bowl/                     # Process crash monitoring sample
β”‚   β”œβ”€β”€ Diff/                     # Differential patch generation sample
β”‚   β”œβ”€β”€ Compress/                 # Compression capability sample
β”‚   β”œβ”€β”€ Push/                     # Update push notification sample
β”‚   β”œβ”€β”€ Drivelution/              # Driver update sample
β”‚   β”œβ”€β”€ Extension/                # Extension development sample
β”‚   β”œβ”€β”€ start.cmd                 # Standard update demo launcher
β”‚   └── oss_start.cmd             # OSS update demo launcher
β”œβ”€β”€ UI/                           # UI framework integration samples
β”‚   β”œβ”€β”€ AntdUI/                   # AntdUI framework sample
β”‚   β”œβ”€β”€ LayUI/                    # LayUI framework sample
β”‚   β”œβ”€β”€ SemiUrsa/                 # Semi Ursa (Avalonia) sample
β”‚   └── WPFDevelopers/            # WPF framework sample
β”œβ”€β”€ website/                      # Official website source code (Docusaurus)
β”œβ”€β”€ imgs/                         # Documentation images
β”œβ”€β”€ LICENSE                       # Apache 2.0 License
└── README.md                     # This file

πŸš€ Quick Start

Prerequisites

  • .NET 8.0 SDK or later
  • Windows OS (for .cmd scripts) or cross-platform support with .NET

Standard Update Demo

  1. Clone the repository

    git clone https://github.com/GeneralLibrary/GeneralUpdate-Samples.git
    cd GeneralUpdate-Samples/src
  2. Run the standard update demo

    start.cmd

    This script will:

    • Build the Client, Server, and Upgrade projects
    • Copy compiled files to the run directory
    • Start the Server application
    • Start the Client application
    • Automatically trigger the update process
  3. Verify the update

    • The Client will detect available updates from the Server
    • Download and apply the update package
    • Restart automatically after update completion
    • Check for the new file Congratulations on the update.txt in the run directory

OSS Update Demo

For a simplified update mechanism without server-side code:

cd src
oss_start.cmd

This demonstrates OSS-based updates using only a version.json configuration file on a file server.


πŸ“¦ Sample Projects

Client Sample (src/Client)

Demonstrates the main application that requires updating. Key features:

  • Version detection and verification
  • Update package download with progress tracking
  • Event-based notification system
  • Automatic restart after update

Key Code:

var configinfo = new Configinfo
{
    UpdateUrl = "http://127.0.0.1:5000/Upgrade/Verification",
    MainAppName = "ClientSample.exe",
    ClientVersion = "1.0.0.0",
    ProductId = "2d974e2a-31e6-4887-9bb1-b4689e98c77a"
};

await new GeneralClientBootstrap()
    .AddListenerMultiDownloadStatistics(OnMultiDownloadStatistics)
    .AddListenerMultiDownloadCompleted(OnMultiDownloadCompleted)
    .AddListenerException(OnException)
    .SetConfig(configinfo)
    .LaunchAsync();

Server Sample (src/Server)

Minimal API server providing update information and package distribution:

  • Version verification endpoint
  • Update package download endpoint
  • Update status reporting

Key Code:

app.MapPost("/Upgrade/Verification", (VerifyDTO request) =>
{
    var result = new List<VerificationResultDTO>
    {
        new VerificationResultDTO
        {
            Version = "1.0.0.1",
            Url = "http://localhost:5000/packages/packet.zip",
            Hash = "...",
            Size = packet.Length
        }
    };
    return HttpResponseDTO<IEnumerable<VerificationResultDTO>>.Success(result);
});

Upgrade Sample (src/Upgrade)

Independent upgrade process that updates the main application:

  • Downloads update packages
  • Applies updates while main app is closed
  • Restarts main application after update
  • Provides rollback capability on failure

OSS Update Sample (src/OSS)

Simplified update mechanism:

  • No server-side code required
  • Uses version.json configuration on file server
  • Direct file server integration (Alibaba Cloud OSS, AWS S3, etc.)
  • Supports AOT compilation

version.json Example:

[
  {
    "PacketName": "packet_20250102230201638_1.0.0.1",
    "Hash": "ad1a85a9169ca0083ab54ba390e085c56b9059efc3ca8aa1ec9ed857683cc4b1",
    "Version": "1.0.0.1",
    "Url": "http://localhost:5000/packages/packet_20250102230201638_1.0.0.1.zip"
  }
]

Bowl Sample (src/Bowl)

Process crash monitoring and diagnostic information export:

  • Monitors main application health
  • Captures crash dump files
  • Exports system information
  • Provides automatic rollback on crash

Exports on Crash:

  • πŸ“’ Dump file (.dmp)
  • πŸ“’ Version information (.json)
  • πŸ“’ Driver information (driverInfo.txt)
  • πŸ“’ System information (systeminfo.txt)
  • πŸ“’ Event logs (systemlog.evtx)

Diff Sample (src/Diff)

Binary differential update implementation:

  • Generates differential patches between versions
  • Identifies changed, new, and deleted files
  • Supports blacklist for excluded files
  • Reduces update package size significantly

Push Sample (src/Push)

Real-time update notification using SignalR:

  • Push latest version information to clients
  • Immediate update notifications
  • Supports forced update triggers

🎨 UI Framework Samples

The UI/ directory contains integration examples for various UI frameworks:

Framework Path Description
AntdUI UI/AntdUI Modern UI components for Windows Forms
LayUI UI/LayUI WPF UI framework integration
SemiUrsa UI/SemiUrsa Avalonia UI framework (cross-platform)
WPFDevelopers UI/WPFDevelopers WPF with custom controls

Each UI sample demonstrates how to integrate GeneralUpdate 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 β€’ Gitee β€’ GitCode
GeneralUpdate.Maui MAUI updates (Android platform) GitHub β€’ Gitee
GeneralUpdate.Tools Patch creation and packaging tools GitHub β€’ Gitee
GeneralUpdate-Samples Usage examples (this repository) GitHub β€’ Gitee

πŸ“š Documentation

Official Documentation

Documentation in this Repository

The website/ directory contains the full documentation source built with Docusaurus:

Building the Documentation Website:

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 8.0 Runtime or later
  • Operating Systems: Windows, Linux, macOS, Android (with MAUI)
  • Supported Platforms: x64, ARM64, LoongArch

Supported Frameworks

  • .NET Core 2.0+
  • .NET 5, 6, 7, 8+
  • .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
    git checkout -b feature/your-feature-name
  3. Commit your changes
    git commit -am 'Add some feature'
  4. Push to the branch
    git push origin feature/your-feature-name
  5. Open a Pull Request

Guidelines

  • Follow existing code style and patterns
  • Add samples for new features
  • Update documentation as needed
  • Test your changes thoroughly

πŸ’¬ Support

Free Support

  • πŸ› Issues: GitHub Issues
  • πŸ’¬ Discussion Group: QQ Group 748744489 (GeneralUpdate Discussion)
  • πŸ› οΈ Technical Exchange: QQ Group 341349660 (.NET Technical Exchange)

Contact

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 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 and the community for their support and contributions to the GeneralUpdate project.

Project Maintainer

  • Juster Zhu - Initial work and maintenance - GitHub

⭐ If you find this project useful, please consider giving it a star! ⭐

Updates limitless, upgrades boundless.

About

Example code for automatic upgrades to help you get started quickly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7