mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #11616 from peppy/fix-ios-beatmap-cache-lookups
Avoid using Dapper to fix iOS compatibility of beatmap lookup cache
This commit is contained in:
commit
c592c80a07
@ -7,7 +7,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapper;
|
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using osu.Framework.Development;
|
using osu.Framework.Development;
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
@ -154,20 +153,31 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
using (var db = new SqliteConnection(storage.GetDatabaseConnectionString("online")))
|
using (var db = new SqliteConnection(storage.GetDatabaseConnectionString("online")))
|
||||||
{
|
{
|
||||||
var found = db.QuerySingleOrDefault<CachedOnlineBeatmapLookup>(
|
db.Open();
|
||||||
"SELECT * FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineBeatmapID OR filename = @Path", beatmap);
|
|
||||||
|
|
||||||
if (found != null)
|
using (var cmd = db.CreateCommand())
|
||||||
{
|
{
|
||||||
var status = (BeatmapSetOnlineStatus)found.approved;
|
cmd.CommandText = "SELECT beatmapset_id, beatmap_id, approved FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineBeatmapID OR filename = @Path";
|
||||||
|
|
||||||
beatmap.Status = status;
|
cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmap.MD5Hash));
|
||||||
beatmap.BeatmapSet.Status = status;
|
cmd.Parameters.Add(new SqliteParameter("@OnlineBeatmapID", beatmap.OnlineBeatmapID));
|
||||||
beatmap.BeatmapSet.OnlineBeatmapSetID = found.beatmapset_id;
|
cmd.Parameters.Add(new SqliteParameter("@Path", beatmap.Path));
|
||||||
beatmap.OnlineBeatmapID = found.beatmap_id;
|
|
||||||
|
|
||||||
LogForModel(set, $"Cached local retrieval for {beatmap}.");
|
using (var reader = cmd.ExecuteReader())
|
||||||
return true;
|
{
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
var status = (BeatmapSetOnlineStatus)reader.GetByte(2);
|
||||||
|
|
||||||
|
beatmap.Status = status;
|
||||||
|
beatmap.BeatmapSet.Status = status;
|
||||||
|
beatmap.BeatmapSet.OnlineBeatmapSetID = reader.GetInt32(0);
|
||||||
|
beatmap.OnlineBeatmapID = reader.GetInt32(1);
|
||||||
|
|
||||||
|
LogForModel(set, $"Cached local retrieval for {beatmap}.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Dapper" Version="2.0.78" />
|
|
||||||
<PackageReference Include="DiffPlex" Version="1.6.3" />
|
<PackageReference Include="DiffPlex" Version="1.6.3" />
|
||||||
<PackageReference Include="Humanizer" Version="2.8.26" />
|
<PackageReference Include="Humanizer" Version="2.8.26" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.10" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user