Removed automatically getting list of dlc when finding id or opening file

Fixed db locking issue while getting dlc
This commit is contained in:
Jeddunk 2021-03-11 14:39:25 +01:00
parent fdc2e0277f
commit 89f43166c7
3 changed files with 5 additions and 5 deletions

View File

@ -79,7 +79,7 @@ namespace GoldbergGUI.Core.Models
public class AppType public class AppType
{ {
private AppType(string value) => Value = value; public AppType(string value) => Value = value;
public string Value { get; } public string Value { get; }

View File

@ -179,18 +179,18 @@ namespace GoldbergGUI.Core.Services
var steamAppDetails = await task.ConfigureAwait(true); var steamAppDetails = await task.ConfigureAwait(true);
if (steamAppDetails.Type == AppType.Game.Value) if (steamAppDetails.Type == AppType.Game.Value)
{ {
var db = new LiteDatabase("steamapps.db");
steamAppDetails.DLC.ForEach(x => steamAppDetails.DLC.ForEach(x =>
{ {
/*var result = _caches[AppType.DLC].Cache.FirstOrDefault(y => y.AppId.Equals(x)) /*var result = _caches[AppType.DLC].Cache.FirstOrDefault(y => y.AppId.Equals(x))
?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};*/ ?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};*/
using var db = new LiteDatabase("steamapps.db");
var steamAppCollection = db.GetCollection<SteamApp>("steamapps"); var steamAppCollection = db.GetCollection<SteamApp>("steamapps");
steamAppCollection.EnsureIndex(y => y.AppId); steamAppCollection.EnsureIndex(y => y.AppId);
var result = steamAppCollection.FindOne(y => y.AppId.Equals(x)) var result = steamAppCollection.FindOne(y => y.AppId.Equals(x))
?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"}; ?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};
dlcList.Add(result); dlcList.Add(result);
}); });
db.Dispose();
dlcList.ForEach(x => _log.Debug($"{x.AppId}={x.Name}")); dlcList.ForEach(x => _log.Debug($"{x.AppId}={x.Name}"));
_log.Info("Got DLC successfully..."); _log.Info("Got DLC successfully...");

View File

@ -292,7 +292,7 @@ namespace GoldbergGUI.Core.ViewModels
DllPath = dialog.FileName; DllPath = dialog.FileName;
await ReadConfig().ConfigureAwait(false); await ReadConfig().ConfigureAwait(false);
if (!GoldbergApplied) await GetListOfDlc().ConfigureAwait(false); // if (!GoldbergApplied) await GetListOfDlc().ConfigureAwait(false);
MainWindowEnabled = true; MainWindowEnabled = true;
StatusText = "Ready."; StatusText = "Ready.";
} }
@ -349,7 +349,7 @@ namespace GoldbergGUI.Core.ViewModels
await FindIdInList(steamApps).ConfigureAwait(false); await FindIdInList(steamApps).ConfigureAwait(false);
} }
} }
await GetListOfDlc().ConfigureAwait(false); //await GetListOfDlc().ConfigureAwait(false);
MainWindowEnabled = true; MainWindowEnabled = true;
StatusText = "Ready."; StatusText = "Ready.";
} }