From c6ed582882a0b2abe3e65f2db1b817e2ec6c3560 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 3 Jul 2015 00:20:03 -0700 Subject: [PATCH] Fix not updating files Returning bool and using object, might as well play it safe. --- pk3DS/3DS/DARC.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pk3DS/3DS/DARC.cs b/pk3DS/3DS/DARC.cs index 1aca858..bc74826 100644 --- a/pk3DS/3DS/DARC.cs +++ b/pk3DS/3DS/DARC.cs @@ -313,12 +313,12 @@ internal static int getDARCposition(byte[] data) { pos += 4; if (pos >= data.Length) return -1; } return pos; } - internal static bool insertFile(DARC orig, int index, string path) + internal static bool insertFile(ref DARC orig, int index, string path) { - try { return insertFile(orig, index, File.ReadAllBytes(path)); } + try { return insertFile(ref orig, index, File.ReadAllBytes(path)); } catch (Exception) { return false; } } - internal static bool insertFile(DARC orig, int index, byte[] data) + internal static bool insertFile(ref DARC orig, int index, byte[] data) { if (index < 0) return false; @@ -359,7 +359,7 @@ internal static DARC insertFiles(DARC orig, string folderName) if (orig.Entries[index].IsFolder) throw new Exception(file + " is not a valid file to reinsert!"); - insertFile(orig, index, file); + insertFile(ref orig, index, file); } // Fix Data layout Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - orig.Data.Length % 4);