import all shipped nuget packages as built-in
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
This commit is contained in:
zznty
2025-05-13 00:19:22 +07:00
parent 4ac3989115
commit a441498c09
7 changed files with 144 additions and 35 deletions

View File

@@ -0,0 +1,27 @@
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}";
}
}