Fixed crashes related to DLC.

Removed depot name value.
This commit is contained in:
Jeddunk 2021-04-28 13:51:06 +02:00
parent e17b0a18ca
commit fd518e4504
4 changed files with 16 additions and 10 deletions

View File

@ -67,8 +67,14 @@ namespace GoldbergGUI.Core.Models
public class DlcApp : SteamApp
{
/// <summary>
/// ID of depot (optional)
/// </summary>
public int? DepotId { get; set; }
public string DepotName { get; set; }
//public string DepotName { get; set; }
/// <summary>
/// Path to DLC (relative to Steam API DLL) (optional)
/// </summary>
public string AppPath { get; set; }
}

View File

@ -231,11 +231,11 @@ namespace GoldbergGUI.Core.Services
{
var match = expression.Match(line);
if (match.Success)
dlcList.Add(new SteamApp
dlcList.Add(new DlcApp()
{
AppId = Convert.ToInt32(match.Groups["id"].Value),
Name = match.Groups["name"].Value
} as DlcApp);
});
}
}
else

View File

@ -180,10 +180,10 @@ namespace GoldbergGUI.Core.Services
{
steamAppDetails.DLC.ForEach(async x =>
{
var result = await _db.Table<SteamApp>().Where(z => z.type == AppTypeDlc)
var result = await _db.Table<DlcApp>().Where(z => z.type == AppTypeDlc)
.FirstOrDefaultAsync(y => y.AppId.Equals(x)).ConfigureAwait(true)
?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};
dlcList.Add(result as DlcApp);
?? new DlcApp() {AppId = x, Name = $"Unknown DLC {x}"};
dlcList.Add(result);
_log.Debug($"{result.AppId}={result.Name}");
});
@ -229,15 +229,15 @@ namespace GoldbergGUI.Core.Services
var dlcName = query3 != null
? query3[1].Text().Replace("\n", "").Trim()
: $"Unknown DLC {dlcId}";
var dlcApp = new SteamApp {AppId = Convert.ToInt32(dlcId), Name = dlcName};
var dlcApp = new DlcApp {AppId = Convert.ToInt32(dlcId), Name = dlcName};
var i = dlcList.FindIndex(x => x.AppId.Equals(dlcApp.AppId));
if (i > -1)
{
if (dlcList[i].Name.Contains("Unknown DLC")) dlcList[i] = dlcApp as DlcApp;
if (dlcList[i].Name.Contains("Unknown DLC")) dlcList[i] = dlcApp;
}
else
{
dlcList.Add(dlcApp as DlcApp);
dlcList.Add(dlcApp);
}
}

View File

@ -57,7 +57,7 @@
<DataGridTextColumn Header="App ID" Binding="{Binding AppId}" Width="80" />
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" />
<DataGridTextColumn Header="Depot ID" Binding="{Binding DepotId}" Width="80" Visibility="{Binding Source={x:Reference showOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}"/>
<DataGridTextColumn Header="Depot Name" Binding="{Binding DepotName}" Width="*" Visibility="{Binding Source={x:Reference showOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />
<!--<DataGridTextColumn Header="Depot Name" Binding="{Binding DepotName}" Width="*" Visibility="{Binding Source={x:Reference showOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />-->
<DataGridTextColumn Header="App Path" Binding="{Binding AppPath}" Width="*" Visibility="{Binding Source={x:Reference showOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />
</DataGrid.Columns>
</DataGrid>