1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Initial EF Core commit

This commit is contained in:
TocoToucan 2017-10-04 22:52:12 +03:00
parent de840a5c9e
commit 6a4198d0d6
93 changed files with 730 additions and 708 deletions

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
{
beatmap = original;
BeatmapDifficulty difficulty = original.BeatmapInfo.Difficulty;
BeatmapDifficulty difficulty = original.BeatmapInfo.BeatmapDifficulty;
int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate);
random = new FastRandom(seed);

View File

@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
// The true distance, accounting for any repeats
double distance = (distanceData?.Distance ?? 0) * repeatCount;
// The velocity of the osu! hit object - calculated as the velocity of a slider
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / timingPoint.BeatLength;
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier / timingPoint.BeatLength;
// The duration of the osu! hit object
double osuDuration = distance / osuVelocity;

View File

@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
if (drainTime == 0)
drainTime = 10000;
BeatmapDifficulty difficulty = Beatmap.BeatmapInfo.Difficulty;
BeatmapDifficulty difficulty = Beatmap.BeatmapInfo.BeatmapDifficulty;
conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + Beatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15;
conversionDifficulty = Math.Min(conversionDifficulty.Value, 12);

View File

@ -21,6 +21,6 @@ namespace osu.Game.Rulesets.Mania
return 0;
}
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize)));
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.BeatmapDifficulty.CircleSize)));
}
}

View File

@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
protected override void SimulateAutoplay(Beatmap<ManiaHitObject> beatmap)
{
BeatmapDifficulty difficulty = beatmap.BeatmapInfo.Difficulty;
BeatmapDifficulty difficulty = beatmap.BeatmapInfo.BeatmapDifficulty;
hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max);
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max);

View File

@ -88,18 +88,18 @@ namespace osu.Game.Rulesets.Mania.UI
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter()
{
if (IsForCurrentRuleset)
AvailableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize));
AvailableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.CircleSize));
else
{
float percentSliderOrSpinner = (float)WorkingBeatmap.Beatmap.HitObjects.Count(h => h is IHasEndTime) / WorkingBeatmap.Beatmap.HitObjects.Count;
if (percentSliderOrSpinner < 0.2)
AvailableColumns = 7;
else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize) >= 5)
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 5 ? 7 : 6;
else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.CircleSize) >= 5)
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) > 5 ? 7 : 6;
else if (percentSliderOrSpinner > 0.6)
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 4 ? 5 : 4;
AvailableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) > 4 ? 5 : 4;
else
AvailableColumns = Math.Max(4, Math.Min((int)Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) + 1, 7));
AvailableColumns = Math.Max(4, Math.Min((int)Math.Round(WorkingBeatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty) + 1, 7));
}
return new ManiaBeatmapConverter(IsForCurrentRuleset, AvailableColumns);

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
protected override void SimulateAutoplay(Beatmap<OsuHitObject> beatmap)
{
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
hpDrainRate = beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate;
foreach (var obj in beatmap.HitObjects)
{

View File

@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
if (autoCursorScale && beatmap.Value != null)
{
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.Difficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BeatmapDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);
}
cursorContainer.Scale = new Vector2(scale);

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
{
// Rewrite the beatmap info to add the slider velocity multiplier
BeatmapInfo info = original.BeatmapInfo.DeepClone();
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
info.BeatmapDifficulty.SliderMultiplier *= legacy_velocity_multiplier;
Beatmap<TaikoHitObject> converted = base.ConvertBeatmap(original);
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
// The velocity of the taiko hit object - calculated as the velocity of a drum roll
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the taiko hit object
double taikoDuration = distance / taikoVelocity;
@ -103,12 +103,12 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
speedAdjustedBeatLength *= speedAdjustment;
// The velocity of the osu! hit object - calculated as the velocity of a slider
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.BeatmapDifficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the osu! hit object
double osuDuration = distance / osuVelocity;
// If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats);
double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.BeatmapDifficulty.SliderTickRate, taikoDuration / repeats);
if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength)
{
@ -151,13 +151,13 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
Samples = obj.Samples,
IsStrong = strong,
Duration = taikoDuration,
TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4,
TickRate = beatmap.BeatmapInfo.BeatmapDifficulty.SliderTickRate == 3 ? 3 : 4,
};
}
}
else if (endTimeData != null)
{
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;
double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier;
yield return new Swell
{

View File

@ -71,12 +71,12 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override void SimulateAutoplay(Beatmap<TaikoHitObject> beatmap)
{
double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, 0.5, 0.75, 0.98));
double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate, 0.5, 0.75, 0.98));
hpIncreaseTick = hp_hit_tick;
hpIncreaseGreat = hpMultiplierNormal * hp_hit_great;
hpIncreaseGood = hpMultiplierNormal * hp_hit_good;
hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max);
hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BeatmapDifficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max);
foreach (var obj in beatmap.HitObjects)
{

View File

@ -67,8 +67,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
HitObjects = new List<HitObject> { new CentreHit() },
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata
BeatmapDifficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata
{
Artist = @"Unknown",
Title = @"Sample Beatmap",

View File

@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.UI
StartTime = time,
};
barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty);
barLine.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty);
bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0;
Playfield.Add(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine));

View File

@ -23,8 +23,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
var meta = beatmap.BeatmapInfo.Metadata;
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
var meta = beatmap.BeatmapInfo.BeatmapMetadata;
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId);
Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(false, beatmapInfo.Countdown);
Assert.AreEqual(0.7f, beatmapInfo.StackLeniency);
Assert.AreEqual(false, beatmapInfo.SpecialStyle);
Assert.IsTrue(beatmapInfo.RulesetID == 0);
Assert.IsTrue(beatmapInfo.RulesetInfoId == 0);
Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks);
Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard);
}
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
var difficulty = beatmap.BeatmapInfo.Difficulty;
var difficulty = beatmap.BeatmapInfo.BeatmapDifficulty;
Assert.AreEqual(6.5f, difficulty.DrainRate);
Assert.AreEqual(4, difficulty.CircleSize);
Assert.AreEqual(8, difficulty.OverallDifficulty);

View File

@ -111,7 +111,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var store = osu.Dependencies.Get<BeatmapManager>();
waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any(),
waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526)).Any(),
@"BeatmapSet did not import to the database in allocated time.", timeout);
//ensure we were stored to beatmap database backing...
@ -120,29 +120,29 @@ namespace osu.Game.Tests.Beatmaps.IO
IEnumerable<BeatmapInfo> resultBeatmaps = null;
//if we don't re-check here, the set will be inserted but the beatmaps won't be present yet.
waitForOrAssert(() => (resultBeatmaps = store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() == 12,
waitForOrAssert(() => (resultBeatmaps = store.QueryBeatmaps(s => s.BeatmapSetOnlineInfoId == 241526 && s.BeatmapDifficultyId > 0)).Count() == 12,
@"Beatmaps did not import to the database in allocated time", timeout);
var set = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526).First();
var set = store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526).First();
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");
foreach (BeatmapInfo b in resultBeatmaps)
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
Assert.IsTrue(set.Beatmaps.Any(c => c.BeatmapOnlineInfoId == b.BeatmapOnlineInfoId));
Assert.IsTrue(set.Beatmaps.Count > 0);
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 0))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap;
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 1))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap;
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 2))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap;
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 3))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO
using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId);
Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);

View File

@ -6,6 +6,10 @@
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SharpCompress" publicKeyToken="afb0a02973931d96" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.18.1.0" newVersion="0.18.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -39,15 +39,6 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="SQLite.Net">
<HintPath>$(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net.Platform.Win32">
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net.Platform.Generic">
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">

View File

@ -6,6 +6,4 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste
<packages>
<package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="OpenTK" version="3.0.0-git00009" targetFramework="net461" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="net45" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="net45" />
</packages>

View File

@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps
new Color4(121, 9, 13, 255)
};
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
public BeatmapMetadata Metadata => BeatmapInfo?.BeatmapMetadata ?? BeatmapInfo?.BeatmapSetInfo?.BeatmapMetadata;
/// <summary>
/// The HitObjects this Beatmap contains.

View File

@ -1,7 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using SQLite.Net.Attributes;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace osu.Game.Beatmaps
{
@ -12,8 +13,8 @@ namespace osu.Game.Beatmaps
/// </summary>
public const float DEFAULT_DIFFICULTY = 5;
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;

View File

@ -2,49 +2,43 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.IO.Serialization;
using osu.Game.Rulesets;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace osu.Game.Beatmaps
{
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
//TODO: should be in database
public int BeatmapVersion;
public int? OnlineBeatmapID { get; set; }
public int? BeatmapOnlineInfoId { get; set; }
public int? OnlineBeatmapSetID { get; set; }
public int? BeatmapSetOnlineInfoId { get; set; }
[ForeignKey(typeof(BeatmapSetInfo))]
public int BeatmapSetInfoID { get; set; }
[ForeignKey(nameof(BeatmapSetInfo))]
public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
[ManyToOne]
public BeatmapSetInfo BeatmapSet { get; set; }
[ForeignKey(nameof(BeatmapMetadata))]
public int BeatmapMetadataId { get; set; }
public BeatmapMetadata BeatmapMetadata { get; set; }
[ForeignKey(typeof(BeatmapMetadata))]
public int BeatmapMetadataID { get; set; }
[ForeignKey(nameof(BeatmapDifficulty))]
public int BeatmapDifficultyId { get; set; }
public BeatmapDifficulty BeatmapDifficulty { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.All)]
public BeatmapMetadata Metadata { get; set; }
[ForeignKey(typeof(BeatmapDifficulty)), NotNull]
public int BaseDifficultyID { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.All)]
public BeatmapDifficulty Difficulty { get; set; }
[Ignore]
[NotMapped]
public BeatmapMetrics Metrics { get; set; }
[Ignore]
[NotMapped]
public BeatmapOnlineInfo OnlineInfo { get; set; }
public string Path { get; set; }
@ -57,7 +51,6 @@ namespace osu.Game.Beatmaps
/// <summary>
/// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.).
/// </summary>
[Indexed]
[JsonProperty("file_md5")]
public string MD5Hash { get; set; }
@ -67,11 +60,9 @@ namespace osu.Game.Beatmaps
public float StackLeniency { get; set; }
public bool SpecialStyle { get; set; }
[ForeignKey(typeof(RulesetInfo))]
public int RulesetID { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.CascadeRead)]
public RulesetInfo Ruleset { get; set; }
[ForeignKey(nameof(RulesetInfo))]
public int RulesetInfoId { get; set; }
public RulesetInfo RulesetInfo { get; set; }
public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; }
@ -99,7 +90,7 @@ namespace osu.Game.Beatmaps
}
}
[Ignore]
[NotMapped]
public int[] Bookmarks { get; set; } = new int[0];
public double DistanceSpacing { get; set; }
@ -114,20 +105,20 @@ namespace osu.Game.Beatmaps
public bool Equals(BeatmapInfo other)
{
if (ID == 0 || other?.ID == 0)
if (Id == 0 || other?.Id == 0)
// one of the two BeatmapInfos we are comparing isn't sourced from a database.
// fall back to reference equality.
return ReferenceEquals(this, other);
return ID == other?.ID;
return Id == other?.Id;
}
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null &&
BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash &&
(BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).AudioFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).AudioFile;
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile;
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSetInfo != null && other.BeatmapSetInfo != null &&
BeatmapSetInfo.Hash == other.BeatmapSetInfo.Hash &&
(BeatmapMetadata ?? BeatmapSetInfo.BeatmapMetadata).BackgroundFile == (other.BeatmapMetadata ?? other.BeatmapSetInfo.BeatmapMetadata).BackgroundFile;
}
}

