Changed how DLCs are referred as.
Optional DLC settings can now be shown (loading and saving is not implemented yet)
This commit is contained in:
parent
adc067d8a2
commit
e17b0a18ca
@ -32,13 +32,13 @@ namespace GoldbergGUI.Core.Models
|
||||
/// <summary>
|
||||
/// List of DLC
|
||||
/// </summary>
|
||||
public List<SteamApp> DlcList { get; set; }
|
||||
public List<DlcApp> DlcList { get; set; }
|
||||
|
||||
public List<Depot> Depots { get; set; }
|
||||
//public List<Depot> Depots { get; set; }
|
||||
|
||||
public List<Group> SubscribedGroups { get; set; }
|
||||
|
||||
public List<AppPath> AppPaths { get; set; }
|
||||
//public List<AppPath> AppPaths { get; set; }
|
||||
|
||||
public List<Achievement> Achievements { get; set; }
|
||||
|
||||
@ -65,20 +65,11 @@ namespace GoldbergGUI.Core.Models
|
||||
public GoldbergGlobalConfiguration OverwrittenGlobalConfiguration { get; set; }
|
||||
}
|
||||
|
||||
public class Depot
|
||||
public class DlcApp : SteamApp
|
||||
{
|
||||
/// <summary>
|
||||
/// ID of Depot.
|
||||
/// </summary>
|
||||
public int DepotId { get; set; }
|
||||
/// <summary>
|
||||
/// Name of Depot.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Associated DLC App ID, can be null (e.g. if Depot is for base game).
|
||||
/// </summary>
|
||||
public int DlcAppId { get; set; }
|
||||
public int? DepotId { get; set; }
|
||||
public string DepotName { get; set; }
|
||||
public string AppPath { get; set; }
|
||||
}
|
||||
|
||||
public class Group
|
||||
@ -97,12 +88,6 @@ namespace GoldbergGUI.Core.Models
|
||||
public int AppId { get; set; }
|
||||
}
|
||||
|
||||
public class AppPath
|
||||
{
|
||||
public int AppId { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
|
||||
public class Achievement
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -207,7 +207,7 @@ namespace GoldbergGUI.Core.Services
|
||||
{
|
||||
_log.Info("Reading configuration...");
|
||||
var appId = -1;
|
||||
var dlcList = new List<SteamApp>();
|
||||
var dlcList = new List<DlcApp>();
|
||||
var steamAppidTxt = Path.Combine(path, "steam_appid.txt");
|
||||
if (File.Exists(steamAppidTxt))
|
||||
{
|
||||
@ -235,7 +235,7 @@ namespace GoldbergGUI.Core.Services
|
||||
{
|
||||
AppId = Convert.ToInt32(match.Groups["id"].Value),
|
||||
Name = match.Groups["name"].Value
|
||||
});
|
||||
} as DlcApp);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -23,7 +23,7 @@ namespace GoldbergGUI.Core.Services
|
||||
public Task<IEnumerable<SteamApp>> GetListOfAppsByName(string name);
|
||||
public Task<SteamApp> GetAppByName(string name);
|
||||
public Task<SteamApp> GetAppById(int appid);
|
||||
public Task<List<SteamApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb);
|
||||
public Task<List<DlcApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb);
|
||||
}
|
||||
|
||||
class SteamCache
|
||||
@ -168,9 +168,9 @@ namespace GoldbergGUI.Core.Services
|
||||
return app;
|
||||
}
|
||||
|
||||
public async Task<List<SteamApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb)
|
||||
public async Task<List<DlcApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb)
|
||||
{
|
||||
var dlcList = new List<SteamApp>();
|
||||
var dlcList = new List<DlcApp>();
|
||||
if (steamApp != null)
|
||||
{
|
||||
_log.Info($"Get DLC for App {steamApp}");
|
||||
@ -183,7 +183,7 @@ namespace GoldbergGUI.Core.Services
|
||||
var result = await _db.Table<SteamApp>().Where(z => z.type == AppTypeDlc)
|
||||
.FirstOrDefaultAsync(y => y.AppId.Equals(x)).ConfigureAwait(true)
|
||||
?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};
|
||||
dlcList.Add(result);
|
||||
dlcList.Add(result as DlcApp);
|
||||
_log.Debug($"{result.AppId}={result.Name}");
|
||||
});
|
||||
|
||||
@ -233,11 +233,11 @@ namespace GoldbergGUI.Core.Services
|
||||
var i = dlcList.FindIndex(x => x.AppId.Equals(dlcApp.AppId));
|
||||
if (i > -1)
|
||||
{
|
||||
if (dlcList[i].Name.Contains("Unknown DLC")) dlcList[i] = dlcApp;
|
||||
if (dlcList[i].Name.Contains("Unknown DLC")) dlcList[i] = dlcApp as DlcApp;
|
||||
}
|
||||
else
|
||||
{
|
||||
dlcList.Add(dlcApp);
|
||||
dlcList.Add(dlcApp as DlcApp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
private int _appId;
|
||||
|
||||
//private SteamApp _currentGame;
|
||||
private ObservableCollection<SteamApp> _dlcs;
|
||||
private ObservableCollection<DlcApp> _dlcs;
|
||||
private string _accountName;
|
||||
private long _steamId;
|
||||
private bool _offline;
|
||||
@ -130,7 +130,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public ObservableCollection<SteamApp> DLCs
|
||||
public ObservableCollection<DlcApp> DLCs
|
||||
{
|
||||
get => _dlcs;
|
||||
set
|
||||
@ -382,7 +382,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
StatusText = "Trying to get list of DLCs...";
|
||||
var listOfDlc = await _steam.GetListOfDlc(new SteamApp {AppId = AppId, Name = GameName}, true)
|
||||
.ConfigureAwait(false);
|
||||
DLCs = new MvxObservableCollection<SteamApp>(listOfDlc);
|
||||
DLCs = new MvxObservableCollection<DlcApp>(listOfDlc);
|
||||
MainWindowEnabled = true;
|
||||
if (DLCs.Count > 0)
|
||||
{
|
||||
@ -480,7 +480,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
|
||||
var pastedDlc = (from line in result.Split(new[] {"\n", "\r\n"},
|
||||
StringSplitOptions.RemoveEmptyEntries) select expression.Match(line) into match
|
||||
where match.Success select new SteamApp
|
||||
where match.Success select new DlcApp
|
||||
{
|
||||
AppId = Convert.ToInt32(match.Groups["id"].Value),
|
||||
Name = match.Groups["name"].Value
|
||||
@ -488,7 +488,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
if (pastedDlc.Count > 0)
|
||||
{
|
||||
DLCs.Clear();
|
||||
DLCs = new ObservableCollection<SteamApp>(pastedDlc);
|
||||
DLCs = new ObservableCollection<DlcApp>(pastedDlc);
|
||||
//var empty = DLCs.Count == 1 ? "" : "s";
|
||||
//StatusText = $"Successfully got {DLCs.Count} DLC{empty} from clipboard! Ready.";
|
||||
var statusTextCount = DLCs.Count == 1 ? "one DLC" : $"{DLCs.Count} DLCs";
|
||||
@ -524,7 +524,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
DllPath = "Path to game's steam_api(64).dll...";
|
||||
GameName = "Game name...";
|
||||
AppId = -1;
|
||||
DLCs = new ObservableCollection<SteamApp>();
|
||||
DLCs = new ObservableCollection<DlcApp>();
|
||||
AccountName = "Account name...";
|
||||
SteamId = -1;
|
||||
Offline = false;
|
||||
@ -544,7 +544,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||
private void SetFormFromConfig(GoldbergConfiguration config)
|
||||
{
|
||||
AppId = config.AppId;
|
||||
DLCs = new ObservableCollection<SteamApp>(config.DlcList);
|
||||
DLCs = new ObservableCollection<DlcApp>(config.DlcList);
|
||||
Offline = config.Offline;
|
||||
DisableNetworking = config.DisableNetworking;
|
||||
DisableOverlay = config.DisableOverlay;
|
||||
|
@ -7,6 +7,9 @@
|
||||
xmlns:viewmodel="clr-namespace:GoldbergGUI.Core.ViewModels;assembly=GoldbergGUI.Core"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="500" d:DesignWidth="400" d:DataContext="{d:DesignInstance Type=viewmodel:MainViewModel }">
|
||||
<views:MvxWpfView.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="B2V" />
|
||||
</views:MvxWpfView.Resources>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
@ -53,10 +56,13 @@
|
||||
<DataGrid.Columns>
|
||||
<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="App Path" Binding="{Binding AppPath}" Width="*" Visibility="{Binding Source={x:Reference showOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Content="Get _DLCs for AppID" Command="{Binding GetListOfDlcCommand}" Grid.Row="1" Width="120" HorizontalAlignment="Right" Margin="0,5,125,0" Height="20"/>
|
||||
<Button Content="_Advanced Settings..." Grid.Row="1" Width="120" HorizontalAlignment="Right" Margin="0,5,0,0" Height="20" IsEnabled="False" ToolTip="Work in progress..."/>
|
||||
<CheckBox Grid.Row="1" x:Name="showOptionalDlcSettings" Margin="0,5,0,0" Content="Show optional settings"/>
|
||||
<Button Content="Get _DLCs for AppID" Command="{Binding GetListOfDlcCommand}" Grid.Row="1" Width="120" HorizontalAlignment="Right" Margin="0,5,0,0" Height="20"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user