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