View File

@ -19,9 +19,9 @@ using osu.Game.IO;
using osu.Game.IPC;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets;
using SQLite.Net;
using osu.Game.Online.API.Requests;
using System.Threading.Tasks;
using osu.Game.Database;
using osu.Game.Online.API;
namespace osu.Game.Beatmaps
@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps
private readonly FileStore files;
private readonly SQLiteConnection connection;
private readonly OsuDbContext connection;
private readonly RulesetStore rulesets;
@ -83,7 +83,7 @@ namespace osu.Game.Beatmaps
/// </summary>
public Func<Storage> GetStableStorage { private get; set; }
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null)
public BeatmapManager(Storage storage, FileStore files, OsuDbContext connection, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null)
{
beatmaps = new BeatmapStore(connection);
beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s);
@ -168,7 +168,7 @@ namespace osu.Game.Beatmaps
// let's only allow one concurrent import at a time for now.
lock (importLock)
connection.RunInTransaction(() => Import(set = importToStorage(archiveReader)));
Import(set = importToStorage(archiveReader));
return set;
}
@ -180,7 +180,7 @@ namespace osu.Game.Beatmaps
public void Import(BeatmapSetInfo beatmapSetInfo)
{
// If we have an ID then we already exist in the database.
if (beatmapSetInfo.ID != 0) return;
if (beatmapSetInfo.Id != 0) return;
beatmaps.Add(beatmapSetInfo);
}
@ -200,7 +200,7 @@ namespace osu.Game.Beatmaps
ProgressNotification downloadNotification = new ProgressNotification
{
Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}",
Text = $"Downloading {beatmapSetInfo.BeatmapMetadata.Artist} - {beatmapSetInfo.BeatmapMetadata.Title}",
};
var request = new DownloadBeatmapSetRequest(beatmapSetInfo);
@ -251,7 +251,7 @@ namespace osu.Game.Beatmaps
/// </summary>
/// <param name="beatmap">The <see cref="BeatmapSetInfo"/> whose download request is wanted.</param>
/// <returns>The <see cref="DownloadBeatmapSetRequest"/> object if it exists, or null.</returns>
public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID);
public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.BeatmapSetOnlineInfoId == beatmap.BeatmapSetOnlineInfoId);
/// <summary>
/// Delete a beatmap from the manager.
@ -302,14 +302,15 @@ namespace osu.Game.Beatmaps
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
return DefaultBeatmap;
lock (beatmaps)
beatmaps.Populate(beatmapInfo);
// TODO Include()
//lock (beatmaps)
// beatmaps.Populate(beatmapInfo);
if (beatmapInfo.BeatmapSet == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
if (beatmapInfo.BeatmapSetInfo == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database.");
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
if (beatmapInfo.BeatmapMetadata == null)
beatmapInfo.BeatmapMetadata = beatmapInfo.BeatmapSetInfo.BeatmapMetadata;
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(files.Store, beatmapInfo);
@ -336,10 +337,11 @@ namespace osu.Game.Beatmaps
{
lock (beatmaps)
{
BeatmapSetInfo set = beatmaps.Query<BeatmapSetInfo>().FirstOrDefault(query);
BeatmapSetInfo set = beatmaps.QueryBeatmapSet(query);
if (set != null)
beatmaps.Populate(set);
// TODO Include()
//if (set != null)
// beatmaps.Populate(set);
return set;
}
@ -350,7 +352,7 @@ namespace osu.Game.Beatmaps
/// </summary>
/// <param name="beatmapSet">A stale instance.</param>
/// <returns>A fresh instance.</returns>
public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.ID == beatmapSet.ID);
public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.Id == beatmapSet.Id);
/// <summary>
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
@ -359,7 +361,7 @@ namespace osu.Game.Beatmaps
/// <returns>Results from the provided query.</returns>
public List<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query)
{
return beatmaps.QueryAndPopulate(query);
return beatmaps.QueryBeatmapSets(query);
}
/// <summary>
@ -369,10 +371,11 @@ namespace osu.Game.Beatmaps
/// <returns>The first result for the provided query, or null if no results were found.</returns>
public BeatmapInfo QueryBeatmap(Func<BeatmapInfo, bool> query)
{
BeatmapInfo set = beatmaps.Query<BeatmapInfo>().FirstOrDefault(query);
BeatmapInfo set = beatmaps.QueryBeatmap(query);
if (set != null)
beatmaps.Populate(set);
// TODO Include()
//if (set != null)
// beatmaps.Populate(set);
return set;
}
@ -384,7 +387,7 @@ namespace osu.Game.Beatmaps
/// <returns>Results from the provided query.</returns>
public List<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query)
{
lock (beatmaps) return beatmaps.QueryAndPopulate(query);
lock (beatmaps) return beatmaps.QueryBeatmaps(query);
}
/// <summary>
@ -424,7 +427,7 @@ namespace osu.Game.Beatmaps
// check if this beatmap has already been imported and exit early if so.
BeatmapSetInfo beatmapSet;
lock (beatmaps)
beatmapSet = beatmaps.QueryAndPopulate<BeatmapSetInfo>(b => b.Hash == hash).FirstOrDefault();
beatmapSet = beatmaps.QueryBeatmapSet(b => b.Hash == hash);
if (beatmapSet != null)
{
@ -459,11 +462,11 @@ namespace osu.Game.Beatmaps
beatmapSet = new BeatmapSetInfo
{
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
BeatmapSetOnlineInfoId = metadata.BeatmapSetOnlineInfoId,
Beatmaps = new List<BeatmapInfo>(),
Hash = hash,
Files = fileInfos,
Metadata = metadata
BeatmapMetadata = metadata
};
var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));
@ -485,11 +488,11 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;
beatmap.BeatmapInfo.BeatmapMetadata = null;
// TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.Ruleset = rulesets.Query<RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID);
beatmap.BeatmapInfo.StarDifficulty = rulesets.Query<RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
beatmap.BeatmapInfo.RulesetInfo = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId);
beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
.Calculate() ?? 0;
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
@ -509,9 +512,9 @@ namespace osu.Game.Beatmaps
lock (beatmaps)
{
if (populate)
return beatmaps.QueryAndPopulate<BeatmapSetInfo>(b => !b.DeletePending).ToList();
return beatmaps.QueryBeatmapSets(b => !b.DeletePending);
else
return beatmaps.Query<BeatmapSetInfo>(b => !b.DeletePending).ToList();
return beatmaps.QueryBeatmapSets(b => !b.DeletePending);
}
}

View File

@ -1,18 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
using SQLite.Net.Attributes;
namespace osu.Game.Beatmaps
{
public class BeatmapMetadata
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int? OnlineBeatmapSetID { get; set; }
public int? BeatmapSetOnlineInfoId { get; set; }
public string Title { get; set; }
public string TitleUnicode { get; set; }

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace osu.Game.Beatmaps
@ -10,6 +11,9 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapOnlineInfo
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary>
/// The length in milliseconds of this beatmap's song.
/// </summary>

View File

@ -1,27 +1,26 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.IO;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace osu.Game.Beatmaps
{
public class BeatmapSetFileInfo
{
[PrimaryKey, AutoIncrement]
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
[ForeignKey(typeof(BeatmapSetInfo)), NotNull]
public int BeatmapSetInfoID { get; set; }
[ForeignKey(nameof(BeatmapSetInfo))]
public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
[ForeignKey(typeof(FileInfo)), NotNull]
public int FileInfoID { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.CascadeRead)]
[ForeignKey(nameof(FileInfo))]
public int FileInfoId { get; set; }
public FileInfo FileInfo { get; set; }
[NotNull]
[Required]
public string Filename { get; set; }
}
}
}

View File

