From 0e94beecc0f42221c7db6532582581db87d1ed95 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 23 Nov 2024 04:40:07 +0100 Subject: [PATCH] fix pre release updater and cli uri parser --- ShockOsc/Cli/MauiCliOptions.cs | 2 +- ShockOsc/Platforms/Windows/WindowsEntryPoint.cs | 5 ++--- ShockOsc/Services/Updater.cs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ShockOsc/Cli/MauiCliOptions.cs b/ShockOsc/Cli/MauiCliOptions.cs index 638eefc..8f8f1b8 100644 --- a/ShockOsc/Cli/MauiCliOptions.cs +++ b/ShockOsc/Cli/MauiCliOptions.cs @@ -8,5 +8,5 @@ public sealed class MauiCliOptions : CliOptions public required bool Console { get; init; } [Option("uri", Required = false, HelpText = "Custom URI for callbacks")] - public required string Uri { get; init; } + public required string? Uri { get; init; } } \ No newline at end of file diff --git a/ShockOsc/Platforms/Windows/WindowsEntryPoint.cs b/ShockOsc/Platforms/Windows/WindowsEntryPoint.cs index 4a09bdf..0df9142 100644 --- a/ShockOsc/Platforms/Windows/WindowsEntryPoint.cs +++ b/ShockOsc/Platforms/Windows/WindowsEntryPoint.cs @@ -53,14 +53,13 @@ private static void Start(MauiCliOptions config) { using var pipeClientStream = new NamedPipeClientStream(".", "OpenShock.ShockOsc", PipeDirection.Out); pipeClientStream.Connect(500); - - var parsedUri = UriParser.Parse(config.Uri); - + using var writer = new StreamWriter(pipeClientStream); writer.AutoFlush = true; if (!string.IsNullOrEmpty(config.Uri)) { + var parsedUri = UriParser.Parse(config.Uri); var pipeMessage = parsedUri.Type switch { UriParameterType.Show => new PipeMessage { Type = PipeMessageType.Show }, diff --git a/ShockOsc/Services/Updater.cs b/ShockOsc/Services/Updater.cs index 5d82ea6..aefc388 100644 --- a/ShockOsc/Services/Updater.cs +++ b/ShockOsc/Services/Updater.cs @@ -126,8 +126,8 @@ await JsonSerializer.DeserializeAsync>( listOfValid.Add((release, version)); } - - (GithubReleaseResponse, SemVersion)? newestPreRelease = listOfValid.OrderByDescending(x => x.Item2).FirstOrDefault(); + + (GithubReleaseResponse, SemVersion)? newestPreRelease = listOfValid.OrderByDescending(x => x.Item2, SemVersion.PrecedenceComparer).FirstOrDefault(); var latestRelease = await GetLatestRelease(); if (newestPreRelease == null && latestRelease == null) {