diff --git a/Giants.Launcher/GameSettings.cs b/Giants.Launcher/GameSettings.cs index 11cc67b..16be3aa 100644 --- a/Giants.Launcher/GameSettings.cs +++ b/Giants.Launcher/GameSettings.cs @@ -10,21 +10,29 @@ namespace Giants.Launcher static class GameSettings { // Constants - private const string REGISTRY_KEY = @"HKEY_CURRENT_USER\Software\PlanetMoon\Giants"; - private const int OPTIONS_VERSION = 3; + private const string RegistryKey = @"HKEY_CURRENT_USER\Software\PlanetMoon\Giants"; + private const int OptionsVersion = 3; private static readonly Dictionary Settings = new Dictionary(); // List of renderers compatible with the user's system. - static public List CompatibleRenderers; + public static List CompatibleRenderers; + + public static T Get(string settingName) + { + return (T)Get(settingName); + } public static object Get(string settingName) { if (Settings.ContainsKey(settingName)) + { return Settings[settingName]; + } else + { return 0; - + } } public static void Modify(string settingName, object settingValue) @@ -35,17 +43,15 @@ namespace Giants.Launcher public static void SetDefaults(string gamePath) { // Set default settings: - Settings["Renderer"] = "gg_dx7r.dll"; - Settings["Antialiasing"] = 0; - Settings["AnisotropicFiltering"] = 0; - Settings["VideoWidth"] = 640; - Settings["VideoHeight"] = 480; - Settings["VideoDepth"] = 32; - Settings["Windowed"] = 0; - Settings["BorderlessWindow"] = 0; - Settings["VerticalSync"] = 1; - Settings["TripleBuffering"] = 1; - Settings["NoAutoUpdate"] = 0; + 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; // Get a list of renderers compatible with the user's system if (CompatibleRenderers == null) @@ -54,44 +60,51 @@ namespace Giants.Launcher if (CompatibleRenderers.Count == 0) { MessageBox.Show( - "Could not locate any renderers compatible with your system. " + - "The most compatible renderer has been selected, but you may experience difficulty running the game.", - "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + text: Resources.ErrorNoRenderers, + caption: Resources.Error, + buttons: MessageBoxButtons.OK, + icon: MessageBoxIcon.Error); } } // Select the highest priority renderer - if (CompatibleRenderers.Count > 0) - Settings["Renderer"] = Path.GetFileName(CompatibleRenderers.Max().FilePath); + if (CompatibleRenderers.Any()) + { + Settings[SettingKeys.Renderer] = Path.GetFileName(CompatibleRenderers.Max().FilePath); + } // Set the current desktop resolution, leaving bit depth at the default 32: - Settings["VideoWidth"] = Screen.PrimaryScreen.Bounds.Width; - Settings["VideoHeight"] = Screen.PrimaryScreen.Bounds.Height; + Settings[SettingKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width; + Settings[SettingKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height; } public static void Load(string gamePath) { SetDefaults(gamePath); - if ((int)Registry.GetValue(REGISTRY_KEY, "GameOptionsVersion", 0) == OPTIONS_VERSION) + if ((int)Registry.GetValue(RegistryKey, SettingKeys.GameOptionsVersion, 0) == OptionsVersion) { try { - Settings["Renderer"] = RegistryExtensions.GetValue(REGISTRY_KEY, "Renderer", Settings["Renderer"], typeof(string)); - Settings["Antialiasing"] = RegistryExtensions.GetValue(REGISTRY_KEY, "Antialiasing", Settings["Antialiasing"], typeof(int)); - Settings["AnisotropicFiltering"] = RegistryExtensions.GetValue(REGISTRY_KEY, "AnisotropicFiltering", Settings["AnisotropicFiltering"], typeof(int)); - Settings["VideoWidth"] = RegistryExtensions.GetValue(REGISTRY_KEY, "VideoWidth", Settings["VideoWidth"], typeof(int)); - Settings["VideoHeight"] = RegistryExtensions.GetValue(REGISTRY_KEY, "VideoHeight", Settings["VideoHeight"], typeof(int)); - Settings["VideoDepth"] = RegistryExtensions.GetValue(REGISTRY_KEY, "VideoDepth", Settings["VideoDepth"], typeof(int)); - Settings["Windowed"] = RegistryExtensions.GetValue(REGISTRY_KEY, "Windowed", Settings["Windowed"], typeof(int)); - Settings["BorderlessWindow"] = RegistryExtensions.GetValue(REGISTRY_KEY, "BorderlessWindow", Settings["BorderlessWindow"], typeof(int)); - Settings["VerticalSync"] = RegistryExtensions.GetValue(REGISTRY_KEY, "VerticalSync", Settings["VerticalSync"], typeof(int)); - Settings["TripleBuffering"] = RegistryExtensions.GetValue(REGISTRY_KEY, "TripleBuffering", Settings["TripleBuffering"], typeof(int)); - Settings["NoAutoUpdate"] = RegistryExtensions.GetValue(REGISTRY_KEY, "NoAutoUpdate", Settings["NoAutoUpdate"], typeof(int)); + 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)); } catch (Exception ex) { - MessageBox.Show(string.Format("Could not read game settings from registry!\n\nReason: {0}", ex.Message)); + MessageBox.Show( + text: string.Format(Resources.ErrorSettingsLoad, ex.Message), + caption: Resources.Error, + buttons: MessageBoxButtons.OK, + icon: MessageBoxIcon.Error); } } } @@ -100,22 +113,26 @@ namespace Giants.Launcher { try { - Registry.SetValue(REGISTRY_KEY, "GameOptionsVersion", 3, RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "Renderer", Settings["Renderer"], RegistryValueKind.String); - Registry.SetValue(REGISTRY_KEY, "Antialiasing", Settings["Antialiasing"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "AnisotropicFiltering", Settings["AnisotropicFiltering"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "VideoWidth", Settings["VideoWidth"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "VideoHeight", Settings["VideoHeight"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "VideoDepth", Settings["VideoDepth"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "Windowed", Settings["Windowed"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "BorderlessWindow", Settings["BorderlessWindow"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "VerticalSync", Settings["VerticalSync"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "TripleBuffering", Settings["TripleBuffering"], RegistryValueKind.DWord); - Registry.SetValue(REGISTRY_KEY, "NoAutoUpdate", Settings["NoAutoUpdate"], RegistryValueKind.DWord); + 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); } catch (Exception ex) { - MessageBox.Show(string.Format("Could not save game settings to registry!\n\nReason: {0}", ex.Message)); + MessageBox.Show( + text: string.Format(Resources.ErrorSettingsSave, ex.Message), + caption: Resources.Error, + buttons: MessageBoxButtons.OK, + icon: MessageBoxIcon.Error); } } } diff --git a/Giants.Launcher/Giants.Launcher.csproj b/Giants.Launcher/Giants.Launcher.csproj index 7eb73b7..175a552 100644 --- a/Giants.Launcher/Giants.Launcher.csproj +++ b/Giants.Launcher/Giants.Launcher.csproj @@ -77,6 +77,8 @@ + + diff --git a/Giants.Launcher/LauncherForm.cs b/Giants.Launcher/LauncherForm.cs index acf891a..28572a6 100644 --- a/Giants.Launcher/LauncherForm.cs +++ b/Giants.Launcher/LauncherForm.cs @@ -101,7 +101,7 @@ namespace Giants.Launcher // Read game settings from registry GameSettings.Load(this.gamePath); - if ((int)GameSettings.Get("NoAutoUpdate") == 0) + if (GameSettings.Get("NoAutoUpdate") == 0) { Version gameVersion = VersionHelper.GetGameVersion(this.gamePath); if (gameVersion == null) diff --git a/Giants.Launcher/Native/Capabilities.cs b/Giants.Launcher/Native/Capabilities.cs new file mode 100644 index 0000000..94849b6 --- /dev/null +++ b/Giants.Launcher/Native/Capabilities.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; + +namespace Giants.Launcher +{ + partial class RendererInterop + { + public class Capabilities : IComparable + { + [Flags] + public enum RendererFlag + { + LowBitDepthAllowed = 0x1, + + // Multisampling support flags: + MSAA2x = 0x2, + MSAA4x = 0x4, + MSAA8x = 0x8, + MSAA16x = 0x10, + + // Other options: + VSync = 0x20, + TripleBuffer = 0x40, + }; + + public Capabilities(string filePath, ref RendererInterop.GFXCapabilityInfo gfxCaps) + { + this.FilePath = filePath; + this.FileName = Path.GetFileName(filePath); + this.MaxAnisotropy = gfxCaps.maxAnisotropy; + this.Flags = (RendererFlag)gfxCaps.flags; + this.Priority = gfxCaps.priority; + this.Name = gfxCaps.rendererName; + } + + public override string ToString() + { + return string.Format("{0} ({1})", this.Name, Path.GetFileName(this.FilePath)); + } + + public int CompareTo(object obj) + { + if (obj == null) return 1; + + Capabilities other = obj as Capabilities; + if (other != null) + return this.Priority.CompareTo(other.Priority); + else + throw new ArgumentException(); + } + + public string FilePath { get; private set; } + public string FileName { get; private set; } + public int MaxAnisotropy { get; private set; } + public RendererFlag Flags { get; private set; } + public int Priority { get; private set; } + public string Name { get; private set; } + } + } +} diff --git a/Giants.Launcher/Native/RendererInterop.cs b/Giants.Launcher/Native/RendererInterop.cs index 24e1b67..0fa9748 100644 --- a/Giants.Launcher/Native/RendererInterop.cs +++ b/Giants.Launcher/Native/RendererInterop.cs @@ -6,7 +6,7 @@ using System.Windows.Forms; namespace Giants.Launcher { - class RendererInterop + partial class RendererInterop { #pragma warning disable 649 public struct GFXCapabilityInfo @@ -48,9 +48,9 @@ namespace Giants.Launcher public static List GetCompatibleRenderers(string gamePath) { - DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(gamePath)); - - List Capabilities = new List(); + var dir = new DirectoryInfo( + Path.GetDirectoryName(gamePath)); + var capabilities = new List(); // Search current directory for compatible renderers: foreach (FileInfo file in dir.GetFiles("gg_*.dll")) @@ -58,82 +58,21 @@ namespace Giants.Launcher try { // Make interop call to native renderer DLLs to get capability info - RendererInterop.GFXCapabilityInfo interopCaps = new RendererInterop.GFXCapabilityInfo(); + var interopCaps = new RendererInterop.GFXCapabilityInfo(); string path = Path.Combine(file.DirectoryName, file.Name); - if (RendererInterop.GetRendererCapabilities(path, ref interopCaps)) + if (GetRendererCapabilities(path, ref interopCaps)) { - Capabilities caps = new Capabilities(path, ref interopCaps); - Capabilities.Add(caps); - //cmbRenderer.Items.Add(caps); + capabilities.Add(caps); } - - } catch (Exception ex) { - MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } } - return Capabilities; - - // Select highest priority renderer - //cmbRenderer.SelectedItem = _RendererCaps.Max(); - } - - public class Capabilities : IComparable - { - [Flags] - public enum RendererFlag - { - LowBitDepthAllowed = 0x1, - - // Multisampling support flags: - MSAA2x = 0x2, - MSAA4x = 0x4, - MSAA8x = 0x8, - MSAA16x = 0x10, - - // Other options: - VSync = 0x20, - TripleBuffer = 0x40, - - - }; - - public Capabilities(string filePath, ref RendererInterop.GFXCapabilityInfo gfxCaps) - { - this.FilePath = filePath; - this.FileName = Path.GetFileName(filePath); - this.MaxAnisotropy = gfxCaps.maxAnisotropy; - this.Flags = (RendererFlag)gfxCaps.flags; - this.Priority = gfxCaps.priority; - this.Name = gfxCaps.rendererName; - } - - public override string ToString() - { - return string.Format("{0} ({1})", this.Name, Path.GetFileName(this.FilePath)); - } - - public int CompareTo(object obj) - { - if (obj == null) return 1; - - Capabilities other = obj as Capabilities; - if (other != null) - return this.Priority.CompareTo(other.Priority); - else - throw new ArgumentException(); - } - - public string FilePath { get; private set; } - public string FileName { get; private set; } - public int MaxAnisotropy { get; private set; } - public RendererFlag Flags { get; private set; } - public int Priority { get; private set; } - public string Name { get; private set; } + return capabilities; } } } diff --git a/Giants.Launcher/OptionsForm.cs b/Giants.Launcher/OptionsForm.cs index fe9aa9a..d7c6f0f 100644 --- a/Giants.Launcher/OptionsForm.cs +++ b/Giants.Launcher/OptionsForm.cs @@ -28,9 +28,13 @@ namespace Giants.Launcher this.cmbRenderer.Items.Clear(); this.cmbRenderer.Items.AddRange(GameSettings.CompatibleRenderers.ToArray()); - RendererInterop.Capabilities renderer = GameSettings.CompatibleRenderers.Find(r => StringComparer.OrdinalIgnoreCase.Compare(Path.GetFileName(r.FilePath), GameSettings.Get("Renderer")) == 0); + RendererInterop.Capabilities renderer = GameSettings.CompatibleRenderers.Find( + r => StringComparer.OrdinalIgnoreCase.Compare(Path.GetFileName(r.FilePath), GameSettings.Get("Renderer")) == 0); + if (renderer != null) + { this.cmbRenderer.SelectedItem = renderer; + } else { renderer = GameSettings.CompatibleRenderers.Find(r => r.Name == "DirectX 7"); @@ -57,21 +61,28 @@ namespace Giants.Launcher private void PopulateAntialiasing() { - List> AntialiasingOptions = new List>(); - - AntialiasingOptions.Add(new KeyValuePair("None (Best performance)", 0)); + var antialiasingOptions = new List>(); + antialiasingOptions.Add(new KeyValuePair(Resources.OptionNone, 0)); var renderer = (RendererInterop.Capabilities)this.cmbRenderer.SelectedItem; if (renderer != null) { - if ((renderer.Flags & RendererInterop.Capabilities.RendererFlag.MSAA2x) == RendererInterop.Capabilities.RendererFlag.MSAA2x) - AntialiasingOptions.Add(new KeyValuePair("2 Samples", 2)); - if ((renderer.Flags & RendererInterop.Capabilities.RendererFlag.MSAA4x) == RendererInterop.Capabilities.RendererFlag.MSAA4x) - AntialiasingOptions.Add(new KeyValuePair("4 Samples", 4)); - if ((renderer.Flags & RendererInterop.Capabilities.RendererFlag.MSAA8x) == RendererInterop.Capabilities.RendererFlag.MSAA8x) - AntialiasingOptions.Add(new KeyValuePair("8 Samples", 8)); - if ((renderer.Flags & RendererInterop.Capabilities.RendererFlag.MSAA16x) == RendererInterop.Capabilities.RendererFlag.MSAA16x) - AntialiasingOptions.Add(new KeyValuePair("16 Samples", 16)); + if (renderer.Flags.HasFlag(RendererInterop.Capabilities.RendererFlag.MSAA2x)) + { + antialiasingOptions.Add(new KeyValuePair(string.Format(Resources.OptionSamples, 2), 2)); + } + if (renderer.Flags.HasFlag(RendererInterop.Capabilities.RendererFlag.MSAA4x)) + { + antialiasingOptions.Add(new KeyValuePair(string.Format(Resources.OptionSamples, 4), 4)); + } + if (renderer.Flags.HasFlag(RendererInterop.Capabilities.RendererFlag.MSAA8x)) + { + antialiasingOptions.Add(new KeyValuePair(string.Format(Resources.OptionSamples, 8), 8)); + } + if (renderer.Flags.HasFlag(RendererInterop.Capabilities.RendererFlag.MSAA16x)) + { + antialiasingOptions.Add(new KeyValuePair(string.Format(Resources.OptionSamples, 16), 16)); + } } // Try to keep current selection when repopulating @@ -81,7 +92,7 @@ namespace Giants.Launcher currentValue = (int)this.cmbAntialiasing.SelectedValue; } - this.cmbAntialiasing.DataSource = AntialiasingOptions; + this.cmbAntialiasing.DataSource = antialiasingOptions; this.cmbAntialiasing.DisplayMember = "Key"; this.cmbAntialiasing.ValueMember = "Value"; @@ -101,7 +112,7 @@ namespace Giants.Launcher { List> AnisotropyOptions = new List>(); - AnisotropyOptions.Add(new KeyValuePair("None (Best performance)", 0)); + AnisotropyOptions.Add(new KeyValuePair(Resources.OptionNone, 0)); var renderer = (RendererInterop.Capabilities)this.cmbRenderer.SelectedItem; if (renderer != null) @@ -110,7 +121,7 @@ namespace Giants.Launcher { if (!this.IsPowerOfTwo(i)) continue; - AnisotropyOptions.Add(new KeyValuePair(String.Format("{0} Samples", i), i)); + AnisotropyOptions.Add(new KeyValuePair(string.Format(Resources.OptionSamples, i), i)); } } diff --git a/Giants.Launcher/Program.cs b/Giants.Launcher/Program.cs index b69665c..0ed8c81 100644 --- a/Giants.Launcher/Program.cs +++ b/Giants.Launcher/Program.cs @@ -37,18 +37,26 @@ namespace Giants.Launcher Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + + Form form; try { - Application.Run(new LauncherForm()); + form = new LauncherForm(); } catch (Exception ex) { MessageBox.Show( - text: $"Unable to start launcher: {ex.Message}", - caption: "Fatal Error", + text: string.Format(Resources.LauncherFatalError, ex.Message), + caption: Resources.Error, buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error); + + Application.Exit(); + return; } + + Application.Run(form); + } } } diff --git a/Giants.Launcher/Properties/Resources.Designer.cs b/Giants.Launcher/Properties/Resources.Designer.cs index a927f58..f2d8467 100644 --- a/Giants.Launcher/Properties/Resources.Designer.cs +++ b/Giants.Launcher/Properties/Resources.Designer.cs @@ -88,6 +88,42 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to Error. + /// + internal static string Error { + get { + return ResourceManager.GetString("Error", 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.. + /// + internal static string ErrorNoRenderers { + get { + return ResourceManager.GetString("ErrorNoRenderers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not read game settings!\n\nReason: {0}. + /// + internal static string ErrorSettingsLoad { + get { + return ResourceManager.GetString("ErrorSettingsLoad", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not save game settings!\n\nReason: {0}. + /// + internal static string ErrorSettingsSave { + get { + return ResourceManager.GetString("ErrorSettingsSave", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -136,6 +172,15 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to Unable to start launcher: {0}. + /// + internal static string LauncherFatalError { + get { + return ResourceManager.GetString("LauncherFatalError", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. /// @@ -154,6 +199,15 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to None (Best performance). + /// + internal static string OptionNone { + get { + return ResourceManager.GetString("OptionNone", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -164,6 +218,15 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to {0} Samples. + /// + internal static string OptionSamples { + get { + return ResourceManager.GetString("OptionSamples", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Giants.Launcher/Properties/Resources.resx b/Giants.Launcher/Properties/Resources.resx index 4c404e9..087caec 100644 --- a/Giants.Launcher/Properties/Resources.resx +++ b/Giants.Launcher/Properties/Resources.resx @@ -112,12 +112,12 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + ..\Resources\backdrop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -178,4 +178,25 @@ Downloading - {0}% of {1} MB + + Error + + + Could not locate any renderers compatible with your system. The most compatible renderer has been selected, but you may experience difficulty running the game. + + + Could not read game settings!\n\nReason: {0} + + + Could not save game settings!\n\nReason: {0} + + + Unable to start launcher: {0} + + + None (Best performance) + + + {0} Samples + \ No newline at end of file diff --git a/Giants.Launcher/SettingKeys.cs b/Giants.Launcher/SettingKeys.cs new file mode 100644 index 0000000..bcab14e --- /dev/null +++ b/Giants.Launcher/SettingKeys.cs @@ -0,0 +1,18 @@ +namespace Giants.Launcher +{ + public class SettingKeys + { + public const string Antialiasing = "Antialiasing"; + public const string AnisotropicFiltering = "AnisotropicFiltering"; + public const string BorderlessWindow = "BorderlessWindow"; + public const string GameOptionsVersion = "GameOptionsVersion"; + public const string NoAutoUpdate = "NoAutoUpdate"; + public const string Renderer = "Renderer"; + public const string TripleBuffering = "TripleBuffering"; + public const string VerticalSync = "VerticalSync"; + public const string VideoWidth = "VideoWidth"; + public const string VideoHeight = "VideoHeight"; + public const string VideoDepth = "VideoDepth"; + public const string Windowed = "Windowed"; + } +} diff --git a/Giants.Launcher/Updater/UpdateInfo.cs b/Giants.Launcher/Updater/UpdateInfo.cs index 36f6c83..48d0310 100644 --- a/Giants.Launcher/Updater/UpdateInfo.cs +++ b/Giants.Launcher/Updater/UpdateInfo.cs @@ -1,12 +1,11 @@ -using System; -using System.IO; - -namespace Giants.Launcher +namespace Giants.Launcher { public class UpdateInfo { public int FileSize { get; set; } + public string FilePath { get; set; } + public ApplicationType ApplicationType { get; set; } } } diff --git a/Giants.Launcher/WindowType.cs b/Giants.Launcher/WindowType.cs index f0df7d8..214e685 100644 --- a/Giants.Launcher/WindowType.cs +++ b/Giants.Launcher/WindowType.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Giants.Launcher +namespace Giants.Launcher { public enum WindowType {