@ -2,41 +2,36 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace osu.Game.Beatmaps
{
public class BeatmapSetInfo
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int? OnlineBeatmapSetID { get; set; }
public int? BeatmapSetOnlineInfoId { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.All)]
public BeatmapMetadata Metadata { get; set; }
[ForeignKey(nameof(BeatmapMetadata))]
public int BeatmapMetadataId { get; set; }
public BeatmapMetadata BeatmapMetadata { get; set; }
[NotNull, ForeignKey(typeof(BeatmapMetadata))]
public int BeatmapMetadataID { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<BeatmapInfo> Beatmaps { get; set; }
[Ignore]
[NotMapped]
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
[Indexed]
public bool DeletePending { get; set; }
public string Hash { get; set; }
public string StoryboardFile => Files.FirstOrDefault(f => f.Filename.EndsWith(".osb"))?.Filename;
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<BeatmapSetFileInfo> Files { get; set; }
public bool Protected { get; set; }

View File

@ -2,6 +2,9 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using osu.Game.Users;
@ -12,11 +15,19 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapSetOnlineInfo
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary>
/// The author of the beatmaps in this set.
/// </summary>
public User Author;
public int BeatmapSetInfoId { get; set; }
public BeatmapSetInfo BeatmapSetInfo { get; set; }
public List<BeatmapInfo> Beatmaps { get; set; }
/// <summary>
/// The date this beatmap set was submitted to the online listing.
/// </summary>
@ -35,7 +46,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The different sizes of cover art for this beatmap set.
/// </summary>
[JsonProperty(@"covers")]
[Required, JsonProperty(@"covers")]
public BeatmapSetOnlineCovers Covers { get; set; }
/// <summary>
@ -64,6 +75,9 @@ namespace osu.Game.Beatmaps
public class BeatmapSetOnlineCovers
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string CoverLowRes { get; set; }
[JsonProperty(@"cover@2x")]

View File

@ -2,9 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using osu.Game.Database;
using SQLite.Net;
using SQLiteNetExtensions.Extensions;
namespace osu.Game.Beatmaps
{
@ -19,13 +21,7 @@ namespace osu.Game.Beatmaps
public event Action<BeatmapInfo> BeatmapHidden;
public event Action<BeatmapInfo> BeatmapRestored;
/// <summary>
/// The current version of this store. Used for migrations (see <see cref="PerformMigration(int, int)"/>).
/// The initial version is 1.
/// </summary>
protected override int StoreVersion => 4;
public BeatmapStore(SQLiteConnection connection)
public BeatmapStore(OsuDbContext connection)
: base(connection)
{
}
@ -42,18 +38,13 @@ namespace osu.Game.Beatmaps
{
if (reset)
{
Connection.DropTable<BeatmapMetadata>();
Connection.DropTable<BeatmapDifficulty>();
Connection.DropTable<BeatmapSetInfo>();
Connection.DropTable<BeatmapSetFileInfo>();
Connection.DropTable<BeatmapInfo>();
// https://stackoverflow.com/a/10450893
Connection.Database.ExecuteSqlCommand("DELETE FROM BeatmapMetadata");
Connection.Database.ExecuteSqlCommand("DELETE FROM BeatmapDifficulty");
Connection.Database.ExecuteSqlCommand("DELETE FROM BeatmapSetInfo");
Connection.Database.ExecuteSqlCommand("DELETE FROM BeatmapSetFileInfo");
Connection.Database.ExecuteSqlCommand("DELETE FROM BeatmapInfo");
}
Connection.CreateTable<BeatmapMetadata>();
Connection.CreateTable<BeatmapDifficulty>();
Connection.CreateTable<BeatmapSetInfo>();
Connection.CreateTable<BeatmapSetFileInfo>();
Connection.CreateTable<BeatmapInfo>();
}
protected override void StartupTasks()
@ -62,46 +53,14 @@ namespace osu.Game.Beatmaps
cleanupPendingDeletions();
}
/// <summary>
/// Perform migrations between two store versions.
/// </summary>
/// <param name="currentVersion">The current store version. This will be zero on a fresh database initialisation.</param>
/// <param name="targetVersion">The target version which we are migrating to (equal to the current <see cref="StoreVersion"/>).</param>
protected override void PerformMigration(int currentVersion, int targetVersion)
{
base.PerformMigration(currentVersion, targetVersion);
while (currentVersion++ < targetVersion)
{
switch (currentVersion)
{
case 1:
case 2:
// cannot migrate; breaking underlying changes.
Reset();
break;
case 3:
// Added MD5Hash column to BeatmapInfo
Connection.MigrateTable<BeatmapInfo>();
break;
case 4:
// Added Hidden column to BeatmapInfo
Connection.MigrateTable<BeatmapInfo>();
break;
}
}
}
/// <summary>
/// Add a <see cref="BeatmapSetInfo"/> to the database.
/// </summary>
/// <param name="beatmapSet">The beatmap to add.</param>
public void Add(BeatmapSetInfo beatmapSet)
{
Connection.RunInTransaction(() =>
{
Connection.InsertOrReplaceWithChildren(beatmapSet, true);
});
Connection.BeatmapSetInfo.Update(beatmapSet);
Connection.SaveChanges();
BeatmapSetAdded?.Invoke(beatmapSet);
}
@ -116,7 +75,8 @@ namespace osu.Game.Beatmaps
if (beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = true;
Connection.Update(beatmapSet);
Connection.BeatmapSetInfo.Remove(beatmapSet);
Connection.SaveChanges();
BeatmapSetRemoved?.Invoke(beatmapSet);
return true;
@ -132,7 +92,7 @@ namespace osu.Game.Beatmaps
if (!beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = false;
Connection.Update(beatmapSet);
Connection.BeatmapSetInfo.Update(beatmapSet);
BeatmapSetAdded?.Invoke(beatmapSet);
return true;
@ -148,7 +108,7 @@ namespace osu.Game.Beatmaps
if (beatmap.Hidden) return false;
beatmap.Hidden = true;
Connection.Update(beatmap);
Connection.BeatmapInfo.Update(beatmap);
BeatmapHidden?.Invoke(beatmap);
return true;
@ -164,7 +124,7 @@ namespace osu.Game.Beatmaps
if (!beatmap.Hidden) return false;
beatmap.Hidden = false;
Connection.Update(beatmap);
Connection.BeatmapInfo.Update(beatmap);
BeatmapRestored?.Invoke(beatmap);
return true;
@ -172,11 +132,27 @@ namespace osu.Game.Beatmaps
private void cleanupPendingDeletions()
{
Connection.RunInTransaction(() =>
{
foreach (var b in QueryAndPopulate<BeatmapSetInfo>(b => b.DeletePending && !b.Protected))
Connection.Delete(b, true);
});
Connection.BeatmapSetInfo.RemoveRange(Connection.BeatmapSetInfo.Where(b => b.DeletePending && !b.Protected));
}
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> query)
{
return Connection.BeatmapSetInfo.FirstOrDefault(query);
}
public List<BeatmapSetInfo> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query)
{
return Connection.BeatmapSetInfo.Where(query).ToList();
}
public BeatmapInfo QueryBeatmap(Func<BeatmapInfo, bool> query)
{
return Connection.BeatmapInfo.FirstOrDefault(query);
}
public List<BeatmapInfo> QueryBeatmaps(Expression<Func<BeatmapInfo, bool>> query)
{
return Connection.BeatmapInfo.Where(query).ToList();
}
}
}

View File

@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps
Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects;
foreach (var h in Objects)
h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);
h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty);
PreprocessHitObjects();
}

View File

@ -135,7 +135,7 @@ namespace osu.Game.Beatmaps.Drawables
new OsuSpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
Text = $"{(beatmap.BeatmapMetadata ?? beatmap.BeatmapSetInfo.BeatmapMetadata).Author}",
TextSize = 16,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft

View File

@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps.Drawables
new ConstrainedIconContainer
{
RelativeSizeAxes = Axes.Both,
Icon = beatmap.Ruleset.CreateInstance().CreateIcon()
Icon = beatmap.RulesetInfo.CreateInstance().CreateIcon()
}
};
}

View File

@ -18,14 +18,14 @@ namespace osu.Game.Beatmaps
public DummyWorkingBeatmap(OsuGameBase game)
: base(new BeatmapInfo
{
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Artist = "please load a beatmap!",
Title = "no beatmaps available!",
Author = "no one",
},
BeatmapSet = new BeatmapSetInfo(),
Difficulty = new BeatmapDifficulty
BeatmapSetInfo = new BeatmapSetInfo(),
BeatmapDifficulty = new BeatmapDifficulty
{
DrainRate = 0,
CircleSize = 0,
@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps
SliderMultiplier = 0,
SliderTickRate = 0,
},
Ruleset = new DummyRulesetInfo()
RulesetInfo = new DummyRulesetInfo()
})
{
this.game = game;

View File

@ -48,8 +48,8 @@ namespace osu.Game.Beatmaps.Formats
{
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
Difficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata(),
BeatmapDifficulty = new BeatmapDifficulty(),
},
};

View File

@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.Formats
{
var pair = splitKeyVal(line, ':');
var metadata = beatmap.BeatmapInfo.Metadata;
var metadata = beatmap.BeatmapInfo.BeatmapMetadata;
switch (pair.Key)
{
case @"AudioFilename":
@ -97,9 +97,9 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
break;
case @"Mode":
beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
beatmap.BeatmapInfo.RulesetInfoId = int.Parse(pair.Value);
switch (beatmap.BeatmapInfo.RulesetID)
switch (beatmap.BeatmapInfo.RulesetInfoId)
{
case 0:
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
@ -155,7 +155,7 @@ namespace osu.Game.Beatmaps.Formats
{
var pair = splitKeyVal(line, ':');
var metadata = beatmap.BeatmapInfo.Metadata;
var metadata = beatmap.BeatmapInfo.BeatmapMetadata;
switch (pair.Key)
{
case @"Title":
@ -177,17 +177,17 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.Version = pair.Value;
break;
case @"Source":
beatmap.BeatmapInfo.Metadata.Source = pair.Value;
beatmap.BeatmapInfo.BeatmapMetadata.Source = pair.Value;
break;
case @"Tags":
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
beatmap.BeatmapInfo.BeatmapMetadata.Tags = pair.Value;
break;
case @"BeatmapID":
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value);
break;
case @"BeatmapSetID":
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value);
metadata.OnlineBeatmapSetID = int.Parse(pair.Value);
beatmap.BeatmapInfo.BeatmapSetOnlineInfoId = int.Parse(pair.Value);
metadata.BeatmapSetOnlineInfoId = int.Parse(pair.Value);
break;
}
}
@ -196,7 +196,7 @@ namespace osu.Game.Beatmaps.Formats
{
var pair = splitKeyVal(line, ':');
var difficulty = beatmap.BeatmapInfo.Difficulty;
var difficulty = beatmap.BeatmapInfo.BeatmapDifficulty;
switch (pair.Key)
{
case @"HPDrainRate":
@ -270,7 +270,7 @@ namespace osu.Game.Beatmaps.Formats
string filename = split[2].Trim('"');
if (type == EventType.Background)
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
beatmap.BeatmapInfo.BeatmapMetadata.BackgroundFile = filename;
break;
case EventType.Break:
@ -674,7 +674,7 @@ namespace osu.Game.Beatmaps.Formats
}
foreach (var hitObject in beatmap.HitObjects)
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty);
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BeatmapDifficulty);
}
private KeyValuePair<string, string> splitKeyVal(string line, char separator)

