diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index 35468ce831..1806c2b491 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Extensions; @@ -34,8 +33,7 @@ public int? OnlineID public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; - [NotNull] - public List Files { get; set; } = new List(); + public List Files { get; } = new List(); /// /// The maximum star difficulty of all beatmaps in this set. diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index a0e8105285..adbb71c8da 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -392,7 +392,8 @@ void rollback() { LogForModel(item, @"Beginning import..."); - item.Files = archive != null ? createFileInfos(archive, Files) : new List(); + if (archive != null) + item.Files.AddRange(createFileInfos(archive, Files)); item.Hash = ComputeHash(item); await Populate(item, archive, cancellationToken).ConfigureAwait(false); diff --git a/osu.Game/Database/IHasFiles.cs b/osu.Game/Database/IHasFiles.cs index f6aa941ec2..3f6531832f 100644 --- a/osu.Game/Database/IHasFiles.cs +++ b/osu.Game/Database/IHasFiles.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using JetBrains.Annotations; namespace osu.Game.Database { @@ -12,7 +13,8 @@ namespace osu.Game.Database public interface IHasFiles where TFile : INamedFileInfo { - List Files { get; set; } + [NotNull] + List Files { get; } string Hash { get; set; } } diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 26749a23f9..f0c57cb953 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -394,7 +394,7 @@ public MenuItem[] ContextMenuItems if (Score.Mods.Length > 0 && modsContainer.Any(s => s.IsHovered) && songSelect != null) items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = Score.Mods)); - if (Score.Files?.Count > 0) + if (Score.Files.Count > 0) items.Add(new OsuMenuItem("Export", MenuItemType.Standard, () => scoreManager.Export(Score))); if (Score.ID != 0) diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 736a939a59..b4e194cbed 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -160,7 +160,7 @@ public string StatisticsJson [NotMapped] public List HitEvents { get; set; } - public List Files { get; set; } + public List Files { get; } = new List(); public string Hash { get; set; } diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index fae1a599d1..10526b69af 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -59,7 +59,7 @@ protected Skin(SkinInfo skin, IStorageResourceProvider resources, [CanBeNull] St string filename = $"{skinnableTarget}.json"; // skininfo files may be null for default skin. - var fileInfo = SkinInfo.Files?.FirstOrDefault(f => f.Filename == filename); + var fileInfo = SkinInfo.Files.FirstOrDefault(f => f.Filename == filename); if (fileInfo == null) continue; diff --git a/osu.Game/Skinning/SkinInfo.cs b/osu.Game/Skinning/SkinInfo.cs index 3b34e23d57..4733e8cdd9 100644 --- a/osu.Game/Skinning/SkinInfo.cs +++ b/osu.Game/Skinning/SkinInfo.cs @@ -36,7 +36,7 @@ public virtual Skin CreateInstance(IStorageResourceProvider resources) return (Skin)Activator.CreateInstance(type, this, resources); } - public List Files { get; set; } = new List(); + public List Files { get; } = new List(); public bool DeletePending { get; set; }