Continue adding options.

This commit is contained in:
Jeddunk 2021-02-17 14:27:54 +01:00
parent a00ec26e68
commit 6196ed84b4
4 changed files with 111 additions and 25 deletions

View File

@ -6,21 +6,39 @@ namespace GoldbergGUI.Core.Models
{ {
public class GoldbergGlobalConfiguration public class GoldbergGlobalConfiguration
{ {
/// <summary>
/// Name of the user
/// </summary>
public string AccountName { get; set; } public string AccountName { get; set; }
/// <summary>
/// Steam64ID of the user
/// </summary>
public long UserSteamId { get; set; } public long UserSteamId { get; set; }
/// <summary>
/// language to be used
/// </summary>
public string Language { get; set; } public string Language { get; set; }
/// <summary>
/// Custom broadcast addresses (IPv4 or domain addresses)
/// </summary>
public List<string> CustomBroadcastIps { get; set; } public List<string> CustomBroadcastIps { get; set; }
} }
public class GoldbergConfiguration public class GoldbergConfiguration
{ {
/// <summary>
/// App ID of the game
/// </summary>
public int AppId { get; set; } public int AppId { get; set; }
/// <summary>
/// List of DLC
/// </summary>
public List<SteamApp> DlcList { get; set; } public List<SteamApp> DlcList { get; set; }
public List<int> Depots { get; set; } public List<Depot> Depots { get; set; }
public List<int> SubscribedGroups { get; set; } public List<Group> SubscribedGroups { get; set; }
public Dictionary<int, string> AppPaths { get; set; } public List<AppPath> AppPaths { get; set; }
public List<Achievement> Achievements { get; set; } public List<Achievement> Achievements { get; set; }
@ -31,30 +49,95 @@ namespace GoldbergGUI.Core.Models
public List<Stat> Stats { get; set; } public List<Stat> Stats { get; set; }
// Add controller setting here! // Add controller setting here!
/// <summary>
/// Set offline mode.
/// </summary>
public bool Offline { get; set; } public bool Offline { get; set; }
/// <summary>
/// Disable networking (game is set to online, however all outgoing network connectivity will be disabled).
/// </summary>
public bool DisableNetworking { get; set; } public bool DisableNetworking { get; set; }
/// <summary>
/// Disable overlay (experimental only).
/// </summary>
public bool DisableOverlay { get; set; } public bool DisableOverlay { get; set; }
public GoldbergGlobalConfiguration OverwrittenGlobalConfiguration { get; set; } public GoldbergGlobalConfiguration OverwrittenGlobalConfiguration { get; set; }
} }
public class Depot
{
/// <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 class Group
{
/// <summary>
/// ID of group (https://steamcommunity.com/gid/103582791433980119/memberslistxml/?xml=1).
/// </summary>
public int GroupId { get; set; }
/// <summary>
/// Name of group.
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// App ID of game associated with group (https://steamcommunity.com/games/218620/memberslistxml/?xml=1).
/// </summary>
public int AppId { get; set; }
}
public class AppPath
{
public int AppId { get; set; }
public string Path { get; set; }
}
public class Achievement public class Achievement
{ {
/// <summary>
/// Achievement description.
/// </summary>
[JsonPropertyName("description")] [JsonPropertyName("description")]
public string Description { get; set; } public string Description { get; set; }
/// <summary>
/// Human readable name, as shown on webpage, game libary, overlay, etc.
/// </summary>
[JsonPropertyName("displayName")] [JsonPropertyName("displayName")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
/// <summary>
/// Is achievement hidden? 0 = false, else true.
/// </summary>
[JsonPropertyName("hidden")] [JsonPropertyName("hidden")]
public string Hidden { get; set; } public int Hidden { get; set; }
/// <summary>
/// Path to icon when unlocked (colored).
/// </summary>
[JsonPropertyName("icon")] [JsonPropertyName("icon")]
public string Icon { get; set; } public string Icon { get; set; }
/// <summary>
/// Path to icon when locked (grayed out).
/// </summary>
[JsonPropertyName("icongray")] [JsonPropertyName("icongray")]
public string IconGray { get; set; } public string IconGray { get; set; }
/// <summary>
/// Internal name.
/// </summary>
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string Name { get; set; } public string Name { get; set; }
} }

View File

@ -17,6 +17,9 @@ namespace GoldbergGUI.Core.Models
private string _comparableName; private string _comparableName;
[JsonPropertyName("appid")] public int AppId { get; set; } [JsonPropertyName("appid")] public int AppId { get; set; }
/// <summary>
/// Name of Steam app
/// </summary>
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string Name public string Name
{ {
@ -28,8 +31,14 @@ namespace GoldbergGUI.Core.Models
} }
} }
/// <summary>
/// Trimmed and cleaned name of Steam app, used for comparisons.
/// </summary>
public bool CompareName(string value) => _comparableName.Equals(value); public bool CompareName(string value) => _comparableName.Equals(value);
/// <summary>
/// App type (Game, DLC, ...)
/// </summary>
public AppType type { get; set; } public AppType type { get; set; }
public override string ToString() public override string ToString()

View File

@ -476,29 +476,23 @@ namespace GoldbergGUI.Core.ViewModels
} }
else else
{ {
var pastedDlc = new List<SteamApp>();
var result = Clipboard.GetText(); var result = Clipboard.GetText();
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)"); var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
foreach (var line in result.Split(new[] var pastedDlc = (from line in result.Split(new[] {"\n", "\r\n"},
{ StringSplitOptions.RemoveEmptyEntries) select expression.Match(line) into match
"\n", where match.Success select new SteamApp
"\r\n" {
}, StringSplitOptions.RemoveEmptyEntries)) AppId = Convert.ToInt32(match.Groups["id"].Value),
{ Name = match.Groups["name"].Value
var match = expression.Match(line); }).ToList();
if (match.Success)
pastedDlc.Add(new SteamApp
{
AppId = Convert.ToInt32(match.Groups["id"].Value),
Name = match.Groups["name"].Value
});
}
if (pastedDlc.Count > 0) if (pastedDlc.Count > 0)
{ {
DLCs.Clear(); DLCs.Clear();
DLCs = new ObservableCollection<SteamApp>(pastedDlc); DLCs = new ObservableCollection<SteamApp>(pastedDlc);
var empty = DLCs.Count == 1 ? "" : "s"; //var empty = DLCs.Count == 1 ? "" : "s";
StatusText = $"Successfully got {DLCs.Count} DLC{empty} from clipboard! Ready."; //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 else
{ {

View File

@ -137,10 +137,10 @@
<CheckBox Content="Global" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right" <CheckBox Content="Global" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right"
Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True" Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True"
IsEnabled="False"/> IsEnabled="False"/>
<TextBox Grid.Row="4" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" <TextBox Grid.Row="4" Grid.ColumnSpan="3" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
TextWrapping="Wrap" TextWrapping="Wrap"
AcceptsReturn="True" AcceptsReturn="True"
VerticalScrollBarVisibility="Visible" MaxHeight="120" MinHeight="120"/> VerticalScrollBarVisibility="Auto" MaxHeight="120" MinHeight="120"/>
<TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="5" Margin="5,10,5,5"> <TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="5" Margin="5,10,5,5">
<Run Text="{Binding G.Header, Mode=OneTime}" FontWeight="Bold"/><!-- <Run Text="{Binding G.Header, Mode=OneTime}" FontWeight="Bold"/><!--
--><Run Text="{Binding G.TextPreLink, Mode=OneTime}"/> --><Run Text="{Binding G.TextPreLink, Mode=OneTime}"/>