fix dumping vista store (really hacky fix)

This commit is contained in:
Lyssa 2025-04-02 18:23:16 +04:00
parent accbed0c51
commit 1286b58501
3 changed files with 30 additions and 11 deletions

View File

@ -46,8 +46,9 @@ namespace LibTSforge.SPP
{ {
continue; continue;
} }
catch (InvalidOperationException) catch (InvalidOperationException ex)
{ {
Logger.WriteLine("Warning: Stopping sppsvc failed, retrying. Details:" + ex.Message);
System.Threading.Thread.Sleep(500); System.Threading.Thread.Sleep(500);
continue; continue;
} }
@ -110,8 +111,9 @@ namespace LibTSforge.SPP
{ {
continue; continue;
} }
catch (InvalidOperationException) catch (InvalidOperationException ex)
{ {
Logger.WriteLine("Warning: Starting slsvc failed, retrying. Details:" + ex.Message);
System.Threading.Thread.Sleep(500); System.Threading.Thread.Sleep(500);
continue; continue;
} }
@ -250,9 +252,13 @@ namespace LibTSforge.SPP
public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath) public static void DumpStore(PSVersion version, bool production, string filePath, string encrFilePath)
{ {
bool manageSpp = false;
if (encrFilePath == null) if (encrFilePath == null)
{ {
encrFilePath = GetPSPath(version); encrFilePath = GetPSPath(version);
manageSpp = true;
KillSPP(version);
} }
if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath)) if (string.IsNullOrEmpty(encrFilePath) || !File.Exists(encrFilePath))
@ -260,18 +266,23 @@ namespace LibTSforge.SPP
throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'."); throw new FileNotFoundException("Store does not exist at expected path '" + encrFilePath + "'.");
} }
KillSPP(version); try
{
using (FileStream fs = File.Open(encrFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) using (FileStream fs = File.Open(encrFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{ {
byte[] encrData = fs.ReadAllBytes(); byte[] encrData = fs.ReadAllBytes();
File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version)); File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version));
} }
RestartSPP(version);
Logger.WriteLine("Store dumped successfully to '" + filePath + "'."); Logger.WriteLine("Store dumped successfully to '" + filePath + "'.");
} }
finally
{
if (manageSpp)
{
RestartSPP(version);
}
}
}
public static void LoadStore(PSVersion version, bool production, string filePath) public static void LoadStore(PSVersion version, bool production, string filePath)
{ {

View File

@ -0,0 +1,8 @@
{
"profiles": {
"TSforgeCLI": {
"commandName": "Project",
"commandLineArgs": "/dump vista.dat blah.dat /ver vista"
}
}
}

BIN
vista.dat Normal file

Binary file not shown.