2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-09-20 15:30:03 +08:00
|
|
|
|
|
2017-10-19 13:05:11 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-10-05 03:52:12 +08:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2017-05-02 16:54:07 +08:00
|
|
|
|
using System.Linq;
|
2017-05-28 11:37:55 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2017-10-13 19:25:27 +08:00
|
|
|
|
using osu.Game.Users;
|
2016-10-05 04:29:08 +08:00
|
|
|
|
|
2017-07-26 12:22:46 +08:00
|
|
|
|
namespace osu.Game.Beatmaps
|
2016-08-31 12:52:30 +08:00
|
|
|
|
{
|
2016-10-08 01:50:34 +08:00
|
|
|
|
public class BeatmapMetadata
|
2016-08-31 12:52:30 +08:00
|
|
|
|
{
|
2017-10-06 05:23:26 +08:00
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
2017-10-14 13:28:25 +08:00
|
|
|
|
public int ID { get; set; }
|
2016-12-21 14:47:56 +08:00
|
|
|
|
|
2017-10-25 13:34:39 +08:00
|
|
|
|
private int? onlineBeatmapSetID;
|
|
|
|
|
|
2017-10-09 05:30:52 +08:00
|
|
|
|
[NotMapped]
|
2017-10-25 18:26:46 +08:00
|
|
|
|
[JsonProperty(@"id")]
|
2017-10-25 13:34:39 +08:00
|
|
|
|
public int? OnlineBeatmapSetID
|
|
|
|
|
{
|
|
|
|
|
get { return onlineBeatmapSetID; }
|
|
|
|
|
set { onlineBeatmapSetID = value > 0 ? value : null; }
|
|
|
|
|
}
|
2016-12-21 14:47:56 +08:00
|
|
|
|
|
2016-10-05 04:29:08 +08:00
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
public string TitleUnicode { get; set; }
|
|
|
|
|
public string Artist { get; set; }
|
|
|
|
|
public string ArtistUnicode { get; set; }
|
2017-05-28 11:37:55 +08:00
|
|
|
|
|
2017-10-19 13:05:11 +08:00
|
|
|
|
public List<BeatmapInfo> Beatmaps { get; set; }
|
|
|
|
|
public List<BeatmapSetInfo> BeatmapSets { get; set; }
|
|
|
|
|
|
2017-10-13 19:25:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Helper property to deserialize a username to <see cref="User"/>.
|
|
|
|
|
/// </summary>
|
2017-05-28 11:37:55 +08:00
|
|
|
|
[JsonProperty(@"creator")]
|
2017-10-13 19:25:27 +08:00
|
|
|
|
[Column("Author")]
|
|
|
|
|
public string AuthorString
|
|
|
|
|
{
|
2017-10-14 11:27:32 +08:00
|
|
|
|
get { return Author?.Username; }
|
2017-10-13 19:25:27 +08:00
|
|
|
|
set { Author = new User { Username = value }; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The author of the beatmaps in this set.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public User Author;
|
2017-05-28 11:37:55 +08:00
|
|
|
|
|
2016-10-05 04:29:08 +08:00
|
|
|
|
public string Source { get; set; }
|
2017-06-07 22:30:52 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"tags")]
|
2016-10-05 04:29:08 +08:00
|
|
|
|
public string Tags { get; set; }
|
|
|
|
|
public int PreviewTime { get; set; }
|
|
|
|
|
public string AudioFile { get; set; }
|
|
|
|
|
public string BackgroundFile { get; set; }
|
2017-05-02 09:45:55 +08:00
|
|
|
|
|
|
|
|
|
public string[] SearchableTerms => new[]
|
|
|
|
|
{
|
2017-10-13 19:25:27 +08:00
|
|
|
|
Author?.Username,
|
2017-05-02 09:45:55 +08:00
|
|
|
|
Artist,
|
|
|
|
|
ArtistUnicode,
|
|
|
|
|
Title,
|
|
|
|
|
TitleUnicode,
|
|
|
|
|
Source,
|
|
|
|
|
Tags
|
2017-05-02 16:54:07 +08:00
|
|
|
|
}.Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
2016-08-31 12:52:30 +08:00
|
|
|
|
}
|
2017-05-28 11:37:55 +08:00
|
|
|
|
}
|