1
0
mirror of synced 2024-11-30 17:04:28 +01:00
GC-local-server-rewrite/SharedProject/models/SongPlayData.cs

40 lines
1019 B
C#
Raw Normal View History

2022-06-20 19:49:47 +02:00
using System.Text.Json.Serialization;
using SharedProject.common;
using SharedProject.enums;
2022-06-20 19:49:47 +02:00
namespace SharedProject.models;
2022-04-24 20:07:11 +02:00
public class SongPlayData
{
public string Title { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
2022-06-20 19:49:47 +02:00
public int MusicId { get; set; }
2022-04-24 20:07:11 +02:00
public SongPlayDetailData[] SongPlaySubDataList { get; set; } = new SongPlayDetailData[SharedConstants.DIFFICULTY_COUNT];
2022-06-18 16:11:14 +02:00
public bool IsFavorite { get; set; }
2022-04-24 20:07:11 +02:00
public bool ShowDetails { get; set; }
2022-06-20 19:49:47 +02:00
[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;
}
}
2022-04-24 20:07:11 +02:00
}