namespace Mlaumcherb.Client.Avalonia.классы; public record VersionSearchParams { public bool ReleaseTypeAllowed; public bool SnapshotTypeAllowed; public bool OldTypeAllowed; public bool OtherTypeAllowed; } public class GameVersionCatalog { [JsonRequired] public List versions { get; set; } = null!; /// empty list if couldn't find any remote versions public List GetDownloadableVersions(VersionSearchParams p) { var _versionPropsList = new List(); foreach (var r in versions) { bool match = r.type switch { "release" => p.ReleaseTypeAllowed, "snapshot" => p.SnapshotTypeAllowed, "old_alpha" or "old_beta" => p.OldTypeAllowed, _ => p.OtherTypeAllowed }; if(match) _versionPropsList.Add(new GameVersionProps(r)); } return _versionPropsList; } } public class AssetProperties { [JsonRequired] public string hash { get; set; } = ""; [JsonRequired] public int size { get; set; } } public class AssetIndex { [JsonRequired] public Dictionary objects { get; set; } = new(); } public class RemoteVersionDescriptorProps { [JsonRequired] public string id { get; set; } = ""; [JsonRequired] public string url { get; set; } = ""; [JsonRequired] public string type { get; set; } = ""; public string sha1 { get; set; } = ""; public DateTime time { get; set; } public DateTime releaseTime { get; set; } }