From 00faf5bd7a01ea1ebe28e180d44af8a74b4d3255 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Wed, 15 May 2019 18:24:08 -0500 Subject: [PATCH] Added BeatMods gameVersion field support --- IPA.Loader/Config/SelfConfig.cs | 2 +- IPA.Loader/Loader/manifest.json | 2 +- IPA.Loader/Updating/BeatMods/ApiEndpoint.cs | 71 ++------------------- IPA.Loader/Updating/BeatMods/Updater.cs | 2 +- IPA/Program.cs | 2 +- appveyor.yml | 2 +- 6 files changed, 9 insertions(+), 72 deletions(-) diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 24575ab7..cb3e6e39 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -33,7 +33,7 @@ namespace IPA.Config } internal const string IPAName = "Beat Saber IPA"; - internal const string IPAVersion = "3.12.16"; + internal const string IPAVersion = "3.12.17"; public bool Regenerate = true; diff --git a/IPA.Loader/Loader/manifest.json b/IPA.Loader/Loader/manifest.json index 11ea7cce..7e9f8137 100644 --- a/IPA.Loader/Loader/manifest.json +++ b/IPA.Loader/Loader/manifest.json @@ -8,7 +8,7 @@ "gameVersion": "0.13.2", "id": "BSIPA", "name": "Beat Saber IPA", - "version": "3.12.16", + "version": "3.12.17", "icon": "IPA.icon.png", "features": [ "define-feature(print, IPA.Loader.Features.PrintFeature)", diff --git a/IPA.Loader/Updating/BeatMods/ApiEndpoint.cs b/IPA.Loader/Updating/BeatMods/ApiEndpoint.cs index 09dc0d2e..b34fe5ab 100644 --- a/IPA.Loader/Updating/BeatMods/ApiEndpoint.cs +++ b/IPA.Loader/Updating/BeatMods/ApiEndpoint.cs @@ -102,6 +102,10 @@ namespace IPA.Updating.BeatMods JsonConverter(typeof(SemverVersionConverter))] public Version Version; + [JsonProperty("gameVersion"), + JsonConverter(typeof(SemverVersionConverter))] + public Version GameVersion; + [Serializable] public class AuthorType { @@ -116,22 +120,6 @@ namespace IPA.Updating.BeatMods [JsonProperty("author")] public AuthorType Author; - /*[Serializable] - public class DetailsData - { - [JsonProperty("author")] - public AuthorType Author; - [JsonProperty("title")] - public string Title; - [JsonProperty("description")] - public string Description; - [JsonProperty("published")] - public string Published; - } - - [JsonProperty("details")] - public DetailsData Details;*/ - [JsonProperty("status")] public string Status; public const string ApprovedStatus = "approved"; @@ -146,35 +134,6 @@ namespace IPA.Updating.BeatMods public Uri Link; #pragma warning restore CS0649 - /*[Serializable] - public class PlatformFile - { - [JsonProperty("hash"), - JsonConverter(typeof(HexArrayConverter))] - public byte[] Hash = new byte[20]; - - [JsonProperty("files", ItemConverterType = typeof(HexArrayConverter))] - public Dictionary FileHashes = new Dictionary(); - - [JsonProperty("url")] - public string DownloadPath; - - public override string ToString() => - $"{Utils.ByteArrayToString(Hash)}@{DownloadPath}({string.Join(",", FileHashes.Select(o => $"\"{o.Key}\":\"{Utils.ByteArrayToString(o.Value)}\""))})"; - } - - [Serializable] - public class FilesObject - { - [JsonProperty("steam")] - public PlatformFile Steam; - - [JsonProperty("oculus")] - public PlatformFile Oculus; - } - - [JsonProperty("files")] - public FilesObject Files;*/ [Serializable] public class DownloadsObject @@ -209,28 +168,6 @@ namespace IPA.Updating.BeatMods [JsonProperty("downloads")] public DownloadsObject[] Downloads; - /*public class Dependency - { - public string Name = null; - public Range VersionRange = null; - } - - [Serializable] - public class LinksType - { - [JsonProperty("dependencies", ItemConverterType = typeof(ModSaberDependencyConverter))] - public Dependency[] Dependencies = new Dependency[0]; - - [JsonProperty("conflicts", ItemConverterType = typeof(ModSaberDependencyConverter))] - public Dependency[] Conflicts = new Dependency[0]; - } - - [JsonProperty("links")] - public LinksType Links; - - [JsonProperty("oldVersions", ItemConverterType = typeof(SemverVersionConverter))] - public Version[] OldVersions = new Version[0];*/ - [JsonProperty("dependencies", ItemConverterType = typeof(ModMultiformatJsonConverter))] public Mod[] Dependencies; diff --git a/IPA.Loader/Updating/BeatMods/Updater.cs b/IPA.Loader/Updating/BeatMods/Updater.cs index 8592e919..f347975a 100644 --- a/IPA.Loader/Updating/BeatMods/Updater.cs +++ b/IPA.Loader/Updating/BeatMods/Updater.cs @@ -365,7 +365,7 @@ namespace IPA.Updating.BeatMods var ver = modsMatching.Value .Where(nullCheck => nullCheck != null) // entry is not null - //.Where(versionCheck => versionCheck.GameVersion.Version == BeatSaber.GameVersion) // game version matches + .Where(versionCheck => versionCheck.GameVersion == BeatSaber.GameVersion) // game version matches .Where(approvalCheck => approvalCheck.Status == ApiEndpoint.Mod.ApprovedStatus) // version approved .Where(conflictsCheck => dep.Conflicts == null || !dep.Conflicts.IsSatisfied(conflictsCheck.Version)) // not a conflicting version .Select(mod => mod.Version).Max(); // (2.1) get the max version diff --git a/IPA/Program.cs b/IPA/Program.cs index e9d4e464..46f95139 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -23,7 +23,7 @@ namespace IPA Unknown } - public const string FileVersion = "3.12.16"; + public const string FileVersion = "3.12.17"; public static Version Version => Assembly.GetEntryAssembly().GetName().Version; diff --git a/appveyor.yml b/appveyor.yml index 76a7304d..0f8aef76 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ version: 'BSIPA-{branch}-{build}' environment: - bsipa_version: '3.12.16' + bsipa_version: '3.12.17' pull_requests: do_not_increment_build_number: true install: