mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Replace BeatmapCollection
with RealmBeatmapCollection
This commit is contained in:
@ -1,32 +1,50 @@
|
||||
// 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 osu.Framework.Bindables;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using Realms;
|
||||
|
||||
namespace osu.Game.Collections
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection of beatmaps grouped by a name.
|
||||
/// </summary>
|
||||
public class BeatmapCollection
|
||||
public class BeatmapCollection : RealmObject, IHasGuidPrimaryKey
|
||||
{
|
||||
[PrimaryKey]
|
||||
public Guid ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The collection's name.
|
||||
/// </summary>
|
||||
public readonly Bindable<string> Name = new Bindable<string>();
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="BeatmapInfo.MD5Hash"/>es of beatmaps contained by the collection.
|
||||
/// </summary>
|
||||
public readonly BindableList<string> BeatmapHashes = new BindableList<string>();
|
||||
public IList<string> BeatmapMD5Hashes { get; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// The date when this collection was last modified.
|
||||
/// </summary>
|
||||
public DateTimeOffset LastModifyDate { get; private set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset LastModified { get; set; }
|
||||
|
||||
public BeatmapCollection(string? name = null, IList<string>? beatmapMD5Hashes = null)
|
||||
{
|
||||
ID = Guid.NewGuid();
|
||||
Name = name ?? string.Empty;
|
||||
BeatmapMD5Hashes = beatmapMD5Hashes ?? new List<string>();
|
||||
|
||||
LastModified = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
private BeatmapCollection()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user