Merge branch 'ppy:master' into fix-exported-replay-overwrite

This commit is contained in:
Dawid Sośnia
2022-11-30 10:54:12 +01:00
committed by GitHub
2534 changed files with 10843 additions and 5866 deletions

View File

@ -13,7 +13,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Database
{
public class BeatmapLookupCache : OnlineLookupCache<int, APIBeatmap, GetBeatmapsRequest>
public partial class BeatmapLookupCache : OnlineLookupCache<int, APIBeatmap, GetBeatmapsRequest>
{
/// <summary>
/// Perform an API lookup on the specified beatmap, populating a <see cref="APIBeatmap"/> model.

View File

@ -5,7 +5,7 @@ using osu.Game.Overlays.Notifications;
namespace osu.Game.Database
{
public class ImportProgressNotification : ProgressNotification
public partial class ImportProgressNotification : ProgressNotification
{
public ImportProgressNotification()
{

View File

@ -1,11 +1,11 @@
// 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.IO.Stores;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.IO;
@ -22,22 +22,42 @@ namespace osu.Game.Database
{
// make sure the directory exists
if (!storage.ExistsDirectory(string.Empty))
yield break;
return Array.Empty<string>();
foreach (string directory in storage.GetDirectories(string.Empty))
List<string> paths = new List<string>();
try
{
var directoryStorage = storage.GetStorageForDirectory(directory);
if (!directoryStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any())
foreach (string directory in storage.GetDirectories(string.Empty))
{
// if a directory doesn't contain files, attempt looking for beatmaps inside of that directory.
// this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615.
foreach (string subDirectory in GetStableImportPaths(directoryStorage))
yield return subDirectory;
var directoryStorage = storage.GetStorageForDirectory(directory);
try
{
if (!directoryStorage.GetFiles(string.Empty).ExcludeSystemFileNames().Any())
{
// if a directory doesn't contain files, attempt looking for beatmaps inside of that directory.
// this is a special behaviour in stable for beatmaps only, see https://github.com/ppy/osu/issues/18615.
foreach (string subDirectory in GetStableImportPaths(directoryStorage))
paths.Add(subDirectory);
}
else
paths.Add(storage.GetFullPath(directory));
}
catch (Exception e)
{
// Catch any errors when enumerating files
Logger.Log($"Error when enumerating files in {directoryStorage.GetFullPath(string.Empty)}: {e}");
}
}
else
yield return storage.GetFullPath(directory);
}
catch (Exception e)
{
// Catch any errors when enumerating directories
Logger.Log($"Error when enumerating directories in {storage.GetFullPath(string.Empty)}: {e}");
}
return paths;
}
public LegacyBeatmapImporter(IModelImporter<BeatmapSetInfo> importer)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Database
/// <summary>
/// Handles migration of legacy user data from osu-stable.
/// </summary>
public class LegacyImportManager : Component
public partial class LegacyImportManager : Component
{
[Resolved]
private SkinManager skins { get; set; } = null!;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Database
/// A component which performs lookups (or calculations) and caches the results.
/// Currently not persisted between game sessions.
/// </summary>
public abstract class MemoryCachingComponent<TLookup, TValue> : Component
public abstract partial class MemoryCachingComponent<TLookup, TValue> : Component
{
private readonly ConcurrentDictionary<TLookup, TValue> cache = new ConcurrentDictionary<TLookup, TValue>();

View File

@ -14,7 +14,7 @@ using osu.Game.Overlays.Notifications;
namespace osu.Game.Database
{
public abstract class ModelDownloader<TModel, T> : IModelDownloader<T>
public abstract partial class ModelDownloader<TModel, T> : IModelDownloader<T>
where TModel : class, IHasGuidPrimaryKey, ISoftDelete, IEquatable<TModel>, T
where T : class
{
@ -124,7 +124,7 @@ namespace osu.Game.Database
private bool canDownload(T model) => GetExistingDownload(model) == null && api != null;
private class DownloadNotification : ProgressNotification
private partial class DownloadNotification : ProgressNotification
{
public override bool IsImportant => false;
@ -134,7 +134,7 @@ namespace osu.Game.Database
Text = CompletionText
};
private class SilencedProgressCompletionNotification : ProgressCompletionNotification
private partial class SilencedProgressCompletionNotification : ProgressCompletionNotification
{
public override bool IsImportant => false;
}

View File

@ -15,7 +15,7 @@ using osu.Game.Online.API;
namespace osu.Game.Database
{
public abstract class OnlineLookupCache<TLookup, TValue, TRequest> : MemoryCachingComponent<TLookup, TValue>
public abstract partial class OnlineLookupCache<TLookup, TValue, TRequest> : MemoryCachingComponent<TLookup, TValue>
where TLookup : IEquatable<TLookup>
where TValue : class, IHasOnlineID<TLookup>
where TRequest : APIRequest

View File

@ -9,7 +9,7 @@ using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Database
{
public class TooManyDownloadsNotification : SimpleNotification
public partial class TooManyDownloadsNotification : SimpleNotification
{
public TooManyDownloadsNotification()
{

View File

@ -13,7 +13,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Database
{
public class UserLookupCache : OnlineLookupCache<int, APIUser, GetUsersRequest>
public partial class UserLookupCache : OnlineLookupCache<int, APIUser, GetUsersRequest>
{
/// <summary>
/// Perform an API lookup on the specified user, populating a <see cref="APIUser"/> model.