minor changes

This commit is contained in:
Jeddunk 2021-03-21 16:15:17 +01:00
parent 13eb05fff9
commit 3bee1a5508
2 changed files with 8 additions and 6 deletions

View File

@ -23,8 +23,6 @@ namespace GoldbergGUI.Core.Services
public Task<GoldbergGlobalConfiguration> GetGlobalSettings();
public Task SetGlobalSettings(GoldbergGlobalConfiguration configuration);
public bool GoldbergApplied(string path);
// public Task<bool> Download();
// public Task Extract(string archivePath);
public Task GenerateInterfacesFile(string filePath);
public List<string> Languages();
}

View File

@ -82,7 +82,7 @@ namespace GoldbergGUI.Core.Services
private const string AppTypeGame = "game";
private const string AppTypeDlc = "dlc";
private const string Database = "steamapps.db";
private const string Database = "steamapps.cache";
private IMvxLog _log;
@ -90,7 +90,6 @@ namespace GoldbergGUI.Core.Services
public async Task Initialize(IMvxLog log)
{
//var (path, uri, jsonType, appType) = _caches[0];
static SteamApps DeserializeSteamApps(Type type, string cacheString)
{
return type == typeof(SteamAppsV2)
@ -128,7 +127,7 @@ namespace GoldbergGUI.Core.Services
foreach (var steamApp in cacheRaw)
{
steamApp.type = steamCache.SteamAppType;
steamApp.ComparableName = Regex.Replace(steamApp.Name, Misc.AlphaNumOnlyRegex, "").ToLower();
steamApp.ComparableName = PrepareStringToCompare(steamApp.Name);
cache.Add(steamApp);
}
@ -149,7 +148,7 @@ namespace GoldbergGUI.Core.Services
public SteamApp GetAppByName(string name)
{
_log.Info($"Trying to get app {name}");
var comparableName = Regex.Replace(name, Misc.AlphaNumOnlyRegex, "").ToLower();
var comparableName = PrepareStringToCompare(name);
var app = _db.Table<SteamApp>()
.FirstOrDefault(x => x.type == AppTypeGame && x.ComparableName.Equals(comparableName));
if (app != null) _log.Info($"Successfully got app {app}");
@ -256,5 +255,10 @@ namespace GoldbergGUI.Core.Services
return dlcList;
}
private static string PrepareStringToCompare(string name)
{
return Regex.Replace(name, Misc.AlphaNumOnlyRegex, "").ToLower();
}
}
}