Skip to content

Commit 60a4c89

Browse files
committed
V2025.11.6
1 parent 5de3d77 commit 60a4c89

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed

Nickvision.Desktop.Tests/GitHubUpdaterServiceTests.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,23 @@ public async Task Case004_CompareVersions()
8888
Assert.IsTrue(preview < stable);
8989
}
9090

91+
[TestMethod]
92+
public async Task Case005_Ytdlp()
93+
{
94+
if (Environment.GetEnvironmentVariable("CI") == "true")
95+
{
96+
Assert.Inconclusive("Dialogs are not supported in CI environments");
97+
}
98+
Assert.IsNotNull(_client);
99+
var updateService = new GitHubUpdaterService("yt-dlp", "yt-dlp", _client);
100+
var stable = await updateService.GetLatestStableVersionAsync();
101+
Assert.IsNotNull(stable);
102+
Assert.IsTrue(stable >= new AppVersion("2025.11.12"));
103+
}
104+
91105
#if OS_WINDOWS
92106
[TestMethod]
93-
public async Task Check005_WindowsUpdate()
107+
public async Task Check006_WindowsUpdate()
94108
{
95109
if (Environment.GetEnvironmentVariable("CI") == "true")
96110
{

Nickvision.Desktop/Application/AppVersion.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Nickvision.Desktop.Application;
44

5-
public class AppVersion
5+
public class AppVersion : IComparable<AppVersion>, IEquatable<AppVersion>
66
{
77
public Version BaseVersion { get; init; }
88
public string PreviewLabel { get; init; }
@@ -56,6 +56,8 @@ public static bool TryParse(string version, out AppVersion? appVersion)
5656

5757
public static bool operator <(AppVersion? pv, Version? v) => pv is null ? v is not null : pv.BaseVersion <= v;
5858

59+
public static bool operator <=(AppVersion? pv1, AppVersion? pv2) => pv1 is null ? pv2 is null : pv1 < pv2 || pv1 == pv2;
60+
5961
public static bool operator >(AppVersion? pv1, AppVersion? pv2)
6062
{
6163
if (pv1 is null)
@@ -75,6 +77,8 @@ public static bool TryParse(string version, out AppVersion? appVersion)
7577

7678
public static bool operator >(AppVersion? pv, Version? v) => pv is null ? v is null : pv.BaseVersion > v;
7779

80+
public static bool operator >=(AppVersion? pv1, AppVersion? pv2) => pv1 is null ? pv2 is null : pv1 > pv2 || pv1 == pv2;
81+
7882
public static bool operator ==(AppVersion? pv1, AppVersion? pv2) => pv1 is null ? pv2 is null : pv1.BaseVersion == pv2?.BaseVersion && pv1.PreviewLabel == pv2?.PreviewLabel;
7983

8084
public static bool operator ==(AppVersion? pv, Version? v) => pv is null ? v is null : pv.BaseVersion == v && string.IsNullOrEmpty(pv.PreviewLabel);
@@ -83,6 +87,21 @@ public static bool TryParse(string version, out AppVersion? appVersion)
8387

8488
public static bool operator !=(AppVersion? pv, Version? v) => !(pv == v);
8589

90+
public int CompareTo(AppVersion? other)
91+
{
92+
if (this < other)
93+
{
94+
return -1;
95+
}
96+
else if (this > other)
97+
{
98+
return 1;
99+
}
100+
return 0;
101+
}
102+
103+
public bool Equals(AppVersion? other) => this == other;
104+
86105
public override bool Equals(object? obj) => obj switch
87106
{
88107
AppVersion pv => this == pv,

Nickvision.Desktop/Application/GitHubUpdaterService.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public GitHubUpdaterService(AppInfo appInfo, HttpClient httpClient)
3232
{
3333
if (appInfo.SourceRepository is null || appInfo.SourceRepository.IsEmpty())
3434
{
35-
throw new ArgumentException("AppInfo.SourceRepository cannot be null");
35+
throw new ArgumentException("AppInfo.SourceRepository cannot be null or empty");
3636
}
3737
_httpClient = httpClient;
3838
_githubClient = new GitHubClient(new ProductHeaderValue("Nickvision.Desktop"));
@@ -48,6 +48,25 @@ public GitHubUpdaterService(AppInfo appInfo, HttpClient httpClient)
4848
}
4949
}
5050

51+
/// <summary>
52+
/// Constructs an UpdaterService.
53+
/// </summary>
54+
/// <param name="owner">The repository owner</param>
55+
/// <param name="name">The repository name</param>
56+
/// <param name="httpClient">The HttpClient for the app</param>
57+
/// <exception cref="ArgumentException">Thrown if the Owner and/or Name are empty</exception>
58+
public GitHubUpdaterService(string owner, string name, HttpClient httpClient)
59+
{
60+
if (string.IsNullOrEmpty(owner) || string.IsNullOrEmpty(name))
61+
{
62+
throw new ArgumentException("Owner and Name cannot be null or empty");
63+
}
64+
_owner = owner;
65+
_name = name;
66+
_httpClient = httpClient;
67+
_githubClient = new GitHubClient(new ProductHeaderValue("Nickvision.Desktop"));
68+
}
69+
5170
/// <summary>
5271
/// Downloads an asset from a released version.
5372
/// </summary>

Nickvision.Desktop/Nickvision.Desktop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<EnableWindowsTargeting>true</EnableWindowsTargeting>
1010
<PackageId>Nickvision.Desktop</PackageId>
11-
<Version>2025.11.5</Version>
11+
<Version>2025.11.6</Version>
1212
<Company>Nickvision</Company>
1313
<Authors>Nickvision</Authors>
1414
<Description>A cross-platform base for Nickvision desktop applications.</Description>

0 commit comments

Comments
 (0)