InstalledGameVersionCatalog

This commit is contained in:
2024-12-31 17:55:30 +05:00
parent 2c780afea8
commit e5deb3f3d4
24 changed files with 477 additions and 341 deletions

View File

@@ -9,13 +9,13 @@ public record VersionSearchParams
}
public class GameVersionCatalog
{
[JsonRequired] public List<RemoteVersionDescriptorProps> versions { get; set; } = null!;
{
[JsonRequired] public List<RemoteVersionDescriptorProps> versions { get; set; } = new();
/// <returns>empty list if couldn't find any remote versions</returns>
public List<GameVersionProps> GetDownloadableVersions(VersionSearchParams p)
public List<RemoteVersionDescriptorProps> GetDownloadableVersions(VersionSearchParams p)
{
var _versionPropsList = new List<GameVersionProps>();
var _versionPropsList = new List<RemoteVersionDescriptorProps>();
foreach (var r in versions)
{
bool match = r.type switch
@@ -26,7 +26,7 @@ public class GameVersionCatalog
_ => p.OtherTypeAllowed
};
if(match)
_versionPropsList.Add(new GameVersionProps(r));
_versionPropsList.Add(r);
}
return _versionPropsList;
}

View File

@@ -10,7 +10,7 @@ public class GameVersionDescriptor
[JsonRequired] public DateTime releaseTime { get; set; }
[JsonRequired] public string type { get; set; } = "";
[JsonRequired] public string mainClass { get; set; } = "";
[JsonRequired] public List<Library> libraries { get; set; } = null!;
[JsonRequired] public List<Library> libraries { get; set; } = new();
[JsonRequired] public AssetIndexProperties assetIndex { get; set; } = null!;
[JsonRequired] public string assets { get; set; } = "";
public Downloads? downloads { get; set; } = null;

View File

@@ -67,7 +67,7 @@ public class JavaVersionProps
public class JavaDistributiveManifest
{
[JsonRequired] public Dictionary<string, JavaDistributiveElementProps> files { get; set; } = null!;
[JsonRequired] public Dictionary<string, JavaDistributiveElementProps> files { get; set; } = new();
}
public class JavaDistributiveElementProps