mirror of https://github.com/ppy/osu
Initialise all file lists at construction time (and remove setter)
This commit is contained in:
parent
049f25a133
commit
99a139dc98
|
@ -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<BeatmapSetFileInfo> Files { get; set; } = new List<BeatmapSetFileInfo>();
|
||||
public List<BeatmapSetFileInfo> Files { get; } = new List<BeatmapSetFileInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// The maximum star difficulty of all beatmaps in this set.
|
||||
|
|
|
@ -392,7 +392,8 @@ void rollback()
|
|||
{
|
||||
LogForModel(item, @"Beginning import...");
|
||||
|
||||
item.Files = archive != null ? createFileInfos(archive, Files) : new List<TFileModel>();
|
||||
if (archive != null)
|
||||
item.Files.AddRange(createFileInfos(archive, Files));
|
||||
item.Hash = ComputeHash(item);
|
||||
|
||||
await Populate(item, archive, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -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<TFile>
|
||||
where TFile : INamedFileInfo
|
||||
{
|
||||
List<TFile> Files { get; set; }
|
||||
[NotNull]
|
||||
List<TFile> Files { get; }
|
||||
|
||||
string Hash { get; set; }
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -160,7 +160,7 @@ public string StatisticsJson
|
|||
[NotMapped]
|
||||
public List<HitEvent> HitEvents { get; set; }
|
||||
|
||||
public List<ScoreFileInfo> Files { get; set; }
|
||||
public List<ScoreFileInfo> Files { get; } = new List<ScoreFileInfo>();
|
||||
|
||||
public string Hash { get; set; }
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -36,7 +36,7 @@ public virtual Skin CreateInstance(IStorageResourceProvider resources)
|
|||
return (Skin)Activator.CreateInstance(type, this, resources);
|
||||
}
|
||||
|
||||
public List<SkinFileInfo> Files { get; set; } = new List<SkinFileInfo>();
|
||||
public List<SkinFileInfo> Files { get; } = new List<SkinFileInfo>();
|
||||
|
||||
public bool DeletePending { get; set; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue