From 6196ed84b43785362020648b435c9c64f99fd394 Mon Sep 17 00:00:00 2001 From: Jeddunk Date: Wed, 17 Feb 2021 14:27:54 +0100 Subject: [PATCH] Continue adding options. --- GoldbergGUI.Core/Models/GoldbergModel.cs | 93 ++++++++++++++++++-- GoldbergGUI.Core/Models/SteamAppModel.cs | 11 ++- GoldbergGUI.Core/ViewModels/MainViewModel.cs | 28 +++--- GoldbergGUI.WPF/Views/MainView.xaml | 4 +- 4 files changed, 111 insertions(+), 25 deletions(-) diff --git a/GoldbergGUI.Core/Models/GoldbergModel.cs b/GoldbergGUI.Core/Models/GoldbergModel.cs index 32e8227..58e0f89 100644 --- a/GoldbergGUI.Core/Models/GoldbergModel.cs +++ b/GoldbergGUI.Core/Models/GoldbergModel.cs @@ -6,21 +6,39 @@ namespace GoldbergGUI.Core.Models { public class GoldbergGlobalConfiguration { + /// + /// Name of the user + /// public string AccountName { get; set; } + /// + /// Steam64ID of the user + /// public long UserSteamId { get; set; } + /// + /// language to be used + /// public string Language { get; set; } + /// + /// Custom broadcast addresses (IPv4 or domain addresses) + /// public List CustomBroadcastIps { get; set; } } public class GoldbergConfiguration { + /// + /// App ID of the game + /// public int AppId { get; set; } + /// + /// List of DLC + /// public List DlcList { get; set; } - public List Depots { get; set; } + public List Depots { get; set; } - public List SubscribedGroups { get; set; } + public List SubscribedGroups { get; set; } - public Dictionary AppPaths { get; set; } + public List AppPaths { get; set; } public List Achievements { get; set; } @@ -31,30 +49,95 @@ namespace GoldbergGUI.Core.Models public List Stats { get; set; } // Add controller setting here! + /// + /// Set offline mode. + /// public bool Offline { get; set; } + /// + /// Disable networking (game is set to online, however all outgoing network connectivity will be disabled). + /// public bool DisableNetworking { get; set; } + /// + /// Disable overlay (experimental only). + /// public bool DisableOverlay { get; set; } public GoldbergGlobalConfiguration OverwrittenGlobalConfiguration { get; set; } } + public class Depot + { + /// + /// ID of Depot. + /// + public int DepotId { get; set; } + /// + /// Name of Depot. + /// + public string Name { get; set; } + /// + /// Associated DLC App ID, can be null (e.g. if Depot is for base game). + /// + public int DlcAppId { get; set; } + } + + public class Group + { + /// + /// ID of group (https://steamcommunity.com/gid/103582791433980119/memberslistxml/?xml=1). + /// + public int GroupId { get; set; } + /// + /// Name of group. + /// + public string GroupName { get; set; } + /// + /// App ID of game associated with group (https://steamcommunity.com/games/218620/memberslistxml/?xml=1). + /// + public int AppId { get; set; } + } + + public class AppPath + { + public int AppId { get; set; } + public string Path { get; set; } + } + public class Achievement { + /// + /// Achievement description. + /// [JsonPropertyName("description")] public string Description { get; set; } + /// + /// Human readable name, as shown on webpage, game libary, overlay, etc. + /// [JsonPropertyName("displayName")] public string DisplayName { get; set; } + /// + /// Is achievement hidden? 0 = false, else true. + /// [JsonPropertyName("hidden")] - public string Hidden { get; set; } - + public int Hidden { get; set; } + + /// + /// Path to icon when unlocked (colored). + /// [JsonPropertyName("icon")] public string Icon { get; set; } + /// + /// Path to icon when locked (grayed out). + /// [JsonPropertyName("icongray")] public string IconGray { get; set; } + /// + /// Internal name. + /// [JsonPropertyName("name")] public string Name { get; set; } } diff --git a/GoldbergGUI.Core/Models/SteamAppModel.cs b/GoldbergGUI.Core/Models/SteamAppModel.cs index 66bd139..6fbf277 100644 --- a/GoldbergGUI.Core/Models/SteamAppModel.cs +++ b/GoldbergGUI.Core/Models/SteamAppModel.cs @@ -17,6 +17,9 @@ namespace GoldbergGUI.Core.Models private string _comparableName; [JsonPropertyName("appid")] public int AppId { get; set; } + /// + /// Name of Steam app + /// [JsonPropertyName("name")] public string Name { @@ -27,9 +30,15 @@ namespace GoldbergGUI.Core.Models _comparableName = Regex.Replace(value, Misc.AlphaNumOnlyRegex, "").ToLower(); } } - + + /// + /// Trimmed and cleaned name of Steam app, used for comparisons. + /// public bool CompareName(string value) => _comparableName.Equals(value); + /// + /// App type (Game, DLC, ...) + /// public AppType type { get; set; } public override string ToString() diff --git a/GoldbergGUI.Core/ViewModels/MainViewModel.cs b/GoldbergGUI.Core/ViewModels/MainViewModel.cs index a864d3c..ef36c1d 100644 --- a/GoldbergGUI.Core/ViewModels/MainViewModel.cs +++ b/GoldbergGUI.Core/ViewModels/MainViewModel.cs @@ -476,29 +476,23 @@ namespace GoldbergGUI.Core.ViewModels } else { - var pastedDlc = new List(); var result = Clipboard.GetText(); var expression = new Regex(@"(?.*) *= *(?.*)"); - foreach (var line in result.Split(new[] - { - "\n", - "\r\n" - }, StringSplitOptions.RemoveEmptyEntries)) - { - var match = expression.Match(line); - if (match.Success) - pastedDlc.Add(new SteamApp - { - AppId = Convert.ToInt32(match.Groups["id"].Value), - Name = match.Groups["name"].Value - }); - } + 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 + { + AppId = Convert.ToInt32(match.Groups["id"].Value), + Name = match.Groups["name"].Value + }).ToList(); if (pastedDlc.Count > 0) { DLCs.Clear(); DLCs = new ObservableCollection(pastedDlc); - var empty = DLCs.Count == 1 ? "" : "s"; - StatusText = $"Successfully got {DLCs.Count} DLC{empty} from clipboard! Ready."; + //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"; + StatusText = $"Successfully got {statusTextCount} from clipboard! Ready."; } else { diff --git a/GoldbergGUI.WPF/Views/MainView.xaml b/GoldbergGUI.WPF/Views/MainView.xaml index bf50f6c..b8d16ce 100644 --- a/GoldbergGUI.WPF/Views/MainView.xaml +++ b/GoldbergGUI.WPF/Views/MainView.xaml @@ -137,10 +137,10 @@ - + VerticalScrollBarVisibility="Auto" MaxHeight="120" MinHeight="120"/>