1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 10:22:56 +08:00

Rename Stable to Legacy and add xmldoc

This commit is contained in:
Dean Herbert 2021-11-25 15:39:05 +09:00
parent 6cab7b877d
commit 9dcb20a821
8 changed files with 31 additions and 28 deletions

View File

@ -19,7 +19,10 @@ using osu.Game.Skinning;
namespace osu.Game.Database namespace osu.Game.Database
{ {
public class StableImportManager : Component /// <summary>
/// Handles migration of legacy user data from osu-stable.
/// </summary>
public class LeagcyImportManager : Component
{ {
[Resolved] [Resolved]
private SkinManager skins { get; set; } private SkinManager skins { get; set; }
@ -51,9 +54,9 @@ namespace osu.Game.Database
var stableStorage = await getStableStorage().ConfigureAwait(false); var stableStorage = await getStableStorage().ConfigureAwait(false);
var importTasks = new List<Task>(); var importTasks = new List<Task>();
var beatmapImporter = new StableBeatmapImporter(beatmaps); var beatmapImporter = new LegacyBeatmapImporter(beatmaps);
var skinImporter = new StableSkinImporter(skins); var skinImporter = new LegacySkinImporter(skins);
var scoreImporter = new StableScoreImporter(scores); var scoreImporter = new LegacyScoreImporter(scores);
Task beatmapImportTask = Task.CompletedTask; Task beatmapImportTask = Task.CompletedTask;
if (content.HasFlagFast(StableContent.Beatmaps)) if (content.HasFlagFast(StableContent.Beatmaps))

View File

@ -4,13 +4,13 @@ using osu.Game.IO;
namespace osu.Game.Database namespace osu.Game.Database
{ {
public class StableBeatmapImporter : StableImporter<BeatmapSetInfo> public class LegacyBeatmapImporter : LegacyImporter<BeatmapSetInfo>
{ {
protected override string ImportFromStablePath => "."; protected override string ImportFromStablePath => ".";
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage(); protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
public StableBeatmapImporter(IModelImporter<BeatmapSetInfo> importer) public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
: base(importer) : base(importer)
{ {
} }

View File

@ -11,9 +11,9 @@ using osu.Game.IO;
namespace osu.Game.Database namespace osu.Game.Database
{ {
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
public class StableImporter<TModel> public abstract class LegacyImporter<TModel>
where TModel : class where TModel : class
{ {
/// <summary> /// <summary>
@ -29,7 +29,7 @@ namespace osu.Game.Database
protected readonly IModelImporter<TModel> Importer; protected readonly IModelImporter<TModel> Importer;
public StableImporter(IModelImporter<TModel> importer) protected LegacyImporter(IModelImporter<TModel> importer)
{ {
Importer = importer; Importer = importer;
} }

View File

@ -7,7 +7,7 @@ using osu.Game.Scoring;
namespace osu.Game.Database namespace osu.Game.Database
{ {
public class StableScoreImporter : StableImporter<ScoreInfo> public class LegacyScoreImporter : LegacyImporter<ScoreInfo>
{ {
protected override string ImportFromStablePath => Path.Combine("Data", "r"); 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)) => storage.GetFiles(ImportFromStablePath).Where(p => Importer.HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false))
.Select(path => storage.GetFullPath(path)); .Select(path => storage.GetFullPath(path));
public StableScoreImporter(IModelImporter<ScoreInfo> importer) public LegacyScoreImporter(IModelImporter<ScoreInfo> importer)
: base(importer) : base(importer)
{ {
} }

View File

@ -2,11 +2,11 @@ using osu.Game.Skinning;
namespace osu.Game.Database namespace osu.Game.Database
{ {
public class StableSkinImporter : StableImporter<SkinInfo> public class LegacySkinImporter : LegacyImporter<SkinInfo>
{ {
protected override string ImportFromStablePath => "Skins"; protected override string ImportFromStablePath => "Skins";
public StableSkinImporter(IModelImporter<SkinInfo> importer) public LegacySkinImporter(IModelImporter<SkinInfo> importer)
: base(importer) : base(importer)
{ {
} }

View File

@ -116,7 +116,7 @@ namespace osu.Game
private readonly DifficultyRecommender difficultyRecommender = new DifficultyRecommender(); private readonly DifficultyRecommender difficultyRecommender = new DifficultyRecommender();
[Cached] [Cached]
private readonly StableImportManager stableImportManager = new StableImportManager(); private readonly LeagcyImportManager leagcyImportManager = new LeagcyImportManager();
[Cached] [Cached]
private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
@ -782,7 +782,7 @@ namespace osu.Game
PostNotification = n => Notifications.Post(n), PostNotification = n => Notifications.Post(n),
}, Add, true); }, Add, true);
loadComponentSingleFile(stableImportManager, Add); loadComponentSingleFile(leagcyImportManager, Add);
loadComponentSingleFile(screenshotManager, Add); loadComponentSingleFile(screenshotManager, Add);

View File

@ -31,9 +31,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
private SettingsButton undeleteButton; private SettingsButton undeleteButton;
[BackgroundDependencyLoader(permitNulls: true)] [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 Add(importBeatmapsButton = new SettingsButton
{ {
@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () => Action = () =>
{ {
importBeatmapsButton.Enabled.Value = false; 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 Add(importScoresButton = new SettingsButton
{ {
@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () => Action = () =>
{ {
importScoresButton.Enabled.Value = false; 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 Add(importSkinsButton = new SettingsButton
{ {
@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () => Action = () =>
{ {
importSkinsButton.Enabled.Value = false; 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 (collectionManager != null)
{ {
if (stableImportManager?.SupportsImportFromStable == true) if (leagcyImportManager?.SupportsImportFromStable == true)
{ {
Add(importCollectionsButton = new SettingsButton Add(importCollectionsButton = new SettingsButton
{ {
@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
Action = () => Action = () =>
{ {
importCollectionsButton.Enabled.Value = false; 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));
} }
}); });
} }

View File

@ -51,7 +51,7 @@ namespace osu.Game.Screens.Select
protected virtual bool ShowFooter => true; protected virtual bool ShowFooter => true;
protected virtual bool DisplayStableImportPrompt => stableImportManager?.SupportsImportFromStable == true; protected virtual bool DisplayStableImportPrompt => leagcyImportManager?.SupportsImportFromStable == true;
public override bool? AllowTrackAdjustments => true; public override bool? AllowTrackAdjustments => true;
@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select
private BeatmapManager beatmaps { get; set; } private BeatmapManager beatmaps { get; set; }
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private StableImportManager stableImportManager { get; set; } private LeagcyImportManager leagcyImportManager { get; set; }
protected ModSelectOverlay ModSelect { get; private set; } protected ModSelectOverlay ModSelect { get; private set; }
@ -297,7 +297,7 @@ namespace osu.Game.Screens.Select
{ {
dialogOverlay.Push(new ImportFromStablePopup(() => dialogOverlay.Push(new ImportFromStablePopup(() =>
{ {
Task.Run(() => stableImportManager.ImportFromStableAsync(StableContent.All)); Task.Run(() => leagcyImportManager.ImportFromStableAsync(StableContent.All));
})); }));
} }
}); });