From 054e5662679dd0ae5be5a589c929caff8b8f2c9e Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:08:08 +0200 Subject: [PATCH 01/10] Add Option Strict and Option Explicit to code --- BackEnd/Data Access/TableComments.vb | 3 +++ BackEnd/Data Access/Tables.vb | 3 +++ BackEnd/Data Access/Tables/AutoIncrementTable.vb | 3 +++ BackEnd/Data Access/Tables/ControlTable.vb | 5 ++++- BackEnd/Data Access/Tables/DefaultTable.vb | 3 +++ BackEnd/Data Access/Tables/DuplicateEntryTable.vb | 3 +++ BackEnd/Data Access/Tables/EnemyItemTable.vb | 3 +++ BackEnd/Data Access/Tables/InventoryTable.vb | 5 ++++- BackEnd/Data Access/Tables/IteTable.vb | 5 ++++- BackEnd/Data Access/Tables/ItemTable.vb | 3 +++ BackEnd/Data Access/Tables/ItemTransformationTable.vb | 5 ++++- BackEnd/Data Access/Tables/MercStartingGearTable.vb | 5 ++++- BackEnd/Data Access/Tables/SoundTable.vb | 3 +++ BackEnd/Data Access/Tables/WeaponTable.vb | 5 ++++- BackEnd/Data Access/Utility.vb | 3 +++ BackEnd/Data Access/XmlDB.vb | 3 +++ BackEnd/DataManager.vb | 5 ++++- BackEnd/DatabaseCode.vb | 3 +++ BackEnd/ErrorHandler.vb | 3 +++ BackEnd/Images/ItemImageManager.vb | 3 +++ BackEnd/Images/STI.vb | 3 +++ BackEnd/Localization.vb | 5 ++++- BackEnd/LookupFile.vb | 3 +++ GUI/App Forms/AboutForm.vb | 3 +++ GUI/App Forms/MainForm.vb | 3 +++ GUI/App Forms/SplashForm.vb | 3 +++ GUI/ApplicationEvents.vb | 5 ++++- GUI/Data Forms/BaseDataForm.vb | 3 +++ GUI/Data Forms/ItemDataForm.vb | 3 +++ GUI/Data Forms/MercGearDataForm.vb | 3 +++ GUI/Forms/BitCodeMakerForm.vb | 5 ++++- GUI/Forms/ChangeClassForm.vb | 3 +++ GUI/Forms/ColumnSelectForm.vb | 3 +++ GUI/Forms/CustomFilterForm.vb | 3 +++ GUI/Forms/EnterItemIDForm.vb | 3 +++ GUI/Forms/LoadingForm.vb | 3 +++ GUI/Forms/NewItemForm.vb | 3 +++ GUI/Forms/SimpleFormBase.vb | 3 +++ GUI/Grid Forms/ChildDataGridForm.vb | 3 +++ GUI/Grid Forms/DataGridForm.vb | 3 +++ GUI/Grid Forms/GridForm.vb | 3 +++ GUI/Grid Forms/GridUtility.vb | 3 +++ GUI/Grid Forms/ItemGridForm.vb | 3 +++ GUI/Grid Forms/LookupGridForm.vb | 3 +++ GUI/Grid Forms/MercGearGridForm.vb | 3 +++ GUI/IniFile.vb | 3 +++ GUI/Main.vb | 3 +++ GUI/SettingsUtility.vb | 3 +++ 48 files changed, 154 insertions(+), 10 deletions(-) diff --git a/BackEnd/Data Access/TableComments.vb b/BackEnd/Data Access/TableComments.vb index a703207..44efdb9 100644 --- a/BackEnd/Data Access/TableComments.vb +++ b/BackEnd/Data Access/TableComments.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports System.Runtime.CompilerServices diff --git a/BackEnd/Data Access/Tables.vb b/BackEnd/Data Access/Tables.vb index 7948ed6..3413794 100644 --- a/BackEnd/Data Access/Tables.vb +++ b/BackEnd/Data Access/Tables.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class Tables Public Const Sounds As String = "SOUND" Public Const BurstSounds As String = "BURSTSOUND" diff --git a/BackEnd/Data Access/Tables/AutoIncrementTable.vb b/BackEnd/Data Access/Tables/AutoIncrementTable.vb index e734fb9..d6d79b6 100644 --- a/BackEnd/Data Access/Tables/AutoIncrementTable.vb +++ b/BackEnd/Data Access/Tables/AutoIncrementTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class AutoIncrementTable diff --git a/BackEnd/Data Access/Tables/ControlTable.vb b/BackEnd/Data Access/Tables/ControlTable.vb index d229891..5546cb6 100644 --- a/BackEnd/Data Access/Tables/ControlTable.vb +++ b/BackEnd/Data Access/Tables/ControlTable.vb @@ -1,4 +1,7 @@ -Imports System.Xml +Option Strict On +Option Explicit On + +Imports System.Xml Imports System.IO Imports System.Data diff --git a/BackEnd/Data Access/Tables/DefaultTable.vb b/BackEnd/Data Access/Tables/DefaultTable.vb index c8e448b..44d312e 100644 --- a/BackEnd/Data Access/Tables/DefaultTable.vb +++ b/BackEnd/Data Access/Tables/DefaultTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports System.IO diff --git a/BackEnd/Data Access/Tables/DuplicateEntryTable.vb b/BackEnd/Data Access/Tables/DuplicateEntryTable.vb index e812834..a249804 100644 --- a/BackEnd/Data Access/Tables/DuplicateEntryTable.vb +++ b/BackEnd/Data Access/Tables/DuplicateEntryTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data 'for incompatible attachments and compatible face items diff --git a/BackEnd/Data Access/Tables/EnemyItemTable.vb b/BackEnd/Data Access/Tables/EnemyItemTable.vb index 6529618..ebbc5f4 100644 --- a/BackEnd/Data Access/Tables/EnemyItemTable.vb +++ b/BackEnd/Data Access/Tables/EnemyItemTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class EnemyItemTable diff --git a/BackEnd/Data Access/Tables/InventoryTable.vb b/BackEnd/Data Access/Tables/InventoryTable.vb index be0bba3..c1e6446 100644 --- a/BackEnd/Data Access/Tables/InventoryTable.vb +++ b/BackEnd/Data Access/Tables/InventoryTable.vb @@ -1,4 +1,7 @@ -Imports System.Data +Option Strict On +Option Explicit On + +Imports System.Data Imports System.Xml Public Class InventoryTable diff --git a/BackEnd/Data Access/Tables/IteTable.vb b/BackEnd/Data Access/Tables/IteTable.vb index 7086229..1e10afe 100644 --- a/BackEnd/Data Access/Tables/IteTable.vb +++ b/BackEnd/Data Access/Tables/IteTable.vb @@ -1,4 +1,7 @@ -Imports System.Data +Option Strict On +Option Explicit On + +Imports System.Data Public Class IteTable Inherits DefaultTable diff --git a/BackEnd/Data Access/Tables/ItemTable.vb b/BackEnd/Data Access/Tables/ItemTable.vb index 44b858f..55def45 100644 --- a/BackEnd/Data Access/Tables/ItemTable.vb +++ b/BackEnd/Data Access/Tables/ItemTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Xml Imports System.IO Imports System.Data diff --git a/BackEnd/Data Access/Tables/ItemTransformationTable.vb b/BackEnd/Data Access/Tables/ItemTransformationTable.vb index 8116221..1b27e3d 100644 --- a/BackEnd/Data Access/Tables/ItemTransformationTable.vb +++ b/BackEnd/Data Access/Tables/ItemTransformationTable.vb @@ -1,4 +1,7 @@ -Imports System.Xml +Option Strict On +Option Explicit On + +Imports System.Xml Imports System.IO Imports System.Data diff --git a/BackEnd/Data Access/Tables/MercStartingGearTable.vb b/BackEnd/Data Access/Tables/MercStartingGearTable.vb index ad0d014..681f463 100644 --- a/BackEnd/Data Access/Tables/MercStartingGearTable.vb +++ b/BackEnd/Data Access/Tables/MercStartingGearTable.vb @@ -1,4 +1,7 @@ -Imports System.Xml +Option Strict On +Option Explicit On + +Imports System.Xml Imports System.IO Imports System.Data diff --git a/BackEnd/Data Access/Tables/SoundTable.vb b/BackEnd/Data Access/Tables/SoundTable.vb index 67ce3c2..0e7664a 100644 --- a/BackEnd/Data Access/Tables/SoundTable.vb +++ b/BackEnd/Data Access/Tables/SoundTable.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class SoundTable diff --git a/BackEnd/Data Access/Tables/WeaponTable.vb b/BackEnd/Data Access/Tables/WeaponTable.vb index d4512d9..6991670 100644 --- a/BackEnd/Data Access/Tables/WeaponTable.vb +++ b/BackEnd/Data Access/Tables/WeaponTable.vb @@ -1,4 +1,7 @@ -Imports System.Xml +Option Strict On +Option Explicit On + +Imports System.Xml Imports System.IO Imports System.Xml.Linq Imports System.Data diff --git a/BackEnd/Data Access/Utility.vb b/BackEnd/Data Access/Utility.vb index f80d538..a3fa024 100644 --- a/BackEnd/Data Access/Utility.vb +++ b/BackEnd/Data Access/Utility.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports System.Runtime.CompilerServices diff --git a/BackEnd/Data Access/XmlDB.vb b/BackEnd/Data Access/XmlDB.vb index 0ba679a..7c390e9 100644 --- a/BackEnd/Data Access/XmlDB.vb +++ b/BackEnd/Data Access/XmlDB.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class XmlDB diff --git a/BackEnd/DataManager.vb b/BackEnd/DataManager.vb index 7f2c9e5..8057804 100644 --- a/BackEnd/DataManager.vb +++ b/BackEnd/DataManager.vb @@ -1,4 +1,7 @@ -Public Class DataManager +Option Strict On +Option Explicit On + +Public Class DataManager Protected _dataDirectory As String Protected _gameDirRussianPath As String Protected _gameDirPolishPath As String diff --git a/BackEnd/DatabaseCode.vb b/BackEnd/DatabaseCode.vb index c951c91..91561e5 100644 --- a/BackEnd/DatabaseCode.vb +++ b/BackEnd/DatabaseCode.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports System.Security.Cryptography.Pkcs diff --git a/BackEnd/ErrorHandler.vb b/BackEnd/ErrorHandler.vb index 10e7118..25ccb26 100644 --- a/BackEnd/ErrorHandler.vb +++ b/BackEnd/ErrorHandler.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class ErrorHandler Protected Shared strLogFilename As String diff --git a/BackEnd/Images/ItemImageManager.vb b/BackEnd/Images/ItemImageManager.vb index 460db94..0c26d5b 100644 --- a/BackEnd/Images/ItemImageManager.vb +++ b/BackEnd/Images/ItemImageManager.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Windows.Forms Imports System.Drawing diff --git a/BackEnd/Images/STI.vb b/BackEnd/Images/STI.vb index 3830347..1bcb98a 100644 --- a/BackEnd/Images/STI.vb +++ b/BackEnd/Images/STI.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System Imports System.Drawing Imports System.Drawing.Imaging diff --git a/BackEnd/Localization.vb b/BackEnd/Localization.vb index 30a056f..7c8b554 100644 --- a/BackEnd/Localization.vb +++ b/BackEnd/Localization.vb @@ -1,4 +1,7 @@ -Public Module Localization +Option Strict On +Option Explicit On + +Public Module Localization Public Function IsLanguageSpecificFile(ByVal filename As String) As Boolean Dim langSpec = False diff --git a/BackEnd/LookupFile.vb b/BackEnd/LookupFile.vb index a20dad4..145401f 100644 --- a/BackEnd/LookupFile.vb +++ b/BackEnd/LookupFile.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class LookupFile diff --git a/GUI/App Forms/AboutForm.vb b/GUI/App Forms/AboutForm.vb index 09c02ce..cbcbf77 100644 --- a/GUI/App Forms/AboutForm.vb +++ b/GUI/App Forms/AboutForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public NotInheritable Class AboutForm Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load diff --git a/GUI/App Forms/MainForm.vb b/GUI/App Forms/MainForm.vb index 3952ec8..40c0446 100644 --- a/GUI/App Forms/MainForm.vb +++ b/GUI/App Forms/MainForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Windows.Forms Public Class MainForm diff --git a/GUI/App Forms/SplashForm.vb b/GUI/App Forms/SplashForm.vb index 2acf8c9..e6de6e8 100644 --- a/GUI/App Forms/SplashForm.vb +++ b/GUI/App Forms/SplashForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public NotInheritable Class SplashForm 'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab diff --git a/GUI/ApplicationEvents.vb b/GUI/ApplicationEvents.vb index 83eb605..7acfd14 100644 --- a/GUI/ApplicationEvents.vb +++ b/GUI/ApplicationEvents.vb @@ -1,4 +1,7 @@ -Namespace My +Option Strict On +Option Explicit On + +Namespace My ' The following events are available for MyApplication: ' Startup: Raised when the application starts, before the startup form is created. ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. diff --git a/GUI/Data Forms/BaseDataForm.vb b/GUI/Data Forms/BaseDataForm.vb index b8aadbe..f45b5e5 100644 --- a/GUI/Data Forms/BaseDataForm.vb +++ b/GUI/Data Forms/BaseDataForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class BaseDataForm diff --git a/GUI/Data Forms/ItemDataForm.vb b/GUI/Data Forms/ItemDataForm.vb index 603f8d4..f63c6fa 100644 --- a/GUI/Data Forms/ItemDataForm.vb +++ b/GUI/Data Forms/ItemDataForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports System.Diagnostics.Metrics diff --git a/GUI/Data Forms/MercGearDataForm.vb b/GUI/Data Forms/MercGearDataForm.vb index ce6e849..cc6cc3a 100644 --- a/GUI/Data Forms/MercGearDataForm.vb +++ b/GUI/Data Forms/MercGearDataForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class MercGearDataForm Inherits BaseDataForm diff --git a/GUI/Forms/BitCodeMakerForm.vb b/GUI/Forms/BitCodeMakerForm.vb index d7ed60d..96be715 100644 --- a/GUI/Forms/BitCodeMakerForm.vb +++ b/GUI/Forms/BitCodeMakerForm.vb @@ -1,4 +1,7 @@ -Imports System.Data +Option Strict On +Option Explicit On + +Imports System.Data Public Class BitCodeMakerForm Protected _dm As DataManager diff --git a/GUI/Forms/ChangeClassForm.vb b/GUI/Forms/ChangeClassForm.vb index 3766f7b..f761bfd 100644 --- a/GUI/Forms/ChangeClassForm.vb +++ b/GUI/Forms/ChangeClassForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class ChangeClassForm diff --git a/GUI/Forms/ColumnSelectForm.vb b/GUI/Forms/ColumnSelectForm.vb index 5794cd4..1507ecf 100644 --- a/GUI/Forms/ColumnSelectForm.vb +++ b/GUI/Forms/ColumnSelectForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class ColumnSelectForm diff --git a/GUI/Forms/CustomFilterForm.vb b/GUI/Forms/CustomFilterForm.vb index 6983d06..6d373aa 100644 --- a/GUI/Forms/CustomFilterForm.vb +++ b/GUI/Forms/CustomFilterForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.ComponentModel Public Class CustomFilterForm diff --git a/GUI/Forms/EnterItemIDForm.vb b/GUI/Forms/EnterItemIDForm.vb index 844f624..f8cc55e 100644 --- a/GUI/Forms/EnterItemIDForm.vb +++ b/GUI/Forms/EnterItemIDForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class EnterItemIDForm diff --git a/GUI/Forms/LoadingForm.vb b/GUI/Forms/LoadingForm.vb index 10731d1..8adbae0 100644 --- a/GUI/Forms/LoadingForm.vb +++ b/GUI/Forms/LoadingForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class LoadingForm Private _saving As Boolean diff --git a/GUI/Forms/NewItemForm.vb b/GUI/Forms/NewItemForm.vb index 7c0982a..a6dad21 100644 --- a/GUI/Forms/NewItemForm.vb +++ b/GUI/Forms/NewItemForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class NewItemForm diff --git a/GUI/Forms/SimpleFormBase.vb b/GUI/Forms/SimpleFormBase.vb index dd3953f..33c4175 100644 --- a/GUI/Forms/SimpleFormBase.vb +++ b/GUI/Forms/SimpleFormBase.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class SimpleFormBase Protected _dm As DataManager diff --git a/GUI/Grid Forms/ChildDataGridForm.vb b/GUI/Grid Forms/ChildDataGridForm.vb index 5ab792c..ca64449 100644 --- a/GUI/Grid Forms/ChildDataGridForm.vb +++ b/GUI/Grid Forms/ChildDataGridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class ChildDataGridForm diff --git a/GUI/Grid Forms/DataGridForm.vb b/GUI/Grid Forms/DataGridForm.vb index db1cf72..e8a012b 100644 --- a/GUI/Grid Forms/DataGridForm.vb +++ b/GUI/Grid Forms/DataGridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class DataGridForm diff --git a/GUI/Grid Forms/GridForm.vb b/GUI/Grid Forms/GridForm.vb index df9628f..1a1c6f9 100644 --- a/GUI/Grid Forms/GridForm.vb +++ b/GUI/Grid Forms/GridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Imports GUI.GUI Imports System.ComponentModel diff --git a/GUI/Grid Forms/GridUtility.vb b/GUI/Grid Forms/GridUtility.vb index 7979dce..d47582a 100644 --- a/GUI/Grid Forms/GridUtility.vb +++ b/GUI/Grid Forms/GridUtility.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Module GridUtility diff --git a/GUI/Grid Forms/ItemGridForm.vb b/GUI/Grid Forms/ItemGridForm.vb index cd627b8..e172036 100644 --- a/GUI/Grid Forms/ItemGridForm.vb +++ b/GUI/Grid Forms/ItemGridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class ItemGridForm diff --git a/GUI/Grid Forms/LookupGridForm.vb b/GUI/Grid Forms/LookupGridForm.vb index 8929d1d..b0961dc 100644 --- a/GUI/Grid Forms/LookupGridForm.vb +++ b/GUI/Grid Forms/LookupGridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class LookupGridForm diff --git a/GUI/Grid Forms/MercGearGridForm.vb b/GUI/Grid Forms/MercGearGridForm.vb index f776811..ba701be 100644 --- a/GUI/Grid Forms/MercGearGridForm.vb +++ b/GUI/Grid Forms/MercGearGridForm.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Data Public Class MercGearGridForm diff --git a/GUI/IniFile.vb b/GUI/IniFile.vb index 93af43c..64f5c4a 100644 --- a/GUI/IniFile.vb +++ b/GUI/IniFile.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Public Class IniFile Protected Const MaxDataDir As Integer = 9 Protected Shared dataDir(MaxDataDir) As String diff --git a/GUI/Main.vb b/GUI/Main.vb index 84451cc..995b3ec 100644 --- a/GUI/Main.vb +++ b/GUI/Main.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports System.Globalization Imports GUI.GUI Imports System.Threading diff --git a/GUI/SettingsUtility.vb b/GUI/SettingsUtility.vb index db9cedf..42a621a 100644 --- a/GUI/SettingsUtility.vb +++ b/GUI/SettingsUtility.vb @@ -1,3 +1,6 @@ +Option Strict On +Option Explicit On + Imports GUI.My Imports Microsoft.VisualBasic.CompilerServices Imports System From 604e1c657367a73a978ab9e904706c193ee508ed Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:10:10 +0200 Subject: [PATCH 02/10] Remove hardcoded paths from project files --- BackEnd/BackEnd.vbproj | 1 - GUI/GUI.vbproj | 2 -- 2 files changed, 3 deletions(-) diff --git a/BackEnd/BackEnd.vbproj b/BackEnd/BackEnd.vbproj index 60d800a..f40bc3a 100644 --- a/BackEnd/BackEnd.vbproj +++ b/BackEnd/BackEnd.vbproj @@ -22,7 +22,6 @@ true true 40 - J:\JA2 1.13 SVN\xml-editor-vb\Backup\BackEnd\ 2.0 diff --git a/GUI/GUI.vbproj b/GUI/GUI.vbproj index ea8dc8b..97ac450 100644 --- a/GUI/GUI.vbproj +++ b/GUI/GUI.vbproj @@ -26,11 +26,9 @@ true true 40 - J:\JA2 1.13 SVN\xml-editor-vb\Backup\GUI\ 2.0 - ..\..\..\..\Game\JA2 1.13 EN %28Actual%29\ XML Editor.xml 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355 From 3426c93ac7488a201ac7214812672039f28f3d13 Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:11:32 +0200 Subject: [PATCH 03/10] Replace End statements with Application.Exit() in Main.vb --- GUI/Main.vb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GUI/Main.vb b/GUI/Main.vb index 995b3ec..b04be03 100644 --- a/GUI/Main.vb +++ b/GUI/Main.vb @@ -17,7 +17,10 @@ Module Main Public Splash As SplashForm Public Sub Main() - If CheckForDuplicateProcess(My.Application.Info.AssemblyName) Then End + If CheckForDuplicateProcess(My.Application.Info.AssemblyName) Then + Application.Exit() + Return + End If Try AddHandler ErrorHandler.FatalError, AddressOf ExitDueToError @@ -93,7 +96,8 @@ Module Main End Sub Private Sub ExitDueToError() - End + Application.Exit() + Environment.Exit(1) End Sub From 72106fd440aa1bdfb21da23ab8b61abdd379a5a8 Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:15:30 +0200 Subject: [PATCH 04/10] Make empty catch blocks atleast log something --- BackEnd/Data Access/Tables/DefaultTable.vb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BackEnd/Data Access/Tables/DefaultTable.vb b/BackEnd/Data Access/Tables/DefaultTable.vb index 44d312e..b7716c7 100644 --- a/BackEnd/Data Access/Tables/DefaultTable.vb +++ b/BackEnd/Data Access/Tables/DefaultTable.vb @@ -349,8 +349,12 @@ Public Class DefaultTable If canAddRow Then Try row.Table.Rows.Add(dupeRow) + Catch ex As ConstraintException + ' Row already exists with this primary key, skip silently + ErrorHandler.LogError("Failed to add duplicate row", ex) Catch ex As Exception - + ErrorHandler.LogError("Unexpected error adding duplicate row", ex) + Throw End Try End If From 54a766c62b5282a0b9f2d30e89fe9187ac18aaee Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:17:05 +0200 Subject: [PATCH 05/10] Add using statements for FileStream resources --- BackEnd/Data Access/Tables/ControlTable.vb | 6 ++++-- BackEnd/Data Access/Tables/ItemTable.vb | 8 ++++---- BackEnd/Data Access/Tables/ItemTransformationTable.vb | 6 ++++-- BackEnd/Data Access/Tables/MercStartingGearTable.vb | 6 ++++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/BackEnd/Data Access/Tables/ControlTable.vb b/BackEnd/Data Access/Tables/ControlTable.vb index 5546cb6..aae50d4 100644 --- a/BackEnd/Data Access/Tables/ControlTable.vb +++ b/BackEnd/Data Access/Tables/ControlTable.vb @@ -45,8 +45,10 @@ Public Class ControlTable Protected Overridable Sub LoadControlData(ByVal fileName As String, ByVal filePath As String) Dim xmldoc As New XmlDocument() - Dim fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) - xmldoc.Load(fs) + + Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) + xmldoc.Load(fs) + End Using Dim xmlnode As XmlNode = xmldoc.GetElementsByTagName("INVENTORYLIST").Item(0) Dim xmlParentNode As XmlNodeList diff --git a/BackEnd/Data Access/Tables/ItemTable.vb b/BackEnd/Data Access/Tables/ItemTable.vb index 55def45..6020f8f 100644 --- a/BackEnd/Data Access/Tables/ItemTable.vb +++ b/BackEnd/Data Access/Tables/ItemTable.vb @@ -335,9 +335,11 @@ Public Class ItemTable Dim a As Integer Dim da, aap As Integer Dim uicomments As Integer = 0 - Dim fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) - xmldoc.Load(fs) + Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) + xmldoc.Load(fs) + End Using + xmlnode = xmldoc.GetElementsByTagName("ITEMLIST").Item(0) For i = 0 To xmlnode.ChildNodes.Count - 1 If xmlnode.ChildNodes.Item(i).Name = "#comment" Then @@ -402,8 +404,6 @@ Public Class ItemTable Next _table.Rows(rowIndex).EndEdit() Next - fs.Close() - fs.Dispose() End Sub Protected Overrides Sub WriteXml(ByVal table As DataTable, ByVal fileName As String) diff --git a/BackEnd/Data Access/Tables/ItemTransformationTable.vb b/BackEnd/Data Access/Tables/ItemTransformationTable.vb index 1b27e3d..db55349 100644 --- a/BackEnd/Data Access/Tables/ItemTransformationTable.vb +++ b/BackEnd/Data Access/Tables/ItemTransformationTable.vb @@ -31,9 +31,11 @@ Public Class ItemTransformationTable Dim x As Integer Dim da As Integer Dim uiComments As Integer = 0 - Dim fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) - xmldoc.Load(fs) + Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) + xmldoc.Load(fs) + End Using + xmlnode = xmldoc.GetElementsByTagName("TRANSFORMATIONS_LIST").Item(0) For i = 0 To xmlnode.ChildNodes.Count - 1 If xmlnode.ChildNodes.Item(i).Name = "#comment" Then diff --git a/BackEnd/Data Access/Tables/MercStartingGearTable.vb b/BackEnd/Data Access/Tables/MercStartingGearTable.vb index 681f463..8a48e8e 100644 --- a/BackEnd/Data Access/Tables/MercStartingGearTable.vb +++ b/BackEnd/Data Access/Tables/MercStartingGearTable.vb @@ -33,9 +33,11 @@ Public Class MercStartingGearTable Dim y As Integer Dim a As Integer Dim uiComments As Integer = 0 - Dim fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) - xmldoc.Load(fs) + Using fs As New FileStream(filePath, FileMode.Open, FileAccess.Read) + xmldoc.Load(fs) + End Using + xmlnode = xmldoc.GetElementsByTagName("MERCGEARLIST").Item(0) For i = 0 To xmlnode.ChildNodes.Count - 1 From 41340c8c7d7e295d9059663edb034c5d5d2cf247 Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:19:15 +0200 Subject: [PATCH 06/10] Refactor duplicate table name mapping code to dictionary in DefaultTable.vb --- BackEnd/Data Access/Tables/DefaultTable.vb | 87 ++++++++-------------- 1 file changed, 29 insertions(+), 58 deletions(-) diff --git a/BackEnd/Data Access/Tables/DefaultTable.vb b/BackEnd/Data Access/Tables/DefaultTable.vb index b7716c7..e857175 100644 --- a/BackEnd/Data Access/Tables/DefaultTable.vb +++ b/BackEnd/Data Access/Tables/DefaultTable.vb @@ -10,6 +10,24 @@ Public Class DefaultTable Protected _table As DataTable Protected WithEvents _dm As DataManager + ' Dictionary mapping file names to table names for special cases + Private Shared ReadOnly FileNameToTableNameMap As New Dictionary(Of String, String) From { + {"Inventory\EnemyGunChoices.xml", "ENEMYGUNCHOICESDEFAULT"}, + {"Inventory\GunChoices_Enemy_Admin.xml", "ENEMYGUNCHOICESADMIN"}, + {"Inventory\GunChoices_Enemy_Regular.xml", "ENEMYGUNCHOICESREGULAR"}, + {"Inventory\GunChoices_Enemy_Elite.xml", "ENEMYGUNCHOICESELITE"}, + {"Inventory\GunChoices_Militia_Green.xml", "MILITIAGUNCHOICESGREEN"}, + {"Inventory\GunChoices_Militia_Regular.xml", "MILITIAGUNCHOICESREGULAR"}, + {"Inventory\GunChoices_Militia_Elite.xml", "MILITIAGUNCHOICESELITE"}, + {"Inventory\EnemyItemChoices.xml", "ENEMYITEMCHOICESDEFAULT"}, + {"Inventory\ItemChoices_Enemy_Admin.xml", "ENEMYITEMCHOICESADMIN"}, + {"Inventory\ItemChoices_Enemy_Regular.xml", "ENEMYITEMCHOICESREGULAR"}, + {"Inventory\ItemChoices_Enemy_Elite.xml", "ENEMYITEMCHOICESELITE"}, + {"Inventory\ItemChoices_Militia_Green.xml", "MILITIAITEMCHOICESGREEN"}, + {"Inventory\ItemChoices_Militia_Regular.xml", "MILITIAITEMCHOICESREGULAR"}, + {"Inventory\ItemChoices_Militia_Elite.xml", "MILITIAITEMCHOICESELITE"} + } + Public Sub New(ByVal table As DataTable, ByVal manager As DataManager) _table = table _dm = manager @@ -30,6 +48,15 @@ Public Class DefaultTable Return filePath End Function + ''' + ''' Applies table name mapping based on file name if it exists in the dictionary + ''' + Private Sub ApplyTableNameMapping(fileName As String) + If FileNameToTableNameMap.ContainsKey(fileName) Then + _table.TableName = FileNameToTableNameMap(fileName) + End If + End Sub + Public Overridable Sub LoadData() Const Temp As String = "temp" @@ -48,35 +75,7 @@ Public Class DefaultTable _table.TableName() = "ENEMYITEMCHOICES" End If _table.ReadXml(filePath) - If fileName = "Inventory\EnemyGunChoices.xml" Then - _table.TableName = "ENEMYGUNCHOICESDEFAULT" - ElseIf fileName = "Inventory\GunChoices_Enemy_Admin.xml" Then - _table.TableName = "ENEMYGUNCHOICESADMIN" - ElseIf fileName = "Inventory\GunChoices_Enemy_Regular.xml" Then - _table.TableName = "ENEMYGUNCHOICESREGULAR" - ElseIf fileName = "Inventory\GunChoices_Enemy_Elite.xml" Then - _table.TableName = "ENEMYGUNCHOICESELITE" - ElseIf fileName = "Inventory\GunChoices_Militia_Green.xml" Then - _table.TableName = "MILITIAGUNCHOICESGREEN" - ElseIf fileName = "Inventory\GunChoices_Militia_Regular.xml" Then - _table.TableName = "MILITIAGUNCHOICESREGULAR" - ElseIf fileName = "Inventory\GunChoices_Militia_Elite.xml" Then - _table.TableName = "MILITIAGUNCHOICESELITE" - ElseIf fileName = "Inventory\EnemyItemChoices.xml" Then - _table.TableName = "ENEMYITEMCHOICESDEFAULT" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Admin.xml" Then - _table.TableName = "ENEMYITEMCHOICESADMIN" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Regular.xml" Then - _table.TableName = "ENEMYITEMCHOICESREGULAR" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Elite.xml" Then - _table.TableName = "ENEMYITEMCHOICESELITE" - ElseIf fileName = "Inventory\ItemChoices_Militia_Green.xml" Then - _table.TableName = "MILITIAITEMCHOICESGREEN" - ElseIf fileName = "Inventory\ItemChoices_Militia_Regular.xml" Then - _table.TableName = "MILITIAITEMCHOICESREGULAR" - ElseIf fileName = "Inventory\ItemChoices_Militia_Elite.xml" Then - _table.TableName = "MILITIAITEMCHOICESELITE" - End If + ApplyTableNameMapping(fileName) Else Dim tableName As String = _table.TableName For Each t In _table.DataSet.Tables @@ -107,35 +106,7 @@ Public Class DefaultTable _table.TableName() = "ENEMYITEMCHOICES" End If SaveData(_table) - If fileName = "Inventory\EnemyGunChoices.xml" Then - _table.TableName = "ENEMYGUNCHOICESDEFAULT" - ElseIf fileName = "Inventory\GunChoices_Enemy_Admin.xml" Then - _table.TableName = "ENEMYGUNCHOICESADMIN" - ElseIf fileName = "Inventory\GunChoices_Enemy_Regular.xml" Then - _table.TableName = "ENEMYGUNCHOICESREGULAR" - ElseIf fileName = "Inventory\GunChoices_Enemy_Elite.xml" Then - _table.TableName = "ENEMYGUNCHOICESELITE" - ElseIf fileName = "Inventory\GunChoices_Militia_Green.xml" Then - _table.TableName = "MILITIAGUNCHOICESGREEN" - ElseIf fileName = "Inventory\GunChoices_Militia_Regular.xml" Then - _table.TableName = "MILITIAGUNCHOICESREGULAR" - ElseIf fileName = "Inventory\GunChoices_Militia_Elite.xml" Then - _table.TableName = "MILITIAGUNCHOICESELITE" - ElseIf fileName = "Inventory\EnemyItemChoices.xml" Then - _table.TableName = "ENEMYITEMCHOICESDEFAULT" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Admin.xml" Then - _table.TableName = "ENEMYITEMCHOICESADMIN" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Regular.xml" Then - _table.TableName = "ENEMYITEMCHOICESREGULAR" - ElseIf fileName = "Inventory\ItemChoices_Enemy_Elite.xml" Then - _table.TableName = "ENEMYITEMCHOICESELITE" - ElseIf fileName = "Inventory\ItemChoices_Militia_Green.xml" Then - _table.TableName = "MILITIAITEMCHOICESGREEN" - ElseIf fileName = "Inventory\ItemChoices_Militia_Regular.xml" Then - _table.TableName = "MILITIAITEMCHOICESREGULAR" - ElseIf fileName = "Inventory\ItemChoices_Militia_Elite.xml" Then - _table.TableName = "MILITIAITEMCHOICESELITE" - End If + ApplyTableNameMapping(fileName) End Sub Protected Overridable Sub SaveData(ByVal table As DataTable) From 574798c6c2231131eacee412d25d7032a6dffd5c Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:21:09 +0200 Subject: [PATCH 07/10] Remove unnecessary AspNetCore framework reference from project files, Remove obsolete .NET Framework 3.5 bootstrapper configuration --- BackEnd/BackEnd.vbproj | 20 -------------------- GUI/GUI.vbproj | 17 ----------------- 2 files changed, 37 deletions(-) diff --git a/BackEnd/BackEnd.vbproj b/BackEnd/BackEnd.vbproj index f40bc3a..d4400ef 100644 --- a/BackEnd/BackEnd.vbproj +++ b/BackEnd/BackEnd.vbproj @@ -69,23 +69,6 @@ Application.Designer.vb - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - @@ -96,7 +79,4 @@ - - - \ No newline at end of file diff --git a/GUI/GUI.vbproj b/GUI/GUI.vbproj index 97ac450..34a72fd 100644 --- a/GUI/GUI.vbproj +++ b/GUI/GUI.vbproj @@ -158,23 +158,6 @@ - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - From b40233d07b87116f527309a582f8ef4aaa6ba9cf Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:29:03 +0200 Subject: [PATCH 08/10] Remove commented-out code --- BackEnd/Data Access/Tables/DefaultTable.vb | 2 -- BackEnd/Data Access/Tables/EnemyItemTable.vb | 6 ----- BackEnd/Data Access/Tables/ItemTable.vb | 19 ------------- .../Tables/MercStartingGearTable.vb | 2 -- BackEnd/DatabaseCode.vb | 15 ----------- GUI/App Forms/MainForm.vb | 4 --- GUI/Data Forms/ItemDataForm.vb | 27 ------------------- 7 files changed, 75 deletions(-) diff --git a/BackEnd/Data Access/Tables/DefaultTable.vb b/BackEnd/Data Access/Tables/DefaultTable.vb index e857175..a72a974 100644 --- a/BackEnd/Data Access/Tables/DefaultTable.vb +++ b/BackEnd/Data Access/Tables/DefaultTable.vb @@ -258,8 +258,6 @@ Public Class DefaultTable xw.WriteWhitespace(vbLf) xw.Close() view.Dispose() - - 'table.AcceptChanges() End Sub 'this just works on single pk tables for now diff --git a/BackEnd/Data Access/Tables/EnemyItemTable.vb b/BackEnd/Data Access/Tables/EnemyItemTable.vb index ebbc5f4..68f2bbc 100644 --- a/BackEnd/Data Access/Tables/EnemyItemTable.vb +++ b/BackEnd/Data Access/Tables/EnemyItemTable.vb @@ -66,12 +66,6 @@ Public Class EnemyItemTable Exit For End If Next - 'row.ItemArray = ammoTable.Rows.Contains(rowindex) - - 'row.ItemArray = ammoTable.Rows(rowindex).ItemArray - 'row("uiIndex") = 19 - '_table.Rows.Add(row) - 'ammoTable.Rows.RemoveAt(0) End If End Sub End Class diff --git a/BackEnd/Data Access/Tables/ItemTable.vb b/BackEnd/Data Access/Tables/ItemTable.vb index 6020f8f..34f3aa5 100644 --- a/BackEnd/Data Access/Tables/ItemTable.vb +++ b/BackEnd/Data Access/Tables/ItemTable.vb @@ -294,23 +294,7 @@ Public Class ItemTable End Sub Public Overrides Sub DeleteRow(ByVal key As Decimal) - 'Dim row As DataRow = _table.Rows.Find(key) MyBase.DeleteRow(key) - ''MM: no longer needed due to nothing items being added automatically on save - 'Dim nothingRow As DataRow = tbl.Rows.Find(0) - 'If row IsNot Nothing Then - ' Dim maxID = tbl.Compute("MAX(" & tbl.PrimaryKey(0).ColumnName & ")", Nothing) - ' If row(Tables.Items.Fields.ID) = maxID Then 'if this is the last record, then we can delete it - 'row.Delete() - ' Else 'otherwise, we need to turn this into a nothing item, - ''because JA2 will stop looking for items once it hits this one's zero value itemclass - 'For Each c As DataColumn In tbl.Columns - ' If Not c.ReadOnly AndAlso c IsNot tbl.PrimaryKey(0) Then row(c) = nothingRow(c) - 'Next - 'row(Tables.Items.Fields.ItemClass) = ItemClass.None - 'row(Tables.Items.Fields.Description) = "Index " & row(Tables.Items.Fields.ID) - ' End If - 'End If End Sub Public Overrides Sub LoadData() @@ -619,8 +603,6 @@ Public Class ItemTable CopyExtraRow(Tables.Sounds, newRow, sourceRow, Tables.Weapons.Name & Tables.Weapons.Fields.LockNLoadSound, sourceDB) CopyExtraRow(Tables.Sounds, newRow, sourceRow, Tables.Weapons.Name & Tables.Weapons.Fields.ReloadSound, sourceDB) Case ItemClass.LBE - 'lbes - 'CopyExtraRow(Tables.Silhouettes, newRow, sourceRow, Tables.LoadBearingEquipment.Name & Tables.LoadBearingEquipment.Fields.Silhouette, sourceDB) CopyExtraRow(Tables.LbeClasses, newRow, sourceRow, Tables.LoadBearingEquipment.Name & Tables.LoadBearingEquipment.Fields.LbeClass, sourceDB) End Select @@ -632,7 +614,6 @@ Public Class ItemTable If row IsNot Nothing Then Dim extraRow As DataRow = _dm.Database.CopyRows(tableName, New DataRow() {row}, sourceDB, False) - 'newRow(fieldName) = extraRow(_dm.Database.Table(tableName).PrimaryKey(0)) End If End Sub diff --git a/BackEnd/Data Access/Tables/MercStartingGearTable.vb b/BackEnd/Data Access/Tables/MercStartingGearTable.vb index 8a48e8e..d1d7b7b 100644 --- a/BackEnd/Data Access/Tables/MercStartingGearTable.vb +++ b/BackEnd/Data Access/Tables/MercStartingGearTable.vb @@ -91,7 +91,6 @@ Public Class MercStartingGearTable Protected Overrides Sub WriteXml(ByVal table As DataTable, ByVal fileName As String) 'the stupid table.WriteXml method doesn't let you sort the data first Dim view As New DataView(table, "", table.Columns(0).ColumnName, DataViewRowState.CurrentRows) - 'Dim trim As Boolean = table.GetBooleanProperty(TableProperty.Trim) Dim trim As Boolean = False Dim sourceDSName = table.GetStringProperty(TableProperty.DataSetName) If sourceDSName Is Nothing Then @@ -114,7 +113,6 @@ Public Class MercStartingGearTable xw.WriteStartElement(table.TableName) xw.WriteString(vbLf) - 'Dim dcIndex As Integer = -1 Dim isGearKit As Boolean = False Dim gkIndex As String = "" trim = False diff --git a/BackEnd/DatabaseCode.vb b/BackEnd/DatabaseCode.vb index 91561e5..d1b3d4b 100644 --- a/BackEnd/DatabaseCode.vb +++ b/BackEnd/DatabaseCode.vb @@ -75,7 +75,6 @@ Public Module DatabaseCode Dim itemsToExplosives As DataTable = MakeITETable() Dim transform As DataTable = MakeTransformTable() Dim disease As DataTable = MakeDiseaseTable() - 'Dim drugs As DataTable = MakeDrugsTable() Dim food As DataTable = MakeFoodTable() Dim clothes As DataTable = MakeClothesTable() Dim randomitems As DataTable = MakeRandomTable() @@ -220,7 +219,6 @@ Public Module DatabaseCode ds.Tables.Add(transform) ds.Tables.Add(attachmentPoints) ds.Tables.Add(disease) - 'ds.Tables.Add(drugs) ds.Tables.Add(food) ds.Tables.Add(clothes) ds.Tables.Add(randomitems) @@ -575,7 +573,6 @@ Public Module DatabaseCode AddLookupData(itemClasses, 2048, "Armour") AddLookupData(itemClasses, 4096, "Medkit") AddLookupData(itemClasses, 8192, "Kit") - 'AddLookupData(itemClasses, 16384, "(Unused)") AddLookupData(itemClasses, 32768, "Face Item") AddLookupData(itemClasses, 65536, "Key") AddLookupData(itemClasses, 131072, "Load Bearing Equipment") @@ -929,8 +926,6 @@ Public Module DatabaseCode pk(0) = t.Columns("uiIndex") t.PrimaryKey = pk - 'AddConstraint(t, New String() {"ubCalibre", "ubMagSize", "ubAmmoType"}, False) - Return t End Function @@ -1258,7 +1253,6 @@ Public Module DatabaseCode t.Columns.Add(MakeColumn("fBurstOnlyByFanTheHammer", "fBurstOnlyByFanTheHammer", GetType(Boolean))) ' NOTE BarrelConfiguration tags are defined in LoadData() in Weapontable.vb ' Datasets do not like multiple xml nodes with the same name inside one parent node - 't.Columns.Add(MakeColumn("BarrelConfiguration", "BarrelConfiguration", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("ubNWSSCase", "ubNWSSCase", GetType(Byte), , , , , , , True)) t.Columns.Add(MakeColumn("ubNWSSLast", "ubNWSSLast", GetType(Byte), , , , , , , True)) t.Columns.Add(MakeColumn("szNWSSSound", "szNWSSSound", GetType(String), , , , , , , True)) @@ -1292,7 +1286,6 @@ Public Module DatabaseCode For i As Integer = 0 To 9 t.Columns.Add(MakeColumn("AvailableAttachmentPoint" & i, "Avail. Att. Point " & i + 1, GetType(ULong), , "AttachmentPoint", "id", "name", , , True, , "name", , , , "AvailableAttachmentPoint")) Next - 't.Columns.Add(MakeColumn("AvailableAttachmentPoint", "Avail. Att. Point", GetType(ULong), , "AttachmentPoint", "id", "name", , , True, , "name")) t.Columns.Add(MakeColumn("AttachmentPoint", "Att. Point", GetType(ULong), , "AttachmentPoint", "id", "name", , , True, , "name")) t.Columns.Add(MakeColumn("AttachToPointAPCost", "Att. AP Cost", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("ubClassIndex", "Foreign Key", GetType(Integer), , , , , , , True)) @@ -1463,8 +1456,6 @@ Public Module DatabaseCode t.Columns.Add(MakeColumn("GrenadeLauncher", "Grenade Launcher", GetType(Boolean), , , , , , , True)) t.Columns.Add(MakeColumn("Mortar", "Mortar", GetType(Boolean), , , , , , , True)) t.Columns.Add(MakeColumn("Duckbill", "Duckbill", GetType(Boolean), , , , , , , True)) - 't.Columns.Add(MakeColumn("Detonator", "Detonator", GetType(Boolean), , , , , , , True)) - 't.Columns.Add(MakeColumn("RemoteDetonator", "RemoteDetonator", GetType(Boolean), , , , , , , True)) t.Columns.Add(MakeColumn("HideMuzzleFlash", "Hide Muzzle Flash", GetType(Boolean), , , , , , , True)) t.Columns.Add(MakeColumn("RocketLauncher", "Rocket Launcher", GetType(Boolean), , , , , , , True)) 'ItemFlag2 @@ -2436,12 +2427,6 @@ Public Module DatabaseCode t.Columns.Add(MakeColumn("szName", "Name", GetType(String))) t.Columns.Add(MakeColumn("opinionevent", "Opinion Event", GetType(Boolean))) - 't.Columns.Add(MakeColumn("ubDrugTravelRate", "Travel Rate", GetType(Integer))) - 't.Columns.Add(MakeColumn("ubDrugWearoffRate", "Wear Off Rate", GetType(Integer))) - 't.Columns.Add(MakeColumn("ubDrugEffect", "Effect", GetType(Integer))) - 't.Columns.Add(MakeColumn("ubDrugSideEffect", "Side Effect", GetType(Integer))) - 't.Columns.Add(MakeColumn("ubDrugSideEffectRate", "Side Effect Rate", GetType(Integer))) - Dim pk(0) As DataColumn pk(0) = t.Columns("uiIndex") t.PrimaryKey = pk diff --git a/GUI/App Forms/MainForm.vb b/GUI/App Forms/MainForm.vb index 40c0446..2a2cd45 100644 --- a/GUI/App Forms/MainForm.vb +++ b/GUI/App Forms/MainForm.vb @@ -728,10 +728,6 @@ Public Class MainForm ShowDataGridForm(_activeDataSet, DisplayText.DrugTypes, Tables.DrugTypes) End Sub - 'Private Sub DrugsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DrugsToolStripMenuItem.Click - ' ShowDataGridForm(_activeDataSet, DisplayText.Drugs, Tables.Drugs) - 'End Sub - Private Sub DrugsItemFilterToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DrugsItemFilterToolStripMenuItem.Click ShowItemGridForm(_activeDataSet, FormatItemClassText(DisplayText.Drugs), Tables.Items.Fields.Medical & "= 1", Nothing) End Sub diff --git a/GUI/Data Forms/ItemDataForm.vb b/GUI/Data Forms/ItemDataForm.vb index f63c6fa..4e7e5d5 100644 --- a/GUI/Data Forms/ItemDataForm.vb +++ b/GUI/Data Forms/ItemDataForm.vb @@ -260,8 +260,6 @@ Public Class ItemDataForm TempChecklistBox.SetItemChecked(ItemFlags.GrenadeLauncher, _view(0)("GrenadeLauncher")) TempChecklistBox.SetItemChecked(ItemFlags.Mortar, _view(0)("Mortar")) TempChecklistBox.SetItemChecked(ItemFlags.Duckbill, _view(0)("Duckbill")) - 'TempChecklistBox.SetItemChecked(ItemFlags.Detonator_UNUSED, _view(0)("Detonator")) - 'TempChecklistBox.SetItemChecked(ItemFlags.RemoteDetonator_UNUSED, _view(0)("RemoteDetonator")) TempChecklistBox.SetItemChecked(ItemFlags.HideMuzzleFlash, _view(0)("HideMuzzleFlash")) TempChecklistBox.SetItemChecked(ItemFlags.RocketLauncher, _view(0)("RocketLauncher")) @@ -311,20 +309,6 @@ Public Class ItemDataForm TempChecklistBox.SetItemChecked(ItemFlags2.ProvidesRobotNightVision, _view(0)("ProvidesRobotNightVision")) TempChecklistBox.SetItemChecked(ItemFlags2.ProvidesRobotLaserBonus, _view(0)("ProvidesRobotLaserBonus")) - - - ''Setting Drugs - 'Dim TempDrugFlags As UInt32 = _view(0)("DrugType") - 'Dim BitDrugFlags As String = ToBinary(TempDrugFlags).PadRight(32, "0") - - ''TODO: Dynamically create the checkboxes from the entries in table "DRUG" - - 'Dim TempDrugChecklistBox As CheckedListBox = ItemTab.TabPages("FlagsTab").Controls.Item("GroupBox65").Controls.Item("DrugsCheckedList") - 'For i As Integer = 0 To 31 - ' TempDrugChecklistBox.SetItemChecked(i, (BitDrugFlags(i).ToString.Equals("1"))) - 'Next - - SetupGrid(AttachmentGrid, Tables.Attachments.Name, Tables.Attachments.Fields.ItemID) SetupGrid(AttachmentInfoGrid, Tables.AttachmentInfo.Name, Tables.AttachmentInfo.Fields.ItemID) SetupGrid(AttachToGrid, Tables.Attachments.Name, Tables.Attachments.Fields.AttachmentID) @@ -922,8 +906,6 @@ Public Class ItemDataForm Dim multiplicator As Integer = Math.Round(maxAPs / 25, 0) Dim val As Integer = Math.Round((2 * multiplicator * 80 * 100) / ((100 + 80) * ubShotsPer4TurnsUpDown.Value), 0) - ' RoWa21: This is the simplified old formular for the 25 AP system - 'Dim val As Integer = Math.Round(89 / ubShotsPer4TurnsUpDown.Value, 0) Me.APsShots4TurnsLabel.Text = "= " & val & " APs" Else Me.APsShots4TurnsLabel.Text = "" @@ -1097,15 +1079,6 @@ Public Class ItemDataForm ''Saving Drugs - 'Dim TempDrugFlags As UInt32 = 0 - 'Dim TempDrugChecklistBox As CheckedListBox = ItemTab.TabPages("FlagsTab").Controls.Item("GroupBox65").Controls.Item("DrugsCheckedList") - 'For i As Integer = 0 To 31 - ' If TempDrugChecklistBox.GetItemChecked(i) Then - ' TempDrugFlags += 2 ^ i - ' End If - 'Next - - '_view(0)("DrugType") = TempDrugFlags _view(0).Row.AcceptChanges() AcceptGridChanges(AttachmentGrid) From 988f436c7e9ea15f33a6593b1ccbf65a2620b05f Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 15:59:17 +0200 Subject: [PATCH 09/10] Remove unused imports --- BackEnd/DatabaseCode.vb | 1 - GUI/Data Forms/ItemDataForm.vb | 1 - 2 files changed, 2 deletions(-) diff --git a/BackEnd/DatabaseCode.vb b/BackEnd/DatabaseCode.vb index d1b3d4b..1e92428 100644 --- a/BackEnd/DatabaseCode.vb +++ b/BackEnd/DatabaseCode.vb @@ -2,7 +2,6 @@ Option Strict On Option Explicit On Imports System.Data -Imports System.Security.Cryptography.Pkcs Public Module DatabaseCode 'JMich diff --git a/GUI/Data Forms/ItemDataForm.vb b/GUI/Data Forms/ItemDataForm.vb index 4e7e5d5..9041fa2 100644 --- a/GUI/Data Forms/ItemDataForm.vb +++ b/GUI/Data Forms/ItemDataForm.vb @@ -2,7 +2,6 @@ Option Strict On Option Explicit On Imports System.Data -Imports System.Diagnostics.Metrics Public Class ItemDataForm Inherits BaseDataForm From bec148a8852ef27c753e0a98b4969e77b08064e9 Mon Sep 17 00:00:00 2001 From: tais <378873+tais@users.noreply.github.com> Date: Sun, 5 Oct 2025 16:10:32 +0200 Subject: [PATCH 10/10] Replace static item type values with references to Enum that already existed as well --- BackEnd/DatabaseCode.vb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BackEnd/DatabaseCode.vb b/BackEnd/DatabaseCode.vb index 1e92428..567c6e4 100644 --- a/BackEnd/DatabaseCode.vb +++ b/BackEnd/DatabaseCode.vb @@ -933,8 +933,8 @@ Public Module DatabaseCode t.ExtendedProperties.Add(TableProperty.DataSetName, t.TableName & "LIST") t.ExtendedProperties.Add(TableProperty.FileName, "Items\Launchables.xml") - t.Columns.Add(MakeColumn("launchableIndex", "Launchable", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = 256 or usItemClass = 512", , , "szLongItemName")) - t.Columns.Add(MakeColumn("itemIndex", "Launcher", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = 16", , , "szLongItemName")) + t.Columns.Add(MakeColumn("launchableIndex", "Launchable", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = " & ItemClass.Grenade & " or usItemClass = " & ItemClass.Bomb, , , "szLongItemName")) + t.Columns.Add(MakeColumn("itemIndex", "Launcher", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = " & ItemClass.Launcher, , , "szLongItemName")) AddConstraint(t, New String() {"launchableIndex", "itemIndex"}, True) @@ -1014,8 +1014,8 @@ Public Module DatabaseCode t.ExtendedProperties.Add(TableProperty.FileName, "Items\CompatibleFaceItems.xml") t.ExtendedProperties.Add(TableProperty.TableHandlerName, "DuplicateEntryTable") - t.Columns.Add(MakeColumn("compatiblefaceitemIndex", "Face Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = 32768", , , "szLongItemName")) - t.Columns.Add(MakeColumn("itemIndex", "Face Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = 32768", , , "szLongItemName")) + t.Columns.Add(MakeColumn("compatiblefaceitemIndex", "Face Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = " & ItemClass.Face, , , "szLongItemName")) + t.Columns.Add(MakeColumn("itemIndex", "Face Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = " & ItemClass.Face, , , "szLongItemName")) AddConstraint(t, New String() {"compatiblefaceitemIndex", "itemIndex"}, True) @@ -1323,7 +1323,7 @@ Public Module DatabaseCode t.Columns.Add(MakeColumn("overheatDamageThresholdModificator", "Overheating Damage Threshold Modifier", GetType(Decimal), 0, , , , , , True)) t.Columns.Add(MakeColumn("DirtIncreaseFactor", "Dirt Increase Factor", GetType(Decimal), , , , , , , True)) t.Columns.Add(MakeColumn("RobotDamageReduction", "RobotDamageReduction", GetType(Decimal), , , , , , , True)) - t.Columns.Add(MakeColumn("DiscardedLauncherItem", "Discarded Launcher Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "uiIndex=0 OR usItemClass=268435456", True, , "szLongItemName")) + t.Columns.Add(MakeColumn("DiscardedLauncherItem", "Discarded Launcher Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "uiIndex=0 OR usItemClass=" & ItemClass.Misc, True, , "szLongItemName")) t.Columns.Add(MakeColumn("randomitem", "Random Item", GetType(Integer), , "RANDOMITEM", "uiIndex", "szName", , , True, , "szName")) t.Columns.Add(MakeColumn("buddyitem", "Buddy Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "uiIndex=0", True, , "szLongItemName")) t.Columns.Add(MakeColumn("usRiotShieldStrength", "Riot Shield Strength", GetType(Integer), 0, , , , , , True)) @@ -1338,7 +1338,7 @@ Public Module DatabaseCode t.Columns.Add(MakeColumn("MinRangeForAimBonus", "Min. Range For Aim Bonus", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("PercentAPReduction", "% AP Reduction", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("PercentStatusDrainReduction", "% Status Drain Reduction", GetType(Integer), , , , , , , True)) - t.Columns.Add(MakeColumn("BloodiedItem", "Bloodied Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = 8 OR uiIndex=0", True, , "szLongItemName")) + t.Columns.Add(MakeColumn("BloodiedItem", "Bloodied Item", GetType(Integer), , "ITEM", "uiIndex", "szLongItemName", , "usItemClass = " & ItemClass.ThrowingKnife & " OR uiIndex=0", True, , "szLongItemName")) t.Columns.Add(MakeColumn("HearingRangeBonus", "Hearing Range Bonus", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("VisionRangeBonus", "Vision Range Bonus", GetType(Integer), , , , , , , True)) t.Columns.Add(MakeColumn("NightVisionRangeBonus", "Night Vision Range Bonus", GetType(Integer), , , , , , , True))