diff --git a/GoldbergGUI.Core/GoldbergGUI.Core.csproj b/GoldbergGUI.Core/GoldbergGUI.Core.csproj index 5eab489..b807a17 100644 --- a/GoldbergGUI.Core/GoldbergGUI.Core.csproj +++ b/GoldbergGUI.Core/GoldbergGUI.Core.csproj @@ -2,8 +2,7 @@ netcoreapp3.1 - 0.1.0 - 0.1.0 + 0.2.0 Jeddunk diff --git a/GoldbergGUI.Core/Models/GoldbergModel.cs b/GoldbergGUI.Core/Models/GoldbergModel.cs index f4a6960..e7ef7ab 100644 --- a/GoldbergGUI.Core/Models/GoldbergModel.cs +++ b/GoldbergGUI.Core/Models/GoldbergModel.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; +// ReSharper disable ClassNeverInstantiated.Global +// ReSharper disable UnusedMember.Global namespace GoldbergGUI.Core.Models { @@ -67,8 +69,6 @@ namespace GoldbergGUI.Core.Models public class DlcApp : SteamApp { - //public int? DepotId { get; set; } - //public string DepotName { get; set; } /// /// Path to DLC (relative to Steam API DLL) (optional) /// @@ -100,7 +100,7 @@ namespace GoldbergGUI.Core.Models public string Description { get; set; } /// - /// Human readable name, as shown on webpage, game libary, overlay, etc. + /// Human readable name, as shown on webpage, game library, overlay, etc. /// [JsonPropertyName("displayName")] public string DisplayName { get; set; } @@ -120,6 +120,7 @@ namespace GoldbergGUI.Core.Models /// /// Path to icon when locked (grayed out). /// + // ReSharper disable once StringLiteralTypo [JsonPropertyName("icongray")] public string IconGray { get; set; } @@ -188,9 +189,10 @@ namespace GoldbergGUI.Core.Models // [JsonConverter(typeof(FluffyParseStringConverter))] public long DropMaxPerWindow { get; set; } + // ReSharper disable once StringLiteralTypo [JsonPropertyName("workshopid")] // [JsonConverter(typeof(FluffyParseStringConverter))] - public long Workshopid { get; set; } + public long WorkshopId { get; set; } [JsonPropertyName("tw_unique_to_own")] // [JsonConverter(typeof(PurpleParseStringConverter))] diff --git a/GoldbergGUI.Core/Services/GoldbergService.cs b/GoldbergGUI.Core/Services/GoldbergService.cs index fa4b47f..5af721b 100644 --- a/GoldbergGUI.Core/Services/GoldbergService.cs +++ b/GoldbergGUI.Core/Services/GoldbergService.cs @@ -243,14 +243,15 @@ namespace GoldbergGUI.Core.Services // ReSharper disable once InvertIf if (File.Exists(appPathTxt)) { - var appPathAllLinesAsync = await File.ReadAllLinesAsync(dlcTxt).ConfigureAwait(false); + var appPathAllLinesAsync = await File.ReadAllLinesAsync(appPathTxt).ConfigureAwait(false); var appPathExpression = new Regex(@"(?.*) *= *(?.*)"); foreach (var line in appPathAllLinesAsync) { var match = appPathExpression.Match(line); - if (match.Success) - dlcList[Convert.ToInt32(match.Groups["id"].Value)].AppPath = - match.Groups["appPath"].Value; + if (!match.Success) continue; + var i = dlcList.FindIndex(x => + x.AppId.Equals(Convert.ToInt32(match.Groups["id"].Value))); + dlcList[i].AppPath = match.Groups["appPath"].Value; } } } @@ -313,22 +314,29 @@ namespace GoldbergGUI.Core.Services { dlcContent += $"{x}\n"; //depotContent += $"{x.DepotId}\n"; - appPathContent += $"{x.AppId}={x.AppPath}\n"; + if (!string.IsNullOrEmpty(x.AppPath)) + appPathContent += $"{x.AppId}={x.AppPath}\n"; }); await File.WriteAllTextAsync(Path.Combine(path, "steam_settings", "DLC.txt"), dlcContent) .ConfigureAwait(false); - /*if (!string.Equals(depotContent, "")) + /*if (!string.IsNullOrEmpty(depotContent)) { await File.WriteAllTextAsync(Path.Combine(path, "steam_settings", "depots.txt"), depotContent) .ConfigureAwait(false); }*/ - if (!string.Equals(appPathContent, "")) + + if (!string.IsNullOrEmpty(appPathContent)) { await File.WriteAllTextAsync(Path.Combine(path, "steam_settings", "app_paths.txt"), appPathContent) .ConfigureAwait(false); } + else + { + if (File.Exists(Path.Combine(path, "steam_settings", "app_paths.txt"))) + File.Delete(Path.Combine(path, "steam_settings", "app_paths.txt")); + } _log.Info("Saved DLC settings."); } else diff --git a/GoldbergGUI.WPF/GoldbergGUI.WPF.csproj b/GoldbergGUI.WPF/GoldbergGUI.WPF.csproj index eb4287b..62b3ad1 100644 --- a/GoldbergGUI.WPF/GoldbergGUI.WPF.csproj +++ b/GoldbergGUI.WPF/GoldbergGUI.WPF.csproj @@ -4,8 +4,7 @@ WinExe netcoreapp3.1 true - 0.1.0 - 0.1.0 + 0.2.0 Jeddunk