Disabled overlay setting, only supported in experimental build.

Started adding more options.
This commit is contained in:
Jeddunk 2021-02-15 20:52:58 +01:00
parent 950844a14b
commit 3eeb893bc4
3 changed files with 203 additions and 4 deletions

View File

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace GoldbergGUI.Core.Models
{
@ -7,13 +9,187 @@ namespace GoldbergGUI.Core.Models
public string AccountName { get; set; }
public long UserSteamId { get; set; }
public string Language { get; set; }
public List<string> CustomBroadcastIps { get; set; }
}
public class GoldbergConfiguration
{
public int AppId { get; set; }
public List<SteamApp> DlcList { get; set; }
public List<int> Depots { get; set; }
public List<int> SubscribedGroups { get; set; }
public Dictionary<int, string> AppPaths { get; set; }
public List<Achievement> Achievements { get; set; }
public List<Item> Items { get; set; }
public List<Leaderboard> Leaderboards { get; set; }
public List<Stat> Stats { get; set; }
// Add controller setting here!
public bool Offline { get; set; }
public bool DisableNetworking { get; set; }
public bool DisableOverlay { get; set; }
public GoldbergGlobalConfiguration OverwrittenGlobalConfiguration { get; set; }
}
public class Achievement
{
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("displayName")]
public string DisplayName { get; set; }
[JsonPropertyName("hidden")]
public string Hidden { get; set; }
[JsonPropertyName("icon")]
public string Icon { get; set; }
[JsonPropertyName("icongray")]
public string IconGray { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class Item
{
[JsonPropertyName("Timestamp")]
public DateTimeOffset Timestamp { get; set; }
[JsonPropertyName("modified")]
public string Modified { get; set; }
[JsonPropertyName("date_created")]
public string DateCreated { get; set; }
[JsonPropertyName("type")]
public string Type { get; set; }
[JsonPropertyName("display_type")]
public string DisplayType { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("bundle")]
public string Bundle { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("background_color")]
public string BackgroundColor { get; set; }
[JsonPropertyName("icon_url")]
public Uri IconUrl { get; set; }
[JsonPropertyName("icon_url_large")]
public Uri IconUrlLarge { get; set; }
[JsonPropertyName("name_color")]
public string NameColor { get; set; }
[JsonPropertyName("tradable")]
// [JsonConverter(typeof(PurpleParseStringConverter))]
public bool Tradable { get; set; }
[JsonPropertyName("marketable")]
// [JsonConverter(typeof(PurpleParseStringConverter))]
public bool Marketable { get; set; }
[JsonPropertyName("commodity")]
// [JsonConverter(typeof(PurpleParseStringConverter))]
public bool Commodity { get; set; }
[JsonPropertyName("drop_interval")]
// [JsonConverter(typeof(FluffyParseStringConverter))]
public long DropInterval { get; set; }
[JsonPropertyName("drop_max_per_window")]
// [JsonConverter(typeof(FluffyParseStringConverter))]
public long DropMaxPerWindow { get; set; }
[JsonPropertyName("workshopid")]
// [JsonConverter(typeof(FluffyParseStringConverter))]
public long Workshopid { get; set; }
[JsonPropertyName("tw_unique_to_own")]
// [JsonConverter(typeof(PurpleParseStringConverter))]
public bool TwUniqueToOwn { get; set; }
[JsonPropertyName("item_quality")]
// [JsonConverter(typeof(FluffyParseStringConverter))]
public long ItemQuality { get; set; }
[JsonPropertyName("tw_price")]
public string TwPrice { get; set; }
[JsonPropertyName("tw_type")]
public string TwType { get; set; }
[JsonPropertyName("tw_client_visible")]
// [JsonConverter(typeof(FluffyParseStringConverter))]
public long TwClientVisible { get; set; }
[JsonPropertyName("tw_icon_small")]
public string TwIconSmall { get; set; }
[JsonPropertyName("tw_icon_large")]
public string TwIconLarge { get; set; }
[JsonPropertyName("tw_description")]
public string TwDescription { get; set; }
[JsonPropertyName("tw_client_name")]
public string TwClientName { get; set; }
[JsonPropertyName("tw_client_type")]
public string TwClientType { get; set; }
[JsonPropertyName("tw_rarity")]
public string TwRarity { get; set; }
}
public class Leaderboard
{
public string Name { get; set; }
public SortMethod SortMethodSetting { get; set; }
public DisplayType DisplayTypeSetting { get; set; }
public enum SortMethod
{
None,
Ascending,
Descending
}
public enum DisplayType
{
None,
Numeric,
TimeSeconds,
TimeMilliseconds
}
}
public class Stat
{
public string Name { get; set; }
public StatType StatTypeSetting { get; set; }
public string Value { get; set; }
public enum StatType
{
Int,
Float,
AvgRate
}
}
}

