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
{
/// <summary>
/// Name of the user
/// </summary>
public string AccountName { get; set; }
/// <summary>
/// Steam64ID of the user
/// </summary>
public long UserSteamId { get; set; }
/// <summary>
/// language to be used
/// </summary>
public string Language { get; set; }
/// <summary>
/// Custom broadcast addresses (IPv4 or domain addresses)
/// </summary>
public List<string> CustomBroadcastIps { get; set; }
}
public class GoldbergConfiguration
{
/// <summary>
/// App ID of the game
/// </summary>
public int AppId { get; set; }
/// <summary>
/// List of DLC
/// </summary>
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; }
@ -31,30 +49,95 @@ namespace GoldbergGUI.Core.Models
public List<Stat> Stats { get; set; }
// Add controller setting here!
/// <summary>
/// Set offline mode.
/// </summary>
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; }
/// <summary>
/// Disable overlay (experimental only).
/// </summary>
public bool DisableOverlay { 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
{
/// <summary>
/// Achievement description.
/// </summary>
[JsonPropertyName("description")]
public string Description { get; set; }
/// <summary>
/// Human readable name, as shown on webpage, game libary, overlay, etc.
/// </summary>
[JsonPropertyName("displayName")]
public string DisplayName { get; set; }
/// <summary>
/// Is achievement hidden? 0 = false, else true.
/// </summary>
[JsonPropertyName("hidden")]
public string Hidden { get; set; }
public int Hidden { get; set; }
/// <summary>
/// Path to icon when unlocked (colored).
/// </summary>
[JsonPropertyName("icon")]
public string Icon { get; set; }
/// <summary>
/// Path to icon when locked (grayed out).
/// </summary>
[JsonPropertyName("icongray")]
public string IconGray { get; set; }
/// <summary>
/// Internal name.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}

View File

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

View File

@ -476,29 +476,23 @@ namespace GoldbergGUI.Core.ViewModels
}
else
{
var pastedDlc = new List<SteamApp>();
var result = Clipboard.GetText();
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
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<SteamApp>(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
{

View File

@ -137,10 +137,10 @@
<CheckBox Content="Global" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right"
Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True"
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"
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">
<Run Text="{Binding G.Header, Mode=OneTime}" FontWeight="Bold"/><!--
--><Run Text="{Binding G.TextPreLink, Mode=OneTime}"/>