View File

@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps
protected WorkingBeatmap(BeatmapInfo beatmapInfo)
{
BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
BeatmapSetInfo = beatmapInfo.BeatmapSetInfo;
Metadata = beatmapInfo.BeatmapMetadata ?? BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata();
Mods.ValueChanged += mods => applyRateAdjustments();
}

View File

@ -2,27 +2,23 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Logging;
using osu.Framework.Platform;
using SQLite.Net;
using SQLiteNetExtensions.Extensions;
namespace osu.Game.Database
{
public abstract class DatabaseBackedStore
{
protected readonly Storage Storage;
protected readonly SQLiteConnection Connection;
protected readonly OsuDbContext Connection;
protected virtual int StoreVersion => 1;
protected DatabaseBackedStore(SQLiteConnection connection, Storage storage = null)
protected DatabaseBackedStore(OsuDbContext connection, Storage storage = null)
{
Storage = storage;
Connection = connection;
Connection.Database.SetCommandTimeout(new TimeSpan(TimeSpan.TicksPerSecond * 10));
try
{
@ -33,36 +29,6 @@ namespace osu.Game.Database
Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database...");
Prepare(true);
}
checkMigrations();
}
private void checkMigrations()
{
var storeName = GetType().Name;
var reportedVersion = Connection.Table<StoreVersion>().Where(s => s.StoreName == storeName).FirstOrDefault() ?? new StoreVersion
{
StoreName = storeName,
Version = 0
};
if (reportedVersion.Version != StoreVersion)
PerformMigration(reportedVersion.Version, reportedVersion.Version = StoreVersion);
Connection.InsertOrReplace(reportedVersion);
StartupTasks();
}
/// <summary>
/// Called when the database version of this store doesn't match the local version.
/// Any manual migration operations should be performed in this.
/// </summary>
/// <param name="currentVersion">The current store version. This will be zero on a fresh database initialisation.</param>
/// <param name="targetVersion">The target version which we are migrating to (equal to the current <see cref="StoreVersion"/>).</param>
protected virtual void PerformMigration(int currentVersion, int targetVersion)
{
}
/// <summary>
@ -83,43 +49,6 @@ namespace osu.Game.Database
/// </summary>
public void Reset() => Prepare(true);
public TableQuery<T> Query<T>(Expression<Func<T, bool>> filter = null) where T : class
{
checkType(typeof(T));
var query = Connection.Table<T>();
if (filter != null)
query = query.Where(filter);
return query;
}
/// <summary>
/// Query and populate results.
/// </summary>
/// <param name="filter">An filter to refine results.</param>
/// <returns></returns>
public List<T> QueryAndPopulate<T>(Expression<Func<T, bool>> filter)
where T : class
{
checkType(typeof(T));
return Connection.GetAllWithChildren(filter, true);
}
/// <summary>
/// Populate a database-backed item.
/// </summary>
/// <param name="item"></param>
/// <param name="recursive">Whether population should recurse beyond a single level.</param>
public void Populate<T>(T item, bool recursive = true)
{
checkType(item.GetType());
Connection.GetChildren(item, recursive);
}
private void checkType(Type type)
{
if (!ValidTypes.Contains(type))

View File

@ -0,0 +1,8 @@
using Microsoft.EntityFrameworkCore;
namespace osu.Game.Database
{
public abstract class DbContextBase:DbContext
{
}
}

View File

@ -0,0 +1,55 @@
using Microsoft.EntityFrameworkCore;
using osu.Game.Beatmaps;
using osu.Game.Input.Bindings;
using osu.Game.IO;
using osu.Game.Rulesets;
namespace osu.Game.Database
{
public class OsuDbContext : DbContext
{
private readonly string connectionString;
public OsuDbContext()
{
connectionString = "DataSource=:memory:";
}
public OsuDbContext(string connectionString)
{
this.connectionString = connectionString;
}
public DbSet<BeatmapMetadata> BeatmapMetadata { get; set; }
public DbSet<BeatmapDifficulty> BeatmapDifficulty { get; set; }
public DbSet<BeatmapInfo> BeatmapInfo { get; set; }
public DbSet<BeatmapSetInfo> BeatmapSetInfo { get; set; }
public DbSet<BeatmapSetFileInfo> BeatmapSetFileInfo { get; set; }
public DbSet<DatabasedKeyBinding> DatabasedKeyBinding { get; set; }
public DbSet<FileInfo> FileInfo { get; set; }
public DbSet<RulesetInfo> RulesetInfo { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseSqlite(connectionString);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.MD5Hash);
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.DeletePending);
modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.Variant);
modelBuilder.Entity<DatabasedKeyBinding>().HasIndex(b => b.IntAction);
modelBuilder.Entity<FileInfo>().HasIndex(b => b.Hash).IsUnique();
modelBuilder.Entity<FileInfo>().HasIndex(b => b.ReferenceCount);
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Name).IsUnique();
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.InstantiationInfo).IsUnique();
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Available);
//modelBuilder.Entity<BeatmapMetadata>().HasOne(b => b.BeatmapSetOnlineInfo).WithOne(bs => bs.BeatmapMetadata).OnDelete(DeleteBehavior.SetNull);
//modelBuilder.Entity<BeatmapSetInfo>().HasOne(b => b.BeatmapSetOnlineInfo).WithOne(bs => bs.BeatmapSetInfo).OnDelete(DeleteBehavior.SetNull);
//modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BeatmapSetOnlineInfo).WithMany(bs => bs.Beatmaps).OnDelete(DeleteBehavior.SetNull);
}
}
}

View File

@ -1,15 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using SQLite.Net.Attributes;
namespace osu.Game.Database
{
public class StoreVersion
{
[PrimaryKey]
public string StoreName { get; set; }
public int Version { get; set; }
}
}

View File

@ -1,22 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using SQLite.Net.Attributes;
namespace osu.Game.IO
{
public class FileInfo
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Indexed(Unique = true)]
public string Hash { get; set; }
public string StoragePath => Path.Combine(Hash.Remove(1), Hash.Remove(2), Hash);
[Indexed]
public int ReferenceCount { get; set; }
}
}

View File

@ -4,12 +4,12 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Extensions;
using osu.Framework.IO.Stores;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Database;
using SQLite.Net;
namespace osu.Game.IO
{
@ -22,9 +22,7 @@ namespace osu.Game.IO
public readonly ResourceStore<byte[]> Store;
protected override int StoreVersion => 2;
public FileStore(SQLiteConnection connection, Storage storage) : base(connection, storage)
public FileStore(OsuDbContext connection, Storage storage) : base(connection, storage)
{
Store = new NamespacedResourceStore<byte[]>(new StorageBackedResourceStore(storage), prefix);
}
@ -44,10 +42,8 @@ namespace osu.Game.IO
if (Storage.ExistsDirectory(prefix))
Storage.DeleteDirectory(prefix);
Connection.DropTable<FileInfo>();
Connection.Database.ExecuteSqlCommand("DELETE FROM FileInfo");
}
Connection.CreateTable<FileInfo>();
}
protected override void StartupTasks()
@ -56,33 +52,11 @@ namespace osu.Game.IO
deletePending();
}
/// <summary>
/// Perform migrations between two store versions.
/// </summary>
/// <param name="currentVersion">The current store version. This will be zero on a fresh database initialisation.</param>
/// <param name="targetVersion">The target version which we are migrating to (equal to the current <see cref="StoreVersion"/>).</param>
protected override void PerformMigration(int currentVersion, int targetVersion)
{
base.PerformMigration(currentVersion, targetVersion);
while (currentVersion++ < targetVersion)
{
switch (currentVersion)
{
case 1:
case 2:
// cannot migrate; breaking underlying changes.
Reset();
break;
}
}
}
public FileInfo Add(Stream data, bool reference = true)
{
string hash = data.ComputeSHA2Hash();
var existing = Connection.Table<FileInfo>().Where(f => f.Hash == hash).FirstOrDefault();
var existing = Connection.FileInfo.Where(f => f.Hash == hash).FirstOrDefault();
var info = existing ?? new FileInfo { Hash = hash };
@ -100,61 +74,54 @@ namespace osu.Game.IO
}
if (existing == null)
Connection.Insert(info);
Connection.FileInfo.Add(info);
if (reference || existing == null)
Reference(info);
Connection.SaveChanges();
return info;
}
public void Reference(params FileInfo[] files)
{
Connection.RunInTransaction(() =>
var incrementedFiles = files.GroupBy(f => f.Id).Select(f =>
{
var incrementedFiles = files.GroupBy(f => f.ID).Select(f =>
{
var accurateRefCount = Connection.Get<FileInfo>(f.First().ID);
accurateRefCount.ReferenceCount += f.Count();
return accurateRefCount;
});
Connection.UpdateAll(incrementedFiles);
var accurateRefCount = Connection.Find<FileInfo>(f.First().Id);
accurateRefCount.ReferenceCount += f.Count();
return accurateRefCount;
});
//Connection.FileInfo.UpdateRange(incrementedFiles);
Connection.SaveChanges();
}
public void Dereference(params FileInfo[] files)
{
Connection.RunInTransaction(() =>
var incrementedFiles = files.GroupBy(f => f.Id).Select(f =>
{
var incrementedFiles = files.GroupBy(f => f.ID).Select(f =>
{
var accurateRefCount = Connection.Get<FileInfo>(f.First().ID);
accurateRefCount.ReferenceCount -= f.Count();
return accurateRefCount;
});
Connection.UpdateAll(incrementedFiles);
var accurateRefCount = Connection.Find<FileInfo>(f.First().Id);
accurateRefCount.ReferenceCount -= f.Count();
return accurateRefCount;
});
//Connection.FileInfo.UpdateRange(incrementedFiles);
Connection.SaveChanges();
}
private void deletePending()
{
Connection.RunInTransaction(() =>
foreach (var f in Connection.FileInfo.Where(f => f.ReferenceCount < 1))
{
foreach (var f in Query<FileInfo>(f => f.ReferenceCount < 1))
try
{
try
{
Storage.Delete(Path.Combine(prefix, f.StoragePath));
Connection.Delete(f);
}
catch (Exception e)
{
Logger.Error(e, $@"Could not delete beatmap {f}");
}
Storage.Delete(Path.Combine(prefix, f.StoragePath));
Connection.FileInfo.Remove(f);
}
});
catch (Exception e)
{
Logger.Error(e, $@"Could not delete beatmap {f}");
}
}
}
}
}
}

