From 9a751ddc64c8fd60dc0ae496f023bb8b4fc80997 Mon Sep 17 00:00:00 2001 From: Nick Blakely Date: Mon, 14 Sep 2020 00:11:32 -0700 Subject: [PATCH] Support configuring master server URI from file. --- Giants.Launcher/Config.cs | 71 +++++++++++++++++ Giants.Launcher/ConfigKeys.cs | 8 ++ Giants.Launcher/ConfigSections.cs | 7 ++ Giants.Launcher/{ => Forms}/ImageButton.cs | 0 .../{ => Forms}/LauncherForm.Designer.cs | 0 Giants.Launcher/{ => Forms}/LauncherForm.cs | 17 +++-- Giants.Launcher/{ => Forms}/LauncherForm.resx | 0 .../{ => Forms}/OptionsForm.Designer.cs | 0 Giants.Launcher/{ => Forms}/OptionsForm.cs | 38 ++++----- Giants.Launcher/{ => Forms}/OptionsForm.resx | 0 Giants.Launcher/GameSettings.cs | 72 +++++++++--------- Giants.Launcher/Giants.Launcher.csproj | 28 ++++--- Giants.Launcher/Program.cs | 2 - .../Properties/Resources.Designer.cs | 9 +++ Giants.Launcher/Properties/Resources.resx | 3 + .../{SettingKeys.cs => RegistryKeys.cs} | 2 +- Giants.Launcher/giants.ico | Bin 2238 -> 0 bytes Giants.Launcher/packages.config | 4 + 18 files changed, 188 insertions(+), 73 deletions(-) create mode 100644 Giants.Launcher/Config.cs create mode 100644 Giants.Launcher/ConfigKeys.cs create mode 100644 Giants.Launcher/ConfigSections.cs rename Giants.Launcher/{ => Forms}/ImageButton.cs (100%) rename Giants.Launcher/{ => Forms}/LauncherForm.Designer.cs (100%) rename Giants.Launcher/{ => Forms}/LauncherForm.cs (96%) rename Giants.Launcher/{ => Forms}/LauncherForm.resx (100%) rename Giants.Launcher/{ => Forms}/OptionsForm.Designer.cs (100%) rename Giants.Launcher/{ => Forms}/OptionsForm.cs (82%) rename Giants.Launcher/{ => Forms}/OptionsForm.resx (100%) rename Giants.Launcher/{SettingKeys.cs => RegistryKeys.cs} (95%) delete mode 100644 Giants.Launcher/giants.ico create mode 100644 Giants.Launcher/packages.config diff --git a/Giants.Launcher/Config.cs b/Giants.Launcher/Config.cs new file mode 100644 index 0000000..c9fd725 --- /dev/null +++ b/Giants.Launcher/Config.cs @@ -0,0 +1,71 @@ +namespace Giants.Launcher +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Windows.Forms; + using Newtonsoft.Json; + + public class Config + { + private const string defaultConfigFileName = "GiantsDefault.config"; + private const string playerConfigFileName = "Giants.config"; + + private IDictionary defaultConfig = new Dictionary(); + private IDictionary userConfig = new Dictionary(); + + public void Read() + { + string defaultConfigFilePath = this.GetDefaultConfigPath(); + if (!File.Exists(defaultConfigFilePath)) + { + string message = string.Format(Resources.ErrorNoConfigFile, defaultConfigFilePath); + MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-1); + return; + } + + this.defaultConfig = ReadConfig(defaultConfigFilePath); + + string userConfigFilePath = this.GetUserConfigPath(); + if (File.Exists(userConfigFilePath)) + { + this.userConfig = ReadConfig(userConfigFilePath); + } + } + + public string GetString(string section, string key) + { + if (this.userConfig.ContainsKey(section)) + { + dynamic sectionObject = this.userConfig[section]; + if (sectionObject != null) + { + return sectionObject.ContainsKey(key) ? (string)sectionObject[key] : ""; + } + } + + return this.defaultConfig[section][key]; + } + + // TODO: other accessors unimplemented as we only need master server host name for now + + private static IDictionary ReadConfig(string filePath) + { + string fileContents = File.ReadAllText(filePath); + return JsonConvert.DeserializeObject>(fileContents); + } + + private string GetDefaultConfigPath() + { + return defaultConfigFileName; + } + + private string GetUserConfigPath() + { + string applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + + return Path.Combine(applicationDataPath, "Giants", playerConfigFileName); + } + } +} diff --git a/Giants.Launcher/ConfigKeys.cs b/Giants.Launcher/ConfigKeys.cs new file mode 100644 index 0000000..576403f --- /dev/null +++ b/Giants.Launcher/ConfigKeys.cs @@ -0,0 +1,8 @@ +namespace Giants.Launcher +{ + public static class ConfigKeys + { + public const string MasterServerHostName = "masterServerHostName"; + public const string BannedPlayers = "bannedPlayers"; + } +} diff --git a/Giants.Launcher/ConfigSections.cs b/Giants.Launcher/ConfigSections.cs new file mode 100644 index 0000000..9092c41 --- /dev/null +++ b/Giants.Launcher/ConfigSections.cs @@ -0,0 +1,7 @@ +namespace Giants.Launcher +{ + public static class ConfigSections + { + public const string Network = "network"; + } +} diff --git a/Giants.Launcher/ImageButton.cs b/Giants.Launcher/Forms/ImageButton.cs similarity index 100% rename from Giants.Launcher/ImageButton.cs rename to Giants.Launcher/Forms/ImageButton.cs diff --git a/Giants.Launcher/LauncherForm.Designer.cs b/Giants.Launcher/Forms/LauncherForm.Designer.cs similarity index 100% rename from Giants.Launcher/LauncherForm.Designer.cs rename to Giants.Launcher/Forms/LauncherForm.Designer.cs diff --git a/Giants.Launcher/LauncherForm.cs b/Giants.Launcher/Forms/LauncherForm.cs similarity index 96% rename from Giants.Launcher/LauncherForm.cs rename to Giants.Launcher/Forms/LauncherForm.cs index a1cab51..5fe745b 100644 --- a/Giants.Launcher/LauncherForm.cs +++ b/Giants.Launcher/Forms/LauncherForm.cs @@ -26,9 +26,10 @@ namespace Giants.Launcher private readonly VersionClient versionHttpClient; private readonly CommunityClient communityHttpClient; - private string commandLine = String.Empty; + private string commandLine; private string gamePath = null; private Updater updater; + private Config config; private string communityAppUri; public LauncherForm() @@ -40,6 +41,12 @@ namespace Giants.Launcher // Set window title this.Text = GameName; + // Read newer file-based game settings + this.config = new Config(); + this.config.Read(); + + string baseUrl = this.config.GetString(ConfigSections.Network, ConfigKeys.MasterServerHostName); + this.httpClient = new HttpClient( new HttpClientHandler() { @@ -47,12 +54,12 @@ namespace Giants.Launcher }); this.versionHttpClient = new VersionClient(this.httpClient) { - BaseUrl = BaseUrl - }; + BaseUrl = baseUrl + }; this.communityHttpClient = new CommunityClient(this.httpClient) { - BaseUrl = BaseUrl - }; + BaseUrl = baseUrl + }; } private void btnExit_Click(object sender, EventArgs e) diff --git a/Giants.Launcher/LauncherForm.resx b/Giants.Launcher/Forms/LauncherForm.resx similarity index 100% rename from Giants.Launcher/LauncherForm.resx rename to Giants.Launcher/Forms/LauncherForm.resx diff --git a/Giants.Launcher/OptionsForm.Designer.cs b/Giants.Launcher/Forms/OptionsForm.Designer.cs similarity index 100% rename from Giants.Launcher/OptionsForm.Designer.cs rename to Giants.Launcher/Forms/OptionsForm.Designer.cs diff --git a/Giants.Launcher/OptionsForm.cs b/Giants.Launcher/Forms/OptionsForm.cs similarity index 82% rename from Giants.Launcher/OptionsForm.cs rename to Giants.Launcher/Forms/OptionsForm.cs index 9825a22..8883d51 100644 --- a/Giants.Launcher/OptionsForm.cs +++ b/Giants.Launcher/Forms/OptionsForm.cs @@ -40,7 +40,7 @@ namespace Giants.Launcher .ToArray()); RendererInfo renderer = GameSettings.CompatibleRenderers.Find( - r => StringComparer.OrdinalIgnoreCase.Compare(Path.GetFileName(r.FilePath), GameSettings.Get(SettingKeys.Renderer)) == 0); + r => StringComparer.OrdinalIgnoreCase.Compare(Path.GetFileName(r.FilePath), GameSettings.Get(RegistryKeys.Renderer)) == 0); if (renderer != null) { @@ -56,21 +56,21 @@ namespace Giants.Launcher private void SetOptions() { var resolutions = (List)this.cmbResolution.DataSource; - this.cmbResolution.SelectedItem = resolutions.Find(r => r.Width == GameSettings.Get(SettingKeys.VideoWidth) && r.Height == GameSettings.Get(SettingKeys.VideoHeight)); + this.cmbResolution.SelectedItem = resolutions.Find(r => r.Width == GameSettings.Get(RegistryKeys.VideoWidth) && r.Height == GameSettings.Get(RegistryKeys.VideoHeight)); if (this.cmbResolution.SelectedItem == null) this.cmbResolution.SelectedIndex = 0; var antialiasingOptions = (List>)this.cmbAntialiasing.DataSource; - this.cmbAntialiasing.SelectedItem = antialiasingOptions.Find(o => o.Value == GameSettings.Get(SettingKeys.Antialiasing)); + this.cmbAntialiasing.SelectedItem = antialiasingOptions.Find(o => o.Value == GameSettings.Get(RegistryKeys.Antialiasing)); if (this.cmbAntialiasing.SelectedItem == null) this.cmbAntialiasing.SelectedIndex = 0; var anisotropyOptions = (List>)this.cmbAnisotropy.DataSource; - this.cmbAnisotropy.SelectedItem = anisotropyOptions.Find(o => o.Value == GameSettings.Get(SettingKeys.AnisotropicFiltering)); + this.cmbAnisotropy.SelectedItem = anisotropyOptions.Find(o => o.Value == GameSettings.Get(RegistryKeys.AnisotropicFiltering)); if (this.cmbAnisotropy.SelectedItem == null) this.cmbAnisotropy.SelectedIndex = 0; - this.chkUpdates.Checked = GameSettings.Get(SettingKeys.NoAutoUpdate) != 1; + this.chkUpdates.Checked = GameSettings.Get(RegistryKeys.NoAutoUpdate) != 1; } private void PopulateAntialiasing() @@ -178,10 +178,10 @@ namespace Giants.Launcher private void cmbRenderer_SelectedIndexChanged(object sender, EventArgs e) { - bool windowed = GameSettings.Get(SettingKeys.Windowed) == 1; + bool windowed = GameSettings.Get(RegistryKeys.Windowed) == 1; if (windowed) { - bool borderless = GameSettings.Get(SettingKeys.BorderlessWindow) == 1; + bool borderless = GameSettings.Get(RegistryKeys.BorderlessWindow) == 1; if (borderless) this.cmbMode.SelectedIndex = 2; else @@ -199,7 +199,7 @@ namespace Giants.Launcher } else { - this.chkVSync.Checked = GameSettings.Get(SettingKeys.VerticalSync) == 1; + this.chkVSync.Checked = GameSettings.Get(RegistryKeys.VerticalSync) == 1; this.chkVSync.Enabled = true; } @@ -210,7 +210,7 @@ namespace Giants.Launcher } else { - this.chkTripleBuffering.Checked = GameSettings.Get(SettingKeys.TripleBuffering) == 1; + this.chkTripleBuffering.Checked = GameSettings.Get(RegistryKeys.TripleBuffering) == 1; this.chkTripleBuffering.Enabled = true; } } @@ -220,25 +220,25 @@ namespace Giants.Launcher var renderer = this.cmbRenderer.SelectedItem as RendererInfo; if (renderer != null) { - GameSettings.Modify(SettingKeys.Renderer, renderer.FileName); + GameSettings.Modify(RegistryKeys.Renderer, renderer.FileName); } var resolution = (ScreenResolution)this.cmbResolution.SelectedItem; if (resolution != null) { - GameSettings.Modify(SettingKeys.VideoWidth, resolution.Width); - GameSettings.Modify(SettingKeys.VideoHeight, resolution.Height); + GameSettings.Modify(RegistryKeys.VideoWidth, resolution.Width); + GameSettings.Modify(RegistryKeys.VideoHeight, resolution.Height); } - GameSettings.Modify(SettingKeys.Antialiasing, this.cmbAntialiasing.SelectedValue); - GameSettings.Modify(SettingKeys.AnisotropicFiltering, this.cmbAnisotropy.SelectedValue); + GameSettings.Modify(RegistryKeys.Antialiasing, this.cmbAntialiasing.SelectedValue); + GameSettings.Modify(RegistryKeys.AnisotropicFiltering, this.cmbAnisotropy.SelectedValue); bool windowed = (WindowType)this.cmbMode.SelectedIndex == WindowType.Windowed || (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless; - GameSettings.Modify(SettingKeys.Windowed, windowed == true ? 1 : 0); + GameSettings.Modify(RegistryKeys.Windowed, windowed == true ? 1 : 0); bool borderless = (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless; - GameSettings.Modify(SettingKeys.BorderlessWindow, borderless == true ? 1 : 0); - GameSettings.Modify(SettingKeys.VerticalSync, this.chkVSync.Checked == true ? 1 : 0); - GameSettings.Modify(SettingKeys.TripleBuffering, this.chkTripleBuffering.Checked == true ? 1 : 0); - GameSettings.Modify(SettingKeys.NoAutoUpdate, this.chkUpdates.Checked == false ? 1 : 0); + GameSettings.Modify(RegistryKeys.BorderlessWindow, borderless == true ? 1 : 0); + GameSettings.Modify(RegistryKeys.VerticalSync, this.chkVSync.Checked == true ? 1 : 0); + GameSettings.Modify(RegistryKeys.TripleBuffering, this.chkTripleBuffering.Checked == true ? 1 : 0); + GameSettings.Modify(RegistryKeys.NoAutoUpdate, this.chkUpdates.Checked == false ? 1 : 0); GameSettings.Save(); diff --git a/Giants.Launcher/OptionsForm.resx b/Giants.Launcher/Forms/OptionsForm.resx similarity index 100% rename from Giants.Launcher/OptionsForm.resx rename to Giants.Launcher/Forms/OptionsForm.resx diff --git a/Giants.Launcher/GameSettings.cs b/Giants.Launcher/GameSettings.cs index 7caf465..b3a8609 100644 --- a/Giants.Launcher/GameSettings.cs +++ b/Giants.Launcher/GameSettings.cs @@ -43,15 +43,15 @@ namespace Giants.Launcher public static void SetDefaults(string gamePath) { // Set default settings: - Settings[SettingKeys.Renderer] = "gg_dx7r.dll"; - Settings[SettingKeys.Antialiasing] = 0; - Settings[SettingKeys.AnisotropicFiltering] = 0; - Settings[SettingKeys.VideoDepth] = 32; - Settings[SettingKeys.Windowed] = 0; - Settings[SettingKeys.BorderlessWindow] = 0; - Settings[SettingKeys.VerticalSync] = 1; - Settings[SettingKeys.TripleBuffering] = 1; - Settings[SettingKeys.NoAutoUpdate] = 0; + Settings[RegistryKeys.Renderer] = "gg_dx7r.dll"; + Settings[RegistryKeys.Antialiasing] = 0; + Settings[RegistryKeys.AnisotropicFiltering] = 0; + Settings[RegistryKeys.VideoDepth] = 32; + Settings[RegistryKeys.Windowed] = 0; + Settings[RegistryKeys.BorderlessWindow] = 0; + Settings[RegistryKeys.VerticalSync] = 1; + Settings[RegistryKeys.TripleBuffering] = 1; + Settings[RegistryKeys.NoAutoUpdate] = 0; // Get a list of renderers compatible with the user's system if (!CompatibleRenderers.Any()) @@ -70,33 +70,33 @@ namespace Giants.Launcher // Select the highest priority renderer if (CompatibleRenderers.Any()) { - Settings[SettingKeys.Renderer] = Path.GetFileName(CompatibleRenderers.Max().FilePath); + Settings[RegistryKeys.Renderer] = Path.GetFileName(CompatibleRenderers.Max().FilePath); } // Set the current desktop resolution, leaving bit depth at the default 32: - Settings[SettingKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width; - Settings[SettingKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height; + Settings[RegistryKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width; + Settings[RegistryKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height; } public static void Load(string gamePath) { SetDefaults(gamePath); - if ((int)Registry.GetValue(RegistryKey, SettingKeys.GameOptionsVersion, 0) == OptionsVersion) + if ((int)Registry.GetValue(RegistryKey, RegistryKeys.GameOptionsVersion, 0) == OptionsVersion) { try { - Settings[SettingKeys.Renderer] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.Renderer, SettingKeys.Renderer, typeof(string)); - Settings[SettingKeys.Antialiasing] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.Antialiasing, Settings[SettingKeys.Antialiasing], typeof(int)); - Settings[SettingKeys.AnisotropicFiltering] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.AnisotropicFiltering, Settings[SettingKeys.AnisotropicFiltering], typeof(int)); - Settings[SettingKeys.VideoWidth] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.VideoWidth, Settings[SettingKeys.VideoWidth], typeof(int)); - Settings[SettingKeys.VideoHeight] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.VideoHeight, Settings[SettingKeys.VideoHeight], typeof(int)); - Settings[SettingKeys.VideoDepth] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.VideoDepth, Settings[SettingKeys.VideoDepth], typeof(int)); - Settings[SettingKeys.Windowed] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.Windowed, Settings[SettingKeys.Windowed], typeof(int)); - Settings[SettingKeys.BorderlessWindow] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.BorderlessWindow, Settings[SettingKeys.BorderlessWindow], typeof(int)); - Settings[SettingKeys.VerticalSync] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.VerticalSync, Settings[SettingKeys.VerticalSync], typeof(int)); - Settings[SettingKeys.TripleBuffering] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.TripleBuffering, Settings[SettingKeys.TripleBuffering], typeof(int)); - Settings[SettingKeys.NoAutoUpdate] = RegistryExtensions.GetValue(RegistryKey, SettingKeys.NoAutoUpdate, Settings[SettingKeys.NoAutoUpdate], typeof(int)); + Settings[RegistryKeys.Renderer] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.Renderer, RegistryKeys.Renderer, typeof(string)); + Settings[RegistryKeys.Antialiasing] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.Antialiasing, Settings[RegistryKeys.Antialiasing], typeof(int)); + Settings[RegistryKeys.AnisotropicFiltering] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.AnisotropicFiltering, Settings[RegistryKeys.AnisotropicFiltering], typeof(int)); + Settings[RegistryKeys.VideoWidth] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoWidth, Settings[RegistryKeys.VideoWidth], typeof(int)); + Settings[RegistryKeys.VideoHeight] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoHeight, Settings[RegistryKeys.VideoHeight], typeof(int)); + Settings[RegistryKeys.VideoDepth] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoDepth, Settings[RegistryKeys.VideoDepth], typeof(int)); + Settings[RegistryKeys.Windowed] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.Windowed, Settings[RegistryKeys.Windowed], typeof(int)); + Settings[RegistryKeys.BorderlessWindow] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.BorderlessWindow, Settings[RegistryKeys.BorderlessWindow], typeof(int)); + Settings[RegistryKeys.VerticalSync] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VerticalSync, Settings[RegistryKeys.VerticalSync], typeof(int)); + Settings[RegistryKeys.TripleBuffering] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.TripleBuffering, Settings[RegistryKeys.TripleBuffering], typeof(int)); + Settings[RegistryKeys.NoAutoUpdate] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.NoAutoUpdate, Settings[RegistryKeys.NoAutoUpdate], typeof(int)); } catch (Exception ex) { @@ -113,18 +113,18 @@ namespace Giants.Launcher { try { - Registry.SetValue(RegistryKey, SettingKeys.GameOptionsVersion, OptionsVersion, RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.Renderer, Settings[SettingKeys.Renderer], RegistryValueKind.String); - Registry.SetValue(RegistryKey, SettingKeys.Antialiasing, Settings[SettingKeys.Antialiasing], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.AnisotropicFiltering, Settings[SettingKeys.AnisotropicFiltering], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.VideoWidth, Settings[SettingKeys.VideoWidth], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.VideoHeight, Settings[SettingKeys.VideoHeight], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.VideoDepth, Settings[SettingKeys.VideoDepth], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.Windowed, Settings[SettingKeys.Windowed], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.BorderlessWindow, Settings[SettingKeys.BorderlessWindow], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.VerticalSync, Settings[SettingKeys.VerticalSync], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.TripleBuffering, Settings[SettingKeys.TripleBuffering], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, SettingKeys.NoAutoUpdate, Settings[SettingKeys.NoAutoUpdate], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.GameOptionsVersion, OptionsVersion, RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.Renderer, Settings[RegistryKeys.Renderer], RegistryValueKind.String); + Registry.SetValue(RegistryKey, RegistryKeys.Antialiasing, Settings[RegistryKeys.Antialiasing], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.AnisotropicFiltering, Settings[RegistryKeys.AnisotropicFiltering], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.VideoWidth, Settings[RegistryKeys.VideoWidth], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.VideoHeight, Settings[RegistryKeys.VideoHeight], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.VideoDepth, Settings[RegistryKeys.VideoDepth], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.Windowed, Settings[RegistryKeys.Windowed], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.BorderlessWindow, Settings[RegistryKeys.BorderlessWindow], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.VerticalSync, Settings[RegistryKeys.VerticalSync], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.TripleBuffering, Settings[RegistryKeys.TripleBuffering], RegistryValueKind.DWord); + Registry.SetValue(RegistryKey, RegistryKeys.NoAutoUpdate, Settings[RegistryKeys.NoAutoUpdate], RegistryValueKind.DWord); } catch (Exception ex) { diff --git a/Giants.Launcher/Giants.Launcher.csproj b/Giants.Launcher/Giants.Launcher.csproj index 4a5c40e..7d7faf6 100644 --- a/Giants.Launcher/Giants.Launcher.csproj +++ b/Giants.Launcher/Giants.Launcher.csproj @@ -12,7 +12,7 @@ Giants v4.7.2 512 - giants.ico + Resources\giants.ico false @@ -58,6 +58,10 @@ false + + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + 3.5 @@ -77,41 +81,44 @@ + + + - + - + Component - + Form Giants.Launcher - + LauncherForm.cs - + Form Giants.Launcher - + OptionsForm.cs - + LauncherForm.cs Giants.Launcher - + OptionsForm.cs @@ -129,6 +136,7 @@ + @@ -163,7 +171,7 @@ - + diff --git a/Giants.Launcher/Program.cs b/Giants.Launcher/Program.cs index 31efb5a..aaf33f3 100644 --- a/Giants.Launcher/Program.cs +++ b/Giants.Launcher/Program.cs @@ -30,7 +30,6 @@ namespace Giants.Launcher } Application.Exit(); - return; } @@ -55,7 +54,6 @@ namespace Giants.Launcher } Application.Run(form); - } } } diff --git a/Giants.Launcher/Properties/Resources.Designer.cs b/Giants.Launcher/Properties/Resources.Designer.cs index 6da43b4..fe22c7f 100644 --- a/Giants.Launcher/Properties/Resources.Designer.cs +++ b/Giants.Launcher/Properties/Resources.Designer.cs @@ -106,6 +106,15 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to Settings file {0} was not found.. + /// + internal static string ErrorNoConfigFile { + get { + return ResourceManager.GetString("ErrorNoConfigFile", resourceCulture); + } + } + /// /// Looks up a localized string similar to Could not locate any renderers compatible with your system. The most compatible renderer has been selected, but you may experience difficulty running the game.. /// diff --git a/Giants.Launcher/Properties/Resources.resx b/Giants.Launcher/Properties/Resources.resx index 88f5efa..0447d91 100644 --- a/Giants.Launcher/Properties/Resources.resx +++ b/Giants.Launcher/Properties/Resources.resx @@ -202,4 +202,7 @@ Join the community on {0}! + + Settings file {0} was not found. + \ No newline at end of file diff --git a/Giants.Launcher/SettingKeys.cs b/Giants.Launcher/RegistryKeys.cs similarity index 95% rename from Giants.Launcher/SettingKeys.cs rename to Giants.Launcher/RegistryKeys.cs index bcab14e..fb563ea 100644 --- a/Giants.Launcher/SettingKeys.cs +++ b/Giants.Launcher/RegistryKeys.cs @@ -1,6 +1,6 @@ namespace Giants.Launcher { - public class SettingKeys + public static class RegistryKeys { public const string Antialiasing = "Antialiasing"; public const string AnisotropicFiltering = "AnisotropicFiltering"; diff --git a/Giants.Launcher/giants.ico b/Giants.Launcher/giants.ico deleted file mode 100644 index 6796ad2bb4cea0ad864ca819645f745a1f5c3e7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2238 zcmchXdt6gx7{`BHHjoWrjB(K^69!`e2M`sMPyt1}vb>O5w#+_-m%+yrF+&9_j3X=&g&&3AQ0r}5C&$8$tG(;nDkEkJT5?6`KL$*EwVd$uvXKF%KC@6$hM*6S{puV)?oeZChWZ0h(kRMIQZxR-aGdI@1L(nQQaME zzxfMFR5i#vc@x=RRAa~88~EhTbrk$`9ie5FNIrWRi?&rD`^=9hss8~vrQaj_?Tc7* z;Q~&zs}NeKLP5pXShl+y%MYH$jQyt(vh^fli%-Be_X|X?FGKLokFf6eF}zWH1aa$* zAYyw7!qZD=?!|~GJPf|{FyMTMr70mis|b^pz76k~1K>Fvz=D+hn6hObCT8q|mB&8# zE-QpcUI@XcLfA8VA$Hvh#o_`erWHUwz5u?_doXFmZn%f-0?c+{;+lMnjmU>Qa0g(q z0~y8J5fJ$%hWWpVw4-_OotFoX#oJ)%vz7YUip0ISkd5C0fpiNtf4Uj|uWiEfF`KY# z-$pRu8#OPN`4ip+##Kqee~GBI*i2CN-3=w2CcnY9L?@#&B% zSHnua8naT<;1aY7!+cjkg0Wc?VEHoa-6Am}I0Dwn2v{i=P|bW| zE+op?q_Yt)ZzkzX2qn{DDV`32V>oP_!(izY1`|OThI>y1&vFWe$wR3w6y~B3z=S|B zFk~|6Wbj3k08>H|MAsaFu#it6N(?6)2?xTS;C8fx zuqDKV4Iv_|2`geKVMz!H0bxN5A-H{SM(_z9!F>Qs2xGzs+~QZOkAJWE;q--*r%N-7 zmijXu0TPQLJTtK;voSBxKWWdP|MvpsX#qpACpUM>%ok=P#3#ord1=;yIdjwF=SEMR z6OuA#PIyju5L0yK*|BUJ`P9fW<75z%{!EjM&t7G6{`BuR)>Nvi)weVq^u-y7wlan} z)ZY&s&|7up%MS};g9Ah6WgWlU+TPOH(bk1hChA02SDWT>dwo{0t4Jsi@c29+IYpWb1aP=GQ8yMnd%QrD$S^i2@!$YXunY>n=?qT;Bk!$LyJKFxo zRmVPlXDZ9`EX|lB<@ZB9nYH3$JJf>7RM7BJ1FGzVYV?r#H2Mu?GS*y@L{C5OF>P1J>7ZW! z9<8tNjVwknOwu08`nlZ0;OO2StzNI|Gw2>2bu*SYFnRu^obRU{9NX8_*sf`8dDwXW z#wuGgXZOTJX%jhPyr@Smbk*->73c2Xl@%Rm!kY5Mp6=Z0#cZ!yP5}M25GU`k&nZXR zn3~uRvsL)Wrg7r+-m8#8$cb271OnWOXyO!(gqWnPpfR8$#`}_II zCU0lc@-%VUX0eBg{LW5!{H3mef)<$p=7-=dTY4o!oS)`WT0W4@@Ksgoxw9uXdwYLs z*8g1bU1fB@@~yA0y*l7Gjb45Emw|$Q^y{gYy6WBRkP(^Ac7Hs!6Oo^)Yo83%a!;za zvQEMZnMCmigDG^Mirrmxt5w@e*9PsQ+J+ETqL3`yG&n6vc7L!q=W=`9jeDBb`ie`} zUSwH;)Z;?;pFXsozczo-`HG9zYt*Xz@wDxPVc+!qWus4D=VzC)BtAJld7gx2jqOu) z==ATA7>3wpo{yUyD-@b9H_IBN) Mf8P1uW&iW_?{rmvvH$=8 diff --git a/Giants.Launcher/packages.config b/Giants.Launcher/packages.config new file mode 100644 index 0000000..a9de8b5 --- /dev/null +++ b/Giants.Launcher/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file