mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 23:47:24 +08:00
Merge pull request #15792 from peppy/realm-integration/stable-import-flow
Move stable import handling out of `IModelManager<T>` into its own class
This commit is contained in:
commit
57cbce8f22
@ -225,11 +225,6 @@ namespace osu.Game.Beatmaps
|
|||||||
remove => beatmapModelManager.ItemRemoved -= value;
|
remove => beatmapModelManager.ItemRemoved -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ImportFromStableAsync(StableStorage stableStorage)
|
|
||||||
{
|
|
||||||
return beatmapModelManager.ImportFromStableAsync(stableStorage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Export(BeatmapSetInfo item)
|
public void Export(BeatmapSetInfo item)
|
||||||
{
|
{
|
||||||
beatmapModelManager.Export(item);
|
beatmapModelManager.Export(item);
|
||||||
|
@ -58,10 +58,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override string[] HashableFileTypes => new[] { ".osu" };
|
protected override string[] HashableFileTypes => new[] { ".osu" };
|
||||||
|
|
||||||
protected override string ImportFromStablePath => ".";
|
|
||||||
|
|
||||||
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
|
|
||||||
|
|
||||||
private readonly BeatmapStore beatmaps;
|
private readonly BeatmapStore beatmaps;
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
|
|
||||||
|
@ -728,17 +728,6 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
#region osu-stable import
|
#region osu-stable import
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The relative path from osu-stable's data directory to import items from.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual string ImportFromStablePath => null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual IEnumerable<string> GetStableImportPaths(Storage storage) => storage.GetDirectories(ImportFromStablePath)
|
|
||||||
.Select(path => storage.GetFullPath(path));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this specified path should be removed after successful import.
|
/// Whether this specified path should be removed after successful import.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -746,29 +735,6 @@ namespace osu.Game.Database
|
|||||||
/// <returns>Whether to perform deletion.</returns>
|
/// <returns>Whether to perform deletion.</returns>
|
||||||
protected virtual bool ShouldDeleteArchive(string path) => false;
|
protected virtual bool ShouldDeleteArchive(string path) => false;
|
||||||
|
|
||||||
public Task ImportFromStableAsync(StableStorage stableStorage)
|
|
||||||
{
|
|
||||||
var storage = PrepareStableStorage(stableStorage);
|
|
||||||
|
|
||||||
// Handle situations like when the user does not have a Skins folder.
|
|
||||||
if (!storage.ExistsDirectory(ImportFromStablePath))
|
|
||||||
{
|
|
||||||
string fullPath = storage.GetFullPath(ImportFromStablePath);
|
|
||||||
|
|
||||||
Logger.Log(@$"Folder ""{fullPath}"" not available in the target osu!stable installation to import {HumanisedModelName}s.", LoggingTarget.Information, LogLevel.Error);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.Run(async () => await Import(GetStableImportPaths(storage).ToArray()).ConfigureAwait(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Run any required traversal operations on the stable storage location before performing operations.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stableStorage">The stable storage.</param>
|
|
||||||
/// <returns>The usable storage. Return the unchanged <paramref name="stableStorage"/> if no traversal is required.</returns>
|
|
||||||
protected virtual Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Game.IO;
|
|
||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
@ -26,11 +24,6 @@ namespace osu.Game.Database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
event Action<TModel> ItemRemoved;
|
event Action<TModel> ItemRemoved;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
|
|
||||||
/// </summary>
|
|
||||||
Task ImportFromStableAsync(StableStorage stableStorage);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exports an item to a legacy (.zip based) package.
|
/// Exports an item to a legacy (.zip based) package.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
21
osu.Game/Database/LegacyBeatmapImporter.cs
Normal file
21
osu.Game/Database/LegacyBeatmapImporter.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.IO;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
public class LegacyBeatmapImporter : LegacyModelImporter<BeatmapSetInfo>
|
||||||
|
{
|
||||||
|
protected override string ImportFromStablePath => ".";
|
||||||
|
|
||||||
|
protected override Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage.GetSongStorage();
|
||||||
|
|
||||||
|
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)
|
||||||
|
: base(importer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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 LegacyImportManager : Component
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private SkinManager skins { get; set; }
|
private SkinManager skins { get; set; }
|
||||||
@ -53,16 +56,16 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
Task beatmapImportTask = Task.CompletedTask;
|
Task beatmapImportTask = Task.CompletedTask;
|
||||||
if (content.HasFlagFast(StableContent.Beatmaps))
|
if (content.HasFlagFast(StableContent.Beatmaps))
|
||||||
importTasks.Add(beatmapImportTask = beatmaps.ImportFromStableAsync(stableStorage));
|
importTasks.Add(beatmapImportTask = new LegacyBeatmapImporter(beatmaps).ImportFromStableAsync(stableStorage));
|
||||||
|
|
||||||
if (content.HasFlagFast(StableContent.Skins))
|
if (content.HasFlagFast(StableContent.Skins))
|
||||||
importTasks.Add(skins.ImportFromStableAsync(stableStorage));
|
importTasks.Add(new LegacySkinImporter(skins).ImportFromStableAsync(stableStorage));
|
||||||
|
|
||||||
if (content.HasFlagFast(StableContent.Collections))
|
if (content.HasFlagFast(StableContent.Collections))
|
||||||
importTasks.Add(beatmapImportTask.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
importTasks.Add(beatmapImportTask.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
||||||
|
|
||||||
if (content.HasFlagFast(StableContent.Scores))
|
if (content.HasFlagFast(StableContent.Scores))
|
||||||
importTasks.Add(beatmapImportTask.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
importTasks.Add(beatmapImportTask.ContinueWith(_ => new LegacyScoreImporter(scores).ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
||||||
|
|
||||||
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
|
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
|
||||||
}
|
}
|
60
osu.Game/Database/LegacyModelImporter.cs
Normal file
60
osu.Game/Database/LegacyModelImporter.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.IO;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A class which handles importing legacy user data of a single type from osu-stable.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class LegacyModelImporter<TModel>
|
||||||
|
where TModel : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from osu-stable's data directory to import items from.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string ImportFromStablePath => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Select paths to import from stable where all paths should be absolute. Default implementation iterates all directories in <see cref="ImportFromStablePath"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual IEnumerable<string> GetStableImportPaths(Storage storage) => storage.GetDirectories(ImportFromStablePath)
|
||||||
|
.Select(path => storage.GetFullPath(path));
|
||||||
|
|
||||||
|
protected readonly IModelImporter<TModel> Importer;
|
||||||
|
|
||||||
|
protected LegacyModelImporter(IModelImporter<TModel> importer)
|
||||||
|
{
|
||||||
|
Importer = importer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task ImportFromStableAsync(StableStorage stableStorage)
|
||||||
|
{
|
||||||
|
var storage = PrepareStableStorage(stableStorage);
|
||||||
|
|
||||||
|
// Handle situations like when the user does not have a Skins folder.
|
||||||
|
if (!storage.ExistsDirectory(ImportFromStablePath))
|
||||||
|
{
|
||||||
|
string fullPath = storage.GetFullPath(ImportFromStablePath);
|
||||||
|
|
||||||
|
Logger.Log(@$"Folder ""{fullPath}"" not available in the target osu!stable installation to import {Importer.HumanisedModelName}s.", LoggingTarget.Information, LogLevel.Error);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.Run(async () => await Importer.Import(GetStableImportPaths(storage).ToArray()).ConfigureAwait(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run any required traversal operations on the stable storage location before performing operations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stableStorage">The stable storage.</param>
|
||||||
|
/// <returns>The usable storage. Return the unchanged <paramref name="stableStorage"/> if no traversal is required.</returns>
|
||||||
|
protected virtual Storage PrepareStableStorage(StableStorage stableStorage) => stableStorage;
|
||||||
|
}
|
||||||
|
}
|
26
osu.Game/Database/LegacyScoreImporter.cs
Normal file
26
osu.Game/Database/LegacyScoreImporter.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
public class LegacyScoreImporter : LegacyModelImporter<ScoreInfo>
|
||||||
|
{
|
||||||
|
protected override string ImportFromStablePath => Path.Combine("Data", "r");
|
||||||
|
|
||||||
|
protected override IEnumerable<string> GetStableImportPaths(Storage storage)
|
||||||
|
=> storage.GetFiles(ImportFromStablePath).Where(p => Importer.HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false))
|
||||||
|
.Select(path => storage.GetFullPath(path));
|
||||||
|
|
||||||
|
public LegacyScoreImporter(IModelImporter<ScoreInfo> importer)
|
||||||
|
: base(importer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
osu.Game/Database/LegacySkinImporter.cs
Normal file
17
osu.Game/Database/LegacySkinImporter.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
public class LegacySkinImporter : LegacyModelImporter<SkinInfo>
|
||||||
|
{
|
||||||
|
protected override string ImportFromStablePath => "Skins";
|
||||||
|
|
||||||
|
public LegacySkinImporter(IModelImporter<SkinInfo> importer)
|
||||||
|
: base(importer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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 LegacyImportManager legacyImportManager = new LegacyImportManager();
|
||||||
|
|
||||||
[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(legacyImportManager, Add);
|
||||||
|
|
||||||
loadComponentSingleFile(screenshotManager, Add);
|
loadComponentSingleFile(screenshotManager, Add);
|
||||||
|
|
||||||
|
@ -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] LegacyImportManager legacyImportManager, DialogOverlay dialogOverlay)
|
||||||
{
|
{
|
||||||
if (stableImportManager?.SupportsImportFromStable == true)
|
if (legacyImportManager?.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));
|
legacyImportManager.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 (legacyImportManager?.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));
|
legacyImportManager.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 (legacyImportManager?.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));
|
legacyImportManager.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 (legacyImportManager?.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));
|
legacyImportManager.ImportFromStableAsync(StableContent.Collections).ContinueWith(t => Schedule(() => importCollectionsButton.Enabled.Value = true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ using osu.Framework.Threading;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO;
|
|
||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
@ -263,11 +262,6 @@ namespace osu.Game.Scoring
|
|||||||
remove => scoreModelManager.ItemRemoved -= value;
|
remove => scoreModelManager.ItemRemoved -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ImportFromStableAsync(StableStorage stableStorage)
|
|
||||||
{
|
|
||||||
return scoreModelManager.ImportFromStableAsync(stableStorage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Export(ScoreInfo item)
|
public void Export(ScoreInfo item)
|
||||||
{
|
{
|
||||||
scoreModelManager.Export(item);
|
scoreModelManager.Export(item);
|
||||||
|
@ -26,8 +26,6 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
protected override string[] HashableFileTypes => new[] { ".osr" };
|
protected override string[] HashableFileTypes => new[] { ".osr" };
|
||||||
|
|
||||||
protected override string ImportFromStablePath => Path.Combine("Data", "r");
|
|
||||||
|
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
private readonly Func<BeatmapManager> beatmaps;
|
private readonly Func<BeatmapManager> beatmaps;
|
||||||
|
|
||||||
@ -81,9 +79,5 @@ namespace osu.Game.Scoring
|
|||||||
using (var inputStream = Files.Storage.GetStream(file.FileInfo.GetStoragePath()))
|
using (var inputStream = Files.Storage.GetStream(file.FileInfo.GetStoragePath()))
|
||||||
inputStream.CopyTo(outputStream);
|
inputStream.CopyTo(outputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<string> GetStableImportPaths(Storage storage)
|
|
||||||
=> storage.GetFiles(ImportFromStablePath).Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.OrdinalIgnoreCase) ?? false))
|
|
||||||
.Select(path => storage.GetFullPath(path));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 => legacyImportManager?.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 LegacyImportManager legacyImportManager { 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(() => legacyImportManager.ImportFromStableAsync(StableContent.All));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -301,11 +301,6 @@ namespace osu.Game.Skinning
|
|||||||
remove => skinModelManager.ItemRemoved -= value;
|
remove => skinModelManager.ItemRemoved -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ImportFromStableAsync(StableStorage stableStorage)
|
|
||||||
{
|
|
||||||
return skinModelManager.ImportFromStableAsync(stableStorage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Export(SkinInfo item)
|
public void Export(SkinInfo item)
|
||||||
{
|
{
|
||||||
skinModelManager.Export(item);
|
skinModelManager.Export(item);
|
||||||
|
@ -34,8 +34,6 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected override string[] HashableFileTypes => new[] { ".ini", ".json" };
|
protected override string[] HashableFileTypes => new[] { ".ini", ".json" };
|
||||||
|
|
||||||
protected override string ImportFromStablePath => "Skins";
|
|
||||||
|
|
||||||
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == @".osk";
|
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == @".osk";
|
||||||
|
|
||||||
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name ?? @"No name" };
|
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name ?? @"No name" };
|
||||||
|
Loading…
Reference in New Issue
Block a user