diff --git a/GoldbergGUI.Core/Models/SteamAppModel.cs b/GoldbergGUI.Core/Models/SteamAppModel.cs index b5f245f..eb1583f 100644 --- a/GoldbergGUI.Core/Models/SteamAppModel.cs +++ b/GoldbergGUI.Core/Models/SteamAppModel.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Text.RegularExpressions; -using GoldbergGUI.Core.Utils; using SQLite; // ReSharper disable UnusedMember.Global @@ -15,8 +13,6 @@ namespace GoldbergGUI.Core.Models [Table("steamapp")] public class SteamApp { - private string _name; - [JsonPropertyName("appid")] [Column("appid")] [PrimaryKey] @@ -27,18 +23,10 @@ namespace GoldbergGUI.Core.Models /// [JsonPropertyName("name")] [Column("name")] - public string Name - { - get => _name; - set - { - _name = value; - ComparableName = Regex.Replace(value, Misc.AlphaNumOnlyRegex, "").ToLower(); - } - } + public string Name { get; set; } [Column("comparable_name")] - public string ComparableName { get; private set; } + public string ComparableName { get; set; } /// /// App type (Game, DLC, ...) @@ -84,30 +72,4 @@ namespace GoldbergGUI.Core.Models { [JsonPropertyName("response")] public override AppList AppList { get; set; } } - - /*[Table("apptype")] - public class AppType - { - private AppType(string value) - { - var db = new SQLiteConnection("steamapps.db"); - db.CreateTable(); - Value = value; - } - - [PrimaryKey, AutoIncrement] - [Column("id")] - public int Id { get; } - - [Column("value")] - public string Value { get; } - - [Ignore] public static AppType Game { get; } = new AppType("game"); - [Ignore] public static AppType DLC { get; } = new AppType("dlc"); - [Ignore] public static AppType Music { get; } = new AppType("music"); - [Ignore] public static AppType Demo { get; } = new AppType("demo"); - [Ignore] public static AppType Ad { get; } = new AppType("advertising"); - [Ignore] public static AppType Mod { get; } = new AppType("mod"); - [Ignore] public static AppType Video { get; } = new AppType("video"); - }*/ } \ No newline at end of file diff --git a/GoldbergGUI.Core/Services/SteamService.cs b/GoldbergGUI.Core/Services/SteamService.cs index eab75cf..7b8e338 100644 --- a/GoldbergGUI.Core/Services/SteamService.cs +++ b/GoldbergGUI.Core/Services/SteamService.cs @@ -128,6 +128,7 @@ namespace GoldbergGUI.Core.Services foreach (var steamApp in cacheRaw) { steamApp.type = steamCache.SteamAppType; + steamApp.ComparableName = Regex.Replace(steamApp.Name, Misc.AlphaNumOnlyRegex, "").ToLower(); cache.Add(steamApp); } @@ -149,8 +150,8 @@ namespace GoldbergGUI.Core.Services { _log.Info($"Trying to get app {name}"); var comparableName = Regex.Replace(name, Misc.AlphaNumOnlyRegex, "").ToLower(); - var app = _db.Table().Where(x => x.type == AppTypeGame) - .FirstOrDefault(x => x.ComparableName.Equals(comparableName)); + var app = _db.Table() + .FirstOrDefault(x => x.type == AppTypeGame && x.ComparableName.Equals(comparableName)); if (app != null) _log.Info($"Successfully got app {app}"); return app; }