From 4d9e3d1982b836c7ff4eaf10d6a4b83bc0c1719f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 18:11:50 +0900 Subject: [PATCH] Rename Score/Skin `ModelManager` classes to `Importer` for now --- ...{ScoreModelManager.cs => ScoreImporter.cs} | 4 +- osu.Game/Scoring/ScoreManager.cs | 34 +++++++-------- .../{SkinModelManager.cs => SkinImporter.cs} | 4 +- osu.Game/Skinning/SkinManager.cs | 42 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) rename osu.Game/Scoring/{ScoreModelManager.cs => ScoreImporter.cs} (93%) rename osu.Game/Skinning/{SkinModelManager.cs => SkinImporter.cs} (98%) diff --git a/osu.Game/Scoring/ScoreModelManager.cs b/osu.Game/Scoring/ScoreImporter.cs similarity index 93% rename from osu.Game/Scoring/ScoreModelManager.cs rename to osu.Game/Scoring/ScoreImporter.cs index c88955c5fd..76c43ba2e2 100644 --- a/osu.Game/Scoring/ScoreModelManager.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -19,7 +19,7 @@ using Realms; namespace osu.Game.Scoring { - public class ScoreModelManager : RealmArchiveModelManager + public class ScoreImporter : RealmArchiveModelManager { public override IEnumerable HandledExtensions => new[] { ".osr" }; @@ -28,7 +28,7 @@ namespace osu.Game.Scoring private readonly RulesetStore rulesets; private readonly Func beatmaps; - public ScoreModelManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm) + public ScoreImporter(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm) : base(storage, realm) { this.rulesets = rulesets; diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index e857d2109f..125746d5dd 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -28,7 +28,7 @@ namespace osu.Game.Scoring private readonly Scheduler scheduler; private readonly Func difficulties; private readonly OsuConfigManager configManager; - private readonly ScoreModelManager scoreModelManager; + private readonly ScoreImporter scoreImporter; public ScoreManager(RulesetStore rulesets, Func beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler, Func difficulties = null, OsuConfigManager configManager = null) @@ -38,10 +38,10 @@ namespace osu.Game.Scoring this.difficulties = difficulties; this.configManager = configManager; - scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, realm); + scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm); } - public Score GetScore(ScoreInfo score) => scoreModelManager.GetScore(score); + public Score GetScore(ScoreInfo score) => scoreImporter.GetScore(score); /// /// Perform a lookup query on available s. @@ -231,7 +231,7 @@ namespace osu.Game.Scoring public Action PostNotification { - set => scoreModelManager.PostNotification = value; + set => scoreImporter.PostNotification = value; } #endregion @@ -240,7 +240,7 @@ namespace osu.Game.Scoring public bool Delete(ScoreInfo item) { - return scoreModelManager.Delete(item); + return scoreImporter.Delete(item); } public void Delete([CanBeNull] Expression> filter = null, bool silent = false) @@ -253,7 +253,7 @@ namespace osu.Game.Scoring if (filter != null) items = items.Where(filter); - scoreModelManager.Delete(items.ToList(), silent); + scoreImporter.Delete(items.ToList(), silent); }); } @@ -262,27 +262,27 @@ namespace osu.Game.Scoring realm.Run(r => { var beatmapScores = r.Find(beatmap.ID).Scores.ToList(); - scoreModelManager.Delete(beatmapScores, silent); + scoreImporter.Delete(beatmapScores, silent); }); } - public void Delete(List items, bool silent = false) => scoreModelManager.Delete(items, silent); + public void Delete(List items, bool silent = false) => scoreImporter.Delete(items, silent); - public void Undelete(List items, bool silent = false) => scoreModelManager.Undelete(items, silent); + public void Undelete(List items, bool silent = false) => scoreImporter.Undelete(items, silent); - public void Undelete(ScoreInfo item) => scoreModelManager.Undelete(item); + public void Undelete(ScoreInfo item) => scoreImporter.Undelete(item); - public Task Import(params string[] paths) => scoreModelManager.Import(paths); + public Task Import(params string[] paths) => scoreImporter.Import(paths); - public Task Import(params ImportTask[] tasks) => scoreModelManager.Import(tasks); + public Task Import(params ImportTask[] tasks) => scoreImporter.Import(tasks); - public IEnumerable HandledExtensions => scoreModelManager.HandledExtensions; + public IEnumerable HandledExtensions => scoreImporter.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks); + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreImporter.Import(notification, tasks); - public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, batchImport, cancellationToken); + public Live Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreImporter.Import(item, archive, batchImport, cancellationToken); - public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model); + public bool IsAvailableLocally(ScoreInfo model) => scoreImporter.IsAvailableLocally(model); #endregion @@ -290,7 +290,7 @@ namespace osu.Game.Scoring public Action>> PostImport { - set => scoreModelManager.PostImport = value; + set => scoreImporter.PostImport = value; } #endregion diff --git a/osu.Game/Skinning/SkinModelManager.cs b/osu.Game/Skinning/SkinImporter.cs similarity index 98% rename from osu.Game/Skinning/SkinModelManager.cs rename to osu.Game/Skinning/SkinImporter.cs index ca90f41080..67626a45a8 100644 --- a/osu.Game/Skinning/SkinModelManager.cs +++ b/osu.Game/Skinning/SkinImporter.cs @@ -20,13 +20,13 @@ using Realms; namespace osu.Game.Skinning { - public class SkinModelManager : RealmArchiveModelManager + public class SkinImporter : RealmArchiveModelManager { private const string skin_info_file = "skininfo.json"; private readonly IStorageResourceProvider skinResources; - public SkinModelManager(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources) + public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources) : base(storage, realm) { this.skinResources = skinResources; diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index f296386d34..f244657ea3 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -55,7 +55,7 @@ namespace osu.Game.Skinning Default = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged() }; - private readonly SkinModelManager skinModelManager; + private readonly SkinImporter skinImporter; private readonly RealmAccess realm; private readonly IResourceStore userFiles; @@ -80,7 +80,7 @@ namespace osu.Game.Skinning userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); - skinModelManager = new SkinModelManager(storage, realm, this); + skinImporter = new SkinImporter(storage, realm, this); var defaultSkins = new[] { @@ -166,7 +166,7 @@ namespace osu.Game.Skinning Name = NamingUtils.GetNextBestName(existingSkinNames, $@"{s.Name} (modified)") }; - var result = skinModelManager.Import(skinInfo); + var result = skinImporter.Import(skinInfo); if (result != null) { @@ -186,7 +186,7 @@ namespace osu.Game.Skinning if (!skin.SkinInfo.IsManaged) throw new InvalidOperationException($"Attempting to save a skin which is not yet tracked. Call {nameof(EnsureMutableSkin)} first."); - skinModelManager.Save(skin); + skinImporter.Save(skin); } /// @@ -260,26 +260,26 @@ namespace osu.Game.Skinning public Action PostNotification { - set => skinModelManager.PostNotification = value; + set => skinImporter.PostNotification = value; } public Action>> PostImport { - set => skinModelManager.PostImport = value; + set => skinImporter.PostImport = value; } - public Task Import(params string[] paths) => skinModelManager.Import(paths); + public Task Import(params string[] paths) => skinImporter.Import(paths); - public Task Import(params ImportTask[] tasks) => skinModelManager.Import(tasks); + public Task Import(params ImportTask[] tasks) => skinImporter.Import(tasks); - public IEnumerable HandledExtensions => skinModelManager.HandledExtensions; + public IEnumerable HandledExtensions => skinImporter.HandledExtensions; - public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinModelManager.Import(notification, tasks); + public Task>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinImporter.Import(notification, tasks); - public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, batchImport, cancellationToken); + public Task> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinImporter.Import(task, batchImport, cancellationToken); public Task> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) => - skinModelManager.Import(archive, batchImport, cancellationToken); + skinImporter.Import(archive, batchImport, cancellationToken); #endregion @@ -300,25 +300,25 @@ namespace osu.Game.Skinning if (items.Any(s => s.ID == currentUserSkin)) scheduler.Add(() => CurrentSkinInfo.Value = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged()); - skinModelManager.Delete(items.ToList(), silent); + skinImporter.Delete(items.ToList(), silent); }); } - public bool Delete(SkinInfo item) => skinModelManager.Delete(item); + public bool Delete(SkinInfo item) => skinImporter.Delete(item); - public void Delete(List items, bool silent = false) => skinModelManager.Delete(items, silent); + public void Delete(List items, bool silent = false) => skinImporter.Delete(items, silent); - public void Undelete(List items, bool silent = false) => skinModelManager.Undelete(items, silent); + public void Undelete(List items, bool silent = false) => skinImporter.Undelete(items, silent); - public void Undelete(SkinInfo item) => skinModelManager.Undelete(item); + public void Undelete(SkinInfo item) => skinImporter.Undelete(item); - public bool IsAvailableLocally(SkinInfo model) => skinModelManager.IsAvailableLocally(model); + public bool IsAvailableLocally(SkinInfo model) => skinImporter.IsAvailableLocally(model); - public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinModelManager.ReplaceFile(model, file, contents); + public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinImporter.ReplaceFile(model, file, contents); - public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinModelManager.DeleteFile(model, file); + public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinImporter.DeleteFile(model, file); - public void AddFile(SkinInfo model, Stream contents, string filename) => skinModelManager.AddFile(model, contents, filename); + public void AddFile(SkinInfo model, Stream contents, string filename) => skinImporter.AddFile(model, contents, filename); #endregion }