Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -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}}/**/*

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Debug/
Release/
obj/
.vs/
*.suo
*.user
1 change: 1 addition & 0 deletions MultiForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
77 changes: 47 additions & 30 deletions RDBEd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
* You should have received a copy of the GNU General Public License along with RDBEd.
* If not, see <http://www.gnu.org/licenses/>.
*/

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"; } }

Expand Down Expand Up @@ -1632,7 +1628,6 @@ static void OpenMultiForm(string title, string info, Action<MultiForm, string> o
mf.btnCancel.Click += (object s, EventArgs e) => mf.Close();
mf.ShowDialog();
}

[STAThread] static void Main(string[] args)
{
Application.EnableVisualStyles();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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)
{
Expand All @@ -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)
Expand All @@ -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<int, int> AddRows = (int filterIdx, int allIdx) =>
{
int fdRow = f.gridMain.FirstDisplayedCell.RowIndex, fdColumn = f.gridMain.FirstDisplayedCell.ColumnIndex;
Expand All @@ -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;
Expand All @@ -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);
};
Expand All @@ -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<string, string>[]
{
new KeyValuePair<string, string>("Google", "https://www.google.com/search?ie=utf-8&oe=utf-8&q=" ),
Expand All @@ -1969,7 +1986,7 @@ [STAThread] static void Main(string[] args)
new KeyValuePair<string, string>("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)
Expand All @@ -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;
};
Expand Down
63 changes: 14 additions & 49 deletions RDBEd.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<Platform Condition="'$(Platform)'==''">AnyCPU</Platform>
<ProjectGuid>{05D6A76D-F8F5-4E20-AB51-2CA534EA3C61}</ProjectGuid>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>RDBEd</RootNamespace>
<AssemblyName>RDBEd</AssemblyName>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>RDBEd.ico</ApplicationIcon>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
Expand All @@ -25,61 +18,33 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>false</BootstrapperEnabled>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Debug\</OutputPath>
<IntermediateOutputPath>$(OutputPath)</IntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release45'">
<TargetFrameworkVersion Condition="'$(Configuration)'=='Release45'">v4.5</TargetFrameworkVersion>
<OutputPath Condition="'$(Configuration)'=='Release45'">Release\45\</OutputPath>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<OutputPath>Release\</OutputPath>
<IntermediateOutputPath>$(OutputPath)</IntermediateOutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(TargetFrameworkVersion)'=='v3.5'">DOTNET35</DefineConstants>
<DefineConstants Condition="'$(TargetFrameworkVersion)'=='v4.5'">DOTNET45</DefineConstants>
<Product>RDBEd</Product>
<AssemblyTitle>RDBEd - Retro RDB &amp; DAT Editor</AssemblyTitle>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<FileVersion>1.4.0.0</FileVersion>
<Nullable>warnings</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>DEBUG;DOTNET45</DefineConstants>
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Compile Include="RDBEd.cs" />
<Compile Include="RDBEdForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MultiForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RegexForm.cs">
<SubType>Form</SubType>
</Compile>
<Content Include="RDBEd.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
10 changes: 5 additions & 5 deletions RDBEd.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions RegexForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Drawing;
using System.Windows.Forms;

namespace RDBEd
Expand Down