From 28d99b531ef64ee88565536c7943df58959d4624 Mon Sep 17 00:00:00 2001 From: Ryan Fredlund Date: Thu, 15 Sep 2022 08:06:35 -0500 Subject: [PATCH] Fix file extraction logic - now the whole file is extracted, not just a placeholder file --- NoodleManagerX/Models/StorageAbstraction.cs | 5 +++++ NoodleManagerX/Mods/ModItem.cs | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NoodleManagerX/Models/StorageAbstraction.cs b/NoodleManagerX/Models/StorageAbstraction.cs index 29c132b..acdddce 100644 --- a/NoodleManagerX/Models/StorageAbstraction.cs +++ b/NoodleManagerX/Models/StorageAbstraction.cs @@ -96,6 +96,11 @@ public static bool FileExists(string path) } } + public static string GetFullComputerPath(string pathRelativeToSynthDir) + { + return Path.Combine(MainViewModel.s_instance.settings.synthDirectory, pathRelativeToSynthDir); + } + public static void DeleteFile(string path) { if (MtpDevice.connected) diff --git a/NoodleManagerX/Mods/ModItem.cs b/NoodleManagerX/Mods/ModItem.cs index 53d27bb..9bc91a8 100644 --- a/NoodleManagerX/Mods/ModItem.cs +++ b/NoodleManagerX/Mods/ModItem.cs @@ -202,7 +202,9 @@ private async Task ExtractModFilesToSynthDir(string synthmodPath) if (StorageAbstraction.FileExists(entry.FullName)) { MainViewModel.Log($"WARNING: Overwriting {entry.FullName}"); - await StorageAbstraction.WriteFile(await CopyStreamToMemoryStream(stream, false), entry.FullName); + // TODO use a more generic function once modding is supported on Oculus + var fullPath = StorageAbstraction.GetFullComputerPath(entry.FullName); + entry.ExtractToFile(fullPath, true); } else { @@ -215,7 +217,9 @@ private async Task ExtractModFilesToSynthDir(string synthmodPath) else { MainViewModel.Log($"Extracting file {entry.FullName}"); - await StorageAbstraction.WriteFile(await CopyStreamToMemoryStream(stream, false), entry.FullName); + // TODO use a more generic function once modding is supported on Oculus + var fullPath = StorageAbstraction.GetFullComputerPath(entry.FullName); + entry.ExtractToFile(fullPath); } } }