From 2faa5122ee94b4dd45da719ce153859d31fc8b9b Mon Sep 17 00:00:00 2001
From: Tristan Read <60425965+kOFReadie@users.noreply.github.com>
Date: Tue, 10 Aug 2021 18:20:54 +0100
Subject: [PATCH] Updated for BeatSaverSharper
---
README.md | 2 +-
beatmods.md | 4 ++--
src/Client/MapEvents.cs | 24 ++++++++++++++++--------
src/DataPuller.csproj | 2 +-
src/Properties/AssemblyInfo.cs | 4 ++--
src/manifest.json | 6 +++---
6 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index 0a1a43d..c0f941c 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ To install this mod, download the [latest version](https://github.com/kOFReadie/
### Dependencies, these can all be found on the [Mod Assistant](https://github.com/Assistant/ModAssistant) app:
In order for this mod to function properly you must have installed the following mods:
- [BSIPA ^4.2.0](https://github.com/bsmg/BeatSaber-IPA-Reloaded)
-- [BeatSaverSharp ^2.0.1](https://github.com/lolPants/BeatSaverSharp)
+- [BeatSaverSharp ^3.0.0](https://github.com/Auros/BeatSaverSharper)
- WebsocketSharp ^1.0.4
- [SongCore ^3.5.0](https://github.com/Kylemc1413/SongCore)
- [SongDataCore ^1.4.0](https://github.com/halsafar/BeatSaberSongDataCore/)
diff --git a/beatmods.md b/beatmods.md
index f3a4cc6..843566d 100644
--- a/beatmods.md
+++ b/beatmods.md
@@ -2,13 +2,13 @@
DataPuller
## Mod Version
-2.0.5
+2.0.6
## Game Version
1.16.3
## Dependencies
-BSIPA@4.2.0,BeatSaverSharp@2.0.1,websocket-sharp@1.0.4,SongCore@3.5.0,SongDataCore@1.4.0,SiraUtil@2.5.6
+BSIPA@4.2.0,BeatSaverSharp@3.0.0,websocket-sharp@1.0.4,SongCore@3.5.0,SongDataCore@1.4.0,SiraUtil@2.5.6
## Category
Tweaks/Tools
diff --git a/src/Client/MapEvents.cs b/src/Client/MapEvents.cs
index 6afdca0..2115a81 100644
--- a/src/Client/MapEvents.cs
+++ b/src/Client/MapEvents.cs
@@ -19,7 +19,7 @@ namespace DataPuller.Client
class MapEvents : IInitializable, IDisposable
{
//I think I need to fix my refrences as VS does not notice when I update them.
- private static BeatSaver beatSaver = new BeatSaver(new HttpOptions("BSDataPuller", Assembly.GetExecutingAssembly().GetName().Version));
+ private static BeatSaver beatSaver = new BeatSaver("BSDataPuller", Assembly.GetExecutingAssembly().GetName().Version);
internal static MapData.JsonData previousStaticData = new MapData.JsonData();
private Timer timer = new Timer { Interval = 250 };
private int NoteCount = 0;
@@ -221,25 +221,33 @@ public void SetupMapDataAndMisc()
else { sdc.available = false; }
}
- if (sdc.available)
+ /*if (sdc.available)
{
MapData.BSRKey = sdc.map.key;
if (levelData is CustomPreviewBeatmapLevel customLevel) { MapData.coverImage = GetBase64CoverImage(customLevel); }
else { getBeatsaverMap(); }
}
- else { getBeatsaverMap(); }
+ else { getBeatsaverMap(); }*/
+ getBeatsaverMap();
void getBeatsaverMap()
{
Task.Run(async () =>
{
- Beatmap bm = await beatSaver.Hash(mapHash);
- if (bm != null)
+ BeatSaverSharp.Models.Beatmap beatmap = await beatSaver.BeatmapByHash(mapHash);
+ if (beatmap != null)
+ {
+ MapData.BSRKey = beatmap.ID;
+
+ BeatSaverSharp.Models.BeatmapVersion mapDetails = null;
+ try { mapDetails = beatmap.Versions.First(map => map.Hash.ToLower() == mapHash.ToLower()); } catch (Exception ex) { Plugin.Logger.Error(ex); }
+ MapData.coverImage = mapDetails != null ? mapDetails.CoverURL : null;
+ }
+ else
{
- MapData.BSRKey = bm.Key;
- MapData.coverImage = BeatSaver.BaseURL + bm.CoverURL;
+ MapData.BSRKey = null;
+ MapData.coverImage = null;
}
- else { MapData.BSRKey = null; }
MapData.Send();
});
}
diff --git a/src/DataPuller.csproj b/src/DataPuller.csproj
index fb6929e..62871dc 100644
--- a/src/DataPuller.csproj
+++ b/src/DataPuller.csproj
@@ -50,7 +50,7 @@
A:\Program Files (x86)\Steam\steamapps\common\Beat Saber\IPA\Libs\0Harmony.dll
-
+
False
A:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Libs\BeatSaverSharp.dll
diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs
index 529119a..5c8dcba 100644
--- a/src/Properties/AssemblyInfo.cs
+++ b/src/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.5")]
-[assembly: AssemblyFileVersion("2.0.5")]
+[assembly: AssemblyVersion("2.0.6")]
+[assembly: AssemblyFileVersion("2.0.6")]
diff --git a/src/manifest.json b/src/manifest.json
index be7e21f..b28d493 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,12 +3,12 @@
"id": "DataPuller",
"name": "DataPuller",
"author": "Readie",
- "version": "2.0.5",
+ "version": "2.0.6",
"description": "Gathers data about the current map you are playing to then be sent out over a websocket for other software to use, e.g. A web overlay like BSDP-Overlay. This mod works with multi PC setups!",
- "gameVersion": "1.16.3",
+ "gameVersion": "1.16.4",
"dependsOn": {
"BSIPA": "^4.2.0",
- "BeatSaverSharp": "^2.0.1",
+ "BeatSaverSharp": "^3.0.0",
"websocket-sharp": "^1.0.4",
"SongCore": "^3.5.0",
"SongDataCore": "^1.4.0",