View File

@ -46,6 +46,7 @@ namespace GoldbergGUI.Core.Services
private readonly string _accountNamePath = Path.Combine(GlobalSettingsPath, "settings/account_name.txt");
private readonly string _userSteamIdPath = Path.Combine(GlobalSettingsPath, "settings/user_steam_id.txt");
private readonly string _languagePath = Path.Combine(GlobalSettingsPath, "settings/language.txt");
private readonly string _customBroadcastIpsPath = Path.Combine(GlobalSettingsPath, "settings/custom_broadcasts.txt");
private readonly List<string> _interfaceNames = new List<string>
{
@ -92,20 +93,27 @@ namespace GoldbergGUI.Core.Services
var accountName = "Account name...";
long steamId = -1;
var language = DefaultLanguage;
var customBroadcastIps = new List<string>();
await Task.Run(() =>
{
if (File.Exists(_accountNamePath)) accountName = File.ReadLines(_accountNamePath).First().Trim();
if (File.Exists(_userSteamIdPath) &&
!long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) &&
steamId < 76561197960265729 && steamId > 76561202255233023)
{
_log.Error("Invalid User Steam ID!");
}
if (File.Exists(_languagePath)) language = File.ReadLines(_languagePath).First().Trim();
if (File.Exists(_customBroadcastIpsPath))
customBroadcastIps.AddRange(
File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim()));
}).ConfigureAwait(false);
return new GoldbergGlobalConfiguration
{
AccountName = accountName,
UserSteamId = steamId,
Language = language
Language = language,
CustomBroadcastIps = customBroadcastIps
};
}
@ -114,7 +122,9 @@ namespace GoldbergGUI.Core.Services
var accountName = c.AccountName;
var userSteamId = c.UserSteamId;
var language = c.Language;
var customBroadcastIps = c.CustomBroadcastIps;
_log.Info("Setting global settings...");
// Account Name
if (accountName != null && accountName != "Account name...")
{
_log.Info("Setting account name...");
@ -125,7 +135,7 @@ namespace GoldbergGUI.Core.Services
_log.Info("Invalid account name! Skipping...");
await File.WriteAllTextAsync(_accountNamePath, "Goldberg").ConfigureAwait(false);
}
// User SteamID
if (userSteamId >= 76561197960265729 && userSteamId <= 76561202255233023)
{
_log.Info("Setting user Steam ID...");
@ -136,7 +146,7 @@ namespace GoldbergGUI.Core.Services
_log.Info("Invalid user Steam ID! Skipping...");
await Task.Run(() => File.Delete(_userSteamIdPath)).ConfigureAwait(false);
}
// Language
if (language != null)
{
_log.Info("Setting language...");
@ -147,6 +157,19 @@ namespace GoldbergGUI.Core.Services
_log.Info("Invalid language! Skipping...");
await File.WriteAllTextAsync(_languagePath, DefaultLanguage).ConfigureAwait(false);
}
// Custom Broadcast IPs
if (customBroadcastIps.Count > 0)
{
_log.Info("Setting custom broadcast IPs...");
var result =
customBroadcastIps.Aggregate("", (current, address) => $"{current}{address}\n");
await File.WriteAllTextAsync(_customBroadcastIpsPath, result).ConfigureAwait(false);
}
else
{
_log.Info("Empty list of custom broadcast IPs! Skipping...");
await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false);
}
}
// If first time, call GenerateInterfaces

View File

@ -84,7 +84,7 @@
<StackPanel Margin="5,5,5,5">
<CheckBox Content="Offline" IsChecked="{Binding Offline, Mode=TwoWay}" Height="20" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
<CheckBox Content="Disable Networking" IsChecked="{Binding DisableNetworking, Mode=TwoWay}" Height="20" VerticalContentAlignment="Center"/>
<CheckBox Content="Disable Overlay" IsChecked="{Binding DisableOverlay, Mode=TwoWay}" Height="20" VerticalContentAlignment="Center"/>
<CheckBox Content="Disable Overlay" IsChecked="{Binding DisableOverlay, Mode=TwoWay}" Height="20" VerticalContentAlignment="Center" IsEnabled="False"/>
</StackPanel>
</GroupBox>
</Grid>