diff --git a/justfile b/justfile
index 485fc5b7f..20f2a5bf8 100644
--- a/justfile
+++ b/justfile
@@ -55,11 +55,11 @@ tr1-build-win-installer: (tr1-image-win-installer "0") (_docker_run "r
tr1-package-linux target='release': (tr1-build-linux target) (_docker_run "rrdash/tr1x-linux" "package")
tr1-package-win target='release': (tr1-build-win target) (_docker_run "rrdash/tr1x" "package")
tr1-package-win-all target='release': (tr1-build-win target) (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package")
-tr1-package-win-installer target='release': (tr1-build-win target) (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/tr1/installer/Installer/Resources/release.zip") (tr1-build-win-installer)
+tr1-package-win-installer target='release': (tr1-build-win target) (tr1-build-win-config) (_docker_run "rrdash/tr1x" "package" "-o" "tools/installer/TR1X_Installer/Resources/release.zip") (tr1-build-win-installer)
#!/bin/sh
- git checkout "tools/tr1/installer/Installer/Resources/release.zip"
+ git checkout "tools/installer/TR1X_Installer/Resources/release.zip"
exe_name=TR1X-$(tools/get_version 1)-Installer.exe
- cp tools/tr1/installer/out/TR1X_Installer.exe "${exe_name}"
+ cp tools/installer/out/TR1X_Installer.exe "${exe_name}"
echo "Created ${exe_name}"
tr2-image-linux force="1": (_docker_build "tools/tr2/docker/game-linux/Dockerfile" "rrdash/tr2x-linux" force)
diff --git a/tools/installer/TR1X_Installer/App.xaml b/tools/installer/TR1X_Installer/App.xaml
new file mode 100644
index 000000000..ebf518429
--- /dev/null
+++ b/tools/installer/TR1X_Installer/App.xaml
@@ -0,0 +1,4 @@
+
diff --git a/tools/installer/TR1X_Installer/App.xaml.cs b/tools/installer/TR1X_Installer/App.xaml.cs
new file mode 100644
index 000000000..05615d2ef
--- /dev/null
+++ b/tools/installer/TR1X_Installer/App.xaml.cs
@@ -0,0 +1,22 @@
+using System.Windows;
+using TR1X_Installer.Installers;
+using TRX_InstallerLib.Controls;
+using TRX_InstallerLib.Installers;
+
+namespace TR1X_Installer;
+
+public partial class App : Application
+{
+ public App()
+ {
+ Current.MainWindow = new TRXInstallWindow(new List
+ {
+ new SteamInstallSource(),
+ new GOGInstallSource(),
+ new TombATIInstallSource(),
+ new CDRomInstallSource(),
+ new TR1XInstallSource(),
+ });
+ Current.MainWindow.Show();
+ }
+}
diff --git a/tools/tr1/installer/Installer/Installers/CDRomInstallSource.cs b/tools/installer/TR1X_Installer/Installers/CDRomInstallSource.cs
similarity index 87%
rename from tools/tr1/installer/Installer/Installers/CDRomInstallSource.cs
rename to tools/installer/TR1X_Installer/Installers/CDRomInstallSource.cs
index 9080bdfcc..9d94d9e8b 100644
--- a/tools/tr1/installer/Installer/Installers/CDRomInstallSource.cs
+++ b/tools/installer/TR1X_Installer/Installers/CDRomInstallSource.cs
@@ -1,10 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.IO;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
+using TRX_InstallerLib.Installers;
+using TRX_InstallerLib.Utils;
-namespace Installer.Installers;
+namespace TR1X_Installer.Installers;
public class CDRomInstallSource : BaseInstallSource
{
@@ -47,7 +46,7 @@ public class CDRomInstallSource : BaseInstallSource
return true;
}
- public override bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory)
+ public override bool IsDownloadingExpansionNeeded(string sourceDirectory)
{
return true;
}
diff --git a/tools/tr1/installer/Installer/Installers/GOGInstallSource.cs b/tools/installer/TR1X_Installer/Installers/GOGInstallSource.cs
similarity index 81%
rename from tools/tr1/installer/Installer/Installers/GOGInstallSource.cs
rename to tools/installer/TR1X_Installer/Installers/GOGInstallSource.cs
index 7c0f5dd5f..e56b2ca10 100644
--- a/tools/tr1/installer/Installer/Installers/GOGInstallSource.cs
+++ b/tools/installer/TR1X_Installer/Installers/GOGInstallSource.cs
@@ -1,15 +1,13 @@
using DiscUtils.Iso9660;
using DiscUtils.Streams;
-using Installer.Utils;
using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
+using TRX_InstallerLib.Installers;
+using TRX_InstallerLib.Models;
+using TRX_InstallerLib.Utils;
-namespace Installer.Installers;
+namespace TR1X_Installer.Installers;
public class GOGInstallSource : BaseInstallSource
{
@@ -50,7 +48,7 @@ public class GOGInstallSource : BaseInstallSource
}
catch (Exception e)
{
- throw new ApplicationException($"Could not read CUE {cuePath}:\n{e.Message}");
+ throw new ApplicationException(string.Format(Language.Instance.Controls!["progress_cue_failure"], cuePath, e.Message));
}
try
@@ -60,7 +58,7 @@ public class GOGInstallSource : BaseInstallSource
}
catch (Exception e)
{
- throw new ApplicationException($"Could not convert BIN to ISO: {e.Message}");
+ throw new ApplicationException(string.Format(Language.Instance.Controls!["progress_converting_bin_failure"], e.Message));
}
try
@@ -73,14 +71,14 @@ public class GOGInstallSource : BaseInstallSource
{
MaximumValue = 1,
CurrentValue = 0,
- Description = "Scanning the source directory",
+ Description = Language.Instance.Controls!["progress_scanning_source"],
});
var filesToExtract = GetFilesToExtract(reader.Root);
progress.Report(new InstallProgress
{
MaximumValue = filesToExtract.Count(),
CurrentValue = 0,
- Description = "Preparing to extract the ISO",
+ Description = Language.Instance.Controls!["progress_preparing_extract"],
});
foreach (var path in filesToExtract)
{
@@ -90,7 +88,7 @@ public class GOGInstallSource : BaseInstallSource
Directory.CreateDirectory(Path.GetDirectoryName(targetPath)!);
using SparseStream sourceStream = reader.OpenFile(path, FileMode.Open, FileAccess.Read);
- var readAllByte = new Byte[sourceStream.Length];
+ var readAllByte = new byte[sourceStream.Length];
sourceStream.Read(readAllByte, 0, readAllByte.Length);
using FileStream targetStream = new(targetPath, FileMode.Create);
@@ -102,13 +100,13 @@ public class GOGInstallSource : BaseInstallSource
{
MaximumValue = filesToExtract.Count(),
CurrentValue = ++currentProgress,
- Description = $"Extracting {path}",
+ Description = string.Format(Language.Instance.Controls!["progress_extracting"], path)
});
}
}
catch (Exception e)
{
- throw new ApplicationException($"Could not open converted ISO: {e.Message}");
+ throw new ApplicationException(string.Format(Language.Instance.Controls!["progress_converting_iso_failure"], e.Message));
}
File.Delete(isoPath);
@@ -121,7 +119,7 @@ public class GOGInstallSource : BaseInstallSource
return true;
}
- public override bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory)
+ public override bool IsDownloadingExpansionNeeded(string sourceDirectory)
{
return true;
}
diff --git a/tools/tr1/installer/Installer/Installers/SteamInstallSource.cs b/tools/installer/TR1X_Installer/Installers/SteamInstallSource.cs
similarity index 91%
rename from tools/tr1/installer/Installer/Installers/SteamInstallSource.cs
rename to tools/installer/TR1X_Installer/Installers/SteamInstallSource.cs
index b2c8017ba..03a12edbe 100644
--- a/tools/tr1/installer/Installer/Installers/SteamInstallSource.cs
+++ b/tools/installer/TR1X_Installer/Installers/SteamInstallSource.cs
@@ -1,8 +1,7 @@
using Microsoft.Win32;
-using System.Collections.Generic;
using System.IO;
-namespace Installer.Installers;
+namespace TR1X_Installer.Installers;
public class SteamInstallSource : GOGInstallSource
{
diff --git a/tools/tr1/installer/Installer/Installers/TR1XInstallSource.cs b/tools/installer/TR1X_Installer/Installers/TR1XInstallSource.cs
similarity index 83%
rename from tools/tr1/installer/Installer/Installers/TR1XInstallSource.cs
rename to tools/installer/TR1X_Installer/Installers/TR1XInstallSource.cs
index c91d38945..2ea7f6d94 100644
--- a/tools/tr1/installer/Installer/Installers/TR1XInstallSource.cs
+++ b/tools/installer/TR1X_Installer/Installers/TR1XInstallSource.cs
@@ -1,10 +1,9 @@
-using System;
-using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
+using TRX_InstallerLib.Installers;
+using TRX_InstallerLib.Utils;
-namespace Installer.Installers;
+namespace TR1X_Installer.Installers;
public class TR1XInstallSource : BaseInstallSource
{
@@ -27,10 +26,7 @@ public class TR1XInstallSource : BaseInstallSource
public override string SuggestedInstallationDirectory
{
- get
- {
- return InstallUtils.GetPreviousInstallationPath() ?? base.SuggestedInstallationDirectory;
- }
+ get => InstallUtils.GetPreviousInstallationPath() ?? base.SuggestedInstallationDirectory;
}
public override bool IsImportingSavesSupported => true;
@@ -57,7 +53,7 @@ public class TR1XInstallSource : BaseInstallSource
return !Directory.Exists(Path.Combine(sourceDirectory, "music"));
}
- public override bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory)
+ public override bool IsDownloadingExpansionNeeded(string sourceDirectory)
{
return !File.Exists(Path.Combine(sourceDirectory, "data", "cat.phd"));
}
diff --git a/tools/tr1/installer/Installer/Installers/TombATIInstallSource.cs b/tools/installer/TR1X_Installer/Installers/TombATIInstallSource.cs
similarity index 89%
rename from tools/tr1/installer/Installer/Installers/TombATIInstallSource.cs
rename to tools/installer/TR1X_Installer/Installers/TombATIInstallSource.cs
index f668465bb..7d1cc8335 100644
--- a/tools/tr1/installer/Installer/Installers/TombATIInstallSource.cs
+++ b/tools/installer/TR1X_Installer/Installers/TombATIInstallSource.cs
@@ -1,10 +1,9 @@
-using System;
-using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
+using TRX_InstallerLib.Installers;
+using TRX_InstallerLib.Utils;
-namespace Installer.Installers;
+namespace TR1X_Installer.Installers;
public class TombATIInstallSource : BaseInstallSource
{
@@ -48,7 +47,7 @@ public class TombATIInstallSource : BaseInstallSource
return !Directory.Exists(Path.Combine(sourceDirectory, "music"));
}
- public override bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory)
+ public override bool IsDownloadingExpansionNeeded(string sourceDirectory)
{
return !File.Exists(Path.Combine(sourceDirectory, "data", "cat.phd"));
}
diff --git a/tools/tr1/installer/Installer/Resources/CDRom.png b/tools/installer/TR1X_Installer/Resources/CDRom.png
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/CDRom.png
rename to tools/installer/TR1X_Installer/Resources/CDRom.png
diff --git a/tools/tr1/installer/Installer/Resources/GOG.png b/tools/installer/TR1X_Installer/Resources/GOG.png
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/GOG.png
rename to tools/installer/TR1X_Installer/Resources/GOG.png
diff --git a/tools/installer/TR1X_Installer/Resources/Lang/en.json b/tools/installer/TR1X_Installer/Resources/Lang/en.json
new file mode 100644
index 000000000..5eec7f72f
--- /dev/null
+++ b/tools/installer/TR1X_Installer/Resources/Lang/en.json
@@ -0,0 +1,12 @@
+{
+ "Controls": {
+ "window_title_main": "TR1X Installer",
+ "step_source_content": "TR1X requires original game files to run.\nPlease choose the source location where to install the data files from.\nIf you're upgrading an existing installation, please choose TR1X.",
+ "step_settings_music_content": "Neither the Steam nor GOG versions of the game ship with the full soundtrack found on the PlayStation or Saturn retail releases. This option lets you download the missing tracks automatically (164 MB). The legality of these files is disputable; the most legal way to import the music to PC is to rip the audio tracks yourself from a physical PlayStation or Saturn disc.",
+ "step_settings_expansion_heading": "Download Unfinished Business expansion pack",
+ "step_settings_expansion_content": "The Unfinished Business expansion pack was made freeware. However, the Steam and GOG versions do not ship it. This option lets you download the expansion files automatically (6 MB).",
+ "step_settings_expansion_music": "Fan-made edition (includes music triggers)",
+ "step_settings_expansion_vanilla": "Original edition (does not include music triggers)",
+ "step_settings_saves_content": "Imports existing savegame files. Only TombATI and TR1X savegame format is supported at this time."
+ }
+}
diff --git a/tools/tr1/installer/Installer/Resources/Steam.png b/tools/installer/TR1X_Installer/Resources/Steam.png
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/Steam.png
rename to tools/installer/TR1X_Installer/Resources/Steam.png
diff --git a/tools/tr1/installer/Installer/Resources/TR1X.png b/tools/installer/TR1X_Installer/Resources/TR1X.png
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/TR1X.png
rename to tools/installer/TR1X_Installer/Resources/TR1X.png
diff --git a/tools/tr1/installer/Installer/Resources/TombATI.png b/tools/installer/TR1X_Installer/Resources/TombATI.png
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/TombATI.png
rename to tools/installer/TR1X_Installer/Resources/TombATI.png
diff --git a/tools/installer/TR1X_Installer/Resources/const.json b/tools/installer/TR1X_Installer/Resources/const.json
new file mode 100644
index 000000000..65b48f7f1
--- /dev/null
+++ b/tools/installer/TR1X_Installer/Resources/const.json
@@ -0,0 +1,4 @@
+{
+ "Game": "TR1X",
+ "AllowExpansionTypeSelection": true
+}
diff --git a/tools/tr1/installer/Installer/Resources/icon.ico b/tools/installer/TR1X_Installer/Resources/icon.ico
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/icon.ico
rename to tools/installer/TR1X_Installer/Resources/icon.ico
diff --git a/tools/tr1/installer/Installer/Resources/release.zip b/tools/installer/TR1X_Installer/Resources/release.zip
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/release.zip
rename to tools/installer/TR1X_Installer/Resources/release.zip
diff --git a/tools/tr1/installer/Installer/Resources/side1.jpg b/tools/installer/TR1X_Installer/Resources/side1.jpg
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/side1.jpg
rename to tools/installer/TR1X_Installer/Resources/side1.jpg
diff --git a/tools/tr1/installer/Installer/Resources/side2.jpg b/tools/installer/TR1X_Installer/Resources/side2.jpg
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/side2.jpg
rename to tools/installer/TR1X_Installer/Resources/side2.jpg
diff --git a/tools/tr1/installer/Installer/Resources/side3.jpg b/tools/installer/TR1X_Installer/Resources/side3.jpg
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/side3.jpg
rename to tools/installer/TR1X_Installer/Resources/side3.jpg
diff --git a/tools/tr1/installer/Installer/Resources/side4.jpg b/tools/installer/TR1X_Installer/Resources/side4.jpg
similarity index 100%
rename from tools/tr1/installer/Installer/Resources/side4.jpg
rename to tools/installer/TR1X_Installer/Resources/side4.jpg
diff --git a/tools/installer/TR1X_Installer/TR1X_Installer.csproj b/tools/installer/TR1X_Installer/TR1X_Installer.csproj
new file mode 100644
index 000000000..cb8b6781e
--- /dev/null
+++ b/tools/installer/TR1X_Installer/TR1X_Installer.csproj
@@ -0,0 +1,56 @@
+
+
+ WinExe
+ net6.0-windows
+ enable
+ enable
+ true
+ false
+
+ true
+ TR1X_Installer
+ True
+ true
+ true
+ false
+ true
+ false
+ false
+ win-x64
+ Resources\icon.ico
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/installer/TRX_InstallerLib.sln b/tools/installer/TRX_InstallerLib.sln
index 087f2e568..c48ed6325 100644
--- a/tools/installer/TRX_InstallerLib.sln
+++ b/tools/installer/TRX_InstallerLib.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.11.35219.272
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TRX_InstallerLib", "TRX_InstallerLib\TRX_InstallerLib.csproj", "{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TR1X_Installer", "TR1X_Installer\TR1X_Installer.csproj", "{5B32640D-3997-472F-A1BA-FCE4128E0688}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27F08E8C-2910-4682-B8BC-96ED4C1ECE54}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5B32640D-3997-472F-A1BA-FCE4128E0688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5B32640D-3997-472F-A1BA-FCE4128E0688}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5B32640D-3997-472F-A1BA-FCE4128E0688}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5B32640D-3997-472F-A1BA-FCE4128E0688}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/tools/installer/TRX_InstallerLib/Controls/InstallStepControl.xaml.cs b/tools/installer/TRX_InstallerLib/Controls/InstallStepControl.xaml.cs
index 1dca0228e..55cd53812 100644
--- a/tools/installer/TRX_InstallerLib/Controls/InstallStepControl.xaml.cs
+++ b/tools/installer/TRX_InstallerLib/Controls/InstallStepControl.xaml.cs
@@ -1,5 +1,4 @@
-using Installer.Models;
-using System.Windows;
+using System.Windows;
using TRX_InstallerLib.Models;
using WC = System.Windows.Controls;
diff --git a/tools/installer/TRX_InstallerLib/Models/InstallStep.cs b/tools/installer/TRX_InstallerLib/Models/InstallStep.cs
index 3ebadfbca..175fa1b60 100644
--- a/tools/installer/TRX_InstallerLib/Models/InstallStep.cs
+++ b/tools/installer/TRX_InstallerLib/Models/InstallStep.cs
@@ -1,4 +1,3 @@
-using Installer.Models;
using TRX_InstallerLib.Installers;
using TRX_InstallerLib.Utils;
diff --git a/tools/installer/TRX_InstallerLib/Models/Logger.cs b/tools/installer/TRX_InstallerLib/Models/Logger.cs
index 0c25c9318..3a3a7b622 100644
--- a/tools/installer/TRX_InstallerLib/Models/Logger.cs
+++ b/tools/installer/TRX_InstallerLib/Models/Logger.cs
@@ -1,4 +1,4 @@
-namespace Installer.Models;
+namespace TRX_InstallerLib.Models;
public class LogEventArgs
{
diff --git a/tools/installer/TRX_InstallerLib/TRX_InstallerLib.csproj b/tools/installer/TRX_InstallerLib/TRX_InstallerLib.csproj
index 238366c20..478161f7d 100644
--- a/tools/installer/TRX_InstallerLib/TRX_InstallerLib.csproj
+++ b/tools/installer/TRX_InstallerLib/TRX_InstallerLib.csproj
@@ -6,21 +6,23 @@
true
enable
false
+ true
+
+
+
+
+
-
-
-
-
-
-
-
+
MSBuild:Compile
+
+
diff --git a/tools/tr1/docker/installer/entrypoint.sh b/tools/tr1/docker/installer/entrypoint.sh
index fdd1be54f..45126b19f 100755
--- a/tools/tr1/docker/installer/entrypoint.sh
+++ b/tools/tr1/docker/installer/entrypoint.sh
@@ -2,11 +2,11 @@
set -x
set -e
-cd /app/tools/tr1/installer/
+cd /app/tools/installer/
export DOTNET_CLI_HOME="/tmp/DOTNET_CLI_HOME"
shopt -s globstar
rm -rf **/bin **/obj **/out/*
dotnet restore
-dotnet publish -c Release -o out
+dotnet publish TR1X_Installer -c Release -o out
diff --git a/tools/tr1/installer/.gitignore b/tools/tr1/installer/.gitignore
deleted file mode 100644
index e76c073eb..000000000
--- a/tools/tr1/installer/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/
-obj/
-out/
diff --git a/tools/tr1/installer/Installer/App.xaml b/tools/tr1/installer/Installer/App.xaml
deleted file mode 100644
index 72af0457e..000000000
--- a/tools/tr1/installer/Installer/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/App.xaml.cs b/tools/tr1/installer/Installer/App.xaml.cs
deleted file mode 100644
index 88e5206ff..000000000
--- a/tools/tr1/installer/Installer/App.xaml.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Windows;
-
-namespace Installer
-{
- public partial class App : Application
- {
- public App()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml b/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml
deleted file mode 100644
index ca8905a79..000000000
--- a/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- Step 4: Done
-
-
-
- Installation complete. To configure more advanced features, you can edit the JSON files in the cfg/ directory with a text editor.
-
-
-
- Happy raiding :)
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml.cs b/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml.cs
deleted file mode 100644
index 4e49298de..000000000
--- a/tools/tr1/installer/Installer/Controls/FinishStepControl.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Windows.Controls;
-
-namespace Installer.Controls;
-
-public partial class FinishStepControl : UserControl
-{
- public FinishStepControl()
- {
- InitializeComponent();
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml b/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml
deleted file mode 100644
index 55d1bc9af..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Step 2: Installation options
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Download music tracks
-
-
-
- Neither the Steam nor GOG versions of the game ship with the
- full soundtrack found on the PlayStation or Saturn retail
- releases. This option lets you download the missing tracks
- automatically (164 MB). The legality of these files is
- disputable; the most legal way to import the music to PC is to
- rip the audio tracks yourself from a physical PlayStation or
- Saturn disc.
-
-
-
-
-
-
-
-
-
-
- Download Unfinished Business expansion pack
-
-
-
- The Unfinished Business expansion pack was made freeware. However, the Steam and GOG versions do not ship it. This option lets you download the expansion files automatically (6 MB).
-
-
-
-
-
-
-
-
-
- Import saves
-
-
- Imports existing savegame files. Only TombATI and TR1X savegame format is supported at this time.
-
-
-
-
-
- Create desktop shortcut
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml.cs b/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml.cs
deleted file mode 100644
index e5e8e90d6..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallSettingsStepControl.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Windows.Controls;
-
-namespace Installer.Controls;
-
-public partial class InstallSettingsStepControl : UserControl
-{
- public InstallSettingsStepControl()
- {
- InitializeComponent();
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml b/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml
deleted file mode 100644
index 05dd8a5f0..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (change)
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml.cs b/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml.cs
deleted file mode 100644
index 368f9e18c..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallSourceControl.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Windows.Controls;
-
-namespace Installer.Controls;
-
-public partial class InstallSourceControl : UserControl
-{
- public InstallSourceControl()
- {
- InitializeComponent();
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml b/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml
deleted file mode 100644
index d7f95f304..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Step 3: Installing
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml.cs b/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml.cs
deleted file mode 100644
index 4394d278f..000000000
--- a/tools/tr1/installer/Installer/Controls/InstallStepControl.xaml.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using Installer.Models;
-using System;
-using System.Windows;
-using System.Windows.Controls;
-
-namespace Installer.Controls;
-
-public partial class InstallStepControl : UserControl
-{
- public InstallStepControl()
- {
- InitializeComponent();
- DataContextChanged += (object sender, DependencyPropertyChangedEventArgs e) =>
- {
- var dataContext = DataContext as InstallStep;
- if (dataContext is not null)
- {
- string? lastMessage = null;
- dataContext.Logger.LogEvent += (object sender, LogEventArgs e) =>
- {
- if (e.Message != lastMessage)
- {
- lastMessage = e.Message;
- AppendMessage(e.Message);
- }
- };
- }
- };
- }
-
- private void AppendMessage(string message)
- {
- logTextBox.Dispatcher.Invoke(() =>
- {
- logTextBox.AppendText(message + Environment.NewLine);
- logTextBox.Focus();
- logTextBox.CaretIndex = logTextBox.Text.Length;
- logTextBox.ScrollToEnd();
- });
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/MainWindow.xaml b/tools/tr1/installer/Installer/Controls/MainWindow.xaml
deleted file mode 100644
index e88531475..000000000
--- a/tools/tr1/installer/Installer/Controls/MainWindow.xaml
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/MainWindow.xaml.cs b/tools/tr1/installer/Installer/Controls/MainWindow.xaml.cs
deleted file mode 100644
index 7f7e94437..000000000
--- a/tools/tr1/installer/Installer/Controls/MainWindow.xaml.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Installer.Models;
-using System.Windows;
-
-namespace Installer;
-
-public partial class MainWindow : Window
-{
- public MainWindow()
- {
- InitializeComponent();
- DataContext = new MainWindowViewModel();
- }
-}
diff --git a/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml b/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml
deleted file mode 100644
index 5870cd50b..000000000
--- a/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Step 1: Choose installation source
-
-
-
- TR1X requires original game files to run.
-
- Please choose the source location where to install the data files from.
-
- If you're upgrading an existing installation, please choose TR1X.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml.cs b/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml.cs
deleted file mode 100644
index 5c6de8758..000000000
--- a/tools/tr1/installer/Installer/Controls/SourceStepControl.xaml.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Windows.Controls;
-
-namespace Installer.Controls;
-
-public partial class SourceStepControl : UserControl
-{
- public SourceStepControl()
- {
- InitializeComponent();
- }
-}
diff --git a/tools/tr1/installer/Installer/Installer.csproj b/tools/tr1/installer/Installer/Installer.csproj
deleted file mode 100644
index e83bd6332..000000000
--- a/tools/tr1/installer/Installer/Installer.csproj
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
- WinExe
- net6.0-windows
- enable
- true
- true
-
- true
- TR1X_Installer
- 10.0
- false
- false
-
- true
- true
- false
- true
- false
- false
- win-x64
- Resources\icon.ico
-
-
-
-
-
- Designer
-
-
- %(Filename)
- Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MSBuild:Compile
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Installers/BaseInstallSource.cs b/tools/tr1/installer/Installer/Installers/BaseInstallSource.cs
deleted file mode 100644
index 73f63b50b..000000000
--- a/tools/tr1/installer/Installer/Installers/BaseInstallSource.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
-
-namespace Installer.Installers;
-
-public abstract class BaseInstallSource : IInstallSource
-{
- public abstract IEnumerable DirectoriesToTry { get; }
-
- public virtual string ImageSource
- {
- get
- {
- return $"pack://application:,,,/TR1X_Installer;component/Resources/{SourceName}.png";
- }
- }
-
- public abstract bool IsImportingSavesSupported { get; }
- public abstract string SourceName { get; }
-
- public virtual string SuggestedInstallationDirectory
- {
- get
- {
- return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TR1X");
- }
- }
-
- public abstract Task CopyOriginalGameFiles(
- string sourceDirectory,
- string targetDirectory,
- IProgress progress,
- bool importSaves
- );
-
- public abstract bool IsDownloadingMusicNeeded(string sourceDirectory);
-
- public abstract bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory);
-
- public abstract bool IsGameFound(string sourceDirectory);
-}
diff --git a/tools/tr1/installer/Installer/Installers/IInstallSource.cs b/tools/tr1/installer/Installer/Installers/IInstallSource.cs
deleted file mode 100644
index a40afaea4..000000000
--- a/tools/tr1/installer/Installer/Installers/IInstallSource.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Installer.Installers;
-
-public interface IInstallSource
-{
- public IEnumerable DirectoriesToTry { get; }
-
- public string ImageSource { get; }
-
- public string SourceName { get; }
-
- public string SuggestedInstallationDirectory { get; }
-
- public Task CopyOriginalGameFiles(
- string sourceDirectory,
- string targetDirectory,
- IProgress progress,
- bool importSaves
- );
-
- bool IsDownloadingMusicNeeded(string sourceDirectory);
-
- bool IsDownloadingUnfinishedBusinessNeeded(string sourceDirectory);
-
- public bool IsGameFound(string sourceDirectory);
-
- bool IsImportingSavesSupported { get; }
-};
diff --git a/tools/tr1/installer/Installer/Installers/InstallExecutor.cs b/tools/tr1/installer/Installer/Installers/InstallExecutor.cs
deleted file mode 100644
index 2e4756d52..000000000
--- a/tools/tr1/installer/Installer/Installers/InstallExecutor.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using Installer.Models;
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Threading.Tasks;
-
-namespace Installer.Installers;
-
-public class InstallExecutor
-{
- private static readonly string _resourceBaseURL = "https://lostartefacts.dev/aux/tr1x";
-
- public InstallExecutor(InstallSettings settings)
- {
- _settings = settings;
- }
-
- public IInstallSource? InstallSource
- {
- get
- {
- return _settings.InstallSource;
- }
- }
-
- public async Task ExecuteInstall(IProgress progress)
- {
- if (_settings.SourceDirectory is null)
- {
- throw new NullReferenceException();
- }
- if (_settings.TargetDirectory is null)
- {
- throw new NullReferenceException();
- }
-
- await CopyOriginalGameFiles(_settings.SourceDirectory, _settings.TargetDirectory, progress);
- await CopyTR1XFiles(_settings.TargetDirectory, progress);
- if (_settings.DownloadMusic)
- {
- await DownloadMusicFiles(_settings.TargetDirectory, progress);
- }
-
- if (_settings.DownloadUnfinishedBusiness)
- {
- await DownloadUnfinishedBusinessFiles(_settings.TargetDirectory, _settings.UnfinishedBusinessType, progress);
- }
- if (_settings.CreateDesktopShortcut)
- {
- CreateDesktopShortcut(_settings.TargetDirectory);
- }
-
- progress.Report(new InstallProgress { Description = "Finished", Finished = true });
- }
-
- protected async Task CopyOriginalGameFiles(string sourceDirectory, string targetDirectory, IProgress progress)
- {
- if (_settings.InstallSource is null)
- {
- throw new NullReferenceException();
- }
- await _settings.InstallSource.CopyOriginalGameFiles(sourceDirectory, targetDirectory, progress, _settings.ImportSaves);
- }
-
- protected static async Task CopyTR1XFiles(string targetDirectory, IProgress progress)
- {
- InstallUtils.StoreInstallationPath(targetDirectory);
-
- progress.Report(new InstallProgress
- {
- CurrentValue = 0,
- MaximumValue = 1,
- Description = "Opening embedded ZIP",
- });
-
- var assembly = Assembly.GetExecutingAssembly();
- var resourceName = assembly.GetManifestResourceNames().Where(n => n.EndsWith("release.zip")).First();
- using var stream = assembly.GetManifestResourceStream(resourceName)
- ?? throw new ApplicationException($"Could not open embedded ZIP.");
- await InstallUtils.ExtractZip(stream, targetDirectory, progress, overwrite: true);
- }
-
- protected static void CreateDesktopShortcut(string targetDirectory)
- {
- InstallUtils.CreateDesktopShortcut("TR1X", Path.Combine(targetDirectory, "TR1X.exe"));
- if (File.Exists(Path.Combine(targetDirectory, "data", "cat.phd")))
- {
- InstallUtils.CreateDesktopShortcut("TR1X - UB", Path.Combine(targetDirectory, "TR1X.exe"), new[] { "-gold" });
- }
- }
-
- protected static async Task DownloadMusicFiles(string targetDirectory, IProgress progress)
- {
- await InstallUtils.DownloadZip($"{_resourceBaseURL}/music.zip", targetDirectory, progress);
- }
-
- protected static async Task DownloadUnfinishedBusinessFiles(string targetDirectory, UBPackType type, IProgress progress)
- {
- await InstallUtils.DownloadZip(
- $"{_resourceBaseURL}/trub-{type.ToString().ToLower()}.zip",
- targetDirectory, progress);
- }
-
- private readonly InstallSettings _settings;
-}
diff --git a/tools/tr1/installer/Installer/Installers/InstallProgress.cs b/tools/tr1/installer/Installer/Installers/InstallProgress.cs
deleted file mode 100644
index 05dfb0b14..000000000
--- a/tools/tr1/installer/Installer/Installers/InstallProgress.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Installer.Installers;
-
-public class InstallProgress
-{
- public int? CurrentValue { get; set; }
- public string? Description { get; set; }
- public bool Finished { get; set; }
- public int? MaximumValue { get; set; }
-}
diff --git a/tools/tr1/installer/Installer/Installers/InstallUtils.cs b/tools/tr1/installer/Installer/Installers/InstallUtils.cs
deleted file mode 100644
index 39ef101d4..000000000
--- a/tools/tr1/installer/Installer/Installers/InstallUtils.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-using Installer.Utils;
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-
-namespace Installer.Installers;
-
-public static class InstallUtils
-{
- private static readonly string _legacyStorageKey = @"Software\Tomb1Main";
- private static readonly string _registryStorageKey = @"Software\TR1X";
-
- public static async Task CopyDirectoryTree(
- string sourceDirectory,
- string targetDirectory,
- IProgress progress,
- Func? filterCallback = null,
- Func? overwriteCallback = null
- )
- {
- try
- {
- progress.Report(new InstallProgress { Description = "Scanning directory" });
- var files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories);
- var currentProgress = 0;
- var maximumProgress = files.Length;
- foreach (var sourcePath in files)
- {
- if (filterCallback is not null && !filterCallback(sourcePath))
- {
- continue;
- }
- var relPath = Path.GetRelativePath(sourceDirectory, sourcePath);
- var targetPath = Path.Combine(targetDirectory, relPath);
- var isSamePath = string.Equals(Path.GetFullPath(sourcePath), Path.GetFullPath(targetPath), StringComparison.OrdinalIgnoreCase);
- if (!File.Exists(targetPath) || (overwriteCallback is not null && overwriteCallback(sourcePath)) && !isSamePath)
- {
- progress.Report(new InstallProgress
- {
- CurrentValue = currentProgress,
- MaximumValue = maximumProgress,
- Description = $"Copying {relPath}",
- });
- Directory.CreateDirectory(Path.GetDirectoryName(targetPath)!);
- await Task.Run(() => File.Copy(sourcePath, targetPath, true));
- }
- else
- {
- progress.Report(new InstallProgress
- {
- CurrentValue = currentProgress,
- MaximumValue = maximumProgress,
- Description = $"Copying {relPath} - skipped",
- });
- }
-
- currentProgress++;
- }
- }
- catch (Exception e)
- {
- throw new ApplicationException($"Could not extract ZIP:\n{e.Message}");
- }
- }
-
- public static void CreateDesktopShortcut(string name, string targetPath, string[]? args = null)
- {
- var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), $"{name}.lnk");
- ShortcutUtils.CreateShortcut(shortcutPath, targetPath, "Tomb Raider I: Community Edition", args);
- }
-
- public static async Task DownloadFile(string url, IProgress progress)
- {
- HttpProgressClient wc = new();
- progress.Report(new InstallProgress { Description = $"Initializing download of {url}" });
- wc.DownloadProgressChanged += (totalBytesToReceive, bytesReceived) =>
- {
- progress.Report(new InstallProgress
- {
- CurrentValue = (int)bytesReceived,
- MaximumValue = (int)totalBytesToReceive,
- Description = $"Downloading {url}",
- });
- };
- return await wc.DownloadDataTaskAsync(new Uri(url));
- }
-
- public static async Task DownloadZip(
- string url,
- string targetDirectory,
- IProgress progress
- )
- {
- var response = await DownloadFile(url, progress);
- using var stream = new MemoryStream(response);
- await ExtractZip(stream, targetDirectory, progress);
- }
-
- public static async Task ExtractZip(
- Stream stream,
- string targetDirectory,
- IProgress progress,
- Func? filterCallback = null,
- bool overwrite = false
- )
- {
- try
- {
- using var zip = new ZipArchive(stream);
- progress.Report(new InstallProgress
- {
- Description = "Scanning embedded ZIP",
- });
- var currentProgress = 0;
- var maximumProgress = zip.Entries.Count;
- foreach (var entry in zip.Entries)
- {
- if (new Regex(@"[\\/]$").IsMatch(entry.FullName))
- {
- continue;
- }
- if (filterCallback is not null && !filterCallback(entry.FullName))
- {
- continue;
- }
- var targetPath = Path.Combine(
- targetDirectory,
- new Regex(@"[\\/]").Replace(entry.FullName, Path.DirectorySeparatorChar.ToString()));
-
- if (!File.Exists(targetPath) || overwrite)
- {
- progress.Report(new InstallProgress
- {
- CurrentValue = currentProgress,
- MaximumValue = maximumProgress,
- Description = $"Extracting {entry.FullName}",
- });
-
- Directory.CreateDirectory(Path.GetDirectoryName(targetPath)!);
- await Task.Run(() => entry.ExtractToFile(targetPath, true));
- }
- else
- {
- progress.Report(new InstallProgress
- {
- CurrentValue = currentProgress,
- MaximumValue = maximumProgress,
- Description = $"Extracting {entry.FullName} - skipped",
- });
- }
-
- currentProgress++;
- }
- }
- catch (Exception e)
- {
- throw new ApplicationException($"Could not extract ZIP:\n{e.Message}");
- }
- }
-
- public static IEnumerable GetDesktopShortcutDirectories()
- {
- foreach (
- var shortcutPath in Directory.EnumerateFiles(
- Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "*.lnk"
- )
- )
- {
- string? lnkPath;
- try
- {
- lnkPath = ShortcutUtils.GetLnkTargetPath(shortcutPath);
- }
- catch (Exception)
- {
- continue;
- }
- if (lnkPath is not null)
- {
- var dirName = Path.GetDirectoryName(lnkPath);
- if (dirName is not null)
- {
- yield return dirName;
- }
- }
- }
- }
-
- public static void StoreInstallationPath(string installPath)
- {
- RenameLegacyStorage();
- using var key = Registry.CurrentUser.CreateSubKey(_registryStorageKey);
- key?.SetValue("InstallPath", installPath);
- }
-
- public static string? GetPreviousInstallationPath()
- {
- RenameLegacyStorage();
- using var key = Registry.CurrentUser.OpenSubKey(_registryStorageKey);
- return key?.GetValue("InstallPath")?.ToString();
- }
-
- private static void RenameLegacyStorage()
- {
- // Added in #1411 - to be removed in the future.
- using var legacyKey = Registry.CurrentUser.OpenSubKey(_legacyStorageKey);
- if (legacyKey is null)
- {
- return;
- }
-
- using var currentKey = Registry.CurrentUser.OpenSubKey(_registryStorageKey);
- if (currentKey is not null)
- {
- return;
- }
-
- using var destinationKey = Registry.CurrentUser.CreateSubKey(_registryStorageKey);
- foreach (string valueName in legacyKey.GetValueNames())
- {
- object? objValue = legacyKey.GetValue(valueName);
- if (objValue is not null)
- {
- RegistryValueKind valueKind = legacyKey.GetValueKind(valueName);
- destinationKey.SetValue(valueName, objValue, valueKind);
- }
- }
-
- Registry.CurrentUser.DeleteSubKey(_legacyStorageKey);
- }
-}
diff --git a/tools/tr1/installer/Installer/Models/FinishSettings.cs b/tools/tr1/installer/Installer/Models/FinishSettings.cs
deleted file mode 100644
index 0b20ccceb..000000000
--- a/tools/tr1/installer/Installer/Models/FinishSettings.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace Installer.Models;
-
-public class FinishSettings : BaseNotifyPropertyChanged
-{
- public bool LaunchGame
- {
- get => _launchGame;
- set
- {
- if (value != _launchGame)
- {
- _launchGame = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool OpenGameDirectory
- {
- get => _openGameDirectory;
- set
- {
- if (value != _openGameDirectory)
- {
- _openGameDirectory = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- private bool _launchGame = false;
- private bool _openGameDirectory = true;
-}
diff --git a/tools/tr1/installer/Installer/Models/FinishStep.cs b/tools/tr1/installer/Installer/Models/FinishStep.cs
deleted file mode 100644
index 5d67a3940..000000000
--- a/tools/tr1/installer/Installer/Models/FinishStep.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Installer.Models;
-
-public class FinishStep : BaseNotifyPropertyChanged, IStep
-{
- public FinishStep(FinishSettings finishSettings)
- {
- FinishSettings = finishSettings;
- }
-
- public bool CanProceedToNextStep => false;
- public bool CanProceedToPreviousStep => false;
- public FinishSettings FinishSettings { get; }
- public string SidebarImage => "pack://application:,,,/TR1X_Installer;component/Resources/side4.jpg";
-}
diff --git a/tools/tr1/installer/Installer/Models/IStep.cs b/tools/tr1/installer/Installer/Models/IStep.cs
deleted file mode 100644
index 3df5ed90c..000000000
--- a/tools/tr1/installer/Installer/Models/IStep.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.ComponentModel;
-
-namespace Installer.Models;
-
-public interface IStep : INotifyPropertyChanged
-{
- bool CanProceedToNextStep { get; }
- bool CanProceedToPreviousStep { get; }
- string SidebarImage { get; }
-}
diff --git a/tools/tr1/installer/Installer/Models/InstallSettings.cs b/tools/tr1/installer/Installer/Models/InstallSettings.cs
deleted file mode 100644
index 58e423d2c..000000000
--- a/tools/tr1/installer/Installer/Models/InstallSettings.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using Installer.Installers;
-
-namespace Installer.Models;
-
-public class InstallSettings : BaseNotifyPropertyChanged
-{
- public bool CreateDesktopShortcut
- {
- get => _createDesktopShortcut;
- set
- {
- if (value != _createDesktopShortcut)
- {
- _createDesktopShortcut = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool DownloadMusic
- {
- get => _downloadMusic;
- set
- {
- if (value != _downloadMusic)
- {
- _downloadMusic = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool DownloadUnfinishedBusiness
- {
- get => _downloadUnfinishedBusiness;
- set
- {
- if (value != _downloadUnfinishedBusiness)
- {
- _downloadUnfinishedBusiness = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public UBPackType UnfinishedBusinessType
- {
- get => _unfinishedBusinessType;
- set
- {
- if (value != _unfinishedBusinessType)
- {
- _unfinishedBusinessType = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool ImportSaves
- {
- get => _importSaves;
- set
- {
- if (value != _importSaves)
- {
- _importSaves = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public IInstallSource? InstallSource
- {
- get => _installSource;
- set
- {
- if (value != _installSource)
- {
- _installSource = value;
- DownloadMusic = SourceDirectory is not null && (_installSource?.IsDownloadingMusicNeeded(SourceDirectory) ?? false);
- DownloadUnfinishedBusiness = SourceDirectory is not null && (_installSource?.IsDownloadingUnfinishedBusinessNeeded(SourceDirectory) ?? false);
- ImportSaves = _installSource?.IsImportingSavesSupported ?? false;
- TargetDirectory = _installSource?.SuggestedInstallationDirectory;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool IsDownloadingMusicNeeded
- {
- get
- {
- return SourceDirectory is not null && (InstallSource?.IsDownloadingMusicNeeded(SourceDirectory) ?? false);
- }
- }
-
- public bool IsDownloadingUnfinishedBusinessNeeded
- {
- get
- {
- return SourceDirectory is not null && (InstallSource?.IsDownloadingUnfinishedBusinessNeeded(SourceDirectory) ?? false);
- }
- }
-
- public string? SourceDirectory
- {
- get => _sourceDirectory;
- set
- {
- if (value != _sourceDirectory)
- {
- _sourceDirectory = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public string? TargetDirectory
- {
- get => _targetDirectory;
- set
- {
- if (value != _targetDirectory)
- {
- _targetDirectory = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- private bool _createDesktopShortcut = true;
- private bool _downloadMusic;
- private bool _downloadUnfinishedBusiness;
- private UBPackType _unfinishedBusinessType;
- private bool _importSaves;
- private IInstallSource? _installSource;
- private string? _sourceDirectory;
- private string? _targetDirectory;
-}
diff --git a/tools/tr1/installer/Installer/Models/InstallSettingsStep.cs b/tools/tr1/installer/Installer/Models/InstallSettingsStep.cs
deleted file mode 100644
index 68a842c7a..000000000
--- a/tools/tr1/installer/Installer/Models/InstallSettingsStep.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Installer.Utils;
-using System.Windows.Input;
-
-namespace Installer.Models;
-
-public class InstallSettingsStep : BaseNotifyPropertyChanged, IStep
-{
- public InstallSettingsStep(InstallSettings installSettings)
- {
- InstallSettings = installSettings;
- InstallSettings.PropertyChanged += (sender, e) =>
- {
- NotifyPropertyChanged(nameof(CanProceedToNextStep));
- };
- }
-
- public bool CanProceedToNextStep => InstallSettings.TargetDirectory != null;
- public bool CanProceedToPreviousStep => true;
-
- public ICommand ChooseLocationCommand
- {
- get
- {
- return _chooseLocationCommand ??= new RelayCommand(ChooseLocation);
- }
- }
-
- public InstallSettings InstallSettings { get; }
- public string SidebarImage => "pack://application:,,,/TR1X_Installer;component/Resources/side2.jpg";
- private RelayCommand? _chooseLocationCommand;
-
- private void ChooseLocation()
- {
- var result = FileBrowser.Browse(InstallSettings.TargetDirectory);
- if (result is not null)
- {
- InstallSettings.TargetDirectory = result;
- }
- }
-}
diff --git a/tools/tr1/installer/Installer/Models/InstallSourceViewModel.cs b/tools/tr1/installer/Installer/Models/InstallSourceViewModel.cs
deleted file mode 100644
index 160f486ad..000000000
--- a/tools/tr1/installer/Installer/Models/InstallSourceViewModel.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using Installer.Installers;
-using Installer.Utils;
-using System.Windows.Input;
-
-namespace Installer.Models;
-
-public class InstallSourceViewModel : BaseNotifyPropertyChanged
-{
- public InstallSourceViewModel(IInstallSource source)
- {
- InstallSource = source;
-
- foreach (var directory in source.DirectoriesToTry)
- {
- if (InstallSource.IsGameFound(directory))
- {
- SourceDirectory = directory;
- break;
- }
- }
- }
-
- public ICommand ChooseLocationCommand
- {
- get
- {
- return _chooseLocationCommand ??= new RelayCommand(ChooseLocation);
- }
- }
-
- public IInstallSource InstallSource { get; private set; }
-
- public bool IsAvailable
- {
- get
- {
- return SourceDirectory != null && InstallSource.IsGameFound(SourceDirectory);
- }
- }
-
- public string? SourceDirectory
- {
- get => _sourceDirectory;
- set
- {
- if (value != _sourceDirectory)
- {
- _sourceDirectory = value;
- NotifyPropertyChanged();
- NotifyPropertyChanged(nameof(IsAvailable));
- }
- }
- }
-
- private RelayCommand? _chooseLocationCommand;
- private string? _sourceDirectory;
-
- private void ChooseLocation()
- {
- var result = FileBrowser.Browse(SourceDirectory);
- if (result is not null)
- {
- SourceDirectory = result;
- }
- }
-}
diff --git a/tools/tr1/installer/Installer/Models/InstallStep.cs b/tools/tr1/installer/Installer/Models/InstallStep.cs
deleted file mode 100644
index aa42941df..000000000
--- a/tools/tr1/installer/Installer/Models/InstallStep.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using Installer.Installers;
-using System;
-using System.Threading.Tasks;
-
-namespace Installer.Models;
-
-public class InstallStep : BaseNotifyPropertyChanged, IStep
-{
- public InstallStep(InstallSettings installSettings)
- {
- Logger = new Logger();
- InstallSettings = installSettings;
- }
-
- public bool CanProceedToNextStep
- {
- get => _canProceedToNextStep;
- set
- {
- if (value != _canProceedToNextStep)
- {
- _canProceedToNextStep = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public bool CanProceedToPreviousStep => false;
-
- public int CurrentProgress
- {
- get { return _currentProgress; }
- set
- {
- if (value != _currentProgress)
- {
- _currentProgress = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public string? Description
- {
- get => _description;
- set
- {
- if (value != _description)
- {
- _description = value;
- NotifyPropertyChanged();
- }
- }
- }
-
- public InstallSettings InstallSettings { get; }
- public Logger Logger { get; }
-
- public int MaximumProgress
- {
- get { return _maximumProgress; }
- set
- {
- if (value != _maximumProgress)
- {
- _maximumProgress = value;
- NotifyPropertyChanged();
- NotifyPropertyChanged(nameof(CanProceedToNextStep));
- }
- }
- }
-
- public string SidebarImage => "pack://application:,,,/TR1X_Installer;component/Resources/side3.jpg";
-
- public void RunInstall()
- {
- var progress = new Progress();
- progress.ProgressChanged += (sender, progress) =>
- {
- if (progress.CurrentValue is not null && progress.MaximumValue is not null)
- {
- CurrentProgress = progress.CurrentValue.Value;
- MaximumProgress = progress.MaximumValue.Value;
- }
- else
- {
- CurrentProgress = progress.Finished ? 1 : 0;
- MaximumProgress = 1;
- }
- Description = progress.Description;
- if (progress.Description is not null)
- {
- Logger.RaiseLogEvent(progress.Description);
- }
- if (progress.Finished)
- {
- CanProceedToNextStep = true;
- }
- };
-
- Task.Run(async () =>
- {
- try
- {
- var executor = new InstallExecutor(InstallSettings);
- await executor.ExecuteInstall(progress);
- }
- catch (Exception ex)
- {
- Logger.RaiseLogEvent(ex.ToString());
- }
- });
- }
-
- private bool _canProceedToNextStep;
- private int _currentProgress = 0;
- private string? _description;
- private int _maximumProgress = 1;
-}
diff --git a/tools/tr1/installer/Installer/Models/Logger.cs b/tools/tr1/installer/Installer/Models/Logger.cs
deleted file mode 100644
index 0c25c9318..000000000
--- a/tools/tr1/installer/Installer/Models/Logger.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace Installer.Models;
-
-public class LogEventArgs
-{
- public LogEventArgs(string message)
- {
- Message = message;
- }
-
- public string Message { get; }
-}
-
-public class Logger
-{
- public delegate void LogEventHandler(object sender, LogEventArgs e);
-
- public event LogEventHandler? LogEvent;
-
- public void RaiseLogEvent(string message)
- {
- LogEvent?.Invoke(this, new LogEventArgs(message));
- }
-}
diff --git a/tools/tr1/installer/Installer/Models/MainWindowViewModel.cs b/tools/tr1/installer/Installer/Models/MainWindowViewModel.cs
deleted file mode 100644
index 5dff1aad7..000000000
--- a/tools/tr1/installer/Installer/Models/MainWindowViewModel.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using Installer.Utils;
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Windows;
-using System.Windows.Input;
-
-namespace Installer.Models;
-
-public class MainWindowViewModel : BaseNotifyPropertyChanged
-{
- public MainWindowViewModel()
- {
- _sourceStep = new SourceStep();
- _currentStep = _sourceStep;
- _installSettings = new InstallSettings();
- }
-
- public ICommand CloseWindowCommand
- {
- get
- {
- return _closeWindowCommand ??= new RelayCommand(CloseWindow);
- }
- }
-
- public IStep CurrentStep
- {
- get { return _currentStep; }
- set
- {
- _currentStep = value;
- _goToPreviousStepCommand?.RaiseCanExecuteChanged();
- _goToNextStepCommand?.RaiseCanExecuteChanged();
- _currentStep.PropertyChanged += (sender, e) =>
- {
- _goToPreviousStepCommand?.RaiseCanExecuteChanged();
- _goToNextStepCommand?.RaiseCanExecuteChanged();
- };
- NotifyPropertyChanged();
- NotifyPropertyChanged(nameof(IsFinalStep));
- }
- }
-
- public ICommand GoToNextStepCommand
- {
- get
- {
- return _goToNextStepCommand ??= new RelayCommand(GoToNextStep, CanGoToNextStep);
- }
- }
-
- public ICommand GoToPreviousStepCommand
- {
- get
- {
- return _goToPreviousStepCommand ??= new RelayCommand(GoToPreviousStep, CanGoToPreviousStep);
- }
- }
-
- public bool IsFinalStep
- {
- get
- {
- return CurrentStep is FinishStep;
- }
- }
-
- public bool IsSidebarVisible
- {
- get
- {
- return WindowWidth >= 500;
- }
- }
-
- public int WindowWidth
- {
- get => _windowWidth;
- set
- {
- if (value != _windowWidth)
- {
- _windowWidth = value;
- NotifyPropertyChanged(nameof(IsSidebarVisible));
- }
- }
- }
-
- private const bool _autoFinishInstallStep = false;
-
- private RelayCommand? _closeWindowCommand;
-
- private IStep _currentStep;
- private FinishSettings? _finishSettings;
- private RelayCommand? _goToNextStepCommand;
- private RelayCommand? _goToPreviousStepCommand;
- private readonly InstallSettings _installSettings;
- private readonly IStep _sourceStep;
- private int _windowWidth;
-
- private bool CanGoToNextStep()
- {
- return CurrentStep.CanProceedToNextStep;
- }
-
- private bool CanGoToPreviousStep()
- {
- return CurrentStep.CanProceedToPreviousStep;
- }
-
- private void CloseWindow(Window? window)
- {
- if (_finishSettings is not null && _finishSettings.LaunchGame)
- {
- if (_installSettings.TargetDirectory is null)
- {
- throw new NullReferenceException();
- }
- Process.Start(Path.Combine(_installSettings.TargetDirectory, "TR1X.exe"));
- }
- if (_finishSettings is not null && _finishSettings.OpenGameDirectory)
- {
- if (_installSettings.TargetDirectory is null)
- {
- throw new NullReferenceException();
- }
- Process.Start("explorer.exe", _installSettings.TargetDirectory);
- }
- window?.Close();
- }
-
- private void GoToNextStep()
- {
- if (CurrentStep is SourceStep sourceStep)
- {
- var installSource = sourceStep.SelectedInstallationSource!.InstallSource;
- _installSettings.InstallSource = installSource;
- _installSettings.SourceDirectory = sourceStep.SelectedInstallationSource.SourceDirectory;
- CurrentStep = new InstallSettingsStep(_installSettings);
- }
- else if (CurrentStep is InstallSettingsStep targetStep)
- {
- var installStep = new InstallStep(targetStep.InstallSettings);
- installStep.RunInstall();
- installStep.PropertyChanged += (sender, e) =>
- {
- if (_autoFinishInstallStep && installStep.CanProceedToNextStep)
- {
- _finishSettings = new FinishSettings();
- CurrentStep = new FinishStep(_finishSettings);
- }
- };
- CurrentStep = installStep;
- }
- else if (CurrentStep is InstallStep)
- {
- _finishSettings = new FinishSettings();
- CurrentStep = new FinishStep(_finishSettings);
- }
- }
-
- private void GoToPreviousStep()
- {
- CurrentStep = _sourceStep;
- }
-}
diff --git a/tools/tr1/installer/Installer/Models/SourceStep.cs b/tools/tr1/installer/Installer/Models/SourceStep.cs
deleted file mode 100644
index 62af17cb7..000000000
--- a/tools/tr1/installer/Installer/Models/SourceStep.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using Installer.Installers;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Installer.Models;
-
-public class SourceStep : BaseNotifyPropertyChanged, IStep
-{
- public SourceStep()
- {
- InstallationSources = new ObservableCollection
- {
- // NOTE: the order also decides which installation source will be selected by default
- new(new SteamInstallSource()),
- new(new GOGInstallSource()),
- new(new TombATIInstallSource()),
- new(new TR1XInstallSource()),
- new(new CDRomInstallSource()),
- };
-
- foreach (var installationSource in InstallationSources)
- {
- installationSource.PropertyChanged += (sender, e) =>
- {
- NotifyPropertyChanged(nameof(InstallationSources));
- if (installationSource == selectedInstallationSource)
- {
- NotifyPropertyChanged(nameof(SelectedInstallationSource));
- }
- };
- }
-
- foreach (var source in InstallationSources)
- {
- if (source.IsAvailable)
- {
- // TR1X comes last and always trumps any other installation source
- SelectedInstallationSource = source;
- }
- }
- }
-
- public bool CanProceedToNextStep
- {
- get
- {
- return SelectedInstallationSource != null && SelectedInstallationSource.IsAvailable;
- }
- }
-
- public bool CanProceedToPreviousStep => false;
- public IEnumerable InstallationSources { get; private set; }
-
- public InstallSourceViewModel? SelectedInstallationSource
- {
- get => selectedInstallationSource;
- set
- {
- if (value != selectedInstallationSource)
- {
- selectedInstallationSource = value;
- NotifyPropertyChanged();
- NotifyPropertyChanged(nameof(CanProceedToNextStep));
- }
- }
- }
-
- public string SidebarImage => "pack://application:,,,/TR1X_Installer;component/Resources/side1.jpg";
- private InstallSourceViewModel? selectedInstallationSource;
-}
diff --git a/tools/tr1/installer/Installer/Models/UBPackType.cs b/tools/tr1/installer/Installer/Models/UBPackType.cs
deleted file mode 100644
index 57502ce0b..000000000
--- a/tools/tr1/installer/Installer/Models/UBPackType.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Installer.Models;
-
-public enum UBPackType
-{
- Music,
- Vanilla,
-}
diff --git a/tools/tr1/installer/Installer/Resources/Styles.xaml b/tools/tr1/installer/Installer/Resources/Styles.xaml
deleted file mode 100644
index 5e0ab611d..000000000
--- a/tools/tr1/installer/Installer/Resources/Styles.xaml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/tr1/installer/Installer/Resources/side4.old.jpg b/tools/tr1/installer/Installer/Resources/side4.old.jpg
deleted file mode 100644
index 8af6d1e7d..000000000
Binary files a/tools/tr1/installer/Installer/Resources/side4.old.jpg and /dev/null differ
diff --git a/tools/tr1/installer/Installer/Utils/BaseNotifyPropertyChanged.cs b/tools/tr1/installer/Installer/Utils/BaseNotifyPropertyChanged.cs
deleted file mode 100644
index c96ef8f78..000000000
--- a/tools/tr1/installer/Installer/Utils/BaseNotifyPropertyChanged.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-
-namespace Installer;
-
-public abstract class BaseNotifyPropertyChanged : INotifyPropertyChanged
-{
- public event PropertyChangedEventHandler? PropertyChanged;
-
- public void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-}
diff --git a/tools/tr1/installer/Installer/Utils/BinaryReaderExtensions.cs b/tools/tr1/installer/Installer/Utils/BinaryReaderExtensions.cs
deleted file mode 100644
index fc37f8f70..000000000
--- a/tools/tr1/installer/Installer/Utils/BinaryReaderExtensions.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.IO;
-using System.Text;
-
-namespace Installer.Utils;
-
-public static class BinaryReaderExtensions
-{
- public static string ReadNullTerminatedString(this BinaryReader stream)
- {
- string str = "";
- char ch;
- while ((int)(ch = stream.ReadChar()) != 0)
- {
- str += ch;
- }
- return str;
- }
-
- public static string ReadSystemCodepageString(this BinaryReader stream)
- {
- var length = stream.ReadUInt16();
- return Encoding.Default.GetString(stream.ReadBytes(length));
- }
-
- public static string ReadUtf16String(this BinaryReader stream)
- {
- var length = stream.ReadUInt16();
- return Encoding.Unicode.GetString(stream.ReadBytes(length * 2));
- }
-}
diff --git a/tools/tr1/installer/Installer/Utils/BoolToVisibilityConverter.cs b/tools/tr1/installer/Installer/Utils/BoolToVisibilityConverter.cs
deleted file mode 100644
index a9f5b95cd..000000000
--- a/tools/tr1/installer/Installer/Utils/BoolToVisibilityConverter.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows;
-using System.Windows.Data;
-
-namespace Installer.Utils;
-
-[ValueConversion(typeof(bool), typeof(Visibility))]
-public class BoolToVisibilityConverter : IValueConverter
-{
- public BoolToVisibilityConverter()
- {
- FalseValue = Visibility.Hidden;
- TrueValue = Visibility.Visible;
- }
-
- public Visibility FalseValue { get; set; }
- public Visibility TrueValue { get; set; }
-
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return (bool)value ? TrueValue : FalseValue;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
-}
diff --git a/tools/tr1/installer/Installer/Utils/ComparisonConverter.cs b/tools/tr1/installer/Installer/Utils/ComparisonConverter.cs
deleted file mode 100644
index f1b394fd7..000000000
--- a/tools/tr1/installer/Installer/Utils/ComparisonConverter.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows.Data;
-
-namespace Installer.Utils;
-
-public class ComparisonConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value.Equals(parameter);
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return (bool)value ? parameter : Binding.DoNothing;
- }
-}
diff --git a/tools/tr1/installer/Installer/Utils/ConditionalMarkupConverter.cs b/tools/tr1/installer/Installer/Utils/ConditionalMarkupConverter.cs
deleted file mode 100644
index 0fca456ec..000000000
--- a/tools/tr1/installer/Installer/Utils/ConditionalMarkupConverter.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows.Data;
-using System.Windows.Markup;
-
-namespace Installer.Utils;
-
-public sealed class ConditionalMarkupConverter : MarkupExtension, IValueConverter
-{
- public object FalseValue { get; set; } = new();
- public object TrueValue { get; set; } = new();
-
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return value is true ? TrueValue : FalseValue;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotSupportedException();
- }
-
- public override object ProvideValue(IServiceProvider serviceProvider)
- {
- return this;
- }
-}
diff --git a/tools/tr1/installer/Installer/Utils/CueFile.cs b/tools/tr1/installer/Installer/Utils/CueFile.cs
deleted file mode 100644
index c43f940d6..000000000
--- a/tools/tr1/installer/Installer/Utils/CueFile.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace Installer.Utils;
-
-public class CueFile
-{
- public readonly List TrackList = new();
-
- public CueFile(string cueFilePath)
- {
- _cueFilePath = cueFilePath;
- string cueFileContent;
- using (TextReader cueReader = new StreamReader(cueFilePath))
- {
- cueFileContent = cueReader.ReadToEnd();
- }
-
- MatchCollection fileMatches = _fileGroupRegex.Matches(cueFileContent);
- if (fileMatches.Count == 0)
- {
- throw new ApplicationException($"Could not parse {cueFilePath}: no tracks were found");
- }
-
- foreach (Match fileMatch in fileMatches.Cast())
- {
- var binFilePath = GetBinFilePath(fileMatch.Groups["name"].Value.Trim('"'));
- var matches = _trackRegex.Matches(fileMatch.Groups["content"].Value);
-
- if (matches.Count == 0)
- {
- throw new ApplicationException($"Could not parse {cueFilePath}: no tracks were found");
- }
-
- CueTrack? track = null;
- CueTrack? prevTrack = null;
- foreach (Match trackMatch in matches.Cast())
- {
- track = new CueTrack(
- binFilePath,
- int.Parse(trackMatch.Groups["track"].Value),
- trackMatch.Groups["mode"].Value,
- trackMatch.Groups["time"].Value);
-
- if (prevTrack != null)
- {
- prevTrack.Stop = track.StartPosition - 1;
- prevTrack.StopSector = track.StartSector;
- }
- TrackList.Add(track);
- prevTrack = track;
- }
-
- if (track == null)
- {
- return;
- }
-
- track.Stop = GetBinFileLength(binFilePath);
- track.StopSector = track.Stop / CueTrack.SectorLength;
- }
- }
-
- private static readonly Regex _fileGroupRegex = new(
- @"^file\s+(?""[^""]+""|[^""\s]+)\s+(?\w+)\s+(?(.(?!^file))*)",
- RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline);
-
- private static readonly Regex _trackRegex = new(@"track\s+?(?