View File

@ -1,23 +1,23 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace osu.Game.Input.Bindings
{
[Table("KeyBinding")]
public class DatabasedKeyBinding : KeyBinding
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey(typeof(RulesetInfo))]
public int? RulesetID { get; set; }
[ForeignKey(nameof(RulesetInfo))]
public int? RulesetInfoId { get; set; }
public RulesetInfo RulesetInfo;
[Indexed]
public int? Variant { get; set; }
[Column("Keys")]
@ -27,7 +27,6 @@ namespace osu.Game.Input.Bindings
private set { KeyCombination = value; }
}
[Indexed]
[Column("Action")]
public int IntAction
{
@ -35,4 +34,4 @@ namespace osu.Game.Input.Bindings
set { Action = value; }
}
}
}
}

View File

@ -48,7 +48,7 @@ namespace osu.Game.Input.Bindings
protected override void ReloadMappings()
{
KeyBindings = store.Query(ruleset?.ID, variant);
KeyBindings = store.Query(ruleset?.Id, variant);
}
}
}

View File

@ -4,78 +4,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Input.Bindings;
using osu.Framework.Platform;
using osu.Game.Database;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets;
using SQLite.Net;
namespace osu.Game.Input
{
public class KeyBindingStore : DatabaseBackedStore
{
public KeyBindingStore(SQLiteConnection connection, RulesetStore rulesets, Storage storage = null)
public KeyBindingStore(OsuDbContext connection, RulesetStore rulesets, Storage storage = null)
: base(connection, storage)
{
foreach (var info in rulesets.AllRulesets)
{
var ruleset = info.CreateInstance();
foreach (var variant in ruleset.AvailableVariants)
insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.ID, variant);
insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.Id, variant);
}
}
public void Register(KeyBindingInputManager manager) => insertDefaults(manager.DefaultKeyBindings);
protected override int StoreVersion => 3;
protected override void PerformMigration(int currentVersion, int targetVersion)
{
base.PerformMigration(currentVersion, targetVersion);
while (currentVersion++ < targetVersion)
{
switch (currentVersion)
{
case 1:
case 2:
case 3:
// cannot migrate; breaking underlying changes.
Reset();
break;
}
}
}
protected override void Prepare(bool reset = false)
{
if (reset)
Connection.DropTable<DatabasedKeyBinding>();
Connection.CreateTable<DatabasedKeyBinding>();
Connection.Database.ExecuteSqlCommand("DELETE FROM KeyBinding");
}
private void insertDefaults(IEnumerable<KeyBinding> defaults, int? rulesetId = null, int? variant = null)
{
var query = Query(rulesetId, variant);
// compare counts in database vs defaults
foreach (var group in defaults.GroupBy(k => k.Action))
{
int count;
while (group.Count() > (count = query.Count(k => (int)k.Action == (int)group.Key)))
while (group.Count() > (count = Query(rulesetId, variant).Count(k => (int)k.Action == (int)group.Key)))
{
var insertable = group.Skip(count).First();
// insert any defaults which are missing.
Connection.Insert(new DatabasedKeyBinding
Connection.DatabasedKeyBinding.Add(new DatabasedKeyBinding
{
KeyCombination = insertable.KeyCombination,
Action = insertable.Action,
RulesetID = rulesetId,
RulesetInfoId = rulesetId,
Variant = variant
});
Connection.SaveChanges();
}
}
}
@ -85,9 +61,18 @@ namespace osu.Game.Input
typeof(DatabasedKeyBinding)
};
public IEnumerable<KeyBinding> Query(int? rulesetId = null, int? variant = null) =>
Query<DatabasedKeyBinding>(b => b.RulesetID == rulesetId && b.Variant == variant);
public List<KeyBinding> Query(int? rulesetId = null, int? variant = null) =>
new List<KeyBinding>(Connection.DatabasedKeyBinding.Where(b => b.RulesetInfoId == rulesetId && b.Variant == variant));
public void Update(KeyBinding keyBinding) => Connection.Update(keyBinding);
public void Update(KeyBinding keyBinding)
{
var dbKeyBinding = Connection.DatabasedKeyBinding.FirstOrDefault(kb => kb.ToString() == keyBinding.ToString());
if (dbKeyBinding!=null)
{
dbKeyBinding.KeyCombination = keyBinding.KeyCombination;
dbKeyBinding.Action = keyBinding.Action;
}
Connection.SaveChanges();
}
}
}

View File

@ -19,6 +19,6 @@ namespace osu.Game.Online.API.Requests
Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total);
}
protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download";
protected override string Target => $@"beatmapsets/{BeatmapSet.BeatmapSetOnlineInfoId}/download";
}
}

View File

@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests
{
private readonly BeatmapInfo beatmap;
private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}";
private string lookupString => beatmap.BeatmapOnlineInfoId > 0 ? beatmap.BeatmapOnlineInfoId.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}";
public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
{

View File

@ -30,7 +30,7 @@ namespace osu.Game.Online.API.Requests
this.direction = direction;
}
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.Id ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
}
public class GetBeatmapSetsResponse : BeatmapMetadata
@ -63,8 +63,8 @@ namespace osu.Game.Online.API.Requests
{
return new BeatmapSetInfo
{
OnlineBeatmapSetID = onlineId,
Metadata = this,
BeatmapSetOnlineInfoId = onlineId,
BeatmapMetadata = this,
OnlineInfo = new BeatmapSetOnlineInfo
{
Author = new User
@ -99,8 +99,8 @@ namespace osu.Game.Online.API.Requests
{
return new BeatmapInfo
{
Metadata = this,
Ruleset = rulesets.GetRuleset(ruleset),
BeatmapMetadata = this,
RulesetInfo = rulesets.GetRuleset(ruleset),
StarDifficulty = starDifficulty,
OnlineInfo = new BeatmapOnlineInfo
{

View File

@ -18,8 +18,8 @@ namespace osu.Game.Online.API.Requests
public GetScoresRequest(BeatmapInfo beatmap)
{
if (!beatmap.OnlineBeatmapID.HasValue)
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
if (!beatmap.BeatmapOnlineInfoId.HasValue)
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.BeatmapOnlineInfoId)}.");
this.beatmap = beatmap;
@ -32,7 +32,7 @@ namespace osu.Game.Online.API.Requests
score.ApplyBeatmap(beatmap);
}
protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores";
protected override string Target => $@"beatmaps/{beatmap.BeatmapOnlineInfoId}/scores";
}
public class GetScoresResponse
@ -116,7 +116,7 @@ namespace osu.Game.Online.API.Requests
public void ApplyBeatmap(BeatmapInfo beatmap)
{
Beatmap = beatmap;
Ruleset = beatmap.Ruleset;
Ruleset = beatmap.RulesetInfo;
// Evaluate the mod string
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();

View File

@ -110,7 +110,7 @@ namespace osu.Game
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value);
Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0;
Ruleset.ValueChanged += r => configRuleset.Value = r.Id ?? 0;
}
private ScheduledDelegate scoreLoad;

View File

@ -3,7 +3,9 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Development;
@ -17,7 +19,6 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Processing;
using osu.Game.Online.API;
using SQLite.Net;
using osu.Framework.Graphics.Performance;
using osu.Game.Database;
using osu.Game.Input;
@ -82,14 +83,21 @@ namespace osu.Game
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
private SQLiteConnection createConnection()
{
var conn = Host.Storage.GetDatabase(@"client");
conn.BusyTimeout = new TimeSpan(TimeSpan.TicksPerSecond * 10);
return conn;
}
//private OsuDbContext dbContext;
private SQLiteConnection connection;
private OsuDbContext createDbContext()
{
var connectionString = Host.Storage.GetDatabaseConnectionString(@"client");
var context = new OsuDbContext(connectionString);
var connection = context.Database.GetDbConnection();
connection.Open();
using (var command = connection.CreateCommand())
{
command.CommandText = "PRAGMA journal_mode=WAL;";
command.ExecuteNonQuery();
}
return context;
}
[BackgroundDependencyLoader]
private void load()
@ -97,8 +105,10 @@ namespace osu.Game
dependencies.Cache(this);
dependencies.Cache(LocalConfig);
connection = createConnection();
connection.CreateTable<StoreVersion>();
using (var dbContext = createDbContext())
if (dbContext.Database.GetPendingMigrations().Any())
dbContext.Database.Migrate();
dependencies.Cache(API = new APIAccess
{
@ -106,11 +116,11 @@ namespace osu.Game
Token = LocalConfig.Get<string>(OsuSetting.Token)
});
dependencies.Cache(RulesetStore = new RulesetStore(connection));
dependencies.Cache(FileStore = new FileStore(connection, Host.Storage));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, API, Host));
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager, RulesetStore));
dependencies.Cache(KeyBindingStore = new KeyBindingStore(connection, RulesetStore));
dependencies.Cache(RulesetStore = new RulesetStore(createDbContext()));
dependencies.Cache(FileStore = new FileStore(createDbContext(), Host.Storage));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, createDbContext(), RulesetStore, API, Host));
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, createDbContext(), Host, BeatmapManager, RulesetStore));
dependencies.Cache(KeyBindingStore = new KeyBindingStore(createDbContext(), RulesetStore));
dependencies.Cache(new OsuColour());
//this completely overrides the framework default. will need to change once we make a proper FontStore.
@ -237,7 +247,7 @@ namespace osu.Game
LocalConfig.Save();
}
connection?.Dispose();
//dbContext?.Dispose();
base.Dispose(isDisposing);
}

View File

