From 9dcb20a8217ff9dfe62487c8d578a7e42ab8ab35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 25 Nov 2021 15:39:05 +0900 Subject: [PATCH] Rename `Stable` to `Legacy` and add xmldoc --- ...ImportManager.cs => LeagcyImportManager.cs} | 11 +++++++---- ...mapImporter.cs => LegacyBeatmapImporter.cs} | 6 +++--- .../{StableImporter.cs => LegacyImporter.cs} | 6 +++--- ...ScoreImporter.cs => LegacyScoreImporter.cs} | 4 ++-- ...leSkinImporter.cs => LegacySkinImporter.cs} | 4 ++-- osu.Game/OsuGame.cs | 4 ++-- .../Sections/Maintenance/GeneralSettings.cs | 18 +++++++++--------- osu.Game/Screens/Select/SongSelect.cs | 6 +++--- 8 files changed, 31 insertions(+), 28 deletions(-) rename osu.Game/Database/{StableImportManager.cs => LeagcyImportManager.cs} (90%) rename osu.Game/Database/{StableBeatmapImporter.cs => LegacyBeatmapImporter.cs} (74%) rename osu.Game/Database/{StableImporter.cs => LegacyImporter.cs} (92%) rename osu.Game/Database/{StableScoreImporter.cs => LegacyScoreImporter.cs} (83%) rename osu.Game/Database/{StableSkinImporter.cs => LegacySkinImporter.cs} (59%) diff --git a/osu.Game/Database/StableImportManager.cs b/osu.Game/Database/LeagcyImportManager.cs similarity index 90% rename from osu.Game/Database/StableImportManager.cs rename to osu.Game/Database/LeagcyImportManager.cs index 0a30fcb2be..9f3f9d007a 100644 --- a/osu.Game/Database/StableImportManager.cs +++ b/osu.Game/Database/LeagcyImportManager.cs @@ -19,7 +19,10 @@ using osu.Game.Skinning; namespace osu.Game.Database { - public class StableImportManager : Component + /// + /// Handles migration of legacy user data from osu-stable. + /// + public class LeagcyImportManager : Component { [Resolved] private SkinManager skins { get; set; } @@ -51,9 +54,9 @@ namespace osu.Game.Database var stableStorage = await getStableStorage().ConfigureAwait(false); var importTasks = new List(); - var beatmapImporter = new StableBeatmapImporter(beatmaps); - var skinImporter = new StableSkinImporter(skins); - var scoreImporter = new StableScoreImporter(scores); + var beatmapImporter = new LegacyBeatmapImporter(beatmaps); + var skinImporter = new LegacySkinImporter(skins); + var scoreImporter = new LegacyScoreImporter(scores); Task beatmapImportTask = Task.CompletedTask; if (content.HasFlagFast(StableContent.Beatmaps)) diff --git a/osu.Game/Database/StableBeatmapImporter.cs b/osu.Game/Database/LegacyBeatmapImporter.cs similarity index 74% rename from osu.Game/Database/StableBeatmapImporter.cs rename to osu.Game/Database/LegacyBeatmapImporter.cs index 7aaa8ba013..a377c39b90 100644 --- a/osu.Game/Database/StableBeatmapImporter.cs +++ b/osu.Game/Database/LegacyBeatmapImporter.cs @@ -4,15 +4,15 @@ using osu.Game.IO; namespace osu.Game.Database { - public class StableBeatmapImporter : StableImporter + public class LegacyBeatmapImporter : LegacyImporter { protected override string ImportFromStablePath => "."; protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage(); - public StableBeatmapImporter(IModelImporter importer) + public LegacyBeatmapImporter(IModelImporter importer) : base(importer) { } } -} \ No newline at end of file +} diff --git a/osu.Game/Database/StableImporter.cs b/osu.Game/Database/LegacyImporter.cs similarity index 92% rename from osu.Game/Database/StableImporter.cs rename to osu.Game/Database/LegacyImporter.cs index e56737959e..4480aa9ee8 100644 --- a/osu.Game/Database/StableImporter.cs +++ b/osu.Game/Database/LegacyImporter.cs @@ -11,9 +11,9 @@ using osu.Game.IO; namespace osu.Game.Database { /// - /// A class which handled importing various user data from osu-stable. + /// A class which handles importing legacy user data of a single type from osu-stable. /// - public class StableImporter + public abstract class LegacyImporter where TModel : class { /// @@ -29,7 +29,7 @@ namespace osu.Game.Database protected readonly IModelImporter Importer; - public StableImporter(IModelImporter importer) + protected LegacyImporter(IModelImporter importer) { Importer = importer; } diff --git a/osu.Game/Database/StableScoreImporter.cs b/osu.Game/Database/LegacyScoreImporter.cs similarity index 83% rename from osu.Game/Database/StableScoreImporter.cs rename to osu.Game/Database/LegacyScoreImporter.cs index fede10c7ea..4cc2be60e6 100644 --- a/osu.Game/Database/StableScoreImporter.cs +++ b/osu.Game/Database/LegacyScoreImporter.cs @@ -7,7 +7,7 @@ using osu.Game.Scoring; namespace osu.Game.Database { - public class StableScoreImporter : StableImporter + public class LegacyScoreImporter : LegacyImporter { protected override string ImportFromStablePath => Path.Combine("Data", "r"); @@ -15,7 +15,7 @@ namespace osu.Game.Database => storage.GetFiles(ImportFromStablePath).Where(p => Importer.HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false)) .Select(path => storage.GetFullPath(path)); - public StableScoreImporter(IModelImporter importer) + public LegacyScoreImporter(IModelImporter importer) : base(importer) { } diff --git a/osu.Game/Database/StableSkinImporter.cs b/osu.Game/Database/LegacySkinImporter.cs similarity index 59% rename from osu.Game/Database/StableSkinImporter.cs rename to osu.Game/Database/LegacySkinImporter.cs index 65601e85b7..357da1b005 100644 --- a/osu.Game/Database/StableSkinImporter.cs +++ b/osu.Game/Database/LegacySkinImporter.cs @@ -2,11 +2,11 @@ using osu.Game.Skinning; namespace osu.Game.Database { - public class StableSkinImporter : StableImporter + public class LegacySkinImporter : LegacyImporter { protected override string ImportFromStablePath => "Skins"; - public StableSkinImporter(IModelImporter importer) + public LegacySkinImporter(IModelImporter importer) : base(importer) { } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 574a5e5393..9b9ec585e8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -116,7 +116,7 @@ namespace osu.Game private readonly DifficultyRecommender difficultyRecommender = new DifficultyRecommender(); [Cached] - private readonly StableImportManager stableImportManager = new StableImportManager(); + private readonly LeagcyImportManager leagcyImportManager = new LeagcyImportManager(); [Cached] private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); @@ -782,7 +782,7 @@ namespace osu.Game PostNotification = n => Notifications.Post(n), }, Add, true); - loadComponentSingleFile(stableImportManager, Add); + loadComponentSingleFile(leagcyImportManager, Add); loadComponentSingleFile(screenshotManager, Add); diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 43df58a8b1..9dfd0d8ff4 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -31,9 +31,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance private SettingsButton undeleteButton; [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] StableImportManager stableImportManager, DialogOverlay dialogOverlay) + private void load(BeatmapManager beatmaps, ScoreManager scores, SkinManager skins, [CanBeNull] CollectionManager collectionManager, [CanBeNull] LeagcyImportManager leagcyImportManager, DialogOverlay dialogOverlay) { - if (stableImportManager?.SupportsImportFromStable == true) + if (leagcyImportManager?.SupportsImportFromStable == true) { Add(importBeatmapsButton = new SettingsButton { @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importBeatmapsButton.Enabled.Value = false; - stableImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); + leagcyImportManager.ImportFromStableAsync(StableContent.Beatmaps).ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }); } @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); - if (stableImportManager?.SupportsImportFromStable == true) + if (leagcyImportManager?.SupportsImportFromStable == true) { Add(importScoresButton = new SettingsButton { @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importScoresButton.Enabled.Value = false; - stableImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); + leagcyImportManager.ImportFromStableAsync(StableContent.Scores).ContinueWith(t => Schedule(() => importScoresButton.Enabled.Value = true)); } }); } @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance } }); - if (stableImportManager?.SupportsImportFromStable == true) + if (leagcyImportManager?.SupportsImportFromStable == true) { Add(importSkinsButton = new SettingsButton { @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importSkinsButton.Enabled.Value = false; - stableImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); + leagcyImportManager.ImportFromStableAsync(StableContent.Skins).ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); } }); } @@ -113,7 +113,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance if (collectionManager != null) { - if (stableImportManager?.SupportsImportFromStable == true) + if (leagcyImportManager?.SupportsImportFromStable == true) { Add(importCollectionsButton = new SettingsButton { @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importCollectionsButton.Enabled.Value = false; - stableImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); + leagcyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true)); } }); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 2c36bf5fc8..b6933a9830 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Select protected virtual bool ShowFooter => true; - protected virtual bool DisplayStableImportPrompt => stableImportManager?.SupportsImportFromStable == true; + protected virtual bool DisplayStableImportPrompt => leagcyImportManager?.SupportsImportFromStable == true; public override bool? AllowTrackAdjustments => true; @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select private BeatmapManager beatmaps { get; set; } [Resolved(CanBeNull = true)] - private StableImportManager stableImportManager { get; set; } + private LeagcyImportManager leagcyImportManager { get; set; } protected ModSelectOverlay ModSelect { get; private set; } @@ -297,7 +297,7 @@ namespace osu.Game.Screens.Select { dialogOverlay.Push(new ImportFromStablePopup(() => { - Task.Run(() => stableImportManager.ImportFromStableAsync(StableContent.All)); + Task.Run(() => leagcyImportManager.ImportFromStableAsync(StableContent.All)); })); } });