Skip to content

Commit

Permalink
Updated for BeatSaverSharper
Browse files Browse the repository at this point in the history
  • Loading branch information
ReadieFur committed Aug 10, 2021
1 parent dec6b70 commit 2faa512
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
4 changes: 2 additions & 2 deletions beatmods.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 16 additions & 8 deletions src/Client/MapEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataPuller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<HintPath>A:\Program Files (x86)\Steam\steamapps\common\Beat Saber\IPA\Libs\0Harmony.dll</HintPath>
</Reference>
<Reference Include="BeatmapCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="BeatSaverSharp, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="BeatSaverSharp, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>A:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Libs\BeatSaverSharp.dll</HintPath>
</Reference>
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
6 changes: 3 additions & 3 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2faa512

Please sign in to comment.