@ -43,8 +43,8 @@ namespace osu.Game.Overlays.BeatmapSet
beatmapSet = value;
Picker.BeatmapSet = author.BeatmapSet = details.BeatmapSet = BeatmapSet;
title.Text = BeatmapSet.Metadata.Title;
artist.Text = BeatmapSet.Metadata.Artist;
title.Text = BeatmapSet.BeatmapMetadata.Title;
artist.Text = BeatmapSet.BeatmapMetadata.Artist;
cover?.FadeOut(400, Easing.Out);
coverContainer.Add(cover = new DelayedLoadWrapper(new BeatmapSetCover(BeatmapSet)

View File

@ -33,8 +33,8 @@ namespace osu.Game.Overlays.BeatmapSet
if (value == beatmapSet) return;
beatmapSet = value;
source.Text = BeatmapSet.Metadata.Source;
tags.Text = BeatmapSet.Metadata.Tags;
source.Text = BeatmapSet.BeatmapMetadata.Source;
tags.Text = BeatmapSet.BeatmapMetadata.Tags;
}
}

View File

@ -66,13 +66,13 @@ namespace osu.Game.Overlays.Direct
{
new OsuSpriteText
{
Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title),
TextSize = 18,
Font = @"Exo2.0-BoldItalic",
},
new OsuSpriteText
{
Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Text = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist),
Font = @"Exo2.0-BoldItalic",
},
},
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Direct
},
new OsuSpriteText
{
Text = SetInfo.Metadata.Author,
Text = SetInfo.BeatmapMetadata.Author,
TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic",
Shadow = false,
@ -132,11 +132,11 @@ namespace osu.Game.Overlays.Direct
{
new OsuSpriteText
{
Text = $"from {SetInfo.Metadata.Source}",
Text = $"from {SetInfo.BeatmapMetadata.Source}",
TextSize = 14,
Shadow = false,
Colour = colours.Gray5,
Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f,
},
},
},

View File

@ -54,13 +54,13 @@ namespace osu.Game.Overlays.Direct
{
new OsuSpriteText
{
Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.TitleUnicode, SetInfo.BeatmapMetadata.Title),
TextSize = 18,
Font = @"Exo2.0-BoldItalic",
},
new OsuSpriteText
{
Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Current = localisation.GetUnicodePreference(SetInfo.BeatmapMetadata.ArtistUnicode, SetInfo.BeatmapMetadata.Artist),
Font = @"Exo2.0-BoldItalic",
},
new FillFlowContainer
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Direct
},
new OsuSpriteText
{
Text = SetInfo.Metadata.Author,
Text = SetInfo.BeatmapMetadata.Author,
TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic",
},
@ -109,11 +109,11 @@ namespace osu.Game.Overlays.Direct
},
new OsuSpriteText
{
Text = $"from {SetInfo.Metadata.Source}",
Text = $"from {SetInfo.BeatmapMetadata.Source}",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 14,
Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
Alpha = string.IsNullOrEmpty(SetInfo.BeatmapMetadata.Source) ? 0f : 1f,
},
},
},

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Direct
private void Bindable_ValueChanged(RulesetInfo obj)
{
iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
iconContainer.FadeTo(Ruleset.Id == obj?.Id ? 1f : 0.5f, 100);
}
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)

View File

@ -57,9 +57,9 @@ namespace osu.Game.Overlays
var tags = new List<string>();
foreach (var s in beatmapSets)
{
artists.Add(s.Metadata.Artist);
songs.Add(s.Metadata.Title);
tags.AddRange(s.Metadata.Tags.Split(' '));
artists.Add(s.BeatmapMetadata.Artist);
songs.Add(s.BeatmapMetadata.Title);
tags.AddRange(s.BeatmapMetadata.Tags.Split(' '));
}
ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags));
@ -175,8 +175,8 @@ namespace osu.Game.Overlays
private void setAdded(BeatmapSetInfo set)
{
// if a new map was imported, we should remove it from search results (download completed etc.)
panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire();
BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID);
panels?.FirstOrDefault(p => p.SetInfo.BeatmapSetOnlineInfoId == set.BeatmapSetOnlineInfoId)?.FadeOut(400).Expire();
BeatmapSets = BeatmapSets?.Where(b => b.BeatmapSetOnlineInfoId != set.BeatmapSetOnlineInfoId);
}
private void updateResultCounts()
@ -260,7 +260,7 @@ namespace osu.Game.Overlays
{
BeatmapSets = r?.
Select(response => response.ToBeatmapSet(rulesets)).
Where(b => beatmaps.QueryBeatmapSet(q => q.OnlineBeatmapSetID == b.OnlineBeatmapSetID) == null);
Where(b => beatmaps.QueryBeatmapSet(q => q.BeatmapSetOnlineInfoId == b.BeatmapSetOnlineInfoId) == null);
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
};

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.KeyBinding
[BackgroundDependencyLoader]
private void load(KeyBindingStore store)
{
var bindings = store.Query(Ruleset?.ID, variant);
var bindings = store.Query(Ruleset?.Id, variant);
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
{

View File

@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Music
hoverColour = colours.Yellow;
artistColour = colours.Gray9;
var metadata = BeatmapSetInfo.Metadata;
var metadata = BeatmapSetInfo.BeatmapMetadata;
FilterTerms = metadata.SearchableTerms;
Children = new Drawable[]

View File

@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Music
public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
{
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.ID == beatmapSet.ID);
var itemToRemove = items.FirstOrDefault(i => i.BeatmapSetInfo.Id == beatmapSet.Id);
if (itemToRemove == null)
return false;
return items.Remove(itemToRemove);
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Music
set
{
foreach (PlaylistItem s in items.Children)
s.Selected = s.BeatmapSetInfo.ID == value?.ID;
s.Selected = s.BeatmapSetInfo.Id == value?.Id;
}
}

View File

@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Music
private void itemSelected(BeatmapSetInfo set)
{
if (set.ID == (beatmapBacking.Value?.BeatmapSetInfo?.ID ?? -1))
if (set.Id == (beatmapBacking.Value?.BeatmapSetInfo?.Id ?? -1))
{
beatmapBacking.Value?.Track?.Seek(0);
return;

View File

@ -302,8 +302,8 @@ namespace osu.Game.Overlays
else
{
//figure out the best direction based on order in playlist.
var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count();
var last = playlist.BeatmapSets.TakeWhile(b => b.Id != current.BeatmapSetInfo?.Id).Count();
var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.Id != beatmap.BeatmapSetInfo?.Id).Count();
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
}

View File

@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Toolbar
{
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
{
bool isActive = m.Ruleset.ID == ruleset.ID;
bool isActive = m.Ruleset.Id == ruleset.Id;
m.Active = isActive;
if (isActive)
activeButton = m;

View File

@ -2,26 +2,23 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using SQLite.Net.Attributes;
using System.ComponentModel.DataAnnotations;
namespace osu.Game.Rulesets
{
public class RulesetInfo : IEquatable<RulesetInfo>
{
[PrimaryKey, AutoIncrement]
public int? ID { get; set; }
[Key]
public int? Id { get; set; }
[Indexed(Unique = true)]
public string Name { get; set; }
[Indexed(Unique = true)]
public string InstantiationInfo { get; set; }
[Indexed]
public bool Available { get; set; }
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this);
public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
public bool Equals(RulesetInfo other) => other != null && Id == other.Id && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
}
}

View File

@ -6,8 +6,8 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using osu.Game.Database;
using SQLite.Net;
namespace osu.Game.Rulesets
{
@ -18,9 +18,9 @@ namespace osu.Game.Rulesets
{
private static readonly Dictionary<Assembly, Type> loaded_assemblies = new Dictionary<Assembly, Type>();
public IEnumerable<RulesetInfo> AllRulesets => Query<RulesetInfo>().Where(r => r.Available);
public IEnumerable<RulesetInfo> AllRulesets => Connection.RulesetInfo.Where(r => r.Available);
public RulesetStore(SQLiteConnection connection) : base(connection)
public RulesetStore(OsuDbContext connection) : base(connection)
{
}
@ -38,54 +38,50 @@ namespace osu.Game.Rulesets
protected override void Prepare(bool reset = false)
{
Connection.CreateTable<RulesetInfo>();
if (reset)
{
Connection.DeleteAll<RulesetInfo>();
Connection.Database.ExecuteSqlCommand("DELETE FROM RulesetInfo");
}
var instances = loaded_assemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r, new RulesetInfo()));
Connection.RunInTransaction(() =>
//add all legacy modes in correct order
foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID))
{
//add all legacy modes in correct order
foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID))
var rulesetInfo = createRulesetInfo(r);
if (Connection.RulesetInfo.SingleOrDefault(rsi=>rsi.Id==rulesetInfo.Id)==null)
{
Connection.InsertOrReplace(createRulesetInfo(r));
Connection.RulesetInfo.Add(rulesetInfo);
}
}
//add any other modes
foreach (var r in instances.Where(r => r.LegacyID < 0))
{
var us = createRulesetInfo(r);
var existing = Query<RulesetInfo>().Where(ri => ri.InstantiationInfo == us.InstantiationInfo).FirstOrDefault();
if (existing == null)
Connection.Insert(us);
}
});
Connection.RunInTransaction(() =>
//add any other modes
foreach (var r in instances.Where(r => r.LegacyID < 0))
{
//perform a consistency check
foreach (var r in Query<RulesetInfo>())
{
try
{
r.CreateInstance();
r.Available = true;
}
catch
{
r.Available = false;
}
var us = createRulesetInfo(r);
Connection.Update(r);
var existing = Connection.RulesetInfo.Where(ri => ri.InstantiationInfo == us.InstantiationInfo).FirstOrDefault();
if (existing == null)
Connection.RulesetInfo.Add(us);
}
//perform a consistency check
foreach (var r in Connection.RulesetInfo)
{
try
{
r.CreateInstance();
r.Available = true;
}
});
catch
{
r.Available = false;
}
//Connection.RulesetInfo.Update(r);
}
Connection.SaveChanges();
}
private static void loadRulesetFromFile(string file)
@ -107,11 +103,24 @@ namespace osu.Game.Rulesets
{
Name = ruleset.Description,
InstantiationInfo = ruleset.GetType().AssemblyQualifiedName,
ID = ruleset.LegacyID
Id = ruleset.LegacyID
};
protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) };
public RulesetInfo GetRuleset(int id) => Query<RulesetInfo>().First(r => r.ID == id);
public RulesetInfo GetRuleset(int id) => Connection.RulesetInfo.First(r => r.Id == id);
public RulesetInfo QueryRulesetInfo(Func<RulesetInfo, bool> query)
{
return Connection.RulesetInfo.FirstOrDefault(query);
}
public List<RulesetInfo> QueryRulesets(Func<RulesetInfo, bool> query = null)
{
var rulesets = Connection.RulesetInfo;
if (query != null)
return rulesets.Where(query).ToList();
return rulesets.ToList();
}
}
}

