From 1b1321ee4f9957b0cf5fbcda62ec86f35bb7f268 Mon Sep 17 00:00:00 2001 From: SciresM Date: Sat, 16 May 2015 18:34:12 -0700 Subject: [PATCH] Validation fixes isTempFIle fix, OutFile vs TempFile moving fix --- pk3DS/3DS/RomFS.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pk3DS/3DS/RomFS.cs b/pk3DS/3DS/RomFS.cs index d07b79d..8083e6c 100644 --- a/pk3DS/3DS/RomFS.cs +++ b/pk3DS/3DS/RomFS.cs @@ -18,7 +18,7 @@ public class RomFS public RomFS(string fn) { FileName = fn; - isTempFile = false; + isTempFile = true; using (var fs = File.OpenRead(fn)) { fs.Seek(0x8, SeekOrigin.Begin); @@ -223,11 +223,12 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, if (OutFileStream != null) OutFileStream.Dispose(); } - updateTB(TB_Progress, "RomFS Super Block Hash: " + ByteArrayToString(SuperBlockHash)); - updateTB(TB_Progress, "Saving to destination..."); - - if (File.Exists(OutFile)) File.Delete(OutFile); - File.Move(TempFile, OutFile); + + if (OutFile != TempFile) + { + if (File.Exists(OutFile)) File.Delete(OutFile); + File.Move(TempFile, OutFile); + } } internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { @@ -801,4 +802,4 @@ public class Output } #endregion } -} \ No newline at end of file +}