thecr3w-dev/docs/WINDOWS-SDK.md

51 lines
1.7 KiB
Markdown

# THECR3W-DEV — WINDOWS UPDATE SDK
## Wersja: 1.0.0 | Data: 2026-10-31
---
## 1. Przegląd Biblioteki
`TheCr3w.WindowsUpdate.Sdk` to lekka, niezawodna biblioteka dla aplikacji desktopowych Windows (.NET 8 / 9 / 10, WPF, WinForms, Avalonia, Console) umożliwiająca:
- Cykliczne sprawdzanie aktualizacji w Native Update API (`https://app.thecr3wnet.com`).
- Obsługę kanałów wydań (`stable`, `beta`, `nightly`).
- Weryfikację integralności binarnej SHA256 pobranych instalatorów (EXE, MSI, ZIP).
- Weryfikację cyfrową Ed25519 metadanych wydania.
- Bezpośrednie pobieranie instalatorów z Cloudflare R2 przez krótko żyjące Pre-signed URLs.
- Wsparcie dla aktualizacji wymuszonych (`mandatory: true`) oraz instalatorów zewnętrznych.
---
## 2. Przykład Użycia
```csharp
using TheCr3w.WindowsUpdate.Sdk;
var updater = new TheCr3wUpdater(new TheCr3wUpdaterOptions
{
ApiBaseUrl = "https://app.thecr3wnet.com",
AppId = "thecr3w-desktop",
CurrentVersion = "1.0.0",
CurrentVersionCode = 10,
Channel = "stable",
Architecture = "x86_64"
});
// 1. Sprawdzenie aktualizacji
var update = await updater.CheckForUpdateAsync();
if (update.UpdateAvailable)
{
Console.WriteLine($"Dostępna nowa wersja: {update.LatestVersion}!");
Console.WriteLine($"Changelog: {update.ReleaseNotes}");
// 2. Pobranie i weryfikacja sumy SHA256
var tempPath = Path.Combine(Path.GetTempPath(), "TheCr3wSetup.exe");
var progress = new Progress<double>(p => Console.WriteLine($"Postęp: {p:P0}"));
await updater.DownloadAndVerifyAsync(update, tempPath, progress);
// 3. Uruchomienie instalatora i zakończenie aplikacji
TheCr3wUpdater.LaunchInstallerAndExit(tempPath, "/SILENT");
}
```