View File

@ -11,7 +11,6 @@ using osu.Game.IO.Legacy;
using osu.Game.IPC;
using osu.Game.Rulesets.Replays;
using SharpCompress.Compressors.LZMA;
using SQLite.Net;
namespace osu.Game.Rulesets.Scoring
{
@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Scoring
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ScoreIPCChannel ipc;
public ScoreStore(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(connection)
public ScoreStore(Storage storage, OsuDbContext connection, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(connection)
{
this.storage = storage;
this.beatmaps = beatmaps;

View File

@ -172,11 +172,11 @@ namespace osu.Game.Rulesets.UI
// Apply difficulty adjustments from mods before using Difficulty.
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.Difficulty);
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BeatmapDifficulty);
// Apply defaults
foreach (var h in Beatmap.HitObjects)
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty);
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BeatmapDifficulty);
// Post-process the beatmap
processor.PostProcess(Beatmap);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
{
var sets = beatmaps.GetAllUsableBeatmapSets(false);
if (sets.Count > 0)
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
setInfo = beatmaps.QueryBeatmapSet(s => s.Id == sets[RNG.Next(0, sets.Count - 1)].Id);
}
if (setInfo == null)

View File

@ -230,7 +230,7 @@ namespace osu.Game.Screens.Multiplayer
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
{
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -239,9 +239,9 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both },
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist);
}
else
{

View File

@ -331,7 +331,7 @@ namespace osu.Game.Screens.Multiplayer
coverContainer.FadeIn(transition_duration);
coverContainer.Children = new[]
{
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSetInfo)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
@ -341,10 +341,10 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both },
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapTitle.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.TitleUnicode, value.BeatmapMetadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
beatmapArtist.Current = localisation.GetUnicodePreference(value.BeatmapMetadata.ArtistUnicode, value.BeatmapMetadata.Artist);
beatmapAuthor.Text = $"mapped by {value.BeatmapMetadata.Author}";
}
else
{

View File

@ -99,18 +99,18 @@ namespace osu.Game.Screens.Play
if (beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded");
ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset;
ruleset = Ruleset.Value ?? beatmap.BeatmapInfo.RulesetInfo;
var rulesetInstance = ruleset.CreateInstance();
try
{
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.RulesetInfo.Id);
}
catch (BeatmapInvalidForRulesetException)
{
// we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
// let's try again forcing the beatmap's ruleset.
ruleset = beatmap.BeatmapInfo.Ruleset;
ruleset = beatmap.BeatmapInfo.RulesetInfo;
rulesetInstance = ruleset.CreateInstance();
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true);
}

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader]
private void load(LocalisationEngine localisation)
{
var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata();
var metadata = beatmap?.BeatmapInfo?.BeatmapMetadata ?? new BeatmapMetadata();
AutoSizeAxes = Axes.Both;
Children = new Drawable[]

View File

@ -324,9 +324,9 @@ namespace osu.Game.Screens.Ranking
title.Colour = artist.Colour = colours.BlueDarker;
versionMapper.Colour = colours.Gray8;
versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}";
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.BeatmapMetadata.Author}";
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.TitleUnicode, beatmap.BeatmapMetadata.Title);
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapMetadata.ArtistUnicode, beatmap.BeatmapMetadata.Artist);
}
}

View File

@ -113,15 +113,15 @@ namespace osu.Game.Screens.Select
});
}
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID));
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) => removeGroup(groups.Find(b => b.BeatmapSet.Id == beatmapSet.Id));
internal void UpdateBeatmap(BeatmapInfo beatmap)
{
// todo: this method should not run more than once for the same BeatmapSetInfo.
var set = manager.Refresh(beatmap.BeatmapSet);
var set = manager.Refresh(beatmap.BeatmapSetInfo);
// todo: this method should be smarter as to not recreate panels that haven't changed, etc.
var group = groups.Find(b => b.BeatmapSet.ID == set.ID);
var group = groups.Find(b => b.BeatmapSet.Id == set.Id);
if (group == null)
return;
@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select
if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0)
{
var newSelection =
newGroup.BeatmapPanels.Find(p => p.Beatmap.ID == selectedPanel?.Beatmap.ID) ??
newGroup.BeatmapPanels.Find(p => p.Beatmap.Id == selectedPanel?.Beatmap.Id) ??
newGroup.BeatmapPanels[Math.Min(newGroup.BeatmapPanels.Count - 1, group.BeatmapPanels.IndexOf(selectedPanel))];
selectGroup(newGroup, newSelection);
@ -337,8 +337,8 @@ namespace osu.Game.Screens.Select
{
foreach (var b in beatmapSet.Beatmaps)
{
if (b.Metadata == null)
b.Metadata = beatmapSet.Metadata;
if (b.BeatmapMetadata == null)
b.BeatmapMetadata = beatmapSet.BeatmapMetadata;
}
return new BeatmapGroup(beatmapSet, manager)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
public BeatmapDeleteDialog(BeatmapSetInfo beatmap)
{
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
BodyText = $@"{beatmap.BeatmapMetadata?.Artist} - {beatmap.BeatmapMetadata?.Title}";
Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of";

View File

@ -188,8 +188,8 @@ namespace osu.Game.Screens.Select
ratingsContainer.FadeIn(transition_duration);
advanced.Beatmap = Beatmap;
description.Text = Beatmap.Version;
source.Text = Beatmap.Metadata.Source;
tags.Text = Beatmap.Metadata.Tags;
source.Text = Beatmap.BeatmapMetadata.Source;
tags.Text = Beatmap.BeatmapMetadata.Tags;
var requestedBeatmap = Beatmap;
if (requestedBeatmap.Metrics == null)
@ -264,7 +264,7 @@ namespace osu.Game.Screens.Select
advanced.Beatmap = new BeatmapInfo
{
StarDifficulty = 0,
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 0,
DrainRate = 0,

View File

@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select
public BufferedWedgeInfo(WorkingBeatmap beatmap)
{
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
BeatmapMetadata metadata = beatmapInfo.BeatmapMetadata ?? beatmap.BeatmapSetInfo?.BeatmapMetadata ?? new BeatmapMetadata();
List<InfoLabel> labels = new List<InfoLabel>();
@ -114,7 +114,7 @@ namespace osu.Game.Screens.Select
}));
//get statistics from the current ruleset.
labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
labels.AddRange(beatmapInfo.RulesetInfo.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
}
PixelSnapping = true;

View File

@ -29,20 +29,20 @@ namespace osu.Game.Screens.Select.Details
beatmap = value;
//mania specific
if ((Beatmap?.Ruleset?.ID ?? 0) == 3)
if ((Beatmap?.RulesetInfo?.Id ?? 0) == 3)
{
firstValue.Title = "Key Amount";
firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0);
firstValue.Value = (int)Math.Round(Beatmap?.BeatmapDifficulty?.CircleSize ?? 0);
}
else
{
firstValue.Title = "Circle Size";
firstValue.Value = Beatmap?.Difficulty?.CircleSize ?? 0;
firstValue.Value = Beatmap?.BeatmapDifficulty?.CircleSize ?? 0;
}
hpDrain.Value = beatmap.Difficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.Difficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.Difficulty?.ApproachRate ?? 0;
hpDrain.Value = beatmap.BeatmapDifficulty?.DrainRate ?? 0;
accuracy.Value = beatmap.BeatmapDifficulty?.OverallDifficulty ?? 0;
approachRate.Value = beatmap.BeatmapDifficulty?.ApproachRate ?? 0;
starDifficulty.Value = (float)beatmap.StarDifficulty;
}
}

View File

