|
| 1 | +# GeneralUpdate.Maui |
| 2 | + |
| 3 | +[](https://github.com/{{GitHub Owner}}/{{Repository Name}}/stargazers) |
| 4 | +[](https://github.com/{{GitHub Owner}}/{{Repository Name}}/network/members) |
| 5 | +[](./LICENSE) |
| 6 | +[](https://github.com/{{GitHub Owner}}/{{Repository Name}}/releases) |
| 7 | + |
| 8 | +[简体中文](./README.md) |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Introduction |
| 13 | + |
| 14 | +**GeneralUpdate.Maui** is an auto-update capability library for the .NET MAUI ecosystem, designed to provide a standardized, extensible, and maintainable update workflow. |
| 15 | + |
| 16 | +The project currently focuses on Android and provides a UI-less update orchestration core that can be integrated into enterprise apps, utility libraries, component libraries, and business systems. |
| 17 | + |
| 18 | +## Core Features |
| 19 | + |
| 20 | +- **Update validation**: Supports version checks and update eligibility validation. |
| 21 | +- **Resumable download**: Implements resumable package downloads based on HTTP Range. |
| 22 | +- **Integrity verification**: Built-in SHA256 verification for package integrity and safety. |
| 23 | +- **Installer triggering**: Supports Android `FileProvider` and system installer intents. |
| 24 | +- **Event-driven workflow**: Exposes lifecycle and download-statistics events for monitoring and extension. |
| 25 | + |
| 26 | +## Quick Start |
| 27 | + |
| 28 | +### 1. Prerequisites |
| 29 | + |
| 30 | +- .NET SDK: `{{.NET SDK Version}}` (recommended `10.0` or later) |
| 31 | +- Target platform: `{{Target Platform}}` (for example, `Android`) |
| 32 | +- Optional IDE: `{{IDE}}` (for example, Visual Studio / JetBrains Rider) |
| 33 | + |
| 34 | +### 2. Installation |
| 35 | + |
| 36 | +```bash |
| 37 | +dotnet add {{Project Path}} package {{Package Name}} --version {{Package Version}} |
| 38 | +``` |
| 39 | + |
| 40 | +Or use your project's standard dependency management command: |
| 41 | + |
| 42 | +```bash |
| 43 | +{{Installation Command}} |
| 44 | +``` |
| 45 | + |
| 46 | +### 3. Basic Usage |
| 47 | + |
| 48 | +```csharp |
| 49 | +using GeneralUpdate.Maui.Android.Models; |
| 50 | +using GeneralUpdate.Maui.Android.Services; |
| 51 | + |
| 52 | +var bootstrap = GeneralUpdateBootstrap.CreateDefault(); |
| 53 | + |
| 54 | +bootstrap.AddListenerValidate += (_, e) => |
| 55 | +{ |
| 56 | + Console.WriteLine($"New version detected: {e.PackageInfo.Version}"); |
| 57 | +}; |
| 58 | + |
| 59 | +var package = new UpdatePackageInfo |
| 60 | +{ |
| 61 | + Version = "{{Target Version}}", |
| 62 | + VersionName = "{{Target Version Name}}", |
| 63 | + ReleaseNotes = "{{Release Notes}}", |
| 64 | + DownloadUrl = "{{Download Url}}", |
| 65 | + Sha256 = "{{SHA256 Value}}", |
| 66 | + PackageSize = {{Package Size}} |
| 67 | +}; |
| 68 | + |
| 69 | +var options = new UpdateOptions |
| 70 | +{ |
| 71 | + CurrentVersion = "{{Current Version}}", |
| 72 | + InstallOptions = new AndroidInstallOptions |
| 73 | + { |
| 74 | + FileProviderAuthority = "{{FileProvider Authority}}" |
| 75 | + } |
| 76 | +}; |
| 77 | + |
| 78 | +var check = await bootstrap.ValidateAsync(package, options, CancellationToken.None); |
| 79 | +if (check.IsUpdateAvailable) |
| 80 | +{ |
| 81 | + await bootstrap.ExecuteUpdateAsync(package, options, CancellationToken.None); |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Directory Structure |
| 86 | + |
| 87 | +```text |
| 88 | +{{Repository Name}}/ |
| 89 | +├── README.md |
| 90 | +├── README-EN.md |
| 91 | +├── LICENSE |
| 92 | +└── src/ |
| 93 | + ├── GeneralUpdate.Maui.Android/ |
| 94 | + └── GeneralUpdate.Maui.Android.Tests/ |
| 95 | +``` |
| 96 | + |
| 97 | +## Contributing |
| 98 | + |
| 99 | +Contributions are welcome through the standard GitHub collaboration workflow: |
| 100 | + |
| 101 | +1. Fork this repository. |
| 102 | +2. Create a feature branch: `git checkout -b feature/{{feature-name}}`. |
| 103 | +3. Follow the project coding standards and complete required tests. |
| 104 | +4. Commit your changes: `git commit -m "feat: {{change summary}}"`. |
| 105 | +5. Push your branch and open a Pull Request. |
| 106 | + |
| 107 | +Before submitting a PR, please make sure: |
| 108 | + |
| 109 | +- your change scope is clear and focused; |
| 110 | +- related docs and examples are updated; |
| 111 | +- no new security risks or breaking behavior are introduced. |
| 112 | + |
| 113 | +## License |
| 114 | + |
| 115 | +This project is licensed under the **Apache License 2.0**. See [LICENSE](./LICENSE) for details. |
| 116 | + |
| 117 | +## Contact |
| 118 | + |
| 119 | +- Maintainer: `{{Maintainer Name}}` |
| 120 | +- Email: `{{Contact Email}}` |
| 121 | +- Issue Tracker: <https://github.com/{{GitHub Owner}}/{{Repository Name}}/issues> |
0 commit comments