From bd0f3484bb00e4d990137c77049089c4d7946174 Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Mon, 1 Nov 2021 21:20:22 +1300 Subject: [PATCH] Working user added icons --- DisplayMagician/Properties/AssemblyInfo.cs | 4 +-- .../UIForms/ShortcutForm.Designer.cs | 2 ++ DisplayMagician/UIForms/ShortcutForm.cs | 35 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs index 9f60421..282977e 100644 --- a/DisplayMagician/Properties/AssemblyInfo.cs +++ b/DisplayMagician/Properties/AssemblyInfo.cs @@ -26,8 +26,8 @@ using System.Resources; [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")] // Version information -[assembly: AssemblyVersion("2.1.0.79")] -[assembly: AssemblyFileVersion("2.1.0.79")] +[assembly: AssemblyVersion("2.1.0.83")] +[assembly: AssemblyFileVersion("2.1.0.83")] [assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: CLSCompliant(true)] diff --git a/DisplayMagician/UIForms/ShortcutForm.Designer.cs b/DisplayMagician/UIForms/ShortcutForm.Designer.cs index df00db1..b9cea74 100644 --- a/DisplayMagician/UIForms/ShortcutForm.Designer.cs +++ b/DisplayMagician/UIForms/ShortcutForm.Designer.cs @@ -768,6 +768,7 @@ namespace DisplayMagician.UIForms // // btn_exe_use_different_icon // + this.btn_exe_use_different_icon.Enabled = false; this.btn_exe_use_different_icon.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_exe_use_different_icon.ForeColor = System.Drawing.Color.White; this.btn_exe_use_different_icon.Location = new System.Drawing.Point(880, 159); @@ -1001,6 +1002,7 @@ namespace DisplayMagician.UIForms // // btn_game_use_different_icon // + this.btn_game_use_different_icon.Enabled = false; this.btn_game_use_different_icon.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_game_use_different_icon.ForeColor = System.Drawing.Color.White; this.btn_game_use_different_icon.Location = new System.Drawing.Point(912, 121); diff --git a/DisplayMagician/UIForms/ShortcutForm.cs b/DisplayMagician/UIForms/ShortcutForm.cs index 0607280..20835d1 100644 --- a/DisplayMagician/UIForms/ShortcutForm.cs +++ b/DisplayMagician/UIForms/ShortcutForm.cs @@ -1546,6 +1546,9 @@ namespace DisplayMagician.UIForms private void btn_choose_alternative_executable_Click(object sender, EventArgs e) { + dialog_open.InitialDirectory = Path.GetDirectoryName(_executableToUse.ExecutableNameAndPath); + dialog_open.DefaultExt = "*.exe"; + dialog_open.Filter = "exe files (*.exe;*.com) | *.exe;*.com | All files(*.*) | *.*"; if (dialog_open.ShowDialog(this) == DialogResult.OK) { if (_loadedShortcut) @@ -1814,6 +1817,9 @@ namespace DisplayMagician.UIForms private string getExeFile() { + dialog_open.InitialDirectory = Environment.SpecialFolder.ProgramFiles.ToString(); + dialog_open.DefaultExt = "*.exe"; + dialog_open.Filter = "exe files (*.exe;*.com) | *.exe;*.com | All files(*.*) | *.*"; string textToReturn = ""; if (dialog_open.ShowDialog(this) == DialogResult.OK) { @@ -2224,6 +2230,19 @@ namespace DisplayMagician.UIForms private void btn_choose_alternative_game_Click(object sender, EventArgs e) { + string gamePath = ""; + foreach (Game game in DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries) + { + if (game.Name == txt_game_name.Text) + { + gamePath = game.Directory; + break; + } + } + + dialog_open.InitialDirectory = gamePath; + dialog_open.DefaultExt = "*.exe"; + dialog_open.Filter = "exe files (*.exe;*.com) | *.exe;*.com | All files(*.*) | *.*"; if (dialog_open.ShowDialog(this) == DialogResult.OK) { if (_loadedShortcut) @@ -2529,6 +2548,19 @@ namespace DisplayMagician.UIForms private void btn_game_use_different_icon_Click(object sender, EventArgs e) { + string gamePath = ""; + foreach (Game game in DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries) + { + if (game.Name == txt_game_name.Text) + { + gamePath = game.Directory; + break; + } + } + + dialog_open.InitialDirectory = gamePath; + dialog_open.DefaultExt = "*.exe"; + dialog_open.Filter = "exe or icon files (*.exe;*.com;*.ico) | *.exe;*.com;*.ico | All files(*.*) | *.*"; if (dialog_open.ShowDialog(this) == DialogResult.OK) { if (_loadedShortcut) @@ -2552,6 +2584,9 @@ namespace DisplayMagician.UIForms private void btn_exe_use_different_icon_Click(object sender, EventArgs e) { + dialog_open.InitialDirectory = Path.GetDirectoryName(_executableToUse.ExecutableNameAndPath); + dialog_open.DefaultExt = "*.exe"; + dialog_open.Filter = "exe or icon files (*.exe;*.com;*.ico) | *.exe;*.com;*.ico | All files(*.*) | *.*"; if (dialog_open.ShowDialog(this) == DialogResult.OK) { if (_loadedShortcut)