@ -23,12 +23,12 @@ namespace osu.Game.Screens.Select
{
var set = g.BeatmapSet;
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetInfoId == (Ruleset?.Id ?? 0));
bool match = hasCurrentMode;
if (!string.IsNullOrEmpty(SearchText))
match &= set.Metadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
match &= set.BeatmapMetadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
switch (g.State)
{
@ -45,13 +45,13 @@ namespace osu.Game.Screens.Select
{
default:
case SortMode.Artist:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Artist, y.BeatmapSet.BeatmapMetadata.Artist, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Title:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Title, y.BeatmapSet.BeatmapMetadata.Title, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.BeatmapMetadata.Author, y.BeatmapSet.BeatmapMetadata.Author, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Difficulty:
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Scores = null;
getScoresRequest?.Cancel();
if (api == null || Beatmap?.OnlineBeatmapID == null) return;
if (api == null || Beatmap?.BeatmapOnlineInfoId == null) return;
loading.Show();

View File

@ -238,7 +238,7 @@ namespace osu.Game.Screens.Select
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
{
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
bool preview = beatmap?.BeatmapSetInfoId != Beatmap.Value.BeatmapInfo.BeatmapSetInfoId;
Beatmap.Value = manager.GetWorkingBeatmap(beatmap, Beatmap);
ensurePlayingSelected(preview);
@ -261,7 +261,7 @@ namespace osu.Game.Screens.Select
}
else
{
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
if (beatmap.BeatmapSetInfoId == beatmapNoDebounce?.BeatmapSetInfoId)
sampleChangeDifficulty.Play();
else
sampleChangeBeatmap.Play();

View File

@ -37,7 +37,7 @@ namespace osu.Game.Storyboards
/// </summary>
public bool ReplacesBackground(BeatmapInfo beatmapInfo)
{
var backgroundPath = beatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant();
var backgroundPath = beatmapInfo.BeatmapSetInfo?.BeatmapMetadata?.BackgroundFile?.ToLowerInvariant();
if (backgroundPath == null)
return false;

View File

@ -1,12 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using Microsoft.Data.Sqlite;
using osu.Framework.Platform;
using SQLite.Net;
using SQLite.Net.Interop;
using SQLite.Net.Platform.Generic;
using SQLite.Net.Platform.Win32;
namespace osu.Game.Tests.Platform
{
@ -16,14 +12,9 @@ namespace osu.Game.Tests.Platform
{
}
public override SQLiteConnection GetDatabase(string name)
public override string GetDatabaseConnectionString(string name)
{
ISQLitePlatform platform;
if (RuntimeInfo.IsWindows)
platform = new SQLitePlatformWin32();
else
platform = new SQLitePlatformGeneric();
return new SQLiteConnection(platform, @":memory:");
return "DataSource=:memory:";
}
}
}
}

View File

@ -24,12 +24,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo
{
Version = "All Metrics",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has all the metrics",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 7,
DrainRate = 1,
@ -48,12 +48,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo
{
Version = "Only Ratings",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 6,
DrainRate = 9,
@ -70,12 +70,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo
{
Version = "Only Retries and Fails",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 3.7f,
DrainRate = 6,
@ -93,12 +93,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo
{
Version = "No Metrics",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has no metrics",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
{
overlay.ShowBeatmapSet(new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Lachryma <Re:QueenM>",
Artist = @"Kaneko Chiharu",
@ -64,8 +64,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 1.36,
Version = @"BASIC",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 6.5f,
@ -92,8 +92,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 2.22,
Version = @"NOVICE",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 7,
@ -120,8 +120,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.49,
Version = @"ADVANCED",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 7.5f,
@ -148,8 +148,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 4.24,
Version = @"EXHAUST",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 8,
@ -176,8 +176,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 5.26,
Version = @"GRAVITY",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 8.5f,
@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual
{
overlay.ShowBeatmapSet(new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Soumatou Labyrinth",
Artist = @"Yunomi with Momobako&miko",
@ -238,8 +238,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 1.40,
Version = @"yzrin's Kantan",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 7,
@ -266,8 +266,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 2.23,
Version = @"Futsuu",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 6,
@ -294,8 +294,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.19,
Version = @"Muzukashii",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 6,
@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.97,
Version = @"Charlotte's Oni",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 6,
@ -350,8 +350,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 5.08,
Version = @"Labyrinth Oni",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,

View File

@ -41,8 +41,8 @@ namespace osu.Game.Tests.Visual
{
new BeatmapSetInfo
{
OnlineBeatmapSetID = 578332,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 578332,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"OrVid",
Artist = @"An",
@ -65,16 +65,16 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.35f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 599627,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 599627,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"tiny lamp",
Artist = @"fhana",
@ -97,16 +97,16 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.81f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 513268,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 513268,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"At Gwanghwamun",
Artist = @"KYUHYUN",
@ -129,31 +129,31 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 0.9f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 1.1f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.02f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.49f,
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 586841,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 586841,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"RHAPSODY OF BLUE SKY",
Artist = @"fhana",
@ -176,43 +176,43 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 1.26f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.01f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.87f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.76f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.93f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 4.37f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.13f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.42f,
},
},

View File

@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 4.65,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Critical Crystal",
Artist = @"Seiryu",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -81,13 +81,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 1.96,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Serendipity",
Artist = @"ZAQ",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
@ -37,12 +38,11 @@ namespace osu.Game.Tests.Visual
{
var storage = new TestStorage(@"TestCasePlaySongSelect");
var backingDatabase = storage.GetDatabase(@"client");
backingDatabase.CreateTable<StoreVersion>();
var dbConnectionString = storage.GetDatabaseConnectionString(@"client");
dependencies.Cache(rulesets = new RulesetStore(backingDatabase));
dependencies.Cache(files = new FileStore(backingDatabase, storage));
dependencies.Cache(manager = new BeatmapManager(storage, files, backingDatabase, rulesets, null));
dependencies.Cache(rulesets = new RulesetStore(new OsuDbContext(dbConnectionString)));
dependencies.Cache(files = new FileStore(new OsuDbContext(dbConnectionString), storage));
dependencies.Cache(manager = new BeatmapManager(storage, files, new OsuDbContext(dbConnectionString), rulesets, null));
for (int i = 0; i < 100; i += 10)
manager.Import(createTestBeatmapSet(i));
@ -60,11 +60,11 @@ namespace osu.Game.Tests.Visual
{
return new BeatmapSetInfo
{
OnlineBeatmapSetID = 1234 + i,
BeatmapSetOnlineInfoId = 1234 + i,
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
OnlineBeatmapSetID = 1234 + i,
BeatmapSetOnlineInfoId = 1234 + i,
// Create random metadata, then we can check if sorting works based on these
Artist = "MONACA " + RNG.Next(0, 9),
Title = "Black Song " + RNG.Next(0, 9),
@ -74,33 +74,33 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
OnlineBeatmapID = 1234 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1234 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "normal.osu",
Version = "Normal",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 3.5f,
}
},
new BeatmapInfo
{
OnlineBeatmapID = 1235 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1235 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "hard.osu",
Version = "Hard",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 5,
}
},
new BeatmapInfo
{
OnlineBeatmapID = 1236 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1236 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "insane.osu",
Version = "Insane",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 7,
}

View File

@ -39,10 +39,11 @@ namespace osu.Game.Tests.Visual
Colour = Color4.Black,
});
foreach (var r in rulesets.Query<RulesetInfo>())
var queryRulesets = rulesets.QueryRulesets(r=>true);
foreach (var r in queryRulesets)
AddStep(r.Name, () => loadPlayerFor(r));
loadPlayerFor(rulesets.Query<RulesetInfo>().First());
loadPlayerFor(queryRulesets.First());
}
protected virtual Beatmap CreateBeatmap()
@ -60,7 +61,7 @@ namespace osu.Game.Tests.Visual
{
var beatmap = CreateBeatmap();
beatmap.BeatmapInfo.Ruleset = r;
beatmap.BeatmapInfo.RulesetInfo = r;
var instance = r.CreateInstance();

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual
if (beatmap == null)
{
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetInfoId == 0);
if (beatmapInfo != null)
beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo);
}

View File

@ -32,14 +32,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 3.7,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Platina",
Artist = @"Maaya Sakamoto",
Author = @"uwutm8",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -99,14 +99,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 7.07,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"FREEDOM DIVE",
Artist = @"xi",
Author = @"Nakagawa-Kanon",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{

View File

@ -48,8 +48,8 @@ namespace osu.Game.Tests.Visual
HitObjects = objects,
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata()
BeatmapDifficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata()
}
};

View File

@ -124,6 +124,49 @@
<HintPath>$(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Microsoft.EntityFrameworkCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.EntityFrameworkCore.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath>
</Reference>
<Reference Include="Microsoft.EntityFrameworkCore.Design">
<HintPath>..\packages\Microsoft.EntityFrameworkCore.Design.2.0.0\lib\net461\Microsoft.EntityFrameworkCore.Design.dll</HintPath>
</Reference>
<Reference Include="Microsoft.EntityFrameworkCore.Relational, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.EntityFrameworkCore.Relational.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Relational.dll</HintPath>
</Reference>
<Reference Include="Microsoft.EntityFrameworkCore.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.EntityFrameworkCore.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Caching.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Caching.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Caching.Memory, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Caching.Memory.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Primitives.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath>
<Private>True</Private>
@ -157,6 +200,9 @@
<HintPath>$(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Remotion.Linq, Version=2.1.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
<HintPath>..\packages\Remotion.Linq.2.1.2\lib\net45\Remotion.Linq.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.18.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SharpCompress.0.18.1\lib\net45\SharpCompress.dll</HintPath>
<Private>True</Private>
@ -165,29 +211,43 @@
<HintPath>$(SolutionDir)\packages\Splat.2.0.0\lib\Net45\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite.Net, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll</HintPath>
<Private>True</Private>
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.8\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net.Platform.Generic, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll</HintPath>
<Private>True</Private>
<Reference Include="SQLitePCLRaw.batteries_v2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.8\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net.Platform.Win32, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
<Private>True</Private>
<Reference Include="SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.core.1.1.8\lib\net45\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLiteNetExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll</HintPath>
<Private>True</Private>
<Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.8\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
</Reference>
<Reference Include="Squirrel, Version=1.7.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\squirrel.windows.1.7.8\lib\Net45\Squirrel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ComponentModel.Annotations.4.4.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.4.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net46\System.Interactive.Async.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
@ -287,7 +347,7 @@
<Compile Include="Configuration\ScreenshotFormat.cs" />
<Compile Include="Configuration\SelectionRandomType.cs" />
<Compile Include="Database\DatabaseBackedStore.cs" />
<Compile Include="Database\StoreVersion.cs" />
<Compile Include="Database\OsuDbContext.cs" />
<Compile Include="Graphics\Backgrounds\Background.cs" />
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
<Compile Include="Graphics\Containers\BeatSyncedContainer.cs" />
@ -800,6 +860,9 @@
<ItemGroup>
<EmbeddedResource Include="lazer.ico" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@ -820,4 +883,15 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
</Target>
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
</Project>

View File

@ -6,14 +6,51 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste
<packages>
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net45" />
<package id="DotNetZip" version="1.10.1" targetFramework="net461" />
<package id="Microsoft.CSharp" version="4.4.0" targetFramework="net461" />
<package id="Microsoft.Data.Sqlite.Core" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Design" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Relational" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Sqlite" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Tools" version="2.0.0" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.Extensions.Caching.Abstractions" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Caching.Memory" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="2.0.0" targetFramework="net461" />
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="OpenTK" version="3.0.0-git00009" targetFramework="net461" />
<package id="Remotion.Linq" version="2.1.2" targetFramework="net461" />
<package id="SharpCompress" version="0.18.1" targetFramework="net461" />
<package id="Splat" version="2.0.0" targetFramework="net45" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="net461" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="net461" />
<package id="SQLiteNetExtensions" version="1.3.0" targetFramework="net461" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.8" targetFramework="net461" />
<package id="SQLitePCLRaw.core" version="1.1.8" targetFramework="net461" />
<package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.8" targetFramework="net461" />
<package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.8" targetFramework="net461" />
<package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.8" targetFramework="net461" />
<package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.8" targetFramework="net461" />
<package id="squirrel.windows" version="1.7.8" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.4.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.4.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" />
<package id="System.Interactive.Async" version="3.1.1" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Queryable" version="4.3.0" targetFramework="net461" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
</packages>