0
0
mirror of https://git.ryujinx.app/ryubing/ryujinx.git synced 2025-04-24 09:25:12 +00:00

misc: chore: Simplify ReleaseChannels creation

This commit is contained in:
GreemDev 2025-03-16 14:21:17 -05:00
parent 95fdc0ca24
commit 078909169d

View File

@ -49,23 +49,22 @@ namespace Ryujinx.Common
public static async Task<ReleaseChannels> GetReleaseChannelsAsync(HttpClient httpClient)
{
ReleaseChannelPair releaseChannelPair = JsonHelper.Deserialize(await httpClient.GetStringAsync("https://ryujinx.app/api/release-channels"), ReleaseChannelPairContext.Default.ReleaseChannelPair);
return ReleaseChannels.Create(releaseChannelPair);
return new ReleaseChannels(releaseChannelPair);
}
}
public struct ReleaseChannels
public readonly struct ReleaseChannels
{
internal static ReleaseChannels Create(ReleaseChannelPair channelPair) =>
new()
{
Stable = new Channel(channelPair.Stable),
Canary = new Channel(channelPair.Canary)
};
internal ReleaseChannels(ReleaseChannelPair channelPair)
{
Stable = new Channel(channelPair.Stable);
Canary = new Channel(channelPair.Canary);
}
public Channel Stable { get; init; }
public Channel Canary { get; init; }
public readonly Channel Stable;
public readonly Channel Canary;
public struct Channel
public readonly struct Channel
{
public Channel(string raw)
{
@ -74,8 +73,8 @@ namespace Ryujinx.Common
Repo = parts[1];
}
public string Owner;
public string Repo;
public readonly string Owner;
public readonly string Repo;
public override string ToString() => $"{Owner}/{Repo}";