Skip to content

Commit

Permalink
Added BeatMods gameVersion field support
Browse files Browse the repository at this point in the history
  • Loading branch information
nike4613 committed May 15, 2019
1 parent 0469949 commit f7f7d2e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 72 deletions.
2 changes: 1 addition & 1 deletion IPA.Loader/Config/SelfConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void Set()
}

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;

Expand Down
2 changes: 1 addition & 1 deletion IPA.Loader/Loader/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
71 changes: 4 additions & 67 deletions IPA.Loader/Updating/BeatMods/ApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public class Mod
JsonConverter(typeof(SemverVersionConverter))]
public Version Version;

[JsonProperty("gameVersion"),
JsonConverter(typeof(SemverVersionConverter))]
public Version GameVersion;

[Serializable]
public class AuthorType
{
Expand All @@ -116,22 +120,6 @@ public class AuthorType
[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";
Expand All @@ -146,35 +134,6 @@ public class DetailsData
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<string, byte[]> FileHashes = new Dictionary<string, byte[]>();
[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
Expand Down Expand Up @@ -209,28 +168,6 @@ public class HashObject
[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;

Expand Down
2 changes: 1 addition & 1 deletion IPA.Loader/Updating/BeatMods/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ internal IEnumerator ResolveDependencyPresence(Ref<List<DependencyObject>> list)

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
Expand Down
2 changes: 1 addition & 1 deletion IPA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum Architecture
Unknown
}

public const string FileVersion = "3.12.16";
public const string FileVersion = "3.12.17";

public static Version Version => Assembly.GetEntryAssembly().GetName().Version;

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit f7f7d2e

Please sign in to comment.