
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (SharedCringe) (push) Successful in 53s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 1m0s
Build / Build Nuget package (NuGet) (push) Successful in 58s
Build / Build Nuget package (CringePlugins) (push) Successful in 1m13s
Build / Build Launcher (push) Successful in 1m42s
also would now throw if version gets changed
27 lines
842 B
C#
27 lines
842 B
C#
using System.Text.Json.Serialization;
|
|
using NuGet.Converters;
|
|
using NuGet.Frameworks;
|
|
|
|
namespace NuGet.Models;
|
|
|
|
/// <summary>
|
|
/// Represents a NuGetFramework with a runtime identifier
|
|
/// </summary>
|
|
[JsonConverter(typeof(RuntimeFrameworkJsonConverter))]
|
|
public record NuGetRuntimeFramework(NuGetFramework Framework, string? RuntimeIdentifier)
|
|
{
|
|
public static NuGetRuntimeFramework Parse(string str)
|
|
{
|
|
var index = str.IndexOf('/');
|
|
|
|
if (index < 0)
|
|
return new NuGetRuntimeFramework(NuGetFramework.Parse(str), null);
|
|
|
|
return new NuGetRuntimeFramework(NuGetFramework.Parse(str[..index]), str[(index + 1)..]);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.IsNullOrEmpty(RuntimeIdentifier) ? Framework.ToString() : $"{Framework}/{RuntimeIdentifier}";
|
|
}
|
|
} |