1
0
mirror of synced 2024-11-30 17:04:28 +01:00
GC-local-server-rewrite/SharedProject/models/SongPlayData.cs
jiych1 4cd290aedc Add last play time support
Support setting avatar, navigator and titles on web interface (unoptimized)
2022-07-06 00:52:38 +08:00

40 lines
1019 B
C#

using System.Text.Json.Serialization;
using SharedProject.common;
using SharedProject.enums;
namespace SharedProject.models;
public class SongPlayData
{
public string Title { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
public int MusicId { get; set; }
public SongPlayDetailData[] SongPlaySubDataList { get; set; } = new SongPlayDetailData[SharedConstants.DIFFICULTY_COUNT];
public bool IsFavorite { get; set; }
public bool ShowDetails { get; set; }
[JsonIgnore]
public int TotalPlayCount
{
get
{
return SongPlaySubDataList.Sum(data => data.PlayCount);
}
}
[JsonIgnore]
public DateTime LastPlayTime
{
get
{
var songPlayDetailData = SongPlaySubDataList.Where(data => data.ClearState != ClearState.NotPlayed)
.MinBy(data => data.LastPlayTime);
return songPlayDetailData?.LastPlayTime ?? DateTime.MaxValue;
}
}
}