1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix code inspections and remove now unused code.

This commit is contained in:
Lucas A 2021-05-10 12:21:51 +02:00
parent a7b740fd1d
commit dabe8bd4c7
5 changed files with 5 additions and 33 deletions

View File

@ -8,7 +8,6 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -95,17 +94,11 @@ namespace osu.Game.Collections
/// </summary>
public Action<Notification> PostNotification { protected get; set; }
/// <summary>
/// Set a storage with access to an osu-stable install for import purposes.
/// </summary>
public Func<Storage> GetStableStorage { private get; set; }
/// <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>
public Task ImportFromStableAsync(StableStorage stableStorage)
{
if (stableStorage == null)
{
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);

View File

@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Humanizer;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using osu.Framework;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
@ -667,16 +666,6 @@ namespace osu.Game.Database
#region osu-stable import
/// <summary>
/// Set a storage with access to an osu-stable install for import purposes.
/// </summary>
public Func<StableStorage> GetStableStorage { private get; set; }
/// <summary>
/// Denotes whether an osu-stable installation is present to perform automated imports from.
/// </summary>
public bool StableInstallationAvailable => GetStableStorage?.Invoke() != null;
/// <summary>
/// The relative path from osu-stable's data directory to import items from.
/// </summary>
@ -700,7 +689,6 @@ namespace osu.Game.Database
/// </summary>
public Task ImportFromStableAsync(StableStorage stableStorage)
{
if (stableStorage == null)
{
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);

View File

@ -60,18 +60,14 @@ namespace osu.Game.Database
if (content.HasFlagFast(StableContent.Collections))
{
if (beatmapImportTask != null)
importTasks.Add(beatmapImportTask.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
else
importTasks.Add(collections.ImportFromStableAsync(stableStorage));
importTasks.Add(beatmapImportTask?.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion)
?? collections.ImportFromStableAsync(stableStorage));
}
if (content.HasFlagFast(StableContent.Scores))
{
if (beatmapImportTask != null)
importTasks.Add(beatmapImportTask.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
else
importTasks.Add(scores.ImportFromStableAsync(stableStorage));
importTasks.Add(beatmapImportTask?.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion)
?? scores.ImportFromStableAsync(stableStorage));
}
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
@ -92,7 +88,6 @@ namespace osu.Game.Database
return cachedStorage = new StableStorage(stablePath, desktopGameHost);
}
}
[Flags]

View File

@ -569,14 +569,11 @@ namespace osu.Game
// todo: all archive managers should be able to be looped here.
SkinManager.PostNotification = n => notifications.Post(n);
SkinManager.GetStableStorage = GetStorageForStableInstall;
BeatmapManager.PostNotification = n => notifications.Post(n);
BeatmapManager.GetStableStorage = GetStorageForStableInstall;
BeatmapManager.PresentImport = items => PresentBeatmap(items.First());
ScoreManager.PostNotification = n => notifications.Post(n);
ScoreManager.GetStableStorage = GetStorageForStableInstall;
ScoreManager.PresentImport = items => PresentScore(items.First());
// make config aware of how to lookup skins for on-screen display purposes.
@ -693,7 +690,6 @@ namespace osu.Game
loadComponentSingleFile(new CollectionManager(Storage)
{
PostNotification = n => notifications.Post(n),
GetStableStorage = GetStorageForStableInstall
}, Add, true);
loadComponentSingleFile(difficultyRecommender, Add);

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
}
protected override void OnSelection(DirectoryInfo directory)
{
{
taskCompletionSource.TrySetResult(directory.FullName);
this.Exit();
}