mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
0.7.7.1
This commit is contained in:
52
VoiceHubLanDesktop/SongModels.cs
Normal file
52
VoiceHubLanDesktop/SongModels.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace VoiceHubLanDesktop;
|
||||
|
||||
/// <summary>
|
||||
/// 歌曲信息
|
||||
/// </summary>
|
||||
public sealed class Song
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("artist")]
|
||||
public string Artist { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("requester")]
|
||||
public string Requester { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("voteCount")]
|
||||
public int VoteCount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排期歌曲项目
|
||||
/// </summary>
|
||||
public sealed class SongItem
|
||||
{
|
||||
[JsonPropertyName("playDate")]
|
||||
public string PlayDate { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("sequence")]
|
||||
public int Sequence { get; set; }
|
||||
|
||||
[JsonPropertyName("song")]
|
||||
public Song Song { get; set; } = new();
|
||||
|
||||
public DateTime GetPlayDate()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(PlayDate))
|
||||
{
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
if (DateTime.TryParseExact(PlayDate, "yyyy-MM-dd", null,
|
||||
System.Globalization.DateTimeStyles.None, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user