2019-07-20 01:15:45 +08:00
|
|
|
using System;
|
2018-10-21 03:10:44 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
namespace StardewModdingAPI.Web.ViewModels
|
|
|
|
{
|
|
|
|
/// <summary>Metadata for the mod list page.</summary>
|
|
|
|
public class ModListModel
|
|
|
|
{
|
|
|
|
/*********
|
|
|
|
** Accessors
|
|
|
|
*********/
|
|
|
|
/// <summary>The current stable version of the game.</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public string? StableVersion { get; }
|
2018-10-21 03:10:44 +08:00
|
|
|
|
|
|
|
/// <summary>The current beta version of the game (if any).</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public string? BetaVersion { get; }
|
2018-10-21 03:10:44 +08:00
|
|
|
|
|
|
|
/// <summary>The mods to display.</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public ModModel[] Mods { get; }
|
2018-10-21 03:10:44 +08:00
|
|
|
|
2019-07-20 01:15:45 +08:00
|
|
|
/// <summary>When the data was last updated.</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public DateTimeOffset LastUpdated { get; }
|
2019-07-20 01:15:45 +08:00
|
|
|
|
|
|
|
/// <summary>Whether the data hasn't been updated in a while.</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public bool IsStale { get; }
|
2019-07-20 01:15:45 +08:00
|
|
|
|
|
|
|
/// <summary>Whether the mod metadata is available.</summary>
|
2022-04-13 07:15:39 +08:00
|
|
|
public bool HasData => this.Mods.Any();
|
2019-07-20 01:15:45 +08:00
|
|
|
|
2018-10-21 03:10:44 +08:00
|
|
|
|
|
|
|
/*********
|
|
|
|
** Public methods
|
|
|
|
*********/
|
|
|
|
/// <summary>Construct an instance.</summary>
|
|
|
|
/// <param name="stableVersion">The current stable version of the game.</param>
|
|
|
|
/// <param name="betaVersion">The current beta version of the game (if any).</param>
|
|
|
|
/// <param name="mods">The mods to display.</param>
|
2019-07-20 01:15:45 +08:00
|
|
|
/// <param name="lastUpdated">When the data was last updated.</param>
|
|
|
|
/// <param name="isStale">Whether the data hasn't been updated in a while.</param>
|
2022-04-13 07:15:39 +08:00
|
|
|
public ModListModel(string? stableVersion, string? betaVersion, IEnumerable<ModModel> mods, DateTimeOffset lastUpdated, bool isStale)
|
2018-10-21 03:10:44 +08:00
|
|
|
{
|
|
|
|
this.StableVersion = stableVersion;
|
|
|
|
this.BetaVersion = betaVersion;
|
|
|
|
this.Mods = mods.ToArray();
|
2019-07-20 01:15:45 +08:00
|
|
|
this.LastUpdated = lastUpdated;
|
|
|
|
this.IsStale = isStale;
|
2018-10-21 03:10:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|