diff --git a/osu.Android.props b/osu.Android.props
index f8ce6befd4..7060e88026 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -52,6 +52,6 @@
-
+
diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj
index e201b250d4..cce7907c6c 100644
--- a/osu.Desktop/osu.Desktop.csproj
+++ b/osu.Desktop/osu.Desktop.csproj
@@ -24,16 +24,13 @@
+
-
-
-
-
diff --git a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
index e90ccbb805..ea91f2d2e0 100644
--- a/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
+++ b/osu.Game/Beatmaps/BeatmapManager_BeatmapOnlineLookupQueue.cs
@@ -7,7 +7,6 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-using Dapper;
using Microsoft.Data.Sqlite;
using osu.Framework.Development;
using osu.Framework.IO.Network;
@@ -154,20 +153,31 @@ namespace osu.Game.Beatmaps
{
using (var db = new SqliteConnection(storage.GetDatabaseConnectionString("online")))
{
- var found = db.QuerySingleOrDefault(
- "SELECT * FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineBeatmapID OR filename = @Path", beatmap);
+ db.Open();
- 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;
- beatmap.BeatmapSet.Status = status;
- beatmap.BeatmapSet.OnlineBeatmapSetID = found.beatmapset_id;
- beatmap.OnlineBeatmapID = found.beatmap_id;
+ cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmap.MD5Hash));
+ cmd.Parameters.Add(new SqliteParameter("@OnlineBeatmapID", beatmap.OnlineBeatmapID));
+ cmd.Parameters.Add(new SqliteParameter("@Path", beatmap.Path));
- LogForModel(set, $"Cached local retrieval for {beatmap}.");
- return true;
+ using (var reader = cmd.ExecuteReader())
+ {
+ 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;
+ }
+ }
}
}
}
diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
index b429a5277b..01bcbd3244 100644
--- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
+++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchFilterRow.cs
@@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK;
using Humanizer;
-using osu.Game.Utils;
+using osu.Framework.Extensions.EnumExtensions;
namespace osu.Game.Overlays.BeatmapListing
{
@@ -80,7 +80,7 @@ namespace osu.Game.Overlays.BeatmapListing
if (typeof(T).IsEnum)
{
- foreach (var val in OrderAttributeUtils.GetValuesInOrder())
+ foreach (var val in EnumExtensions.GetValuesInOrder())
AddItem(val);
}
}
diff --git a/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs b/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs
index eee5d8f7e1..015cee8ce3 100644
--- a/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs
+++ b/osu.Game/Overlays/BeatmapListing/SearchLanguage.cs
@@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using osu.Game.Utils;
+using osu.Framework.Utils;
namespace osu.Game.Overlays.BeatmapListing
{
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
index 324299ccba..ddd1dfa6cd 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
+using osu.Framework.Extensions.EnumExtensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@@ -15,7 +16,6 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Users.Drawables;
-using osu.Game.Utils;
using osuTK;
using osuTK.Graphics;
@@ -105,7 +105,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
var ruleset = scores.First().Ruleset.CreateInstance();
- foreach (var result in OrderAttributeUtils.GetValuesInOrder())
+ foreach (var result in EnumExtensions.GetValuesInOrder())
{
if (!allScoreStatistics.Contains(result))
continue;
diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs
index b3b3d11ab3..dbc2bd4d01 100644
--- a/osu.Game/Rulesets/Ruleset.cs
+++ b/osu.Game/Rulesets/Ruleset.cs
@@ -24,9 +24,9 @@ using osu.Game.Skinning;
using osu.Game.Users;
using JetBrains.Annotations;
using osu.Framework.Extensions;
+using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Testing;
using osu.Game.Screens.Ranking.Statistics;
-using osu.Game.Utils;
namespace osu.Game.Rulesets
{
@@ -272,7 +272,7 @@ namespace osu.Game.Rulesets
var validResults = GetValidHitResults();
// enumerate over ordered list to guarantee return order is stable.
- foreach (var result in OrderAttributeUtils.GetValuesInOrder())
+ foreach (var result in EnumExtensions.GetValuesInOrder())
{
switch (result)
{
@@ -298,7 +298,7 @@ namespace osu.Game.Rulesets
///
/// is implicitly included. Special types like are ignored even when specified.
///
- protected virtual IEnumerable GetValidHitResults() => OrderAttributeUtils.GetValuesInOrder();
+ protected virtual IEnumerable GetValidHitResults() => EnumExtensions.GetValuesInOrder();
///
/// Get a display friendly name for the specified result type.
diff --git a/osu.Game/Rulesets/Scoring/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs
index 6a3a034fc1..eaa1f95744 100644
--- a/osu.Game/Rulesets/Scoring/HitResult.cs
+++ b/osu.Game/Rulesets/Scoring/HitResult.cs
@@ -3,7 +3,7 @@
using System.ComponentModel;
using System.Diagnostics;
-using osu.Game.Utils;
+using osu.Framework.Utils;
namespace osu.Game.Rulesets.Scoring
{
diff --git a/osu.Game/Utils/OrderAttribute.cs b/osu.Game/Utils/OrderAttribute.cs
deleted file mode 100644
index aded7f9814..0000000000
--- a/osu.Game/Utils/OrderAttribute.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace osu.Game.Utils
-{
- public static class OrderAttributeUtils
- {
- ///
- /// Get values of an enum in order. Supports custom ordering via .
- ///
- public static IEnumerable GetValuesInOrder()
- {
- var type = typeof(T);
-
- if (!type.IsEnum)
- throw new InvalidOperationException("T must be an enum");
-
- IEnumerable items = (T[])Enum.GetValues(type);
-
- if (Attribute.GetCustomAttribute(type, typeof(HasOrderedElementsAttribute)) == null)
- return items;
-
- return items.OrderBy(i =>
- {
- if (type.GetField(i.ToString()).GetCustomAttributes(typeof(OrderAttribute), false).FirstOrDefault() is OrderAttribute attr)
- return attr.Order;
-
- throw new ArgumentException($"Not all values of {nameof(T)} have {nameof(OrderAttribute)} specified.");
- });
- }
- }
-
- [AttributeUsage(AttributeTargets.Field)]
- public class OrderAttribute : Attribute
- {
- public readonly int Order;
-
- public OrderAttribute(int order)
- {
- Order = order;
- }
- }
-
- [AttributeUsage(AttributeTargets.Enum)]
- public class HasOrderedElementsAttribute : Attribute
- {
- }
-}
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 97f4320c95..1552dff17d 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -18,7 +18,6 @@
-
@@ -26,8 +25,9 @@
+
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index 301e7378a6..48dc01f5de 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -70,7 +70,7 @@
-
+
@@ -88,7 +88,7 @@
-
+