SnkUpdateMaster.Core
1.0.1
See the version list below for details.
dotnet add package SnkUpdateMaster.Core --version 1.0.1
NuGet\Install-Package SnkUpdateMaster.Core -Version 1.0.1
<PackageReference Include="SnkUpdateMaster.Core" Version="1.0.1" />
<PackageVersion Include="SnkUpdateMaster.Core" Version="1.0.1" />
<PackageReference Include="SnkUpdateMaster.Core" />
paket add SnkUpdateMaster.Core --version 1.0.1
#r "nuget: SnkUpdateMaster.Core, 1.0.1"
#:package SnkUpdateMaster.Core@1.0.1
#addin nuget:?package=SnkUpdateMaster.Core&version=1.0.1
#tool nuget:?package=SnkUpdateMaster.Core&version=1.0.1
SnkUpdateMaster.Core
Purpose: the base module with business logic, interfaces, and ready-made implementations for the update pipeline.
Typical usage
Key interfaces:
IUpdateInfoProvider- fetches information about the available update.IUpdateDownloader- downloads the update file.IInstaller- applies the downloaded file to the application.IIntegrityVerifier- validates the checksum before installation.ICurrentVersionManager- reads and updates the current application version.
Built-in implementations:
ZipInstaller- unpacks an update from a ZIP archive with backup.ShaIntegrityVerifier- SHA‑256 integrity check.FileVersionManager- stores the version in a text file (major.minor.build).
Use UpdateManager to orchestrate download and installation. Build it via UpdateManagerBuilder:
var updateManager = new UpdateManagerBuilder()
.WithZipInstaller("path to app folder")
.WithFileCurrentVersionManager()
.WithSha256IntegrityVerifier()
.AddDependency<IUpdateInfoProvider>(customImplementation)
.AddDependency<IUpdateDownloader>(customImplementation)
.Build();
Check for updates and install:
var updated = await updateManager.CheckAndInstallUpdatesAsync(progress);
💡 Besides the built-ins, you can register custom interface implementations via
AddDependencyand mix them with provided components.
Main subsystems
- Application update (
UpdateManager)
Files:UpdateManager.cs,UpdateManagerBuilder.cs,UpdateInfo.cs
Types:UpdateManager- orchestrates the full update flow:- get current version (
ICurrentVersionManager); - get available update info (
IUpdateInfoProvider); - download update file (
IUpdateDownloader); - verify checksum (
IIntegrityVerifier); - install update (
IInstaller); - update stored version (
ICurrentVersionManager.UpdateCurrentVersionAsync).
Main method:
ReturnsTask<bool> CheckAndInstallUpdatesAsync( IProgress<double> progress, CancellationToken cancellationToken = default);trueif an update was found and installed.- get current version (
UpdateInfo- metadata:Id,Version(System.Version),FileName,Checksum(SHA‑256 hex),ReleaseDate(UTC),FileDir.UpdateManagerBuilder(inheritsDependencyBuilder<UpdateManager>) - fluent builder with shortcuts:WithFileCurrentVersionManager()- stores version inversionfile underEnvironment.CurrentDirectory;WithSha256IntegrityVerifier()- SHA‑256 integrity check;WithZipInstaller(string appDir)- expands ZIP archive overappDirwith backup.
Sources and downloaders are added directly viaAddDependency<T>or through module extensions (Ftp,SqlServer).
- Version management (
VersionManager)
Files:VersionManager/ICurrentVersionManager.cs,VersionManager/FileVersionManager.csICurrentVersionManager- abstraction over version storage.FileVersionManager- stores version in aversiontext file (major.minor.build), creates the file on first update.
- Update providers (
UpdateSource)
File:UpdateSource/IUpdateInfoProvider.csIUpdateInfoProvider- gets the latest available update from any source (FTP, DB, file system, etc.).
Concrete implementations live inSnkUpdateMaster.FtpandSnkUpdateMaster.SqlServer.
- Downloaders (
Downloader)
File:Downloader/IUpdateDownloader.csIUpdateDownloader- async download of the update file (HTTP, FTP, DB, local copy, etc.), returning a local path.
Implementations reside inSnkUpdateMaster.FtpandSnkUpdateMaster.SqlServer.
- Installers (
Installer)
Files:Installer/IInstaller.cs,Installer/ZipInstaller.csIInstaller- “how to apply the downloaded update.”ZipInstaller:- makes a full backup of the application directory;
- unpacks the ZIP over the app;
- on failure, attempts rollback by restoring the backup.
⚠️
ZipInstallerperforms destructive file-system operations (delete/move directories). Use only when the app is stopped. - Integrity and checksums (
Integrity)
Files:Integrity/IChecksumCalculator.cs,Integrity/IIntegrityProvider.cs,Integrity/IIntegrityVerifier.cs,Integrity/ShaChecksumCalculator.cs,Integrity/ShaIntegrityProvider.cs,Integrity/ShaIntegrityVerifier.cs,Integrity/IntegrityProviderType.cs
Types:IChecksumCalculator- compute file checksum;IIntegrityProvider- a wrapper around the calculator, can add extra checks;IIntegrityVerifier- compares calculated checksum against expected;ShaChecksumCalculator/ShaIntegrityProvider/ShaIntegrityVerifier- SHA‑256 implementations.
- Parsing update manifests (
Files)
Files:Files/IUpdateInfoFileParser.cs,Files/JsonUpdateInfoFileParser.csIUpdateInfoFileParser- parses update metadata files.JsonUpdateInfoFileParser- JSON parser. Expected format (seetests/ftp-data/manifest.json):{ "id": 1, "version": "1.0.1", "fileName": "release-1.0.1.zip", "fileDir": "/", "checksum": "…sha256…", "releaseDate": "2025-11-29" }
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on SnkUpdateMaster.Core:
| Package | Downloads |
|---|---|
|
SnkUpdateMaster.Ftp
Module that retrieves update metadata and archives via FTP/SFTP. |
|
|
SnkUpdateMaster.SqlServer
Extensions that fetch update metadata and files directly from Microsoft SQL Server. |
|
|
SnkUpdateMaster.FileSystem
A module that reads metadata and files updated from the local file system. |
|
|
SnkUpdateMaster.Http
Module that retrieves update metadata and archives via HTTP/HTTPS. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- The progress parameter is no longer required.
- Added an error handler for failed integrity checks.
- Added a CancellationToken for retrieving update metadata.
- Added a check for available disk space before installation.
Bugs fixed:
- The application backup is not stored in the application folder.
- When updates are successfully installed, the backup folder is deleted.