Files
HashTool/tests/Compat/LegacyClient/Program.cs
T
poli0981andClaude Opus 5.5 4bd17a50f4 feat: hashtool CLI, app tests, release packaging inputs and benchmarks
- src/HashTool.Cli: `hashtool hash | verify | check | algorithms` on top of
  Core, NativeAOT-ready (3.9 MB native binary), coreutils-style output and
  exit codes (0 ok, 1 failed/mismatch, 2 usage or unreadable checksum
  file); Windows paths are written with '/' so lines need no escaping.
- tests/HashTool.Cli.Tests: commands, formats and exit codes.
- tests/HashTool.App.Tests (Avalonia headless): every page in several
  languages including RTL, a folder create-and-verify flow, translation
  integrity (keys, placeholders, Languages.json/resx/project wiring,
  satellite assemblies, unused keys), system language detection, command
  line parsing and helpers.
- tests/Compat/LegacyClient: drives Velopack 0.0.1298 (the library inside
  Hash Tool 1.1.x) against new release files for the upgrade gate.
- build/macos/Info.plist keeps the 1.x bundle identity and adds "Open
  With" document types; build/linux/hashtool.png is the AppImage icon.
- bench/HashTool.Benchmarks (BenchmarkDotNet) and a tool manifest pinning
  vpk 1.2.161, nuget-license and CycloneDX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:16:40 +07:00

50 lines
2.0 KiB
C#

using System;
using System.IO;
using Velopack;
using Velopack.Locators;
using Velopack.Sources;
// Usage: LegacyClient <releases-dir> <channel> <installed-version> <expected-version> <root-dir> <app-dir> <update-exe> <packages-dir>
//
// Uses Velopack 0.0.1298 - the library inside Hash Tool 1.1.x - to read the new release feed, pick the update and
// download it with its checksum checks, exactly as an installed 1.1.x copy would. Prints the downloaded package path;
// the release workflow then lets the old updater apply it and smoke-tests the result.
if (args.Length != 8)
{
Console.Error.WriteLine("usage: LegacyClient <releases-dir> <channel> <installed-version> <expected-version> <root-dir> <app-dir> <update-exe> <packages-dir>");
return 2;
}
var (releases, channel, installed, expected, root, app, updateExe, packages) =
(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
Directory.CreateDirectory(packages);
var locator = new TestVelopackLocator("HashTool", installed, packages, app, root, updateExe, channel);
var manager = new UpdateManager(new SimpleFileSource(new DirectoryInfo(releases)), new UpdateOptions { ExplicitChannel = channel }, locator);
var update = manager.CheckForUpdates();
if (update is null)
{
Console.Error.WriteLine($"Velopack 0.0.1298 found no update for {installed} on channel '{channel}' in {releases}.");
return 1;
}
var found = update.TargetFullRelease.Version.ToString();
if (!string.Equals(found, expected, StringComparison.Ordinal))
{
Console.Error.WriteLine($"Velopack 0.0.1298 offered {found}, expected {expected}.");
return 1;
}
manager.DownloadUpdates(update);
var package = Path.Combine(packages, update.TargetFullRelease.FileName);
if (!File.Exists(package))
{
Console.Error.WriteLine($"The downloaded package is missing: {package}");
return 1;
}
Console.Error.WriteLine($"Velopack 0.0.1298 downloaded and verified {update.TargetFullRelease.FileName} ({found}).");
Console.WriteLine(package);
return 0;