SnkUpdateMaster.Core 1.0.1

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SnkUpdateMaster.Core" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SnkUpdateMaster.Core" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SnkUpdateMaster.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SnkUpdateMaster.Core --version 1.0.1
                    
#r "nuget: SnkUpdateMaster.Core, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SnkUpdateMaster.Core@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SnkUpdateMaster.Core&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=SnkUpdateMaster.Core&version=1.0.1
                    
Install as a Cake Tool

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 AddDependency and mix them with provided components.

Main subsystems
  1. Application update (UpdateManager)
    Files: UpdateManager.cs, UpdateManagerBuilder.cs, UpdateInfo.cs
    Types:
    • UpdateManager - orchestrates the full update flow:
      1. get current version (ICurrentVersionManager);
      2. get available update info (IUpdateInfoProvider);
      3. download update file (IUpdateDownloader);
      4. verify checksum (IIntegrityVerifier);
      5. install update (IInstaller);
      6. update stored version (ICurrentVersionManager.UpdateCurrentVersionAsync).
        Main method:
      Task<bool> CheckAndInstallUpdatesAsync(
          IProgress<double> progress,
          CancellationToken cancellationToken = default);
      
      Returns true if an update was found and installed.
    • UpdateInfo - metadata: Id, Version (System.Version), FileName, Checksum (SHA‑256 hex), ReleaseDate (UTC), FileDir.
    • UpdateManagerBuilder (inherits DependencyBuilder<UpdateManager>) - fluent builder with shortcuts:
      • WithFileCurrentVersionManager() - stores version in version file under Environment.CurrentDirectory;
      • WithSha256IntegrityVerifier() - SHA‑256 integrity check;
      • WithZipInstaller(string appDir) - expands ZIP archive over appDir with backup.
        Sources and downloaders are added directly via AddDependency<T> or through module extensions (Ftp, SqlServer).
  2. Version management (VersionManager)
    Files: VersionManager/ICurrentVersionManager.cs, VersionManager/FileVersionManager.cs
    • ICurrentVersionManager - abstraction over version storage.
    • FileVersionManager - stores version in a version text file (major.minor.build), creates the file on first update.
  3. Update providers (UpdateSource)
    File: UpdateSource/IUpdateInfoProvider.cs
    • IUpdateInfoProvider - gets the latest available update from any source (FTP, DB, file system, etc.).
      Concrete implementations live in SnkUpdateMaster.Ftp and SnkUpdateMaster.SqlServer.
  4. Downloaders (Downloader)
    File: Downloader/IUpdateDownloader.cs
    • IUpdateDownloader - async download of the update file (HTTP, FTP, DB, local copy, etc.), returning a local path.
      Implementations reside in SnkUpdateMaster.Ftp and SnkUpdateMaster.SqlServer.
  5. Installers (Installer)
    Files: Installer/IInstaller.cs, Installer/ZipInstaller.cs
    • IInstaller - “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.

    ⚠️ ZipInstaller performs destructive file-system operations (delete/move directories). Use only when the app is stopped.

  6. 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.
  7. Parsing update manifests (Files)
    Files: Files/IUpdateInfoFileParser.cs, Files/JsonUpdateInfoFileParser.cs
    • IUpdateInfoFileParser - parses update metadata files.
    • JsonUpdateInfoFileParser - JSON parser. Expected format (see tests/ftp-data/manifest.json):
      {
        "id": 1,
        "version": "1.0.1",
        "fileName": "release-1.0.1.zip",
        "fileDir": "/",
        "checksum": "…sha256…",
        "releaseDate": "2025-11-29"
      }
      
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
2.1.0 198 1/17/2026
2.0.0 167 1/9/2026
1.0.1 147 12/28/2025
1.0.0 217 12/21/2025

- 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.