mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-10 13:11:06 +00:00
source code checkin
This commit is contained in:
parent
5f8fb2c825
commit
7e57b72e35
675 changed files with 168433 additions and 0 deletions
55
src/ServerManager.Common/Model/WorkshopFileList.cs
Normal file
55
src/ServerManager.Common/Model/WorkshopFileList.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace ServerManagerTool.Common.Model
|
||||
{
|
||||
public class WorkshopFileList : ObservableCollection<WorkshopFileItem>
|
||||
{
|
||||
public DateTime CachedTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string CachedTimeFormatted
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CachedTime == DateTime.MinValue)
|
||||
return "";
|
||||
return CachedTime.ToString("G");
|
||||
}
|
||||
}
|
||||
|
||||
public new void Add(WorkshopFileItem item)
|
||||
{
|
||||
if (item == null || this.Any(m => m.WorkshopId.Equals(item.WorkshopId)))
|
||||
return;
|
||||
|
||||
base.Add(item);
|
||||
}
|
||||
|
||||
public static WorkshopFileList GetList(WorkshopFileDetailResponse response)
|
||||
{
|
||||
var result = new WorkshopFileList();
|
||||
if (response != null)
|
||||
{
|
||||
result.CachedTime = response.cached.ToLocalTime();
|
||||
if (response.publishedfiledetails != null)
|
||||
{
|
||||
foreach (var detail in response.publishedfiledetails)
|
||||
{
|
||||
result.Add(WorkshopFileItem.GetItem(detail));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(WorkshopFileList)} - {Count}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue