From b178be21d1e945ee9f8edbdcc93b8f8bffea8a48 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 14 Oct 2017 14:28:25 +0900 Subject: [PATCH] Let's not rename columns yet --- .../Beatmaps/TaikoBeatmapConverter.cs | 2 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 4 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 14 +- .../Beatmaps/IO/OszArchiveReaderTest.cs | 2 +- osu.Game/Beatmaps/BeatmapDifficulty.cs | 2 +- osu.Game/Beatmaps/BeatmapInfo.cs | 16 +- osu.Game/Beatmaps/BeatmapManager.cs | 14 +- osu.Game/Beatmaps/BeatmapMetadata.cs | 5 +- osu.Game/Beatmaps/BeatmapOnlineInfo.cs | 4 - osu.Game/Beatmaps/BeatmapSetFileInfo.cs | 6 +- osu.Game/Beatmaps/BeatmapSetInfo.cs | 4 +- osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs | 13 - osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 10 +- osu.Game/IO/FileInfo.cs | 2 +- osu.Game/IO/FileStore.cs | 8 +- .../Input/Bindings/DatabasedKeyBinding.cs | 4 +- .../DatabasedKeyBindingInputManager.cs | 2 +- osu.Game/Input/KeyBindingStore.cs | 6 +- ...9205048_Init.cs => 20171014052545_Init.cs} | 265 +++++++++--------- ...ner.cs => 20171014052545_Init.designer.cs} | 113 ++++---- .../Migrations/OsuDbContextModelSnapshot.cs | 111 ++++---- .../API/Requests/DownloadBeatmapSetRequest.cs | 2 +- .../API/Requests/GetBeatmapDetailsRequest.cs | 2 +- .../API/Requests/GetBeatmapSetsResponse.cs | 2 +- .../Online/API/Requests/GetScoresRequest.cs | 6 +- .../API/Requests/SearchBeatmapSetsRequest.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/OsuGameBase.cs | 3 +- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/Direct/PlayButton.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 6 +- .../KeyBinding/KeyBindingsSubsection.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 4 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 4 +- .../Profile/Sections/Ranks/DrawableScore.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Rulesets/RulesetInfo.cs | 4 +- osu.Game/Rulesets/RulesetStore.cs | 6 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +- .../Screens/Select/Details/AdvancedStats.cs | 2 +- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- .../Select/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 4 +- osu.Game/Tests/Platform/TestStorage.cs | 1 - osu.Game/Tests/Visual/TestCaseDirect.cs | 8 +- .../Tests/Visual/TestCasePlaySongSelect.cs | 10 +- osu.Game/Tests/Visual/TestCaseResults.cs | 2 +- osu.Game/osu.Game.csproj | 10 +- 51 files changed, 351 insertions(+), 362 deletions(-) rename osu.Game/Migrations/{20171009205048_Init.cs => 20171014052545_Init.cs} (75%) rename osu.Game/Migrations/{20171009205048_Init.Designer.cs => 20171014052545_Init.designer.cs} (72%) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 78dba7beb0..ceaecbb555 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps Beatmap converted = base.ConvertBeatmap(original); - if (original.BeatmapInfo.RulesetInfoId == 3) + if (original.BeatmapInfo.RulesetID == 3) { // Post processing step to transform mania hit objects with the same start time into strong hits converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x => diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 07a0a7e678..edd5b5d219 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Beatmaps.Formats { var beatmap = decoder.Decode(new StreamReader(stream)); var meta = beatmap.BeatmapInfo.Metadata; - Assert.AreEqual(241526, meta.BeatmapSetOnlineInfoId); + Assert.AreEqual(241526, meta.OnlineBeatmapSetID); 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.RulesetInfoId == 0); + Assert.IsTrue(beatmapInfo.RulesetID == 0); Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks); Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard); } diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 1956fcba26..f2ab00bead 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -111,14 +111,14 @@ namespace osu.Game.Tests.Beatmaps.IO var store = osu.Dependencies.Get(); - waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526)).Any(), + waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any(), @"BeatmapSet did not import to the database in allocated time.", timeout); //ensure we were stored to beatmap database backing... Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1)."); - Func> queryBeatmaps = () => store.QueryBeatmaps(s => s.BeatmapSetOnlineInfoId == 241526 && s.BeatmapDifficultyId > 0); - Func> queryBeatmapSets = () => store.QueryBeatmapSets(s => s.BeatmapSetOnlineInfoId == 241526); + Func> queryBeatmaps = () => store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0); + Func> queryBeatmapSets = () => store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526); //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitForOrAssert(() => queryBeatmaps().Count() == 12, @@ -141,16 +141,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 0))?.Beatmap; + var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 1))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 2))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetInfoId == 3))?.Beatmap; + beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 9ca3089944..7a7a8a58bc 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -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.BeatmapSetOnlineInfoId); + Assert.AreEqual(241526, meta.OnlineBeatmapSetID); Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); diff --git a/osu.Game/Beatmaps/BeatmapDifficulty.cs b/osu.Game/Beatmaps/BeatmapDifficulty.cs index 74403e8fb9..25e212f3c5 100644 --- a/osu.Game/Beatmaps/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/BeatmapDifficulty.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps public const float DEFAULT_DIFFICULTY = 5; [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + 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; diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 8e0b4ee7a1..c1516f17c9 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -14,26 +14,26 @@ namespace osu.Game.Beatmaps public class BeatmapInfo : IEquatable, IJsonSerializable { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } //TODO: should be in database public int BeatmapVersion; [JsonProperty("id")] [NotMapped] - public int? BeatmapOnlineInfoId { get; set; } + public int? OnlineBeatmapID { get; set; } [JsonProperty("beatmapset_id")] [NotMapped] - public int? BeatmapSetOnlineInfoId { get; set; } + public int? OnlineBeatmapSetID { get; set; } - public int BeatmapSetInfoId { get; set; } + public int BeatmapSetInfoID { get; set; } [Required] public BeatmapSetInfo BeatmapSet { get; set; } public BeatmapMetadata Metadata { get; set; } - public int BeatmapDifficultyId { get; set; } + public int BaseDifficultyID { get; set; } [Required] public BeatmapDifficulty Difficulty { get; set; } @@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps public float StackLeniency { get; set; } public bool SpecialStyle { get; set; } - public int RulesetInfoId { get; set; } + public int RulesetID { get; set; } public RulesetInfo Ruleset { get; set; } @@ -109,12 +109,12 @@ 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 && diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index d5c9c99abb..955c6f4b17 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -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); } @@ -251,7 +251,7 @@ namespace osu.Game.Beatmaps /// /// The whose download request is wanted. /// The object if it exists, or null. - public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.BeatmapSetOnlineInfoId == beatmap.BeatmapSetOnlineInfoId); + public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID); /// /// Delete a beatmap from the manager. @@ -303,7 +303,7 @@ namespace osu.Game.Beatmaps return DefaultBeatmap; if (beatmapInfo.BeatmapSet == null) - throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoId} is not in the local database."); + throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata; @@ -344,7 +344,7 @@ namespace osu.Game.Beatmaps /// /// A stale instance. /// A fresh instance. - public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.Id == beatmapSet.Id); + public BeatmapSetInfo Refresh(BeatmapSetInfo beatmapSet) => QueryBeatmapSet(s => s.ID == beatmapSet.ID); /// /// Perform a lookup query on available s. @@ -449,7 +449,7 @@ namespace osu.Game.Beatmaps beatmapSet = new BeatmapSetInfo { - BeatmapSetOnlineInfoId = metadata.BeatmapSetOnlineInfoId, + OnlineBeatmapSetID = metadata.OnlineBeatmapSetID, Beatmaps = new List(), Hash = hash, Files = fileInfos, @@ -478,8 +478,8 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.Metadata = null; // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId); - beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.Id == beatmap.BeatmapInfo.RulesetInfoId)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) + beatmap.BeatmapInfo.Ruleset = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID); + beatmap.BeatmapInfo.StarDifficulty = rulesets.QueryRulesetInfo(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap) .Calculate() ?? 0; beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 684f31a4eb..ae7fced2ce 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -10,11 +10,10 @@ namespace osu.Game.Beatmaps public class BeatmapMetadata { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } [NotMapped] - public int? BeatmapSetOnlineInfoId { get; set; } - public int BeatmapSetInfoId { get; set; } + public int? OnlineBeatmapSetID { get; set; } public string Title { get; set; } public string TitleUnicode { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs index 2264a4fc1a..399cabda99 100644 --- a/osu.Game/Beatmaps/BeatmapOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapOnlineInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // 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 @@ -11,9 +10,6 @@ namespace osu.Game.Beatmaps /// public class BeatmapOnlineInfo { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - /// /// The length in milliseconds of this beatmap's song. /// diff --git a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs index a634e5d3eb..0e3aa61d9f 100644 --- a/osu.Game/Beatmaps/BeatmapSetFileInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetFileInfo.cs @@ -10,11 +10,11 @@ namespace osu.Game.Beatmaps public class BeatmapSetFileInfo { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } - public int BeatmapSetInfoId { get; set; } + public int BeatmapSetInfoID { get; set; } - public int FileInfoId { get; set; } + public int FileInfoID { get; set; } public FileInfo FileInfo { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 3e8c4f488c..404add2fa5 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -10,10 +10,10 @@ namespace osu.Game.Beatmaps public class BeatmapSetInfo { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } [NotMapped] - public int? BeatmapSetOnlineInfoId { get; set; } + public int? OnlineBeatmapSetID { get; set; } public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs index c33ee66dac..646b22b327 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineInfo.cs @@ -2,9 +2,7 @@ // 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; @@ -15,19 +13,11 @@ namespace osu.Game.Beatmaps /// public class BeatmapSetOnlineInfo { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - /// /// The author of the beatmaps in this set. /// public User Author; - public int BeatmapSetInfoId { get; set; } - public BeatmapSetInfo BeatmapSetInfo { get; set; } - - public List Beatmaps { get; set; } - /// /// The date this beatmap set was submitted to the online listing. /// @@ -75,9 +65,6 @@ namespace osu.Game.Beatmaps public class BeatmapSetOnlineCovers { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - public string CoverLowRes { get; set; } [JsonProperty(@"cover@2x")] diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index cf34b4afee..2493dab08c 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -97,9 +97,9 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo); break; case @"Mode": - beatmap.BeatmapInfo.RulesetInfoId = int.Parse(pair.Value); + beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value); - switch (beatmap.BeatmapInfo.RulesetInfoId) + switch (beatmap.BeatmapInfo.RulesetID) { case 0: parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); @@ -183,11 +183,11 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Metadata.Tags = pair.Value; break; case @"BeatmapID": - beatmap.BeatmapInfo.BeatmapOnlineInfoId = int.Parse(pair.Value); + beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value); break; case @"BeatmapSetID": - beatmap.BeatmapInfo.BeatmapSetOnlineInfoId = int.Parse(pair.Value); - metadata.BeatmapSetOnlineInfoId = int.Parse(pair.Value); + beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value); + metadata.OnlineBeatmapSetID = int.Parse(pair.Value); break; } } diff --git a/osu.Game/IO/FileInfo.cs b/osu.Game/IO/FileInfo.cs index 29c9729341..31b63ecd21 100644 --- a/osu.Game/IO/FileInfo.cs +++ b/osu.Game/IO/FileInfo.cs @@ -9,7 +9,7 @@ namespace osu.Game.IO public class FileInfo { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } public string Hash { get; set; } diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index a9cdee8cae..680ecedf52 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -85,9 +85,9 @@ namespace osu.Game.IO public void Reference(params FileInfo[] files) { - var incrementedFiles = files.GroupBy(f => f.Id).Select(f => + var incrementedFiles = files.GroupBy(f => f.ID).Select(f => { - var accurateRefCount = Connection.Find(f.First().Id); + var accurateRefCount = Connection.Find(f.First().ID); accurateRefCount.ReferenceCount += f.Count(); return accurateRefCount; }); @@ -96,9 +96,9 @@ namespace osu.Game.IO public void Dereference(params FileInfo[] files) { - var incrementedFiles = files.GroupBy(f => f.Id).Select(f => + var incrementedFiles = files.GroupBy(f => f.ID).Select(f => { - var accurateRefCount = Connection.Find(f.First().Id); + var accurateRefCount = Connection.Find(f.First().ID); accurateRefCount.ReferenceCount -= f.Count(); return accurateRefCount; }); diff --git a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs index 0098cc47bb..c0cecf361d 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs @@ -10,9 +10,9 @@ namespace osu.Game.Input.Bindings public class DatabasedKeyBinding : KeyBinding { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int ID { get; set; } - public int? RulesetInfoId { get; set; } + public int? RulesetID { get; set; } public int? Variant { get; set; } diff --git a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs index ac16500718..8a3c65a35e 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBindingInputManager.cs @@ -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); } } } diff --git a/osu.Game/Input/KeyBindingStore.cs b/osu.Game/Input/KeyBindingStore.cs index 3157bee6a7..41bdc40a88 100644 --- a/osu.Game/Input/KeyBindingStore.cs +++ b/osu.Game/Input/KeyBindingStore.cs @@ -22,7 +22,7 @@ namespace osu.Game.Input { var ruleset = info.CreateInstance(); foreach (var variant in ruleset.AvailableVariants) - insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.Id, variant); + insertDefaults(ruleset.GetDefaultKeyBindings(variant), info.ID, variant); } } @@ -48,7 +48,7 @@ namespace osu.Game.Input { KeyCombination = insertable.KeyCombination, Action = insertable.Action, - RulesetInfoId = rulesetId, + RulesetID = rulesetId, Variant = variant }); Connection.SaveChanges(); @@ -62,7 +62,7 @@ namespace osu.Game.Input }; public List Query(int? rulesetId = null, int? variant = null) => - new List(Connection.DatabasedKeyBinding.Where(b => b.RulesetInfoId == rulesetId && b.Variant == variant)); + new List(Connection.DatabasedKeyBinding.Where(b => b.RulesetID == rulesetId && b.Variant == variant)); public void Update(KeyBinding keyBinding) { diff --git a/osu.Game/Migrations/20171009205048_Init.cs b/osu.Game/Migrations/20171014052545_Init.cs similarity index 75% rename from osu.Game/Migrations/20171009205048_Init.cs rename to osu.Game/Migrations/20171014052545_Init.cs index df6410bfac..3b098ed2a6 100644 --- a/osu.Game/Migrations/20171009205048_Init.cs +++ b/osu.Game/Migrations/20171014052545_Init.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore.Migrations; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; @@ -12,7 +15,7 @@ namespace osu.Game.Migrations name: "BeatmapDifficulty", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) + ID = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), ApproachRate = table.Column(type: "REAL", nullable: false), CircleSize = table.Column(type: "REAL", nullable: false), @@ -23,81 +26,20 @@ namespace osu.Game.Migrations }, constraints: table => { - table.PrimaryKey("PK_BeatmapDifficulty", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BeatmapSetInfo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DeletePending = table.Column(type: "INTEGER", nullable: false), - Hash = table.Column(type: "TEXT", nullable: true), - Protected = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BeatmapSetInfo", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "FileInfo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Hash = table.Column(type: "TEXT", nullable: true), - ReferenceCount = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_FileInfo", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "KeyBinding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Action = table.Column(type: "INTEGER", nullable: false), - Keys = table.Column(type: "TEXT", nullable: true), - RulesetInfoId = table.Column(type: "INTEGER", nullable: true), - Variant = table.Column(type: "INTEGER", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_KeyBinding", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "RulesetInfo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Available = table.Column(type: "INTEGER", nullable: false), - InstantiationInfo = table.Column(type: "TEXT", nullable: true), - Name = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_RulesetInfo", x => x.Id); + table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID); }); migrationBuilder.CreateTable( name: "BeatmapMetadata", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) + ID = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Artist = table.Column(type: "TEXT", nullable: true), ArtistUnicode = table.Column(type: "TEXT", nullable: true), AudioFile = table.Column(type: "TEXT", nullable: true), Author = table.Column(type: "TEXT", nullable: true), BackgroundFile = table.Column(type: "TEXT", nullable: true), - BeatmapSetInfoId = table.Column(type: "INTEGER", nullable: false), PreviewTime = table.Column(type: "INTEGER", nullable: false), Source = table.Column(type: "TEXT", nullable: true), Tags = table.Column(type: "TEXT", nullable: true), @@ -106,62 +48,97 @@ namespace osu.Game.Migrations }, constraints: table => { - table.PrimaryKey("PK_BeatmapMetadata", x => x.Id); - table.ForeignKey( - name: "FK_BeatmapMetadata_BeatmapSetInfo_BeatmapSetInfoId", - column: x => x.BeatmapSetInfoId, - principalTable: "BeatmapSetInfo", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + table.PrimaryKey("PK_BeatmapMetadata", x => x.ID); }); migrationBuilder.CreateTable( - name: "BeatmapSetFileInfo", + name: "FileInfo", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) + ID = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - BeatmapSetInfoId = table.Column(type: "INTEGER", nullable: false), - FileInfoId = table.Column(type: "INTEGER", nullable: false), - Filename = table.Column(type: "TEXT", nullable: false) + Hash = table.Column(type: "TEXT", nullable: true), + ReferenceCount = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_BeatmapSetFileInfo", x => x.Id); + table.PrimaryKey("PK_FileInfo", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "KeyBinding", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Action = table.Column(type: "INTEGER", nullable: false), + Keys = table.Column(type: "TEXT", nullable: true), + RulesetID = table.Column(type: "INTEGER", nullable: true), + Variant = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_KeyBinding", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "RulesetInfo", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Available = table.Column(type: "INTEGER", nullable: false), + InstantiationInfo = table.Column(type: "TEXT", nullable: true), + Name = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RulesetInfo", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "BeatmapSetInfo", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DeletePending = table.Column(type: "INTEGER", nullable: false), + Hash = table.Column(type: "TEXT", nullable: true), + MetadataID = table.Column(type: "INTEGER", nullable: true), + Protected = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID); table.ForeignKey( - name: "FK_BeatmapSetFileInfo_BeatmapSetInfo_BeatmapSetInfoId", - column: x => x.BeatmapSetInfoId, - principalTable: "BeatmapSetInfo", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_BeatmapSetFileInfo_FileInfo_FileInfoId", - column: x => x.FileInfoId, - principalTable: "FileInfo", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID", + column: x => x.MetadataID, + principalTable: "BeatmapMetadata", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "BeatmapInfo", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) + ID = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), AudioLeadIn = table.Column(type: "INTEGER", nullable: false), + BaseDifficultyID = table.Column(type: "INTEGER", nullable: false), BeatDivisor = table.Column(type: "INTEGER", nullable: false), - BeatmapDifficultyId = table.Column(type: "INTEGER", nullable: false), - BeatmapSetInfoId = table.Column(type: "INTEGER", nullable: false), + BeatmapSetInfoID = table.Column(type: "INTEGER", nullable: false), Countdown = table.Column(type: "INTEGER", nullable: false), + DifficultyID = table.Column(type: "INTEGER", nullable: false), DistanceSpacing = table.Column(type: "REAL", nullable: false), GridSize = table.Column(type: "INTEGER", nullable: false), Hash = table.Column(type: "TEXT", nullable: true), Hidden = table.Column(type: "INTEGER", nullable: false), LetterboxInBreaks = table.Column(type: "INTEGER", nullable: false), MD5Hash = table.Column(type: "TEXT", nullable: true), - MetadataId = table.Column(type: "INTEGER", nullable: true), + MetadataID = table.Column(type: "INTEGER", nullable: true), Path = table.Column(type: "TEXT", nullable: true), - RulesetInfoId = table.Column(type: "INTEGER", nullable: false), + RulesetID = table.Column(type: "INTEGER", nullable: false), SpecialStyle = table.Column(type: "INTEGER", nullable: false), StackLeniency = table.Column(type: "REAL", nullable: false), StarDifficulty = table.Column(type: "REAL", nullable: false), @@ -172,42 +149,69 @@ namespace osu.Game.Migrations }, constraints: table => { - table.PrimaryKey("PK_BeatmapInfo", x => x.Id); + table.PrimaryKey("PK_BeatmapInfo", x => x.ID); table.ForeignKey( - name: "FK_BeatmapInfo_BeatmapDifficulty_BeatmapDifficultyId", - column: x => x.BeatmapDifficultyId, - principalTable: "BeatmapDifficulty", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoId", - column: x => x.BeatmapSetInfoId, + name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID", + column: x => x.BeatmapSetInfoID, principalTable: "BeatmapSetInfo", - principalColumn: "Id", + principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_BeatmapInfo_BeatmapMetadata_MetadataId", - column: x => x.MetadataId, + name: "FK_BeatmapInfo_BeatmapDifficulty_DifficultyID", + column: x => x.DifficultyID, + principalTable: "BeatmapDifficulty", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID", + column: x => x.MetadataID, principalTable: "BeatmapMetadata", - principalColumn: "Id", + principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_BeatmapInfo_RulesetInfo_RulesetInfoId", - column: x => x.RulesetInfoId, + name: "FK_BeatmapInfo_RulesetInfo_RulesetID", + column: x => x.RulesetID, principalTable: "RulesetInfo", - principalColumn: "Id", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "BeatmapSetFileInfo", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BeatmapSetInfoID = table.Column(type: "INTEGER", nullable: false), + FileInfoID = table.Column(type: "INTEGER", nullable: false), + Filename = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BeatmapSetFileInfo", x => x.ID); + table.ForeignKey( + name: "FK_BeatmapSetFileInfo_BeatmapSetInfo_BeatmapSetInfoID", + column: x => x.BeatmapSetInfoID, + principalTable: "BeatmapSetInfo", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_BeatmapSetFileInfo_FileInfo_FileInfoID", + column: x => x.FileInfoID, + principalTable: "FileInfo", + principalColumn: "ID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( - name: "IX_BeatmapInfo_BeatmapDifficultyId", + name: "IX_BeatmapInfo_BeatmapSetInfoID", table: "BeatmapInfo", - column: "BeatmapDifficultyId"); + column: "BeatmapSetInfoID"); migrationBuilder.CreateIndex( - name: "IX_BeatmapInfo_BeatmapSetInfoId", + name: "IX_BeatmapInfo_DifficultyID", table: "BeatmapInfo", - column: "BeatmapSetInfoId"); + column: "DifficultyID"); migrationBuilder.CreateIndex( name: "IX_BeatmapInfo_MD5Hash", @@ -215,36 +219,35 @@ namespace osu.Game.Migrations column: "MD5Hash"); migrationBuilder.CreateIndex( - name: "IX_BeatmapInfo_MetadataId", + name: "IX_BeatmapInfo_MetadataID", table: "BeatmapInfo", - column: "MetadataId"); + column: "MetadataID"); migrationBuilder.CreateIndex( - name: "IX_BeatmapInfo_RulesetInfoId", + name: "IX_BeatmapInfo_RulesetID", table: "BeatmapInfo", - column: "RulesetInfoId"); + column: "RulesetID"); migrationBuilder.CreateIndex( - name: "IX_BeatmapMetadata_BeatmapSetInfoId", - table: "BeatmapMetadata", - column: "BeatmapSetInfoId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_BeatmapSetFileInfo_BeatmapSetInfoId", + name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID", table: "BeatmapSetFileInfo", - column: "BeatmapSetInfoId"); + column: "BeatmapSetInfoID"); migrationBuilder.CreateIndex( - name: "IX_BeatmapSetFileInfo_FileInfoId", + name: "IX_BeatmapSetFileInfo_FileInfoID", table: "BeatmapSetFileInfo", - column: "FileInfoId"); + column: "FileInfoID"); migrationBuilder.CreateIndex( name: "IX_BeatmapSetInfo_DeletePending", table: "BeatmapSetInfo", column: "DeletePending"); + migrationBuilder.CreateIndex( + name: "IX_BeatmapSetInfo_MetadataID", + table: "BeatmapSetInfo", + column: "MetadataID"); + migrationBuilder.CreateIndex( name: "IX_FileInfo_Hash", table: "FileInfo", @@ -299,16 +302,16 @@ namespace osu.Game.Migrations name: "BeatmapDifficulty"); migrationBuilder.DropTable( - name: "BeatmapMetadata"); + name: "RulesetInfo"); migrationBuilder.DropTable( - name: "RulesetInfo"); + name: "BeatmapSetInfo"); migrationBuilder.DropTable( name: "FileInfo"); migrationBuilder.DropTable( - name: "BeatmapSetInfo"); + name: "BeatmapMetadata"); } } } diff --git a/osu.Game/Migrations/20171009205048_Init.Designer.cs b/osu.Game/Migrations/20171014052545_Init.designer.cs similarity index 72% rename from osu.Game/Migrations/20171009205048_Init.Designer.cs rename to osu.Game/Migrations/20171014052545_Init.designer.cs index 251a13cbac..f151131882 100644 --- a/osu.Game/Migrations/20171009205048_Init.Designer.cs +++ b/osu.Game/Migrations/20171014052545_Init.designer.cs @@ -1,4 +1,7 @@ -// +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +// using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; @@ -10,7 +13,7 @@ using System; namespace osu.Game.Migrations { [DbContext(typeof(OsuDbContext))] - [Migration("20171009205048_Init")] + [Migration("20171014052545_Init")] partial class Init { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -21,7 +24,7 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("ApproachRate"); @@ -36,26 +39,28 @@ namespace osu.Game.Migrations b.Property("SliderTickRate"); - b.HasKey("Id"); + b.HasKey("ID"); b.ToTable("BeatmapDifficulty"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("AudioLeadIn"); + b.Property("BaseDifficultyID"); + b.Property("BeatDivisor"); - b.Property("BeatmapDifficultyId"); - - b.Property("BeatmapSetInfoId"); + b.Property("BeatmapSetInfoID"); b.Property("Countdown"); + b.Property("DifficultyID"); + b.Property("DistanceSpacing"); b.Property("GridSize"); @@ -68,11 +73,11 @@ namespace osu.Game.Migrations b.Property("MD5Hash"); - b.Property("MetadataId"); + b.Property("MetadataID"); b.Property("Path"); - b.Property("RulesetInfoId"); + b.Property("RulesetID"); b.Property("SpecialStyle"); @@ -88,24 +93,24 @@ namespace osu.Game.Migrations b.Property("WidescreenStoryboard"); - b.HasKey("Id"); + b.HasKey("ID"); - b.HasIndex("BeatmapDifficultyId"); + b.HasIndex("BeatmapSetInfoID"); - b.HasIndex("BeatmapSetInfoId"); + b.HasIndex("DifficultyID"); b.HasIndex("MD5Hash"); - b.HasIndex("MetadataId"); + b.HasIndex("MetadataID"); - b.HasIndex("RulesetInfoId"); + b.HasIndex("RulesetID"); b.ToTable("BeatmapInfo"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Artist"); @@ -118,8 +123,6 @@ namespace osu.Game.Migrations b.Property("BackgroundFile"); - b.Property("BeatmapSetInfoId"); - b.Property("PreviewTime"); b.Property("Source"); @@ -130,56 +133,57 @@ namespace osu.Game.Migrations b.Property("TitleUnicode"); - b.HasKey("Id"); - - b.HasIndex("BeatmapSetInfoId") - .IsUnique(); + b.HasKey("ID"); b.ToTable("BeatmapMetadata"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); - b.Property("BeatmapSetInfoId"); + b.Property("BeatmapSetInfoID"); - b.Property("FileInfoId"); + b.Property("FileInfoID"); b.Property("Filename") .IsRequired(); - b.HasKey("Id"); + b.HasKey("ID"); - b.HasIndex("BeatmapSetInfoId"); + b.HasIndex("BeatmapSetInfoID"); - b.HasIndex("FileInfoId"); + b.HasIndex("FileInfoID"); b.ToTable("BeatmapSetFileInfo"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("DeletePending"); b.Property("Hash"); + b.Property("MetadataID"); + b.Property("Protected"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("DeletePending"); + b.HasIndex("MetadataID"); + b.ToTable("BeatmapSetInfo"); }); modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("IntAction") @@ -188,11 +192,11 @@ namespace osu.Game.Migrations b.Property("KeysString") .HasColumnName("Keys"); - b.Property("RulesetInfoId"); + b.Property("RulesetID"); b.Property("Variant"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("IntAction"); @@ -203,14 +207,14 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.IO.FileInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Hash"); b.Property("ReferenceCount"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("Hash") .IsUnique(); @@ -222,7 +226,7 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Available"); @@ -231,7 +235,7 @@ namespace osu.Game.Migrations b.Property("Name"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("Available"); @@ -246,31 +250,23 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => { - b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty") - .WithMany() - .HasForeignKey("BeatmapDifficultyId") - .OnDelete(DeleteBehavior.Cascade); - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") .WithMany("Beatmaps") - .HasForeignKey("BeatmapSetInfoId") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty") + .WithMany() + .HasForeignKey("DifficultyID") .OnDelete(DeleteBehavior.Cascade); b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") .WithMany() - .HasForeignKey("MetadataId"); + .HasForeignKey("MetadataID"); b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") .WithMany() - .HasForeignKey("RulesetInfoId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") - .WithOne("Metadata") - .HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId") + .HasForeignKey("RulesetID") .OnDelete(DeleteBehavior.Cascade); }); @@ -278,14 +274,21 @@ namespace osu.Game.Migrations { b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") .WithMany("Files") - .HasForeignKey("BeatmapSetInfoId") + .HasForeignKey("BeatmapSetInfoID") .OnDelete(DeleteBehavior.Cascade); b.HasOne("osu.Game.IO.FileInfo", "FileInfo") .WithMany() - .HasForeignKey("FileInfoId") + .HasForeignKey("FileInfoID") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany() + .HasForeignKey("MetadataID"); + }); #pragma warning restore 612, 618 } } diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index d59d2eed09..bfcd09e309 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,4 +1,7 @@ -// +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +// using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; @@ -20,7 +23,7 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("ApproachRate"); @@ -35,26 +38,28 @@ namespace osu.Game.Migrations b.Property("SliderTickRate"); - b.HasKey("Id"); + b.HasKey("ID"); b.ToTable("BeatmapDifficulty"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("AudioLeadIn"); + b.Property("BaseDifficultyID"); + b.Property("BeatDivisor"); - b.Property("BeatmapDifficultyId"); - - b.Property("BeatmapSetInfoId"); + b.Property("BeatmapSetInfoID"); b.Property("Countdown"); + b.Property("DifficultyID"); + b.Property("DistanceSpacing"); b.Property("GridSize"); @@ -67,11 +72,11 @@ namespace osu.Game.Migrations b.Property("MD5Hash"); - b.Property("MetadataId"); + b.Property("MetadataID"); b.Property("Path"); - b.Property("RulesetInfoId"); + b.Property("RulesetID"); b.Property("SpecialStyle"); @@ -87,24 +92,24 @@ namespace osu.Game.Migrations b.Property("WidescreenStoryboard"); - b.HasKey("Id"); + b.HasKey("ID"); - b.HasIndex("BeatmapDifficultyId"); + b.HasIndex("BeatmapSetInfoID"); - b.HasIndex("BeatmapSetInfoId"); + b.HasIndex("DifficultyID"); b.HasIndex("MD5Hash"); - b.HasIndex("MetadataId"); + b.HasIndex("MetadataID"); - b.HasIndex("RulesetInfoId"); + b.HasIndex("RulesetID"); b.ToTable("BeatmapInfo"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Artist"); @@ -117,8 +122,6 @@ namespace osu.Game.Migrations b.Property("BackgroundFile"); - b.Property("BeatmapSetInfoId"); - b.Property("PreviewTime"); b.Property("Source"); @@ -129,56 +132,57 @@ namespace osu.Game.Migrations b.Property("TitleUnicode"); - b.HasKey("Id"); - - b.HasIndex("BeatmapSetInfoId") - .IsUnique(); + b.HasKey("ID"); b.ToTable("BeatmapMetadata"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); - b.Property("BeatmapSetInfoId"); + b.Property("BeatmapSetInfoID"); - b.Property("FileInfoId"); + b.Property("FileInfoID"); b.Property("Filename") .IsRequired(); - b.HasKey("Id"); + b.HasKey("ID"); - b.HasIndex("BeatmapSetInfoId"); + b.HasIndex("BeatmapSetInfoID"); - b.HasIndex("FileInfoId"); + b.HasIndex("FileInfoID"); b.ToTable("BeatmapSetFileInfo"); }); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("DeletePending"); b.Property("Hash"); + b.Property("MetadataID"); + b.Property("Protected"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("DeletePending"); + b.HasIndex("MetadataID"); + b.ToTable("BeatmapSetInfo"); }); modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("IntAction") @@ -187,11 +191,11 @@ namespace osu.Game.Migrations b.Property("KeysString") .HasColumnName("Keys"); - b.Property("RulesetInfoId"); + b.Property("RulesetID"); b.Property("Variant"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("IntAction"); @@ -202,14 +206,14 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.IO.FileInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Hash"); b.Property("ReferenceCount"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("Hash") .IsUnique(); @@ -221,7 +225,7 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => { - b.Property("Id") + b.Property("ID") .ValueGeneratedOnAdd(); b.Property("Available"); @@ -230,7 +234,7 @@ namespace osu.Game.Migrations b.Property("Name"); - b.HasKey("Id"); + b.HasKey("ID"); b.HasIndex("Available"); @@ -245,31 +249,23 @@ namespace osu.Game.Migrations modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => { - b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty") - .WithMany() - .HasForeignKey("BeatmapDifficultyId") - .OnDelete(DeleteBehavior.Cascade); - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") .WithMany("Beatmaps") - .HasForeignKey("BeatmapSetInfoId") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "Difficulty") + .WithMany() + .HasForeignKey("DifficultyID") .OnDelete(DeleteBehavior.Cascade); b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") .WithMany() - .HasForeignKey("MetadataId"); + .HasForeignKey("MetadataID"); b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") .WithMany() - .HasForeignKey("RulesetInfoId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") - .WithOne("Metadata") - .HasForeignKey("osu.Game.Beatmaps.BeatmapMetadata", "BeatmapSetInfoId") + .HasForeignKey("RulesetID") .OnDelete(DeleteBehavior.Cascade); }); @@ -277,14 +273,21 @@ namespace osu.Game.Migrations { b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") .WithMany("Files") - .HasForeignKey("BeatmapSetInfoId") + .HasForeignKey("BeatmapSetInfoID") .OnDelete(DeleteBehavior.Cascade); b.HasOne("osu.Game.IO.FileInfo", "FileInfo") .WithMany() - .HasForeignKey("FileInfoId") + .HasForeignKey("FileInfoID") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany() + .HasForeignKey("MetadataID"); + }); #pragma warning restore 612, 618 } } diff --git a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs index f8e20d1e9f..5a9f609bca 100644 --- a/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadBeatmapSetRequest.cs @@ -19,6 +19,6 @@ namespace osu.Game.Online.API.Requests Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total); } - protected override string Target => $@"beatmapsets/{BeatmapSet.BeatmapSetOnlineInfoId}/download"; + protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download"; } } diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 233e16beb1..934ef7ffa2 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.API.Requests { private readonly BeatmapInfo beatmap; - private string lookupString => beatmap.BeatmapOnlineInfoId > 0 ? beatmap.BeatmapOnlineInfoId.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}"; + private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={System.Uri.EscapeUriString(beatmap.Path)}"; public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { diff --git a/osu.Game/Online/API/Requests/GetBeatmapSetsResponse.cs b/osu.Game/Online/API/Requests/GetBeatmapSetsResponse.cs index 7ff04493b3..085563845d 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapSetsResponse.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapSetsResponse.cs @@ -40,7 +40,7 @@ namespace osu.Game.Online.API.Requests { return new BeatmapSetInfo { - BeatmapSetOnlineInfoId = onlineId, + OnlineBeatmapSetID = onlineId, Metadata = this, OnlineInfo = new BeatmapSetOnlineInfo { diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 2663032a8f..3777e10a31 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -19,8 +19,8 @@ namespace osu.Game.Online.API.Requests public GetScoresRequest(BeatmapInfo beatmap) { - if (!beatmap.BeatmapOnlineInfoId.HasValue) - throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.BeatmapOnlineInfoId)}."); + if (!beatmap.OnlineBeatmapID.HasValue) + throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}."); this.beatmap = beatmap; @@ -33,7 +33,7 @@ namespace osu.Game.Online.API.Requests score.ApplyBeatmap(beatmap); } - protected override string Target => $@"beatmaps/{beatmap.BeatmapOnlineInfoId}/scores"; + protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores"; } public class GetScoresResponse diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 93ea1d4c9e..56858b3d56 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -27,6 +27,6 @@ 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}"; } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6adc5bd821..d1baca68db 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -110,7 +110,7 @@ namespace osu.Game configRuleset = LocalConfig.GetBindable(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; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 6038f643fb..7d9d3517bd 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; -using System.Linq; using System.Reflection; using Microsoft.EntityFrameworkCore; using osu.Framework.Allocation; @@ -104,7 +103,7 @@ namespace osu.Game dependencies.Cache(LocalConfig); using (var dbContext = createDbContext()) - dbContext.Database.Migrate(); + dbContext.Database.Migrate(); dependencies.Cache(API = new APIAccess { diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 1500723680..28d26d0641 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -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 bindable, RulesetInfo ruleset) diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index d36c62cd67..9317bc06cf 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -146,7 +146,7 @@ namespace osu.Game.Overlays.Direct loading = true; - Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.BeatmapSetOnlineInfoId}.mp3") + Add(new AsyncLoadWrapper(trackLoader = new TrackLoader($"https://b.ppy.sh/preview/{BeatmapSet.OnlineBeatmapSetID}.mp3") { OnLoadComplete = d => { diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 14cd4a6632..14110724ea 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -176,8 +176,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.BeatmapSetOnlineInfoId == set.BeatmapSetOnlineInfoId)?.FadeOut(400).Expire(); - BeatmapSets = BeatmapSets?.Where(b => b.BeatmapSetOnlineInfoId != set.BeatmapSetOnlineInfoId); + panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire(); + BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID); } private void updateResultCounts() @@ -278,7 +278,7 @@ namespace osu.Game.Overlays { BeatmapSets = r?. Select(response => response.ToBeatmapSet(rulesets)). - Where(b => beatmaps.QueryBeatmapSet(q => q.BeatmapSetOnlineInfoId == b.BeatmapSetOnlineInfoId) == null); + Where(b => beatmaps.QueryBeatmapSet(q => q.OnlineBeatmapSetID == b.OnlineBeatmapSetID) == null); recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); }; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs b/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs index 8442203f14..bd69403831 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingsSubsection.cs @@ -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)) { diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index b989b1cb1c..6f1eaded7f 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -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; } } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index e78e3d44be..d05ad85726 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -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; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index d0700c5b7f..a99ce89a36 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -308,8 +308,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; } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs index 0b40966e24..52b68e7b30 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks AutoSizeAxes = Axes.Both, Action = () => { - if (score.Beatmap.BeatmapSetOnlineInfoId.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.BeatmapSetOnlineInfoId.Value); + if (score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value); }, Child = new FillFlowContainer { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index cd18980e32..60c1261190 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Toolbar { foreach (ToolbarModeButton m in modeButtons.Children.Cast()) { - bool isActive = m.Ruleset.Id == ruleset.Id; + bool isActive = m.Ruleset.ID == ruleset.ID; m.Active = isActive; if (isActive) activeButton = m; diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 48b3ef23cb..17f07158df 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets public class RulesetInfo : IEquatable { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int? Id { get; set; } + public int? ID { get; set; } public string Name { get; set; } @@ -19,6 +19,6 @@ namespace osu.Game.Rulesets 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; } } diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 6a3ba710a6..5a4b33df0b 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets 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) + if (Connection.RulesetInfo.SingleOrDefault(rsi=>rsi.ID==rulesetInfo.ID)==null) { Connection.RulesetInfo.Add(rulesetInfo); } @@ -103,12 +103,12 @@ 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) => Connection.RulesetInfo.First(r => r.Id == id); + public RulesetInfo GetRuleset(int id) => Connection.RulesetInfo.First(r => r.ID == id); public RulesetInfo QueryRulesetInfo(Func query) { diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 9dfc923d73..b597fc11e4 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu { var sets = beatmaps.GetAllUsableBeatmapSets(); 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) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4d48f53092..589f4b663a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play try { - RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.Id == beatmap.BeatmapInfo.Ruleset.Id); + RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID); } catch (BeatmapInvalidForRulesetException) { diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 2e16da47c6..c72f599955 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -113,7 +113,7 @@ 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) { @@ -121,7 +121,7 @@ namespace osu.Game.Screens.Select var set = manager.Refresh(beatmap.BeatmapSet); // 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); diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index e55642431c..f1215ab33d 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select.Details beatmap = value; //mania specific - if ((Beatmap?.Ruleset?.Id ?? 0) == 3) + if ((Beatmap?.Ruleset?.ID ?? 0) == 3) { firstValue.Title = "Key Amount"; firstValue.Value = (int)Math.Round(Beatmap?.Difficulty?.CircleSize ?? 0); diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 7ce00422a5..04cf1d9d62 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { var set = g.BeatmapSet; - bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetInfoId == (Ruleset?.Id ?? 0)); + bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0)); bool match = hasCurrentMode; diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index df08d4e6f6..7d65b8b648 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select.Leaderboards Scores = null; getScoresRequest?.Cancel(); - if (api == null || Beatmap?.BeatmapOnlineInfoId == null) return; + if (api == null || Beatmap?.OnlineBeatmapID == null) return; loading.Show(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 0a546b7812..b11613634a 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -246,7 +246,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); @@ -269,7 +269,7 @@ namespace osu.Game.Screens.Select } else { - if (beatmap.BeatmapSetInfoId == beatmapNoDebounce?.BeatmapSetInfoId) + if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else sampleChangeBeatmap.Play(); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index be893f7e9c..e583183d46 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using Microsoft.Data.Sqlite; using osu.Framework.Platform; namespace osu.Game.Tests.Platform diff --git a/osu.Game/Tests/Visual/TestCaseDirect.cs b/osu.Game/Tests/Visual/TestCaseDirect.cs index 36c329b7d0..1fb9dbea8f 100644 --- a/osu.Game/Tests/Visual/TestCaseDirect.cs +++ b/osu.Game/Tests/Visual/TestCaseDirect.cs @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual { new BeatmapSetInfo { - BeatmapSetOnlineInfoId = 578332, + OnlineBeatmapSetID = 578332, Metadata = new BeatmapMetadata { Title = @"OrVid", @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual }, new BeatmapSetInfo { - BeatmapSetOnlineInfoId = 599627, + OnlineBeatmapSetID = 599627, Metadata = new BeatmapMetadata { Title = @"tiny lamp", @@ -105,7 +105,7 @@ namespace osu.Game.Tests.Visual }, new BeatmapSetInfo { - BeatmapSetOnlineInfoId = 513268, + OnlineBeatmapSetID = 513268, Metadata = new BeatmapMetadata { Title = @"At Gwanghwamun", @@ -152,7 +152,7 @@ namespace osu.Game.Tests.Visual }, new BeatmapSetInfo { - BeatmapSetOnlineInfoId = 586841, + OnlineBeatmapSetID = 586841, Metadata = new BeatmapMetadata { Title = @"RHAPSODY OF BLUE SKY", diff --git a/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs index d7e03d6251..8d4b76956a 100644 --- a/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game/Tests/Visual/TestCasePlaySongSelect.cs @@ -60,11 +60,11 @@ namespace osu.Game.Tests.Visual { return new BeatmapSetInfo { - BeatmapSetOnlineInfoId = 1234 + i, + OnlineBeatmapSetID = 1234 + i, Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249", Metadata = new BeatmapMetadata { - BeatmapSetOnlineInfoId = 1234 + i, + OnlineBeatmapSetID = 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,7 +74,7 @@ namespace osu.Game.Tests.Visual { new BeatmapInfo { - BeatmapOnlineInfoId = 1234 + i, + OnlineBeatmapID = 1234 + i, Ruleset = rulesets.QueryRulesets().First(), Path = "normal.osu", Version = "Normal", @@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual }, new BeatmapInfo { - BeatmapOnlineInfoId = 1235 + i, + OnlineBeatmapID = 1235 + i, Ruleset = rulesets.QueryRulesets().First(), Path = "hard.osu", Version = "Hard", @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual }, new BeatmapInfo { - BeatmapOnlineInfoId = 1236 + i, + OnlineBeatmapID = 1236 + i, Ruleset = rulesets.QueryRulesets().First(), Path = "insane.osu", Version = "Insane", diff --git a/osu.Game/Tests/Visual/TestCaseResults.cs b/osu.Game/Tests/Visual/TestCaseResults.cs index a0146de7d0..62154a535a 100644 --- a/osu.Game/Tests/Visual/TestCaseResults.cs +++ b/osu.Game/Tests/Visual/TestCaseResults.cs @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual if (beatmap == null) { - var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetInfoId == 0); + var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0); if (beatmapInfo != null) beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5c38e465a5..11539ad752 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -323,6 +323,11 @@ + + + 20171014052545_Init.cs + + @@ -425,11 +430,6 @@ - - - 20171009205048_Init.cs - -