From 0b6c4497bd0a9f74d4153a218afb603b88d9b46c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 19 Nov 2021 18:59:14 +0900 Subject: [PATCH] Rename EF classes to allow for shit to hit the fan --- ...apDifficulty.cs => EFBeatmapDifficulty.cs} | 14 ++++---- .../{BeatmapInfo.cs => EFBeatmapInfo.cs} | 32 +++++++++---------- ...eatmapMetadata.cs => EFBeatmapMetadata.cs} | 8 ++--- ...{BeatmapSetInfo.cs => EFBeatmapSetInfo.cs} | 8 ++--- osu.Game/Database/OsuDbContext.cs | 28 ++++++++-------- .../{RulesetInfo.cs => EFRulesetInfo.cs} | 6 ++-- osu.sln.DotSettings | 2 +- 7 files changed, 49 insertions(+), 49 deletions(-) rename osu.Game/Beatmaps/{BeatmapDifficulty.cs => EFBeatmapDifficulty.cs} (81%) rename osu.Game/Beatmaps/{BeatmapInfo.cs => EFBeatmapInfo.cs} (76%) rename osu.Game/Beatmaps/{BeatmapMetadata.cs => EFBeatmapMetadata.cs} (86%) rename osu.Game/Beatmaps/{BeatmapSetInfo.cs => EFBeatmapSetInfo.cs} (90%) rename osu.Game/Rulesets/{RulesetInfo.cs => EFRulesetInfo.cs} (86%) diff --git a/osu.Game/Beatmaps/BeatmapDifficulty.cs b/osu.Game/Beatmaps/EFBeatmapDifficulty.cs similarity index 81% rename from osu.Game/Beatmaps/BeatmapDifficulty.cs rename to osu.Game/Beatmaps/EFBeatmapDifficulty.cs index 65d1fb8286..843c6ac6bf 100644 --- a/osu.Game/Beatmaps/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/EFBeatmapDifficulty.cs @@ -6,7 +6,7 @@ using osu.Game.Database; namespace osu.Game.Beatmaps { - public class BeatmapDifficulty : IHasPrimaryKey, IBeatmapDifficultyInfo + public class EFBeatmapDifficulty : IHasPrimaryKey, IBeatmapDifficultyInfo { /// /// The default value used for all difficulty settings except and . @@ -23,11 +23,11 @@ namespace osu.Game.Beatmaps private float? approachRate; - public BeatmapDifficulty() + public EFBeatmapDifficulty() { } - public BeatmapDifficulty(IBeatmapDifficultyInfo source) + public EFBeatmapDifficulty(IBeatmapDifficultyInfo source) { CopyFrom(source); } @@ -42,11 +42,11 @@ namespace osu.Game.Beatmaps public double SliderTickRate { get; set; } = 1; /// - /// Returns a shallow-clone of this . + /// Returns a shallow-clone of this . /// - public BeatmapDifficulty Clone() + public EFBeatmapDifficulty Clone() { - var diff = (BeatmapDifficulty)Activator.CreateInstance(GetType()); + var diff = (EFBeatmapDifficulty)Activator.CreateInstance(GetType()); CopyTo(diff); return diff; } @@ -62,7 +62,7 @@ namespace osu.Game.Beatmaps SliderTickRate = other.SliderTickRate; } - public virtual void CopyTo(BeatmapDifficulty other) + public virtual void CopyTo(EFBeatmapDifficulty other) { other.ApproachRate = ApproachRate; other.DrainRate = DrainRate; diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/EFBeatmapInfo.cs similarity index 76% rename from osu.Game/Beatmaps/BeatmapInfo.cs rename to osu.Game/Beatmaps/EFBeatmapInfo.cs index 4175d7ff6b..2336eeb456 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapInfo.cs @@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] [Serializable] - public class BeatmapInfo : IEquatable, IHasPrimaryKey, IBeatmapInfo + public class EFBeatmapInfo : IEquatable, IHasPrimaryKey, IBeatmapInfo { public int ID { get; set; } @@ -40,14 +40,14 @@ namespace osu.Game.Beatmaps public BeatmapOnlineStatus Status { get; set; } = BeatmapOnlineStatus.None; [Required] - public BeatmapSetInfo BeatmapSet { get; set; } + public EFBeatmapSetInfo BeatmapSet { get; set; } - public BeatmapMetadata Metadata { get; set; } + public EFBeatmapMetadata Metadata { get; set; } [JsonIgnore] public int BaseDifficultyID { get; set; } - public BeatmapDifficulty BaseDifficulty { get; set; } + public EFBeatmapDifficulty BaseDifficulty { get; set; } [NotMapped] public APIBeatmap OnlineInfo { get; set; } @@ -86,7 +86,7 @@ namespace osu.Game.Beatmaps public int RulesetID { get; set; } - public RulesetInfo Ruleset { get; set; } + public EFRulesetInfo Ruleset { get; set; } public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } @@ -131,7 +131,7 @@ namespace osu.Game.Beatmaps public override string ToString() => this.GetDisplayTitle(); - public bool Equals(BeatmapInfo other) + public bool Equals(EFBeatmapInfo other) { if (ReferenceEquals(this, other)) return true; if (other == null) return false; @@ -142,20 +142,20 @@ namespace osu.Game.Beatmaps return false; } - public bool Equals(IBeatmapInfo other) => other is BeatmapInfo b && Equals(b); + public bool Equals(IBeatmapInfo other) => other is EFBeatmapInfo b && Equals(b); - 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(EFBeatmapInfo 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 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(EFBeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && + BeatmapSet.Hash == other.BeatmapSet.Hash && + (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile; /// - /// Returns a shallow-clone of this . + /// Returns a shallow-clone of this . /// - public BeatmapInfo Clone() => (BeatmapInfo)MemberwiseClone(); + public EFBeatmapInfo Clone() => (EFBeatmapInfo)MemberwiseClone(); #region Implementation of IHasOnlineID @@ -166,7 +166,7 @@ namespace osu.Game.Beatmaps #region Implementation of IBeatmapInfo [JsonIgnore] - IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata ?? BeatmapSet?.Metadata ?? new BeatmapMetadata(); + IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata ?? BeatmapSet?.Metadata ?? new EFBeatmapMetadata(); [JsonIgnore] IBeatmapDifficultyInfo IBeatmapInfo.Difficulty => BaseDifficulty; diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/EFBeatmapMetadata.cs similarity index 86% rename from osu.Game/Beatmaps/BeatmapMetadata.cs rename to osu.Game/Beatmaps/EFBeatmapMetadata.cs index 5da0264893..6c192088dc 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/EFBeatmapMetadata.cs @@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] [Serializable] - public class BeatmapMetadata : IEquatable, IHasPrimaryKey, IBeatmapMetadataInfo + public class EFBeatmapMetadata : IEquatable, IHasPrimaryKey, IBeatmapMetadataInfo { public int ID { get; set; } @@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps public string ArtistUnicode { get; set; } = string.Empty; [JsonIgnore] - public List Beatmaps { get; set; } = new List(); + public List Beatmaps { get; set; } = new List(); [JsonIgnore] - public List BeatmapSets { get; set; } = new List(); + public List BeatmapSets { get; set; } = new List(); /// /// The author of the beatmaps in this set. @@ -81,7 +81,7 @@ namespace osu.Game.Beatmaps public string BackgroundFile { get; set; } = string.Empty; - public bool Equals(BeatmapMetadata other) => ((IBeatmapMetadataInfo)this).Equals(other); + public bool Equals(EFBeatmapMetadata other) => ((IBeatmapMetadataInfo)this).Equals(other); public override string ToString() => this.GetDisplayTitle(); diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/EFBeatmapSetInfo.cs similarity index 90% rename from osu.Game/Beatmaps/BeatmapSetInfo.cs rename to osu.Game/Beatmaps/EFBeatmapSetInfo.cs index a3a8f8555f..c0310f5a76 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/EFBeatmapSetInfo.cs @@ -14,7 +14,7 @@ using osu.Game.Extensions; namespace osu.Game.Beatmaps { [ExcludeFromDynamicCompile] - public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles, ISoftDelete, IEquatable, IBeatmapSetInfo + public class EFBeatmapSetInfo : IHasPrimaryKey, IHasFiles, ISoftDelete, IEquatable, IBeatmapSetInfo { public int ID { get; set; } @@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps public DateTimeOffset DateAdded { get; set; } - public BeatmapMetadata Metadata { get; set; } + public EFBeatmapMetadata Metadata { get; set; } [NotNull] public List Beatmaps { get; } = new List(); @@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps public bool Protected { get; set; } - public bool Equals(BeatmapSetInfo other) + public bool Equals(EFBeatmapSetInfo other) { if (ReferenceEquals(this, other)) return true; if (other == null) return false; @@ -85,7 +85,7 @@ namespace osu.Game.Beatmaps return false; } - public bool Equals(IBeatmapSetInfo other) => other is BeatmapSetInfo b && Equals(b); + public bool Equals(IBeatmapSetInfo other) => other is EFBeatmapSetInfo b && Equals(b); #region Implementation of IHasOnlineID diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index 7cd9ae2885..9f0bae4a66 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -19,12 +19,12 @@ namespace osu.Game.Database { public class OsuDbContext : DbContext { - public DbSet BeatmapInfo { get; set; } - public DbSet BeatmapDifficulty { get; set; } - public DbSet BeatmapMetadata { get; set; } - public DbSet BeatmapSetInfo { get; set; } + public DbSet EFBeatmapInfo { get; set; } + public DbSet BeatmapDifficulty { get; set; } + public DbSet BeatmapMetadata { get; set; } + public DbSet EFBeatmapSetInfo { get; set; } public DbSet FileInfo { get; set; } - public DbSet RulesetInfo { get; set; } + public DbSet RulesetInfo { get; set; } public DbSet SkinInfo { get; set; } public DbSet ScoreInfo { get; set; } @@ -125,13 +125,13 @@ namespace osu.Game.Database { base.OnModelCreating(modelBuilder); - modelBuilder.Entity().HasIndex(b => b.OnlineID).IsUnique(); - modelBuilder.Entity().HasIndex(b => b.MD5Hash); - modelBuilder.Entity().HasIndex(b => b.Hash); + modelBuilder.Entity().HasIndex(b => b.OnlineID).IsUnique(); + modelBuilder.Entity().HasIndex(b => b.MD5Hash); + modelBuilder.Entity().HasIndex(b => b.Hash); - modelBuilder.Entity().HasIndex(b => b.OnlineID).IsUnique(); - modelBuilder.Entity().HasIndex(b => b.DeletePending); - modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); + modelBuilder.Entity().HasIndex(b => b.OnlineID).IsUnique(); + modelBuilder.Entity().HasIndex(b => b.DeletePending); + modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity().HasIndex(b => b.DeletePending); @@ -142,10 +142,10 @@ namespace osu.Game.Database modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity().HasIndex(b => b.ReferenceCount); - modelBuilder.Entity().HasIndex(b => b.Available); - modelBuilder.Entity().HasIndex(b => b.ShortName).IsUnique(); + modelBuilder.Entity().HasIndex(b => b.Available); + modelBuilder.Entity().HasIndex(b => b.ShortName).IsUnique(); - modelBuilder.Entity().HasOne(b => b.BaseDifficulty); + modelBuilder.Entity().HasOne(b => b.BaseDifficulty); modelBuilder.Entity().HasIndex(b => b.OnlineID).IsUnique(); } diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/EFRulesetInfo.cs similarity index 86% rename from osu.Game/Rulesets/RulesetInfo.cs rename to osu.Game/Rulesets/EFRulesetInfo.cs index d018cc4194..36e2add557 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/EFRulesetInfo.cs @@ -10,7 +10,7 @@ using osu.Framework.Testing; namespace osu.Game.Rulesets { [ExcludeFromDynamicCompile] - public sealed class RulesetInfo : IEquatable, IRulesetInfo + public sealed class EFRulesetInfo : IEquatable, IRulesetInfo { public int? ID { get; set; } @@ -45,9 +45,9 @@ namespace osu.Game.Rulesets return ruleset; } - public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; + public bool Equals(EFRulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; - public override bool Equals(object obj) => obj is RulesetInfo rulesetInfo && Equals(rulesetInfo); + public override bool Equals(object obj) => obj is EFRulesetInfo rulesetInfo && Equals(rulesetInfo); public bool Equals(IRulesetInfo other) => other is RulesetInfo b && Equals(b); diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 44d75f265c..0da109ae7c 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -789,7 +789,7 @@ See the LICENCE file in the repository root for full licence text. <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - True + True True True True