From 6afd2613fe9fe20de4fce6f9f90107bb77517e36 Mon Sep 17 00:00:00 2001 From: papa Date: Sat, 27 Jan 2024 20:19:13 +0900 Subject: [PATCH 01/15] Converted project to dotnet 8 --- MultiForm.cs | 1 + MultiForm.resx | 120 +++++++++++++++++++++++++++++ RDBEd.cs | 29 +++---- RDBEd.csproj | 57 ++++---------- RDBEd.sln | 4 +- app.config | 3 + obj/RDBEd.csproj.nuget.dgspec.json | 66 ++++++++++++++++ obj/RDBEd.csproj.nuget.g.props | 15 ++++ obj/RDBEd.csproj.nuget.g.targets | 2 + obj/project.assets.json | 71 +++++++++++++++++ obj/project.nuget.cache | 8 ++ 11 files changed, 317 insertions(+), 59 deletions(-) create mode 100644 MultiForm.resx create mode 100644 app.config create mode 100644 obj/RDBEd.csproj.nuget.dgspec.json create mode 100644 obj/RDBEd.csproj.nuget.g.props create mode 100644 obj/RDBEd.csproj.nuget.g.targets create mode 100644 obj/project.assets.json create mode 100644 obj/project.nuget.cache diff --git a/MultiForm.cs b/MultiForm.cs index 3bc7abc..d8fa338 100644 --- a/MultiForm.cs +++ b/MultiForm.cs @@ -23,6 +23,7 @@ public class MultiForm : Form { public MultiForm() { + Application.SetDefaultFont(new Font(new FontFamily("Microsoft Sans Serif"), 8f)); InitializeComponent(); this.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); } diff --git a/MultiForm.resx b/MultiForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MultiForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RDBEd.cs b/RDBEd.cs index 5b2fdaa..e4d7fd3 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -19,11 +19,6 @@ using System.IO; using System.Windows.Forms; using System.Text.RegularExpressions; - -[assembly: System.Reflection.AssemblyProduct("RDBEd")] -[assembly: System.Reflection.AssemblyTitle("RDBEd - Retro RDB & DAT Editor")] -[assembly: System.Reflection.AssemblyVersion("1.4.0.0")] -[assembly: System.Reflection.AssemblyFileVersion("1.4.0.0")] [assembly: System.Runtime.InteropServices.ComVisible(false)] namespace RDBEd { static class About { public const string Text = "RDBEd 1.4 - Retro RDB & DAT Editor\n\nhttps://github.com/schellingb/RDBEd"; } } @@ -1690,17 +1685,22 @@ [STAThread] static void Main(string[] args) if (e.Button == MouseButtons.Right) { Point menuPos = f.gridMain.PointToClient(Cursor.Position); - ContextMenu context = new ContextMenu(); + // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ContextMenuStrip context = new ContextMenuStrip(); foreach (DataGridViewColumn col in f.gridMain.Columns) { - MenuItem i = context.MenuItems.Add(col.HeaderText); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ToolStripMenuItem i = context.MenuItems.Add(col.HeaderText); i.Checked = col.Visible; i.Tag = col; i.Click += (object objI, EventArgs ee) => { - (objI as MenuItem).Checked ^= true; - ((DataGridViewColumn)(objI as MenuItem).Tag).Visible ^= true; - (objI as MenuItem).GetContextMenu().Show(f.gridMain, menuPos); + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + (objI as ToolStripMenuItem).Checked ^= true; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ((DataGridViewColumn)(objI as ToolStripMenuItem).Tag).Visible ^= true; + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + (objI as ToolStripMenuItem).GetContextMenu().Show(f.gridMain, menuPos); }; } context.Show(f.gridMain, menuPos); @@ -1840,8 +1840,9 @@ [STAThread] static void Main(string[] args) MouseEventArgs me = e as MouseEventArgs; if (me == null || me.Button != MouseButtons.Right) return; if (f.gridMain.HitTest(me.X, me.Y).Type != DataGridViewHitTestType.None) return; - ContextMenu context = new ContextMenu(); - context.MenuItems.Add("Add New Row").Click += (object objI, EventArgs ee) => + // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ContextMenuStrip context = new ContextMenuStrip(); + context.Items.Add("Add New Row").Click += (object objI, EventArgs ee) => { int fdRow = (f.gridMain.FirstDisplayedCell != null ? f.gridMain.FirstDisplayedCell.RowIndex : 0); int fdColumn = (f.gridMain.FirstDisplayedCell != null ? f.gridMain.FirstDisplayedCell.ColumnIndex : 0); @@ -1859,7 +1860,8 @@ [STAThread] static void Main(string[] args) if (e.RowIndex < 0 || e.RowIndex >= Data.Filter.Count || e.ColumnIndex < 0 || e.Button != MouseButtons.Right) return; DataGridViewCell cell = f.gridMain[e.ColumnIndex, e.RowIndex]; - ContextMenu context = new ContextMenu(); + // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls + ContextMenuStrip context = new ContextMenuStrip(); if (cell.Selected) { @@ -1969,6 +1971,7 @@ [STAThread] static void Main(string[] args) new KeyValuePair("IGDB", "https://www.igdb.com/search?type=1&q=asdf"), }) { + // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls MenuItem i = context.MenuItems.Add(u.Key); i.Click += (object objI, EventArgs ee) => { diff --git a/RDBEd.csproj b/RDBEd.csproj index 2687021..b9aab4c 100644 --- a/RDBEd.csproj +++ b/RDBEd.csproj @@ -1,14 +1,7 @@ - - - + - Debug - AnyCPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61} + net8.0-windows WinExe - RDBEd - RDBEd - 512 RDBEd.ico publish\ true @@ -25,61 +18,37 @@ false false false - - + false + true + true - v4.5 - AnyCPU - true - full - false Debug\ $(OutputPath) - DEBUG;TRACE - prompt - 4 false true - false - v4.5 Release\45\ $(OutputPath) - AnyCPU - pdbonly true - TRACE - prompt - 4 - false DOTNET35 DOTNET45 + RDBEd + RDBEd - Retro RDB & DAT Editor + 1.4.0.0 + 1.4.0.0 DEBUG;DOTNET45 - - - - - - - - - Form - - - Form - - - Form - - + + + + \ No newline at end of file diff --git a/RDBEd.sln b/RDBEd.sln index dc1f79b..5267c73 100644 --- a/RDBEd.sln +++ b/RDBEd.sln @@ -1,8 +1,8 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RDBEd", "RDBEd.csproj", "{05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RDBEd", "RDBEd.csproj", "{05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/app.config b/app.config new file mode 100644 index 0000000..3e0e37c --- /dev/null +++ b/app.config @@ -0,0 +1,3 @@ + + + diff --git a/obj/RDBEd.csproj.nuget.dgspec.json b/obj/RDBEd.csproj.nuget.dgspec.json new file mode 100644 index 0000000..8fadd64 --- /dev/null +++ b/obj/RDBEd.csproj.nuget.dgspec.json @@ -0,0 +1,66 @@ +{ + "format": 1, + "restore": { + "C:\\github\\RDBEd\\RDBEd.csproj": {} + }, + "projects": { + "C:\\github\\RDBEd\\RDBEd.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\github\\RDBEd\\RDBEd.csproj", + "projectName": "RDBEd", + "projectPath": "C:\\github\\RDBEd\\RDBEd.csproj", + "packagesPath": "C:\\Users\\kevin\\.nuget\\packages\\", + "outputPath": "C:\\github\\RDBEd\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\kevin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0-windows" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0-windows7.0": { + "targetAlias": "net8.0-windows", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0-windows7.0": { + "targetAlias": "net8.0-windows", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + }, + "Microsoft.WindowsDesktop.App.WindowsForms": { + "privateAssets": "none" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.101/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/obj/RDBEd.csproj.nuget.g.props b/obj/RDBEd.csproj.nuget.g.props new file mode 100644 index 0000000..bab185c --- /dev/null +++ b/obj/RDBEd.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\kevin\.nuget\packages\ + PackageReference + 6.8.0 + + + + + \ No newline at end of file diff --git a/obj/RDBEd.csproj.nuget.g.targets b/obj/RDBEd.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/obj/RDBEd.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/obj/project.assets.json b/obj/project.assets.json new file mode 100644 index 0000000..fd82ca0 --- /dev/null +++ b/obj/project.assets.json @@ -0,0 +1,71 @@ +{ + "version": 3, + "targets": { + "net8.0-windows7.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0-windows7.0": [] + }, + "packageFolders": { + "C:\\Users\\kevin\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\github\\RDBEd\\RDBEd.csproj", + "projectName": "RDBEd", + "projectPath": "C:\\github\\RDBEd\\RDBEd.csproj", + "packagesPath": "C:\\Users\\kevin\\.nuget\\packages\\", + "outputPath": "C:\\github\\RDBEd\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\kevin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net8.0-windows" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net8.0-windows7.0": { + "targetAlias": "net8.0-windows", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net8.0-windows7.0": { + "targetAlias": "net8.0-windows", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + }, + "Microsoft.WindowsDesktop.App.WindowsForms": { + "privateAssets": "none" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.101/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache new file mode 100644 index 0000000..ebf9b96 --- /dev/null +++ b/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "3AYMMDQRHonZJvPVC5voipSsuViJgsR49wMK4vDO8Mc+4/cIY9JOT3BFcmHBOkD4eLPF51+c7UzYc29Wemt+og==", + "success": true, + "projectFilePath": "C:\\github\\RDBEd\\RDBEd.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file From cdb48fcada8665a5a9ee565e3586f6e595068020 Mon Sep 17 00:00:00 2001 From: papa Date: Sat, 27 Jan 2024 20:44:03 +0900 Subject: [PATCH 02/15] Fixed compile errors --- RDBEd.cs | 63 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/RDBEd.cs b/RDBEd.cs index e4d7fd3..c08bfdc 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -1690,17 +1690,26 @@ [STAThread] static void Main(string[] args) foreach (DataGridViewColumn col in f.gridMain.Columns) { // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls - ToolStripMenuItem i = context.MenuItems.Add(col.HeaderText); + ToolStripMenuItem i = new ToolStripMenuItem(col.HeaderText); i.Checked = col.Visible; i.Tag = col; i.Click += (object objI, EventArgs ee) => { - // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls - (objI as ToolStripMenuItem).Checked ^= true; - // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls - ((DataGridViewColumn)(objI as ToolStripMenuItem).Tag).Visible ^= true; - // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls - (objI as ToolStripMenuItem).GetContextMenu().Show(f.gridMain, menuPos); + ToolStripMenuItem clickedItem = objI as ToolStripMenuItem; + if (clickedItem != null) + { + clickedItem.Checked ^= true; + DataGridViewColumn clickedColumn = clickedItem.Tag as DataGridViewColumn; + if (clickedColumn != null) + { + clickedColumn.Visible ^= true; + ContextMenuStrip contextMenu = clickedItem.GetCurrentParent() as ContextMenuStrip; + if (contextMenu != null) + { + contextMenu.Show(f.gridMain, menuPos); + } + } + } }; } context.Show(f.gridMain, menuPos); @@ -1876,7 +1885,7 @@ [STAThread] static void Main(string[] args) if (revertable != 0) { - context.MenuItems.Add("Revert " + (revertable != 1 ? revertable + " Values" : "Value")).Click += (object objI, EventArgs ee) => + context.Items.Add("Revert " + (revertable != 1 ? revertable + " Values" : "Value")).Click += (object objI, EventArgs ee) => { if (MessageBox.Show("Are you sure you want to revert " + revertable + " value" + (revertable != 1 ? "s" : "") + "?", "Revert", MessageBoxButtons.YesNo) != DialogResult.Yes) return; foreach (DataGridViewCell c in f.gridMain.SelectedCells) @@ -1888,9 +1897,9 @@ [STAThread] static void Main(string[] args) } }; } - int rowCount = (rowLast - rowFirst) + 1; - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add(new ToolStripSeparator()); + Action AddRows = (int filterIdx, int allIdx) => { int fdRow = f.gridMain.FirstDisplayedCell.RowIndex, fdColumn = f.gridMain.FirstDisplayedCell.ColumnIndex; @@ -1903,10 +1912,19 @@ [STAThread] static void Main(string[] args) RefreshBinding(updateCount: true); f.gridMain.FirstDisplayedCell = f.gridMain[fdColumn, fdRow]; }; + string nRows = (rowCount > 1 ? " " + rowCount + " Rows" : " Row"); - context.MenuItems.Add("Add" + nRows + " Above").Click += (object objI, EventArgs ee) => AddRows(rowFirst, Data.AllEntries.IndexOf(Data.Filter[rowFirst])); - context.MenuItems.Add("Add" + nRows + " Below").Click += (object objI, EventArgs ee) => AddRows(rowLast + 1, Data.AllEntries.IndexOf(Data.Filter[rowLast]) + 1); - context.MenuItems.Add("Remove" + nRows).Click += (object objI, EventArgs ee) => + + ToolStripMenuItem addAboveItem = new ToolStripMenuItem("Add" + nRows + " Above"); + addAboveItem.Click += (object objI, EventArgs ee) => AddRows(rowFirst, Data.AllEntries.IndexOf(Data.Filter[rowFirst])); + context.Items.Add(addAboveItem); + + ToolStripMenuItem addBelowItem = new ToolStripMenuItem("Add" + nRows + " Below"); + addBelowItem.Click += (object objI, EventArgs ee) => AddRows(rowLast + 1, Data.AllEntries.IndexOf(Data.Filter[rowLast]) + 1); + context.Items.Add(addBelowItem); + + ToolStripMenuItem removeRowsItem = new ToolStripMenuItem("Remove" + nRows); + removeRowsItem.Click += (object objI, EventArgs ee) => { if (MessageBox.Show("Are you sure you want to remove " + rowCount + " row" + (rowCount > 1 ? "s" : "") + "?", "Remove", MessageBoxButtons.YesNo) != DialogResult.Yes) return; int fdRow = f.gridMain.FirstDisplayedCell.RowIndex, fdColumn = f.gridMain.FirstDisplayedCell.ColumnIndex; @@ -1922,10 +1940,11 @@ [STAThread] static void Main(string[] args) Data.Recount(); RefreshBinding(updateCount: false); }; + context.Items.Add(removeRowsItem); } else if ((Data.Filter[e.RowIndex].FieldFlags[e.ColumnIndex] & EFieldFlag.Modified) != 0 && (Data.Filter[e.RowIndex].RowFlags & ERowFlag.FromFile) != 0) { - context.MenuItems.Add("Revert").Click += (object objI, EventArgs ee) => + context.Items.Add("Revert").Click += (object objI, EventArgs ee) => { Data.Filter[e.RowIndex].Revert(f.gridMain.Columns[e.ColumnIndex].DataPropertyName); }; @@ -1943,22 +1962,22 @@ [STAThread] static void Main(string[] args) } }; bool hasValue = (cellValue != null && cellValue.ToString().Length != 0); - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add("-"); if (hasValue) { string cellStr = (cellValue.ToString().Length > 20 ? cellValue.ToString().Substring(0, 20) + "..." : cellValue.ToString()); - context.MenuItems.Add("Filter '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; - context.MenuItems.Add("Filter NOT '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; + context.Items.Add("Filter '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; + context.Items.Add("Filter NOT '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; } else { - context.MenuItems.Add("Filter Empty").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; - context.MenuItems.Add("Filter NOT Empty").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; + context.Items.Add("Filter Empty").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; + context.Items.Add("Filter NOT Empty").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; } if (hasValue && f.webView != null) { - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add("-"); foreach (var u in new KeyValuePair[] { new KeyValuePair("Google", "https://www.google.com/search?ie=utf-8&oe=utf-8&q=" ), @@ -1972,7 +1991,7 @@ [STAThread] static void Main(string[] args) }) { // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls - MenuItem i = context.MenuItems.Add(u.Key); + ToolStripItem i = context.Items.Add(u.Key); i.Click += (object objI, EventArgs ee) => { if (f.splitContainer.Panel2Collapsed) @@ -1984,7 +2003,7 @@ [STAThread] static void Main(string[] args) }; } } - if (context.MenuItems.Count != 0) + if (context.Items.Count != 0) context.Show(f.gridMain, f.gridMain.PointToClient(Cursor.Position)); return; }; From a41a44cb6df42b69489c32abdd40b1a74f18ab90 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 11:41:42 +0900 Subject: [PATCH 03/15] fixed warning --- RDBEd.cs | 5 +++-- RegexForm.cs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RDBEd.cs b/RDBEd.cs index c08bfdc..f545082 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -12,13 +12,14 @@ * You should have received a copy of the GNU General Public License along with RDBEd. * If not, see . */ - +using System.Runtime.Versioning; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; using System.Text.RegularExpressions; +[assembly: SupportedOSPlatform("windows")] [assembly: System.Runtime.InteropServices.ComVisible(false)] namespace RDBEd { static class About { public const string Text = "RDBEd 1.4 - Retro RDB & DAT Editor\n\nhttps://github.com/schellingb/RDBEd"; } } @@ -1627,7 +1628,7 @@ static void OpenMultiForm(string title, string info, Action o mf.btnCancel.Click += (object s, EventArgs e) => mf.Close(); mf.ShowDialog(); } - + [SupportedOSPlatform("windows")] [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); diff --git a/RegexForm.cs b/RegexForm.cs index 00f7bcf..211dfa1 100644 --- a/RegexForm.cs +++ b/RegexForm.cs @@ -15,6 +15,7 @@ using System; using System.Drawing; +using System.Runtime.Versioning; using System.Windows.Forms; namespace RDBEd From e823e10cbbbf8d6dfc472dcd371b411b409e35c5 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 12:25:24 +0900 Subject: [PATCH 04/15] cleanup --- .gitignore | 1 + RDBEd.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7a87045..73f9d42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Debug/ Release/ +obj/ .vs/ *.suo *.user diff --git a/RDBEd.cs b/RDBEd.cs index f545082..5f01ea6 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -1628,7 +1628,6 @@ static void OpenMultiForm(string title, string info, Action o mf.btnCancel.Click += (object s, EventArgs e) => mf.Close(); mf.ShowDialog(); } - [SupportedOSPlatform("windows")] [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); From e0d0a951b20874fc5acff86d4d7e356894e849bc Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 12:29:35 +0900 Subject: [PATCH 05/15] cleanup --- obj/RDBEd.csproj.nuget.dgspec.json | 66 --------------------------- obj/RDBEd.csproj.nuget.g.props | 15 ------- obj/RDBEd.csproj.nuget.g.targets | 2 - obj/project.assets.json | 71 ------------------------------ obj/project.nuget.cache | 8 ---- 5 files changed, 162 deletions(-) delete mode 100644 obj/RDBEd.csproj.nuget.dgspec.json delete mode 100644 obj/RDBEd.csproj.nuget.g.props delete mode 100644 obj/RDBEd.csproj.nuget.g.targets delete mode 100644 obj/project.assets.json delete mode 100644 obj/project.nuget.cache diff --git a/obj/RDBEd.csproj.nuget.dgspec.json b/obj/RDBEd.csproj.nuget.dgspec.json deleted file mode 100644 index 8fadd64..0000000 --- a/obj/RDBEd.csproj.nuget.dgspec.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "format": 1, - "restore": { - "C:\\github\\RDBEd\\RDBEd.csproj": {} - }, - "projects": { - "C:\\github\\RDBEd\\RDBEd.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "C:\\github\\RDBEd\\RDBEd.csproj", - "projectName": "RDBEd", - "projectPath": "C:\\github\\RDBEd\\RDBEd.csproj", - "packagesPath": "C:\\Users\\kevin\\.nuget\\packages\\", - "outputPath": "C:\\github\\RDBEd\\obj\\", - "projectStyle": "PackageReference", - "configFilePaths": [ - "C:\\Users\\kevin\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0-windows" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0-windows7.0": { - "targetAlias": "net8.0-windows", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net8.0-windows7.0": { - "targetAlias": "net8.0-windows", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - }, - "Microsoft.WindowsDesktop.App.WindowsForms": { - "privateAssets": "none" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.101/PortableRuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/obj/RDBEd.csproj.nuget.g.props b/obj/RDBEd.csproj.nuget.g.props deleted file mode 100644 index bab185c..0000000 --- a/obj/RDBEd.csproj.nuget.g.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\kevin\.nuget\packages\ - PackageReference - 6.8.0 - - - - - \ No newline at end of file diff --git a/obj/RDBEd.csproj.nuget.g.targets b/obj/RDBEd.csproj.nuget.g.targets deleted file mode 100644 index 3dc06ef..0000000 --- a/obj/RDBEd.csproj.nuget.g.targets +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/obj/project.assets.json b/obj/project.assets.json deleted file mode 100644 index fd82ca0..0000000 --- a/obj/project.assets.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "version": 3, - "targets": { - "net8.0-windows7.0": {} - }, - "libraries": {}, - "projectFileDependencyGroups": { - "net8.0-windows7.0": [] - }, - "packageFolders": { - "C:\\Users\\kevin\\.nuget\\packages\\": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "C:\\github\\RDBEd\\RDBEd.csproj", - "projectName": "RDBEd", - "projectPath": "C:\\github\\RDBEd\\RDBEd.csproj", - "packagesPath": "C:\\Users\\kevin\\.nuget\\packages\\", - "outputPath": "C:\\github\\RDBEd\\obj\\", - "projectStyle": "PackageReference", - "configFilePaths": [ - "C:\\Users\\kevin\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0-windows" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0-windows7.0": { - "targetAlias": "net8.0-windows", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - } - }, - "frameworks": { - "net8.0-windows7.0": { - "targetAlias": "net8.0-windows", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - }, - "Microsoft.WindowsDesktop.App.WindowsForms": { - "privateAssets": "none" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.101/PortableRuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache deleted file mode 100644 index ebf9b96..0000000 --- a/obj/project.nuget.cache +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "3AYMMDQRHonZJvPVC5voipSsuViJgsR49wMK4vDO8Mc+4/cIY9JOT3BFcmHBOkD4eLPF51+c7UzYc29Wemt+og==", - "success": true, - "projectFilePath": "C:\\github\\RDBEd\\RDBEd.csproj", - "expectedPackageFiles": [], - "logs": [] -} \ No newline at end of file From 85e1607587f3821a5f8a4777fd500ba72cb067b3 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 12:36:59 +0900 Subject: [PATCH 06/15] cleanup --- RegexForm.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/RegexForm.cs b/RegexForm.cs index 211dfa1..1e82def 100644 --- a/RegexForm.cs +++ b/RegexForm.cs @@ -13,9 +13,6 @@ * If not, see . */ -using System; -using System.Drawing; -using System.Runtime.Versioning; using System.Windows.Forms; namespace RDBEd From 8829cb5fa0471b97d340fc8656440498f4feea00 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 12:46:29 +0900 Subject: [PATCH 07/15] cleanup --- RDBEd.cs | 5 ----- RDBEd.csproj | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/RDBEd.cs b/RDBEd.cs index 5f01ea6..1bb37a1 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -1685,11 +1685,9 @@ [STAThread] static void Main(string[] args) if (e.Button == MouseButtons.Right) { Point menuPos = f.gridMain.PointToClient(Cursor.Position); - // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls ContextMenuStrip context = new ContextMenuStrip(); foreach (DataGridViewColumn col in f.gridMain.Columns) { - // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls ToolStripMenuItem i = new ToolStripMenuItem(col.HeaderText); i.Checked = col.Visible; i.Tag = col; @@ -1849,7 +1847,6 @@ [STAThread] static void Main(string[] args) MouseEventArgs me = e as MouseEventArgs; if (me == null || me.Button != MouseButtons.Right) return; if (f.gridMain.HitTest(me.X, me.Y).Type != DataGridViewHitTestType.None) return; - // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls ContextMenuStrip context = new ContextMenuStrip(); context.Items.Add("Add New Row").Click += (object objI, EventArgs ee) => { @@ -1869,7 +1866,6 @@ [STAThread] static void Main(string[] args) if (e.RowIndex < 0 || e.RowIndex >= Data.Filter.Count || e.ColumnIndex < 0 || e.Button != MouseButtons.Right) return; DataGridViewCell cell = f.gridMain[e.ColumnIndex, e.RowIndex]; - // TODO ContextMenu is no longer supported. Use ContextMenuStrip instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls ContextMenuStrip context = new ContextMenuStrip(); if (cell.Selected) @@ -1990,7 +1986,6 @@ [STAThread] static void Main(string[] args) new KeyValuePair("IGDB", "https://www.igdb.com/search?type=1&q=asdf"), }) { - // TODO MenuItem is no longer supported. Use ToolStripMenuItem instead. For more details see https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls ToolStripItem i = context.Items.Add(u.Key); i.Click += (object objI, EventArgs ee) => { diff --git a/RDBEd.csproj b/RDBEd.csproj index b9aab4c..12c984f 100644 --- a/RDBEd.csproj +++ b/RDBEd.csproj @@ -40,6 +40,7 @@ RDBEd - Retro RDB & DAT Editor 1.4.0.0 1.4.0.0 + warnings DEBUG;DOTNET45 From e4996000f513a80221e16c078f750d6d117b6643 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 12:57:12 +0900 Subject: [PATCH 08/15] activated github action --- .github/dependabot.yml | 6 +++++ .github/workflows/Build.yml | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/Build.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 0000000..da7adc5 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,45 @@ +name: Build RDBeD + +on: + push: + pull_request: + repository_dispatch: + types: [run_build] + +permissions: + contents: read + +jobs: + + build: + runs-on: windows-2022 + strategy: + matrix: + version: [2022] + configuration: [Debug, Release] + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET command line + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + + - name: Create Docker Image + run: dotnet publish ./Wowshop.API/Wowshop.API.csproj /t:PublishContainer -r linux-x64 + + - name: Get SHA + id: slug + shell: powershell + run: echo "sha8=$('${{github.sha}}'.Substring(0,8))" >> $env:GITHUB_OUTPUT + + - uses: actions/upload-artifact@v4 + with: + name: RDBeD-${{matrix.version}}-${{matrix.configuration}}-${{ steps.slug.outputs.sha8 }} + path: ${{matrix.configuration}}/**/* + From e58f09610b89637f7e34051370111a9a4fc79176 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 13:00:24 +0900 Subject: [PATCH 09/15] fixed publishing --- .github/workflows/Build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index da7adc5..92d9e2d 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -30,8 +30,8 @@ jobs: - name: Build run: dotnet build --no-restore - - name: Create Docker Image - run: dotnet publish ./Wowshop.API/Wowshop.API.csproj /t:PublishContainer -r linux-x64 + - name: package app + run: dotnet publish ./RDBEd.csproj /t:Publish - name: Get SHA id: slug From 10b1489cdbb9e50b8a7b1b3d2999eac6eff03465 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 13:45:37 +0900 Subject: [PATCH 10/15] removed old dotenet45 references --- RDBEd.csproj | 13 ++++--------- RDBEd.sln | 6 +++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/RDBEd.csproj b/RDBEd.csproj index 12c984f..bbc1598 100644 --- a/RDBEd.csproj +++ b/RDBEd.csproj @@ -19,6 +19,7 @@ false false false + false true true @@ -28,14 +29,12 @@ false true - - Release\45\ + + Release\ $(OutputPath) true - DOTNET35 - DOTNET45 RDBEd RDBEd - Retro RDB & DAT Editor 1.4.0.0 @@ -43,13 +42,9 @@ warnings - DEBUG;DOTNET45 + DEBUG - - - - \ No newline at end of file diff --git a/RDBEd.sln b/RDBEd.sln index 5267c73..43c131c 100644 --- a/RDBEd.sln +++ b/RDBEd.sln @@ -7,13 +7,13 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release45|Any CPU = Release45|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Debug|Any CPU.Build.0 = Debug|Any CPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release45|Any CPU.ActiveCfg = Release45|Any CPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release45|Any CPU.Build.0 = Release45|Any CPU + {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 9efdcf1c8c93182773fee957cd820b9d0dad7e3e Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 14:04:07 +0900 Subject: [PATCH 11/15] updated dotnet setup action version to 4 --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 92d9e2d..94968b6 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup .NET command line - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.x From 1d7c9c561d1fa86d7f3d5142b2b3be8023205b44 Mon Sep 17 00:00:00 2001 From: papa Date: Sat, 27 Jan 2024 20:19:13 +0900 Subject: [PATCH 12/15] updated project to dotnet 8 Converted project to dotnet 8 Added github Actions --- .github/dependabot.yml | 6 ++ .github/workflows/Build.yml | 45 ++++++++++++++ .gitignore | 1 + MultiForm.cs | 1 + MultiForm.resx | 120 ++++++++++++++++++++++++++++++++++++ RDBEd.cs | 77 ++++++++++++++--------- RDBEd.csproj | 63 +++++-------------- RDBEd.sln | 10 +-- RegexForm.cs | 2 - app.config | 3 + 10 files changed, 242 insertions(+), 86 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/Build.yml create mode 100644 MultiForm.resx create mode 100644 app.config diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 0000000..94968b6 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,45 @@ +name: Build RDBeD + +on: + push: + pull_request: + repository_dispatch: + types: [run_build] + +permissions: + contents: read + +jobs: + + build: + runs-on: windows-2022 + strategy: + matrix: + version: [2022] + configuration: [Debug, Release] + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET command line + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + + - name: package app + run: dotnet publish ./RDBEd.csproj /t:Publish + + - name: Get SHA + id: slug + shell: powershell + run: echo "sha8=$('${{github.sha}}'.Substring(0,8))" >> $env:GITHUB_OUTPUT + + - uses: actions/upload-artifact@v4 + with: + name: RDBeD-${{matrix.version}}-${{matrix.configuration}}-${{ steps.slug.outputs.sha8 }} + path: ${{matrix.configuration}}/**/* + diff --git a/.gitignore b/.gitignore index 7a87045..73f9d42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Debug/ Release/ +obj/ .vs/ *.suo *.user diff --git a/MultiForm.cs b/MultiForm.cs index 3bc7abc..d8fa338 100644 --- a/MultiForm.cs +++ b/MultiForm.cs @@ -23,6 +23,7 @@ public class MultiForm : Form { public MultiForm() { + Application.SetDefaultFont(new Font(new FontFamily("Microsoft Sans Serif"), 8f)); InitializeComponent(); this.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); } diff --git a/MultiForm.resx b/MultiForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MultiForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/RDBEd.cs b/RDBEd.cs index 5b2fdaa..1bb37a1 100644 --- a/RDBEd.cs +++ b/RDBEd.cs @@ -12,18 +12,14 @@ * You should have received a copy of the GNU General Public License along with RDBEd. * If not, see . */ - +using System.Runtime.Versioning; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; using System.Text.RegularExpressions; - -[assembly: System.Reflection.AssemblyProduct("RDBEd")] -[assembly: System.Reflection.AssemblyTitle("RDBEd - Retro RDB & DAT Editor")] -[assembly: System.Reflection.AssemblyVersion("1.4.0.0")] -[assembly: System.Reflection.AssemblyFileVersion("1.4.0.0")] +[assembly: SupportedOSPlatform("windows")] [assembly: System.Runtime.InteropServices.ComVisible(false)] namespace RDBEd { static class About { public const string Text = "RDBEd 1.4 - Retro RDB & DAT Editor\n\nhttps://github.com/schellingb/RDBEd"; } } @@ -1632,7 +1628,6 @@ static void OpenMultiForm(string title, string info, Action o mf.btnCancel.Click += (object s, EventArgs e) => mf.Close(); mf.ShowDialog(); } - [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); @@ -1690,17 +1685,29 @@ [STAThread] static void Main(string[] args) if (e.Button == MouseButtons.Right) { Point menuPos = f.gridMain.PointToClient(Cursor.Position); - ContextMenu context = new ContextMenu(); + ContextMenuStrip context = new ContextMenuStrip(); foreach (DataGridViewColumn col in f.gridMain.Columns) { - MenuItem i = context.MenuItems.Add(col.HeaderText); + ToolStripMenuItem i = new ToolStripMenuItem(col.HeaderText); i.Checked = col.Visible; i.Tag = col; i.Click += (object objI, EventArgs ee) => { - (objI as MenuItem).Checked ^= true; - ((DataGridViewColumn)(objI as MenuItem).Tag).Visible ^= true; - (objI as MenuItem).GetContextMenu().Show(f.gridMain, menuPos); + ToolStripMenuItem clickedItem = objI as ToolStripMenuItem; + if (clickedItem != null) + { + clickedItem.Checked ^= true; + DataGridViewColumn clickedColumn = clickedItem.Tag as DataGridViewColumn; + if (clickedColumn != null) + { + clickedColumn.Visible ^= true; + ContextMenuStrip contextMenu = clickedItem.GetCurrentParent() as ContextMenuStrip; + if (contextMenu != null) + { + contextMenu.Show(f.gridMain, menuPos); + } + } + } }; } context.Show(f.gridMain, menuPos); @@ -1840,8 +1847,8 @@ [STAThread] static void Main(string[] args) MouseEventArgs me = e as MouseEventArgs; if (me == null || me.Button != MouseButtons.Right) return; if (f.gridMain.HitTest(me.X, me.Y).Type != DataGridViewHitTestType.None) return; - ContextMenu context = new ContextMenu(); - context.MenuItems.Add("Add New Row").Click += (object objI, EventArgs ee) => + ContextMenuStrip context = new ContextMenuStrip(); + context.Items.Add("Add New Row").Click += (object objI, EventArgs ee) => { int fdRow = (f.gridMain.FirstDisplayedCell != null ? f.gridMain.FirstDisplayedCell.RowIndex : 0); int fdColumn = (f.gridMain.FirstDisplayedCell != null ? f.gridMain.FirstDisplayedCell.ColumnIndex : 0); @@ -1859,7 +1866,7 @@ [STAThread] static void Main(string[] args) if (e.RowIndex < 0 || e.RowIndex >= Data.Filter.Count || e.ColumnIndex < 0 || e.Button != MouseButtons.Right) return; DataGridViewCell cell = f.gridMain[e.ColumnIndex, e.RowIndex]; - ContextMenu context = new ContextMenu(); + ContextMenuStrip context = new ContextMenuStrip(); if (cell.Selected) { @@ -1874,7 +1881,7 @@ [STAThread] static void Main(string[] args) if (revertable != 0) { - context.MenuItems.Add("Revert " + (revertable != 1 ? revertable + " Values" : "Value")).Click += (object objI, EventArgs ee) => + context.Items.Add("Revert " + (revertable != 1 ? revertable + " Values" : "Value")).Click += (object objI, EventArgs ee) => { if (MessageBox.Show("Are you sure you want to revert " + revertable + " value" + (revertable != 1 ? "s" : "") + "?", "Revert", MessageBoxButtons.YesNo) != DialogResult.Yes) return; foreach (DataGridViewCell c in f.gridMain.SelectedCells) @@ -1886,9 +1893,9 @@ [STAThread] static void Main(string[] args) } }; } - int rowCount = (rowLast - rowFirst) + 1; - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add(new ToolStripSeparator()); + Action AddRows = (int filterIdx, int allIdx) => { int fdRow = f.gridMain.FirstDisplayedCell.RowIndex, fdColumn = f.gridMain.FirstDisplayedCell.ColumnIndex; @@ -1901,10 +1908,19 @@ [STAThread] static void Main(string[] args) RefreshBinding(updateCount: true); f.gridMain.FirstDisplayedCell = f.gridMain[fdColumn, fdRow]; }; + string nRows = (rowCount > 1 ? " " + rowCount + " Rows" : " Row"); - context.MenuItems.Add("Add" + nRows + " Above").Click += (object objI, EventArgs ee) => AddRows(rowFirst, Data.AllEntries.IndexOf(Data.Filter[rowFirst])); - context.MenuItems.Add("Add" + nRows + " Below").Click += (object objI, EventArgs ee) => AddRows(rowLast + 1, Data.AllEntries.IndexOf(Data.Filter[rowLast]) + 1); - context.MenuItems.Add("Remove" + nRows).Click += (object objI, EventArgs ee) => + + ToolStripMenuItem addAboveItem = new ToolStripMenuItem("Add" + nRows + " Above"); + addAboveItem.Click += (object objI, EventArgs ee) => AddRows(rowFirst, Data.AllEntries.IndexOf(Data.Filter[rowFirst])); + context.Items.Add(addAboveItem); + + ToolStripMenuItem addBelowItem = new ToolStripMenuItem("Add" + nRows + " Below"); + addBelowItem.Click += (object objI, EventArgs ee) => AddRows(rowLast + 1, Data.AllEntries.IndexOf(Data.Filter[rowLast]) + 1); + context.Items.Add(addBelowItem); + + ToolStripMenuItem removeRowsItem = new ToolStripMenuItem("Remove" + nRows); + removeRowsItem.Click += (object objI, EventArgs ee) => { if (MessageBox.Show("Are you sure you want to remove " + rowCount + " row" + (rowCount > 1 ? "s" : "") + "?", "Remove", MessageBoxButtons.YesNo) != DialogResult.Yes) return; int fdRow = f.gridMain.FirstDisplayedCell.RowIndex, fdColumn = f.gridMain.FirstDisplayedCell.ColumnIndex; @@ -1920,10 +1936,11 @@ [STAThread] static void Main(string[] args) Data.Recount(); RefreshBinding(updateCount: false); }; + context.Items.Add(removeRowsItem); } else if ((Data.Filter[e.RowIndex].FieldFlags[e.ColumnIndex] & EFieldFlag.Modified) != 0 && (Data.Filter[e.RowIndex].RowFlags & ERowFlag.FromFile) != 0) { - context.MenuItems.Add("Revert").Click += (object objI, EventArgs ee) => + context.Items.Add("Revert").Click += (object objI, EventArgs ee) => { Data.Filter[e.RowIndex].Revert(f.gridMain.Columns[e.ColumnIndex].DataPropertyName); }; @@ -1941,22 +1958,22 @@ [STAThread] static void Main(string[] args) } }; bool hasValue = (cellValue != null && cellValue.ToString().Length != 0); - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add("-"); if (hasValue) { string cellStr = (cellValue.ToString().Length > 20 ? cellValue.ToString().Substring(0, 20) + "..." : cellValue.ToString()); - context.MenuItems.Add("Filter '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; - context.MenuItems.Add("Filter NOT '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; + context.Items.Add("Filter '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; + context.Items.Add("Filter NOT '" + cellStr + "'").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; } else { - context.MenuItems.Add("Filter Empty").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; - context.MenuItems.Add("Filter NOT Empty").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; + context.Items.Add("Filter Empty").Click += (object objI, EventArgs ee) => { AppendFilter(true); }; + context.Items.Add("Filter NOT Empty").Click += (object objI, EventArgs ee) => { AppendFilter(false); }; } if (hasValue && f.webView != null) { - if (context.MenuItems.Count != 0) context.MenuItems.Add("-"); + if (context.Items.Count != 0) context.Items.Add("-"); foreach (var u in new KeyValuePair[] { new KeyValuePair("Google", "https://www.google.com/search?ie=utf-8&oe=utf-8&q=" ), @@ -1969,7 +1986,7 @@ [STAThread] static void Main(string[] args) new KeyValuePair("IGDB", "https://www.igdb.com/search?type=1&q=asdf"), }) { - MenuItem i = context.MenuItems.Add(u.Key); + ToolStripItem i = context.Items.Add(u.Key); i.Click += (object objI, EventArgs ee) => { if (f.splitContainer.Panel2Collapsed) @@ -1981,7 +1998,7 @@ [STAThread] static void Main(string[] args) }; } } - if (context.MenuItems.Count != 0) + if (context.Items.Count != 0) context.Show(f.gridMain, f.gridMain.PointToClient(Cursor.Position)); return; }; diff --git a/RDBEd.csproj b/RDBEd.csproj index 2687021..bbc1598 100644 --- a/RDBEd.csproj +++ b/RDBEd.csproj @@ -1,14 +1,7 @@ - - - + - Debug - AnyCPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61} + net8.0-windows WinExe - RDBEd - RDBEd - 512 RDBEd.ico publish\ true @@ -25,61 +18,33 @@ false false false - - + false + false + true + true - v4.5 - AnyCPU - true - full - false Debug\ $(OutputPath) - DEBUG;TRACE - prompt - 4 false true - false - - v4.5 - Release\45\ + + Release\ $(OutputPath) - AnyCPU - pdbonly true - TRACE - prompt - 4 - false - DOTNET35 - DOTNET45 + RDBEd + RDBEd - Retro RDB & DAT Editor + 1.4.0.0 + 1.4.0.0 + warnings - DEBUG;DOTNET45 + DEBUG - - - - - - - - - Form - - - Form - - - Form - - \ No newline at end of file diff --git a/RDBEd.sln b/RDBEd.sln index dc1f79b..43c131c 100644 --- a/RDBEd.sln +++ b/RDBEd.sln @@ -1,19 +1,19 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RDBEd", "RDBEd.csproj", "{05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RDBEd", "RDBEd.csproj", "{05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release45|Any CPU = Release45|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Debug|Any CPU.Build.0 = Debug|Any CPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release45|Any CPU.ActiveCfg = Release45|Any CPU - {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release45|Any CPU.Build.0 = Release45|Any CPU + {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RegexForm.cs b/RegexForm.cs index 00f7bcf..1e82def 100644 --- a/RegexForm.cs +++ b/RegexForm.cs @@ -13,8 +13,6 @@ * If not, see . */ -using System; -using System.Drawing; using System.Windows.Forms; namespace RDBEd diff --git a/app.config b/app.config new file mode 100644 index 0000000..3e0e37c --- /dev/null +++ b/app.config @@ -0,0 +1,3 @@ + + + From b8402679a533f8bac2fe3705d18d415d75f14970 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 15:10:40 +0900 Subject: [PATCH 13/15] removed references to dotnet framework 4.x --- app.config | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 app.config diff --git a/app.config b/app.config deleted file mode 100644 index 3e0e37c..0000000 --- a/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - From d8748a52037d6513a0154e4194ce5ebc5fde8494 Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 18:37:13 +0900 Subject: [PATCH 14/15] cleanup --- MultiForm.resx | 120 ------------------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 MultiForm.resx diff --git a/MultiForm.resx b/MultiForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/MultiForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file From 389a47b439427bdb893ea9ea87aae109c364453b Mon Sep 17 00:00:00 2001 From: papa Date: Sun, 28 Jan 2024 19:51:25 +0900 Subject: [PATCH 15/15] cleanup --- .github/dependabot.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5ace460..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly"