From cf915687f8f06676524ec5b3a6434c97f30d3db0 Mon Sep 17 00:00:00 2001 From: Christopher Lees Date: Fri, 17 May 2024 21:01:35 +0100 Subject: [PATCH 1/4] Fix excessive indentation for comments in converted XML Closes https://github.com/leezer3/OpenBVE/issues/1035 --- source/CarXMLConvertor/TabbedList.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/CarXMLConvertor/TabbedList.cs b/source/CarXMLConvertor/TabbedList.cs index bc0754926..1f1c9030b 100644 --- a/source/CarXMLConvertor/TabbedList.cs +++ b/source/CarXMLConvertor/TabbedList.cs @@ -28,6 +28,13 @@ internal void Add(string Line) } switch (Line[i]) { + case '!': + if (Line[i - 1] == '<') + { + // comment + decreaseTabs = true; + } + break; case '<': //If we find a second opening symbol in our line, it's a single-line declaration found = true; From 5263213153b586734e8d81c02929f5a142e40d1e Mon Sep 17 00:00:00 2001 From: Christopher Lees Date: Sat, 18 May 2024 19:28:06 +0100 Subject: [PATCH 2/4] Change: Block internal Windows file from main menu --- source/OpenBVE/UserInterface/formMain.Start.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/OpenBVE/UserInterface/formMain.Start.cs b/source/OpenBVE/UserInterface/formMain.Start.cs index 6a89e0c71..5c368e5d4 100644 --- a/source/OpenBVE/UserInterface/formMain.Start.cs +++ b/source/OpenBVE/UserInterface/formMain.Start.cs @@ -328,7 +328,8 @@ private bool isInvalidDatName(string fileName) case "s80_text.dat": //S80 Mechanik routefile sounds case "s80_snd.dat": //S80 Mechanik routefile textures case "gensc.dat": //Mechanik route generator (?) - case "scenerio.dat": //Mechanik route generator (?) + case "scenerio.dat": //Mechanik route generator (?) + case "ntuser.dat": //Windows user file return true; default: return false; From d5c0bf719a6397b4623fee083f78105b5c1790b7 Mon Sep 17 00:00:00 2001 From: Christopher Lees Date: Sat, 18 May 2024 19:28:17 +0100 Subject: [PATCH 3/4] Fix: Inverted null check https://github.com/leezer3/OpenBVE/issues/1036 --- source/OpenBveApi/Objects/ObjectTypes/AnimatedObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/OpenBveApi/Objects/ObjectTypes/AnimatedObject.cs b/source/OpenBveApi/Objects/ObjectTypes/AnimatedObject.cs index a1d1ffcfe..221d25d50 100644 --- a/source/OpenBveApi/Objects/ObjectTypes/AnimatedObject.cs +++ b/source/OpenBveApi/Objects/ObjectTypes/AnimatedObject.cs @@ -880,7 +880,7 @@ public void Reverse(bool Interior = false) { if (a is null) { - return !(b is null); + return b is null; } return a.Equals(b); } @@ -890,7 +890,7 @@ public void Reverse(bool Interior = false) { if (a is null) { - return b is null; + return !(b is null); } return !a.Equals(b); } From f38b13ba824d502703d9c09848d06a5b807269c2 Mon Sep 17 00:00:00 2001 From: Christopher Lees Date: Sat, 18 May 2024 19:32:33 +0100 Subject: [PATCH 4/4] Fix: XML only train not recognised in several places --- source/OpenBVE/System/Program.cs | 4 ++++ source/OpenBVE/UserInterface/formMain.Start.cs | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/source/OpenBVE/System/Program.cs b/source/OpenBVE/System/Program.cs index 85e7525fc..6458f1070 100644 --- a/source/OpenBVE/System/Program.cs +++ b/source/OpenBVE/System/Program.cs @@ -227,6 +227,10 @@ private static void Main(string[] args) { } if (System.IO.Directory.Exists(folder)) { file = Path.CombineFile(folder, "train.dat"); + if (!System.IO.File.Exists(file)) + { + file = Path.CombineFile(folder, "train.xml"); + } if (System.IO.File.Exists(file)) { result.TrainFolder = folder; result.TrainEncoding = System.Text.Encoding.UTF8; diff --git a/source/OpenBVE/UserInterface/formMain.Start.cs b/source/OpenBVE/UserInterface/formMain.Start.cs index 5c368e5d4..673653908 100644 --- a/source/OpenBVE/UserInterface/formMain.Start.cs +++ b/source/OpenBVE/UserInterface/formMain.Start.cs @@ -736,6 +736,10 @@ private void populateTrainList(string Folder, ListView listView, bool packages) { string File = Path.CombineFile(Folders[i], "train.dat"); ListViewItem Item = listView.Items.Add(folderName); + if (!System.IO.File.Exists(File)) + { + File = Path.CombineFile(Folders[i], "train.xml"); + } Item.ImageKey = System.IO.File.Exists(File) ? "train" : "folder"; Item.Tag = Folders[i]; } @@ -782,6 +786,11 @@ private void listviewTrainFolders_SelectedIndexChanged(object sender, EventArgs try { string File = Path.CombineFile(t, "train.dat"); + if (!System.IO.File.Exists(File)) + { + File = Path.CombineFile(t, "train.xml"); + } + if (System.IO.File.Exists(File)) { Result.TrainFolder = t; @@ -943,6 +952,10 @@ private void listViewTrainPackages_SelectedIndexChanged(object sender, EventArgs try { string File = Path.CombineFile(t, "train.dat"); + if (!System.IO.File.Exists(File)) + { + File = Path.CombineFile(t, "train.xml"); + } if (System.IO.File.Exists(File)) { Result.TrainFolder = t;