2020-12-19 19:14:40 -05:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text.Json.Serialization;
|
2021-01-01 10:27:42 -05:00
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using auto_creamapi.Utils;
|
2020-12-19 19:14:40 -05:00
|
|
|
|
2020-12-25 10:49:51 -05:00
|
|
|
namespace auto_creamapi.Models
|
2020-12-19 19:14:40 -05:00
|
|
|
{
|
2020-12-23 06:34:31 -05:00
|
|
|
public class SteamApp
|
2020-12-19 19:14:40 -05:00
|
|
|
{
|
2021-01-01 10:27:42 -05:00
|
|
|
private string _name;
|
|
|
|
private string _comparableName;
|
2020-12-28 09:27:37 -05:00
|
|
|
[JsonPropertyName("appid")] public int AppId { get; set; }
|
|
|
|
|
2021-01-01 10:27:42 -05:00
|
|
|
[JsonPropertyName("name")]
|
|
|
|
public string Name
|
|
|
|
{
|
|
|
|
get => _name;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
_name = value;
|
|
|
|
_comparableName = Regex.Replace(value, Misc.SpecialCharsRegex, "").ToLower();
|
|
|
|
}
|
|
|
|
}
|
2020-12-19 19:14:40 -05:00
|
|
|
|
2021-01-01 10:27:42 -05:00
|
|
|
public bool CompareName(string value)
|
2020-12-19 19:14:40 -05:00
|
|
|
{
|
2021-01-01 10:27:42 -05:00
|
|
|
return _comparableName.Equals(value);
|
2020-12-19 19:14:40 -05:00
|
|
|
}
|
|
|
|
|
2021-01-01 10:27:42 -05:00
|
|
|
public override string ToString()
|
2020-12-19 19:14:40 -05:00
|
|
|
{
|
2021-01-01 10:27:42 -05:00
|
|
|
return $"{AppId}={Name}";
|
2020-12-19 19:14:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-23 06:34:31 -05:00
|
|
|
public class AppList
|
2020-12-19 19:14:40 -05:00
|
|
|
{
|
2020-12-28 09:27:37 -05:00
|
|
|
[JsonPropertyName("apps")] public List<SteamApp> Apps { get; set; }
|
2020-12-19 19:14:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public class SteamApps
|
|
|
|
{
|
2020-12-28 09:27:37 -05:00
|
|
|
[JsonPropertyName("applist")] public AppList AppList { get; set; }
|
2020-12-19 19:14:40 -05:00
|
|
|
}
|
|
|
|
}
|