mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-04-24 06:47:44 +02:00
misc: chore: Simplify ReleaseChannels creation
This commit is contained in:
parent
95fdc0ca24
commit
078909169d
1 changed files with 12 additions and 13 deletions
|
@ -49,23 +49,22 @@ namespace Ryujinx.Common
|
||||||
public static async Task<ReleaseChannels> GetReleaseChannelsAsync(HttpClient httpClient)
|
public static async Task<ReleaseChannels> GetReleaseChannelsAsync(HttpClient httpClient)
|
||||||
{
|
{
|
||||||
ReleaseChannelPair releaseChannelPair = JsonHelper.Deserialize(await httpClient.GetStringAsync("https://ryujinx.app/api/release-channels"), ReleaseChannelPairContext.Default.ReleaseChannelPair);
|
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) =>
|
internal ReleaseChannels(ReleaseChannelPair channelPair)
|
||||||
new()
|
{
|
||||||
{
|
Stable = new Channel(channelPair.Stable);
|
||||||
Stable = new Channel(channelPair.Stable),
|
Canary = new Channel(channelPair.Canary);
|
||||||
Canary = new Channel(channelPair.Canary)
|
}
|
||||||
};
|
|
||||||
|
|
||||||
public Channel Stable { get; init; }
|
public readonly Channel Stable;
|
||||||
public Channel Canary { get; init; }
|
public readonly Channel Canary;
|
||||||
|
|
||||||
public struct Channel
|
public readonly struct Channel
|
||||||
{
|
{
|
||||||
public Channel(string raw)
|
public Channel(string raw)
|
||||||
{
|
{
|
||||||
|
@ -74,8 +73,8 @@ namespace Ryujinx.Common
|
||||||
Repo = parts[1];
|
Repo = parts[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Owner;
|
public readonly string Owner;
|
||||||
public string Repo;
|
public readonly string Repo;
|
||||||
|
|
||||||
public override string ToString() => $"{Owner}/{Repo}";
|
public override string ToString() => $"{Owner}/{Repo}";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue