Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
feat(update): add cross-platform in-app download and update restart for Windows, macOS, and Linux
gtxPrime462ecfc319a3
diff --git a/src/Filee.App/Services/UpdateService.cs b/src/Filee.App/Services/UpdateService.csindex 12d5d617..8fc1487a 100644--- a/src/Filee.App/Services/UpdateService.cs+++ b/src/Filee.App/Services/UpdateService.cs@@ -5,8 +5,11 @@using System.ComponentModel;using System.Diagnostics;+using System.Formats.Tar;+using System.IO.Compression;using System.Net.Http.Headers;using System.Reflection;+using System.Runtime.InteropServices;using System.Security.Cryptography;using System.Text.Json;using Avalonia.Threading;@@ -84,17 +87,32 @@ public sealed partial class UpdateService : ObservableObjectpublic const string WebsiteUrl = "https://filee.sh/";/// <summary>- /// True when this copy was installed by Setup, which puts its uninstaller next to Filee.exe (uninstall.exe; the- /// Inno Setup installer of 1.x put unins000.exe there). Only then can the new installer update it in place; the- /// portable zip and a copy run from source have no uninstaller.+ /// True when this copy was installed by Setup or package installer:+ /// On Windows: puts its uninstaller next to Filee.exe (uninstall.exe; 1.x put unins000.exe).+ /// On Linux: installed with .filee-package marker (install.sh).+ /// On macOS: app bundle inside /Applications or ~/Applications./// </summary>- public static bool IsInstalled { get; } = OperatingSystem.IsWindows() && IsInstalledIn(AppContext.BaseDirectory);+ public static bool IsInstalled { get; } = IsInstalledIn(AppContext.BaseDirectory);- internal static bool IsInstalledIn(string folder) =>- File.Exists(Path.Combine(folder, "uninstall.exe")) || File.Exists(Path.Combine(folder, "unins000.exe"));+ internal static bool IsInstalledIn(string folder)+ {+ if (OperatingSystem.IsWindows())+ return File.Exists(Path.Combine(folder, "uninstall.exe")) || File.Exists(Path.Combine(folder, "unins000.exe"));+ if (OperatingSystem.IsLinux())+ return File.Exists(Path.Combine(folder, ".filee-package")) || folder.Contains("/.local/share/filee", StringComparison.Ordinal);+ if (OperatingSystem.IsMacOS())+ return folder.Contains("/Applications/", StringComparison.Ordinal);+ return false;+ }++ /// <summary>Whether <see cref="UpdateAsync"/> installs by itself (defaults to true; tests may override).</summary>+ internal bool InstallsItself { get; init; } = true;- /// <summary>Whether <see cref="UpdateAsync"/> installs by itself (<see cref="IsInstalled"/>; tests set it).</summary>- internal bool InstallsItself { get; init; } = IsInstalled;+ /// <summary>Allows unit tests to mock the update application and restart process.</summary>+ internal Func<string, Task>? CustomUpdateRunner { get; set; }++ /// <summary>Action invoked to exit the application during an update restart.</summary>+ internal Action ShutdownAction { get; set; } = ExitApplication;/// <summary>The newer version found by the last check (e.g. "1.0.2"), or null when up to date / unknown.</summary>[ObservableProperty]@@ -263,11 +281,11 @@ public sealed partial class UpdateService : ObservableObjectreturn;}- string installer;+ string packageFile;try{var progress = new Progress<int>(percent => DownloadPercent = percent);- installer = await DownloadInstallerAsync(Path.Combine(Path.GetTempPath(), "Filee-update"), progress);+ packageFile = await DownloadInstallerAsync(Path.Combine(Path.GetTempPath(), "Filee-update"), progress);}catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or IOExceptionor InvalidDataException or UnauthorizedAccessException)@@ -276,34 +294,270 @@ public sealed partial class UpdateService : ObservableObjectreturn;}- Process? setup;try{- setup = Process.Start(new ProcessStartInfo(installer, InstallerArguments) { UseShellExecute = true });+ await ApplyUpdateAndRestartAsync(packageFile);}catch (Win32Exception ex) when (ex.NativeErrorCode == ErrorCancelled){_log.LogInformation("Update cancelled at the administrator prompt");Step = UpdateStep.Cancelled;- return;}- catch (Exception ex) when (ex is Win32Exception or InvalidOperationException)+ catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or IOException or UnauthorizedAccessException){Fail("start", ex);+ }+ }++ internal async Task ApplyUpdateAndRestartAsync(string packagePath, CancellationToken cancellationToken = default)+ {+ if (CustomUpdateRunner is not null)+ {+ Step = UpdateStep.Installing;+ await CustomUpdateRunner(packagePath);+ Step = UpdateStep.Idle;+ return;+ }++ if (OperatingSystem.IsWindows())+ {+ if (packagePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))+ {+ Process? setup;+ try+ {+ setup = Process.Start(new ProcessStartInfo(packagePath, InstallerArguments) { UseShellExecute = true });+ }+ catch (Win32Exception ex) when (ex.NativeErrorCode == ErrorCancelled)+ {+ _log.LogInformation("Update cancelled at the administrator prompt");+ Step = UpdateStep.Cancelled;+ return;+ }+ catch (Exception ex) when (ex is Win32Exception or InvalidOperationException)+ {+ Fail("start", ex);+ return;+ }++ _log.LogInformation("Started the installer for {Version}", LatestVersion);+ Step = UpdateStep.Installing;+ if (setup is null)+ return;++ using (setup)+ await setup.WaitForExitAsync(cancellationToken);+ _log.LogInformation("Installer ended with exit code {Code}", setup.ExitCode);+ Step = setup.ExitCode == 0 ? UpdateStep.Idle : UpdateStep.Cancelled;+ return;+ }++ if (packagePath.EndsWith(".zip", StringComparison.OrdinalIgnoreCase))+ {+ Step = UpdateStep.Installing;+ var stagingDir = Path.Combine(Path.GetTempPath(), "Filee-update", "staged-" + Guid.NewGuid().ToString("N")[..8]);+ if (Directory.Exists(stagingDir))+ Directory.Delete(stagingDir, true);+ Directory.CreateDirectory(stagingDir);+ ZipFile.ExtractToDirectory(packagePath, stagingDir);++ var appExeInSub = Directory.GetFiles(stagingDir, "Filee.exe", SearchOption.AllDirectories).FirstOrDefault();+ var sourceDir = appExeInSub is not null ? Path.GetDirectoryName(appExeInSub)! : stagingDir;+ var targetDir = Path.GetFullPath(AppContext.BaseDirectory).TrimEnd('\\', '/');+ var targetExe = Path.Combine(targetDir, "Filee.exe");+ var pid = Environment.ProcessId;++ var scriptPath = Path.Combine(Path.GetTempPath(), $"filee-update-{Guid.NewGuid():N}.cmd");+ var scriptContent = $@"@echo off+:wait_loop+tasklist /fi ""PID eq {pid}"" 2>nul | find ""{pid}"" >nul+if not errorlevel 1 (+ timeout /t 1 /nobreak >nul+ goto wait_loop+)+xcopy /s /e /y /q ""{sourceDir}\*"" ""{targetDir}\"" >nul+start """" ""{targetExe}""+rd /s /q ""{stagingDir}"" 2>nul+del ""%~f0"" 2>nul+";+ await File.WriteAllTextAsync(scriptPath, scriptContent, cancellationToken);++ var psi = new ProcessStartInfo("cmd.exe", $"/c \"\"{scriptPath}\"\"")+ {+ CreateNoWindow = true,+ UseShellExecute = false,+ WindowStyle = ProcessWindowStyle.Hidden+ };+ Process.Start(psi);+ ShutdownAction();+ return;+ }+ }+ else if (OperatingSystem.IsMacOS())+ {+ Step = UpdateStep.Installing;+ var stagingDir = Path.Combine(Path.GetTempPath(), "Filee-update", "staged-" + Guid.NewGuid().ToString("N")[..8]);+ if (Directory.Exists(stagingDir))+ Directory.Delete(stagingDir, true);+ Directory.CreateDirectory(stagingDir);++ await ExtractTarGzAsync(packagePath, stagingDir, cancellationToken);++ var stagedApp = Directory.GetDirectories(stagingDir, "Filee.app", SearchOption.AllDirectories).FirstOrDefault();+ if (stagedApp is null)+ throw new InvalidDataException("Extracted macOS package did not contain Filee.app");++ var baseDir = Path.GetFullPath(AppContext.BaseDirectory);+ var targetApp = GetMacOSBundlePath(baseDir);+ var pid = Environment.ProcessId;++ var scriptPath = Path.Combine(Path.GetTempPath(), $"filee-update-{Guid.NewGuid():N}.sh");+ var scriptContent = $@"#!/bin/sh+while kill -0 {pid} 2>/dev/null; do+ sleep 0.2+done+rm -rf ""{targetApp}""+if command -v ditto >/dev/null 2>&1; then+ ditto ""{stagedApp}"" ""{targetApp}""+else+ cp -R ""{stagedApp}"" ""{targetApp}""+fi+chmod +x ""{targetApp}/Contents/MacOS/Filee"" 2>/dev/null+open ""{targetApp}""+rm -rf ""{stagingDir}""+rm -f ""$0""+";+ await File.WriteAllTextAsync(scriptPath, scriptContent.Replace("\r\n", "\n"), cancellationToken);++ try+ {+ using var chmodProc = Process.Start(new ProcessStartInfo("chmod", $"+x \"{scriptPath}\"")+ {+ UseShellExecute = false,+ CreateNoWindow = true+ });+ if (chmodProc is not null)+ await chmodProc.WaitForExitAsync(cancellationToken);+ }+ catch+ {+ // Ignored+ }++ Process.Start(new ProcessStartInfo("/bin/sh", $"\"{scriptPath}\"")+ {+ UseShellExecute = false,+ CreateNoWindow = true+ });++ ShutdownAction();return;}+ else if (OperatingSystem.IsLinux())+ {+ Step = UpdateStep.Installing;+ var stagingDir = Path.Combine(Path.GetTempPath(), "Filee-update", "staged-" + Guid.NewGuid().ToString("N")[..8]);+ if (Directory.Exists(stagingDir))+ Directory.Delete(stagingDir, true);+ Directory.CreateDirectory(stagingDir);++ await ExtractTarGzAsync(packagePath, stagingDir, cancellationToken);++ var appExeInSub = Directory.GetFiles(stagingDir, "Filee", SearchOption.AllDirectories)+ .FirstOrDefault(f => !f.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && !f.EndsWith(".png", StringComparison.OrdinalIgnoreCase));+ var sourceDir = appExeInSub is not null ? Path.GetDirectoryName(appExeInSub)! : stagingDir;+ var targetDir = Path.GetFullPath(AppContext.BaseDirectory).TrimEnd('/');+ var targetExe = Path.Combine(targetDir, "Filee");+ var pid = Environment.ProcessId;++ var scriptPath = Path.Combine(Path.GetTempPath(), $"filee-update-{Guid.NewGuid():N}.sh");+ var scriptContent = $@"#!/bin/sh+while kill -0 {pid} 2>/dev/null; do+ sleep 0.2+done+cp -R ""{sourceDir}""/* ""{targetDir}/""+chmod +x ""{targetExe}"" 2>/dev/null+if [ -f ""{targetDir}/filee-cli"" ]; then+ chmod +x ""{targetDir}/filee-cli"" 2>/dev/null+fi+""{targetExe}"" &+rm -rf ""{stagingDir}""+rm -f ""$0""+";+ await File.WriteAllTextAsync(scriptPath, scriptContent.Replace("\r\n", "\n"), cancellationToken);++ try+ {+ using var chmodProc = Process.Start(new ProcessStartInfo("chmod", $"+x \"{scriptPath}\"")+ {+ UseShellExecute = false,+ CreateNoWindow = true+ });+ if (chmodProc is not null)+ await chmodProc.WaitForExitAsync(cancellationToken);+ }+ catch+ {+ // Ignored+ }- _log.LogInformation("Started the installer for {Version}", LatestVersion);- Step = UpdateStep.Installing;- if (setup is null)+ Process.Start(new ProcessStartInfo("/bin/sh", $"\"{scriptPath}\"")+ {+ UseShellExecute = false,+ CreateNoWindow = true+ });++ ShutdownAction();return;+ }+ }++ private static async Task ExtractTarGzAsync(string archivePath, string destinationDirectory, CancellationToken cancellationToken = default)+ {+ try+ {+ var tarExe = OperatingSystem.IsMacOS() ? "/usr/bin/tar" : "tar";+ using var proc = Process.Start(new ProcessStartInfo(tarExe, $"-xzf \"{archivePath}\" -C \"{destinationDirectory}\"")+ {+ UseShellExecute = false,+ CreateNoWindow = true+ });+ if (proc is not null)+ {+ await proc.WaitForExitAsync(cancellationToken);+ if (proc.ExitCode == 0)+ return;+ }+ }+ catch+ {+ // Fallback to managed extraction below+ }++ await using var fs = File.OpenRead(archivePath);+ await using var gz = new GZipStream(fs, CompressionMode.Decompress);+ TarFile.ExtractToDirectory(gz, destinationDirectory, overwriteFiles: true);+ }++ private static string GetMacOSBundlePath(string baseDir)+ {+ var dir = new DirectoryInfo(baseDir);+ while (dir is not null)+ {+ if (dir.Name.EndsWith(".app", StringComparison.OrdinalIgnoreCase))+ return dir.FullName;+ dir = dir.Parent;+ }+ return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Applications", "Filee.app");+ }- // A successful update closes Filee before Setup exits, so getting here means Setup ended without updating:- // the administrator prompt was declined (Setup asks for it itself), or the user cancelled.- using (setup)- await setup.WaitForExitAsync();- _log.LogInformation("Installer ended with exit code {Code}", setup.ExitCode);- Step = setup.ExitCode == 0 ? UpdateStep.Idle : UpdateStep.Cancelled;+ private static void ExitApplication()+ {+ Dispatcher.UIThread.Post(() =>+ {+ App.Quit();+ });+ Task.Delay(1000).ContinueWith(_ => Environment.Exit(0));}/// <summary>@@ -423,12 +677,27 @@ public sealed partial class UpdateService : ObservableObject/// <summary>A file attached to a release.</summary>internal sealed record ReleaseFile(string Name, string Url, long Size);- /// <summary>Picks the Windows installer and the checksum file from a GitHub release (null when missing).</summary>- internal static (ReleaseFile? Installer, ReleaseFile? Checksums) FindFiles(JsonElement release)+ /// <summary>Picks the package installer and the checksum file from a GitHub release (null when missing).</summary>+ internal static (ReleaseFile? Installer, ReleaseFile? Checksums) FindFiles(+ JsonElement release,+ OSPlatform? targetPlatform = null,+ Architecture? targetArch = null){- ReleaseFile? installer = null, checksums = null;if (!release.TryGetProperty("assets", out var assets) || assets.ValueKind != JsonValueKind.Array)return (null, null);++ var platform = targetPlatform ?? (OperatingSystem.IsWindows() ? OSPlatform.Windows+ : OperatingSystem.IsMacOS() ? OSPlatform.OSX+ : OSPlatform.Linux);++ var arch = targetArch ?? RuntimeInformation.ProcessArchitecture;+ var archName = arch == Architecture.Arm64 ? "arm64" : "x64";++ ReleaseFile? installer = null;+ ReleaseFile? checksums = null;+ var candidateChecksums = new List<ReleaseFile>();++ var allAssets = new List<ReleaseFile>();foreach (var asset in assets.EnumerateArray()){var name = asset.TryGetProperty("name", out var n) ? n.GetString() ?? "" : "";@@ -436,11 +705,51 @@ public sealed partial class UpdateService : ObservableObjectvar size = asset.TryGetProperty("size", out var s) && s.TryGetInt64(out var bytes) ? bytes : 0;if (name.Length == 0 || !url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))continue;- if (name.EndsWith("-win-Setup.exe", StringComparison.OrdinalIgnoreCase))- installer = new ReleaseFile(name, url, size);- else if (name.EndsWith("-SHA256SUMS.txt", StringComparison.OrdinalIgnoreCase))- checksums = new ReleaseFile(name, url, size);++ var rf = new ReleaseFile(name, url, size);+ allAssets.Add(rf);++ if (name.EndsWith("-SHA256SUMS.txt", StringComparison.OrdinalIgnoreCase) ||+ name.EndsWith(".sha256", StringComparison.OrdinalIgnoreCase) ||+ name.EndsWith("SHA256SUMS.txt", StringComparison.OrdinalIgnoreCase))+ {+ candidateChecksums.Add(rf);+ }+ }++ if (platform == OSPlatform.Windows)+ {+ installer = allAssets.FirstOrDefault(a => a.Name.EndsWith("-win-Setup.exe", StringComparison.OrdinalIgnoreCase))+ ?? allAssets.FirstOrDefault(a => a.Name.EndsWith("-win-Portable.zip", StringComparison.OrdinalIgnoreCase));+ }+ else if (platform == OSPlatform.OSX)+ {+ var targetSuffix = $"-osx-{archName}.tar.gz";+ installer = allAssets.FirstOrDefault(a => a.Name.EndsWith(targetSuffix, StringComparison.OrdinalIgnoreCase))+ ?? allAssets.FirstOrDefault(a => a.Name.Contains("-osx-", StringComparison.OrdinalIgnoreCase) && a.Name.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase))+ ?? allAssets.FirstOrDefault(a => a.Name.Contains("mac", StringComparison.OrdinalIgnoreCase) && a.Name.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase));+ }+ else if (platform == OSPlatform.Linux)+ {+ var targetSuffix = $"-linux-{archName}.tar.gz";+ installer = allAssets.FirstOrDefault(a => a.Name.EndsWith(targetSuffix, StringComparison.OrdinalIgnoreCase))+ ?? allAssets.FirstOrDefault(a => a.Name.Contains("-linux-", StringComparison.OrdinalIgnoreCase) && a.Name.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase));}++ if (installer is not null)+ {+ var baseName = installer.Name.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase)+ ? installer.Name[..^".tar.gz".Length]+ : Path.GetFileNameWithoutExtension(installer.Name);++ checksums = candidateChecksums.FirstOrDefault(c => c.Name.StartsWith(baseName, StringComparison.OrdinalIgnoreCase))+ ?? candidateChecksums.FirstOrDefault(c => c.Name.Contains(archName, StringComparison.OrdinalIgnoreCase) &&+ ((platform == OSPlatform.Linux && c.Name.Contains("linux", StringComparison.OrdinalIgnoreCase)) ||+ (platform == OSPlatform.OSX && c.Name.Contains("osx", StringComparison.OrdinalIgnoreCase))))+ ?? candidateChecksums.FirstOrDefault(c => c.Name.EndsWith("-SHA256SUMS.txt", StringComparison.OrdinalIgnoreCase))+ ?? candidateChecksums.FirstOrDefault();+ }+return (installer, checksums);}diff --git a/src/Filee.App/Services/UpdateTexts.cs b/src/Filee.App/Services/UpdateTexts.csindex ac23802e..e991820f 100644--- a/src/Filee.App/Services/UpdateTexts.cs+++ b/src/Filee.App/Services/UpdateTexts.cs@@ -6,11 +6,11 @@ namespace Filee.App.Services;public static class UpdateTexts{- /// <summary>Button text: "Update" in an installed copy (it installs by itself), "Download" in a portable one.</summary>- public static string ButtonKey => UpdateService.IsInstalled ? "update.install" : "update.download";+ /// <summary>Button text: "Update" across all platforms (downloads and installs in-app).</summary>+ public static string ButtonKey => "update.install";/// <summary>What the update button does, for the notice and tooltips.</summary>- public static string HowKey => UpdateService.IsInstalled ? "update.notice_text" : "update.notice_text_portable";+ public static string HowKey => "update.notice_text";/// <summary>Short label for the sidebar button and the tray menu ("Update to 1.4.0", "Downloading… 42%").</summary>public static string Short(UpdateService updates, ILocalizer loc) => updates.Step switchdiff --git a/src/Filee.App/Views/UpdateNoticeWindow.axaml.cs b/src/Filee.App/Views/UpdateNoticeWindow.axaml.csindex 1ba4d582..a9091a44 100644--- a/src/Filee.App/Views/UpdateNoticeWindow.axaml.cs+++ b/src/Filee.App/Views/UpdateNoticeWindow.axaml.cs@@ -39,7 +39,7 @@ public partial class UpdateNoticeWindow : Window{if (_updates is null)return;- if (!UpdateService.IsInstalled)+ if (!_updates.InstallsItself){_updates.OpenDownloadPage();Close();diff --git a/tests/Filee.App.Tests/UpdateServiceTests.cs b/tests/Filee.App.Tests/UpdateServiceTests.csindex 137abb56..45a81812 100644--- a/tests/Filee.App.Tests/UpdateServiceTests.cs+++ b/tests/Filee.App.Tests/UpdateServiceTests.cs@@ -1,5 +1,6 @@using System.Net;using System.Net.Sockets;+using System.Runtime.InteropServices;using System.Security.Cryptography;using System.Text;using System.Text.Json;@@ -84,6 +85,68 @@ public class UpdateServiceTestsAssert.Equal("Filee-9.9.9-SHA256SUMS.txt", checksums?.Name);}+ [Fact]+ public void Release_files_for_macos_arm64_and_x64()+ {+ using var release = JsonDocument.Parse($$"""+ {"tag_name": "v9.9.9", "assets": [+ {"name": "Filee-9.9.9-osx-arm64-SHA256SUMS.txt", "size": 189, "browser_download_url": "{{Base}}Filee-9.9.9-osx-arm64-SHA256SUMS.txt"},+ {"name": "Filee-9.9.9-osx-arm64.tar.gz", "size": 2000, "browser_download_url": "{{Base}}Filee-9.9.9-osx-arm64.tar.gz"},+ {"name": "Filee-9.9.9-osx-x64-SHA256SUMS.txt", "size": 189, "browser_download_url": "{{Base}}Filee-9.9.9-osx-x64-SHA256SUMS.txt"},+ {"name": "Filee-9.9.9-osx-x64.tar.gz", "size": 2100, "browser_download_url": "{{Base}}Filee-9.9.9-osx-x64.tar.gz"}+ ]}+ """);++ var (armApp, armSums) = UpdateService.FindFiles(release.RootElement, OSPlatform.OSX, Architecture.Arm64);+ Assert.Equal("Filee-9.9.9-osx-arm64.tar.gz", armApp?.Name);+ Assert.Equal("Filee-9.9.9-osx-arm64-SHA256SUMS.txt", armSums?.Name);++ var (intelApp, intelSums) = UpdateService.FindFiles(release.RootElement, OSPlatform.OSX, Architecture.X64);+ Assert.Equal("Filee-9.9.9-osx-x64.tar.gz", intelApp?.Name);+ Assert.Equal("Filee-9.9.9-osx-x64-SHA256SUMS.txt", intelSums?.Name);+ }++ [Fact]+ public void Release_files_for_linux_arm64_and_x64()+ {+ using var release = JsonDocument.Parse($$"""+ {"tag_name": "v9.9.9", "assets": [+ {"name": "Filee-9.9.9-linux-arm64-SHA256SUMS.txt", "size": 189, "browser_download_url": "{{Base}}Filee-9.9.9-linux-arm64-SHA256SUMS.txt"},+ {"name": "Filee-9.9.9-linux-arm64.tar.gz", "size": 3000, "browser_download_url": "{{Base}}Filee-9.9.9-linux-arm64.tar.gz"},+ {"name": "Filee-9.9.9-linux-x64-SHA256SUMS.txt", "size": 189, "browser_download_url": "{{Base}}Filee-9.9.9-linux-x64-SHA256SUMS.txt"},+ {"name": "Filee-9.9.9-linux-x64.tar.gz", "size": 3100, "browser_download_url": "{{Base}}Filee-9.9.9-linux-x64.tar.gz"}+ ]}+ """);++ var (armApp, armSums) = UpdateService.FindFiles(release.RootElement, OSPlatform.Linux, Architecture.Arm64);+ Assert.Equal("Filee-9.9.9-linux-arm64.tar.gz", armApp?.Name);+ Assert.Equal("Filee-9.9.9-linux-arm64-SHA256SUMS.txt", armSums?.Name);++ var (x64App, x64Sums) = UpdateService.FindFiles(release.RootElement, OSPlatform.Linux, Architecture.X64);+ Assert.Equal("Filee-9.9.9-linux-x64.tar.gz", x64App?.Name);+ Assert.Equal("Filee-9.9.9-linux-x64-SHA256SUMS.txt", x64Sums?.Name);+ }++ [Fact]+ public async Task UpdateAsync_executes_in_app_update_runner()+ {+ var installerData = RandomNumberGenerator.GetBytes(1000);+ var network = new FakeRelease(installerData, Sha256(installerData));+ var updates = Updates(network, installerData.Length);+ string? appliedPackage = null;+ updates.CustomUpdateRunner = path =>+ {+ appliedPackage = path;+ return Task.CompletedTask;+ };++ await updates.UpdateAsync();++ Assert.NotNull(appliedPackage);+ Assert.True(File.Exists(appliedPackage));+ Assert.Equal(UpdateStep.Idle, updates.Step);+ }+[Fact]public void Release_without_files_or_with_plain_http_links_has_no_installer(){