diff --git a/AppResource.Designer.cs b/AppResource.Designer.cs index 9cf055e..35848c8 100644 --- a/AppResource.Designer.cs +++ b/AppResource.Designer.cs @@ -96,46 +96,6 @@ namespace RokettoLaunch { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap cog2 { - get { - object obj = ResourceManager.GetObject("cog2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap disk2 { - get { - object obj = ResourceManager.GetObject("disk2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap file { - get { - object obj = ResourceManager.GetObject("file", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap folder { - get { - object obj = ResourceManager.GetObject("folder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -146,16 +106,6 @@ namespace RokettoLaunch { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap help2 { - get { - object obj = ResourceManager.GetObject("help2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/AppResource.resx b/AppResource.resx index 22ca018..ead4e1e 100644 --- a/AppResource.resx +++ b/AppResource.resx @@ -130,24 +130,9 @@ https://www.hiimray.co.uk/software-rokettolaunch - - Resources\cog2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\disk2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - Resources\folder_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Resources\help2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - Resources\icon-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/EditTileFolderForm.cs b/EditTileFolderForm.cs index 7e0dcb9..808589c 100644 --- a/EditTileFolderForm.cs +++ b/EditTileFolderForm.cs @@ -70,7 +70,7 @@ namespace RokettoLaunch textBox1.IconSize = 13F; textBox1.Location = new Point(109, 20); textBox1.Name = "textBox1"; - textBox1.Size = new Size(275, 32); + textBox1.Size = new Size(260, 32); textBox1.TabIndex = 152; textBox1.TabStop = false; textBox1.UseSystemPasswordChar = false; @@ -126,6 +126,7 @@ namespace RokettoLaunch dialogFooter1.Button1Text = "&Save"; dialogFooter1.Dialog = this; dialogFooter1.Dock = DockStyle.Bottom; + dialogFooter1.IsBusy = false; dialogFooter1.Location = new Point(0, 437); dialogFooter1.Name = "dialogFooter1"; dialogFooter1.Size = new Size(384, 84); diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 819c016..1f9de9f 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -139,64 +139,64 @@ namespace RokettoLaunch // // newToolStripMenuItem // - newToolStripMenuItem.Image = AppResource.file; + newToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; newToolStripMenuItem.Name = "newToolStripMenuItem"; newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N; - newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + newToolStripMenuItem.Size = new System.Drawing.Size(180, 22); newToolStripMenuItem.Text = "&New"; newToolStripMenuItem.Click += newToolStripMenuItem_Click; // // openToolStripMenuItem // - openToolStripMenuItem.Image = AppResource.folder; + openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; openToolStripMenuItem.Name = "openToolStripMenuItem"; openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O; - openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); openToolStripMenuItem.Text = "&Open"; openToolStripMenuItem.Click += openToolStripMenuItem_Click; // // toolStripMenuItem13 // toolStripMenuItem13.Name = "toolStripMenuItem13"; - toolStripMenuItem13.Size = new System.Drawing.Size(143, 6); + toolStripMenuItem13.Size = new System.Drawing.Size(177, 6); // // closeToolStripMenuItem // closeToolStripMenuItem.Name = "closeToolStripMenuItem"; - closeToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + closeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); closeToolStripMenuItem.Text = "&Close"; closeToolStripMenuItem.Click += closeToolStripMenuItem_Click; // // toolStripMenuItem14 // toolStripMenuItem14.Name = "toolStripMenuItem14"; - toolStripMenuItem14.Size = new System.Drawing.Size(143, 6); + toolStripMenuItem14.Size = new System.Drawing.Size(177, 6); // // saveToolStripMenuItem // - saveToolStripMenuItem.Image = AppResource.disk2; + saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; saveToolStripMenuItem.Name = "saveToolStripMenuItem"; saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S; - saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); saveToolStripMenuItem.Text = "&Save"; saveToolStripMenuItem.Click += saveToolStripMenuItem_Click; // // saveAsToolStripMenuItem // saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); + saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); saveAsToolStripMenuItem.Text = "Save &As..."; saveAsToolStripMenuItem.Click += saveAsToolStripMenuItem_Click; // // toolStripMenuItem15 // toolStripMenuItem15.Name = "toolStripMenuItem15"; - toolStripMenuItem15.Size = new System.Drawing.Size(143, 6); + toolStripMenuItem15.Size = new System.Drawing.Size(177, 6); // // exitToolStripMenuItem2 // exitToolStripMenuItem2.Name = "exitToolStripMenuItem2"; - exitToolStripMenuItem2.Size = new System.Drawing.Size(146, 22); + exitToolStripMenuItem2.Size = new System.Drawing.Size(180, 22); exitToolStripMenuItem2.Text = "E&xit"; exitToolStripMenuItem2.Click += exitToolStripMenuItem2_Click; // @@ -210,7 +210,7 @@ namespace RokettoLaunch // addGroupToolStripMenuItem // addGroupToolStripMenuItem.Name = "addGroupToolStripMenuItem"; - addGroupToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + addGroupToolStripMenuItem.Size = new System.Drawing.Size(180, 22); addGroupToolStripMenuItem.Text = "&Add Group"; addGroupToolStripMenuItem.Click += addGroupToolStripMenuItem_Click; // @@ -224,14 +224,14 @@ namespace RokettoLaunch // showBigIconsToolStripMenuItem // showBigIconsToolStripMenuItem.Name = "showBigIconsToolStripMenuItem"; - showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); showBigIconsToolStripMenuItem.Text = "Show &Big Icons"; showBigIconsToolStripMenuItem.Click += showBigIconsToolStripMenuItem_Click; // // alwaysOnTopToolStripMenuItem // alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem"; - alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(180, 22); alwaysOnTopToolStripMenuItem.Text = "Always On &Top"; alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click; // @@ -244,10 +244,10 @@ namespace RokettoLaunch // // optionsToolStripMenuItem // - optionsToolStripMenuItem.Image = AppResource.cog2; + optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; optionsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12; - optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + optionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); optionsToolStripMenuItem.Text = "&Options"; optionsToolStripMenuItem.Click += optionsToolStripMenuItem_Click; // @@ -260,22 +260,22 @@ namespace RokettoLaunch // // viewHelpToolStripMenuItem1 // - viewHelpToolStripMenuItem1.Image = AppResource.help2; + viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1"; viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1; - viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22); + viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); viewHelpToolStripMenuItem1.Text = "&View Help"; viewHelpToolStripMenuItem1.Click += viewHelpToolStripMenuItem1_Click; // // toolStripMenuItem16 // toolStripMenuItem16.Name = "toolStripMenuItem16"; - toolStripMenuItem16.Size = new System.Drawing.Size(143, 6); + toolStripMenuItem16.Size = new System.Drawing.Size(177, 6); // // aboutToolStripMenuItem1 // aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1"; - aboutToolStripMenuItem1.Size = new System.Drawing.Size(146, 22); + aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); aboutToolStripMenuItem1.Text = "&About"; aboutToolStripMenuItem1.Click += aboutToolStripMenuItem1_Click; // diff --git a/MainForm.cs b/MainForm.cs index c4ac8ca..092068c 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; using System.IO; using System.Linq; using System.Reflection; @@ -32,6 +33,12 @@ namespace RokettoLaunch this.AutoScaleMode = AutoScaleMode.None; this.Text = Application.ProductName; + newToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("a", Color.Black, 2); + openToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("b", Color.Black, 2); + saveToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("c", Color.Black, 2); + optionsToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("i", Color.Black, 2); + viewHelpToolStripMenuItem1.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("j", Color.Black, 2); + _fileSessionManager = new FileSessionManager(); _fileSessionManager.OpenFileDialog = openFileDialog1; _fileSessionManager.SaveFileDialog = saveFileDialog1; @@ -150,7 +157,7 @@ namespace RokettoLaunch { closeToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close); - saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open); + saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open) && _fileSessionManager.HasChanged; saveAsToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close); addGroupToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close); diff --git a/Models/TileModel.cs b/Models/TileModel.cs index e61f02d..b70d6a6 100644 --- a/Models/TileModel.cs +++ b/Models/TileModel.cs @@ -27,40 +27,76 @@ namespace RokettoLaunch.Models public List Items { get; set; } = new List(); + public string Version { get; set; } + + public override string ToString() => this.Title ?? string.Empty; - public string CleanProcessFilename => (string.IsNullOrWhiteSpace(this.ProcessFilename) ? string.Empty : resolvePath(this.ProcessFilename)); - public string CleanProcessArgument => (string.IsNullOrWhiteSpace(this.ProcessArgument) ? string.Empty : resolvePath(this.ProcessArgument)); - - public string CleanProcessWorkingDirectory => (string.IsNullOrWhiteSpace(this.ProcessWorkingDirectory) ? string.Empty : resolvePath(this.ProcessWorkingDirectory)); - - protected string resolvePath(string value) + [JsonIgnore] + public string CleanProcessFilename { - string rv = Environment.ExpandEnvironmentVariables(value); - - rv = resolveFirstPath(rv); - rv = resolveLastPath(rv); - - return rv; + get + { + return (string.IsNullOrWhiteSpace(this.ProcessFilename) ? string.Empty : ResolvePath(this.ProcessFilename)); + } } - protected string resolveFirstPath(string value) + [JsonIgnore] + public string CleanProcessArgument { - const string last = "%FIRST%"; - if (!value.Contains(last)) + get { - return value; + return (string.IsNullOrWhiteSpace(this.ProcessArgument) ? string.Empty : ResolvePath(this.ProcessArgument)); + } + } + + [JsonIgnore] + public string CleanProcessWorkingDirectory + { + get + { + return (string.IsNullOrWhiteSpace(this.ProcessWorkingDirectory) ? string.Empty : ResolvePath(this.ProcessWorkingDirectory)); + } + } + + + private Tuple SplitPath(string path, string needle) + { + if (string.IsNullOrWhiteSpace(path)) + { + return null; } - string head = value.Substring(0, value.IndexOf(last)); - string tail = value.Substring(value.IndexOf(last) + last.Length); + if (string.IsNullOrWhiteSpace(needle)) + { + return null; + } + + if (!path.Contains(needle)) + { + return null; + } + + string head = path.Substring(0, path.IndexOf(needle)); + string tail = path.Substring(path.IndexOf(needle) + needle.Length); + + return new Tuple(head, tail); + } + + private string GetFirstPath(string value) + { + var parts = SplitPath(value, "%FIRST%"); + if (parts == null) + { + return null; + } string[] dirList = new string[0]; try { - dirList = System.IO.Directory.GetDirectories(head, "*", System.IO.SearchOption.TopDirectoryOnly); + dirList = System.IO.Directory.GetDirectories(parts.Item1, "*", System.IO.SearchOption.TopDirectoryOnly); } catch { @@ -69,28 +105,25 @@ namespace RokettoLaunch.Models if (dirList.Length <= 0) { - return value; + return null; } - return dirList[0] + tail; + return System.IO.Path.GetFileName(dirList[0]); } - protected string resolveLastPath(string value) + private string GetLastPath(string value) { - const string last = "%LAST%"; - if (!value.Contains(last)) + var parts = SplitPath(value, "%LAST%"); + if (parts == null) { - return value; + return null; } - string head = value.Substring(0, value.IndexOf(last)); - string tail = value.Substring(value.IndexOf(last) + last.Length); - string[] dirList = new string[0]; try { - dirList = System.IO.Directory.GetDirectories(head, "*", System.IO.SearchOption.TopDirectoryOnly); + dirList = System.IO.Directory.GetDirectories(parts.Item1, "*", System.IO.SearchOption.TopDirectoryOnly); } catch { @@ -98,12 +131,129 @@ namespace RokettoLaunch.Models } if (dirList.Length <= 0) + { + return null; + } + + return System.IO.Path.GetFileName(dirList[(dirList.Length - 1)]); + } + + private string ResolvePath(string path) + { + var result = Environment.ExpandEnvironmentVariables(path); + + if (result.Contains("%FIRST%")) + { + result = ResolveFirstPath(result); + } + + if (result.Contains("%LAST%")) + { + result = ResolveLastPath(result); + } + + return result; + } + + private string ResolveFirstPath(string value) + { + var parts = SplitPath(value, "%FIRST%"); + if (parts == null) { return value; } - return dirList[(dirList.Length - 1)] + tail; + try + { + if (!System.IO.Directory.Exists(parts.Item1)) + { + return value; + } + } + catch (Exception) + { + return value; + } + + // Try cached version + if (!string.IsNullOrWhiteSpace(this.Version)) + { + var filename = parts.Item1 + this.Version + parts.Item2; + + try + { + if (System.IO.File.Exists(filename)) + { + return filename; + } + } + catch (Exception) + { + + } + } + + // Resolve version + var version = GetFirstPath(value); + if (version == null) + { + return value; + } + + this.Version = version; + + return parts.Item1 + version + parts.Item2; + } + + private string ResolveLastPath(string value) + { + var parts = SplitPath(value, "%LAST%"); + if (parts == null) + { + return value; + } + + try + { + if (!System.IO.Directory.Exists(parts.Item1)) + { + return value; + } + } + catch (Exception) + { + return value; + } + + // Try cached version + if (!string.IsNullOrWhiteSpace(this.Version)) + { + var filename = parts.Item1 + this.Version + parts.Item2; + + try + { + if (System.IO.File.Exists(filename)) + { + return filename; + } + } + catch (Exception) + { + + } + } + + // Resolve version + var version = GetLastPath(value); + if (version == null) + { + return value; + } + + this.Version = version; + + return parts.Item1 + version + parts.Item2; } } -} +} \ No newline at end of file diff --git a/Resources/cog2.png b/Resources/cog2.png deleted file mode 100644 index d40221f..0000000 Binary files a/Resources/cog2.png and /dev/null differ diff --git a/Resources/disk2.png b/Resources/disk2.png deleted file mode 100644 index 29b59a4..0000000 Binary files a/Resources/disk2.png and /dev/null differ diff --git a/Resources/file.png b/Resources/file.png deleted file mode 100644 index c4b89eb..0000000 Binary files a/Resources/file.png and /dev/null differ diff --git a/Resources/folder.png b/Resources/folder.png deleted file mode 100644 index 7ec26c4..0000000 Binary files a/Resources/folder.png and /dev/null differ diff --git a/Resources/help2.png b/Resources/help2.png deleted file mode 100644 index ae6856d..0000000 Binary files a/Resources/help2.png and /dev/null differ diff --git a/RokettoLaunch.csproj b/RokettoLaunch.csproj index f2bcf75..27c2043 100644 --- a/RokettoLaunch.csproj +++ b/RokettoLaunch.csproj @@ -14,7 +14,7 @@ Ray Lam 1.0.0.0 1.0.0.0 - 0.3.4.164 + 0.3.5.0335 False x64 icon-128.png @@ -79,8 +79,8 @@ - - + + diff --git a/Windows/Forms/TilePanel.cs b/Windows/Forms/TilePanel.cs index c8b235b..1af5b60 100644 --- a/Windows/Forms/TilePanel.cs +++ b/Windows/Forms/TilePanel.cs @@ -87,6 +87,10 @@ namespace RokettoLaunch.Windows.Forms { if (this.ModelInfo.IsGroup) { + var iconSize = ((this.MainForm?.CurrentSession?.ShowBigIcons ?? true) ? 24 : 16); + + this.LeftContextMenuStrip.ImageScalingSize = new Size(iconSize, iconSize); + this.LeftContextMenuStrip?.Show(this, e.Location); } else @@ -169,14 +173,11 @@ namespace RokettoLaunch.Windows.Forms private void InvalidateGroupMenu(TileModel model) { - var iconSize = ((this.MainForm?.CurrentSession?.ShowBigIcons ?? true) ? 24 : 16); - if (this.LeftContextMenuStrip == null) { this.LeftContextMenuStrip = new ContextMenuStrip(); } - this.LeftContextMenuStrip.ImageScalingSize = new Size(iconSize, iconSize); this.LeftContextMenuStrip.Items.Clear(); foreach (TileModel item in model?.Items ?? new System.Collections.Generic.List()) diff --git a/build-installer.iss b/build-installer.iss index 90f83e4..cb9092c 100644 --- a/build-installer.iss +++ b/build-installer.iss @@ -2,13 +2,13 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "RokettoLaunch" -#define MyAppVersion "0.3.4.164" +#define MyAppVersion "0.3.5.335" #define MyAppPublisher "Hi, I'm Ray" #define MyAppURL "https://www.hiimray.co.uk/software-fizzy-launcher" #define MyAppExeName "rokettolaunch.exe" -#define AppSourcePath "L:\gitea-hiimray\linear-app-launcher\bin" -#define AppReleasePath "L:\gitea-hiimray\linear-app-launcher\bin" +#define AppSourcePath "L:\gitea-hiimray\roketto-launch\bin" +#define AppReleasePath "L:\gitea-hiimray\roketto-launch\bin" #define AppReleaseName "rokettolaunch-installer"