summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyssa2025-04-02 14:23:16 +0000
committerLyssa2025-04-02 14:23:16 +0000
commit1286b585015b085672afbadcc1408584bab94df2 (patch)
tree5b36c4a0e17e6443f70a053c0e21356d2e36eaba
parentaccbed0c514fc4ad1eaf5691cb89421f0485b5d6 (diff)
downloadTSforge-1286b585015b085672afbadcc1408584bab94df2.zip
fix dumping vista store (really hacky fix)
-rw-r--r--LibTSforge/SPP/SPPUtils.cs33
-rw-r--r--TSforgeCLI/Properties/launchSettings.json8
-rw-r--r--vista.datbin0 -> 21788 bytes
3 files changed, 30 insertions, 11 deletions
diff --git a/LibTSforge/SPP/SPPUtils.cs b/LibTSforge/SPP/SPPUtils.cs
index 1046439..1a6ef62 100644
--- a/LibTSforge/SPP/SPPUtils.cs
+++ b/LibTSforge/SPP/SPPUtils.cs
@@ -46,8 +46,9 @@ namespace LibTSforge.SPP
{
continue;
}
- catch (InvalidOperationException)
+ catch (InvalidOperationException ex)
{
+ Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details:" + ex.Message);
System.Threading.Thread.Sleep(500);
continue;
}
@@ -110,8 +111,9 @@ namespace LibTSforge.SPP
{
continue;
}
- catch (InvalidOperationException)
+ catch (InvalidOperationException ex)
{
+ Logger.WriteLine("Warning: Starting slsvc failed, retrying. Details:" + ex.Message);
System.Threading.Thread.Sleep(500);
continue;
}
@@ -250,9 +252,13 @@ namespace LibTSforge.SPP
public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath)
{
+ bool manageSpp = false;
+
if (encrFilePath == null)
{
encrFilePath = GetPSPath(version);
+ manageSpp = true;
+ KillSPP(version);
}
if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath))
@@ -260,17 +266,22 @@ namespace LibTSforge.SPP
throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'.");
}
- KillSPP(version);
-
- using (FileStream fs = File.Open(encrFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
+ try
+ {
+ using (FileStream fs = File.Open(encrFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ byte[] encrData = fs.ReadAllBytes();
+ File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version));
+ }
+ Logger.WriteLine("Store dumped successfully to '" + filePath + "'.");
+ }
+ finally
{
- byte[] encrData = fs.ReadAllBytes();
- File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version));
+ if (manageSpp)
+ {
+ RestartSPP(version);
+ }
}
-
- RestartSPP(version);
-
- Logger.WriteLine("Store dumped successfully to '" + filePath + "'.");
}
public static void LoadStore(PSVersion version, bool production, string filePath)
diff --git a/TSforgeCLI/Properties/launchSettings.json b/TSforgeCLI/Properties/launchSettings.json
new file mode 100644
index 0000000..112530f
--- /dev/null
+++ b/TSforgeCLI/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "TSforgeCLI": {
+ "commandName": "Project",
+ "commandLineArgs": "/dump vista.dat blah.dat /ver vista"
+ }
+ }
+} \ No newline at end of file
diff --git a/vista.dat b/vista.dat
new file mode 100644
index 0000000..97ff497
--- /dev/null
+++ b/vista.dat
Binary files differ