From d80eef458588aee506403c0a3fa845581f7762c9 Mon Sep 17 00:00:00 2001 From: Villermen Date: Mon, 8 Dec 2014 09:47:48 +0100 Subject: [PATCH] Update fileSize after changing it --- Program.cs | 10 ++++++---- RSCacheTool.csproj | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 146c574..73176ec 100644 --- a/Program.cs +++ b/Program.cs @@ -209,12 +209,12 @@ namespace RSCacheTool //process file string outFileDir = outDir + archiveIndex + "\\"; string outFileName = fileIndex.ToString(); - byte[] tempBuffer; //remove the first 5 bytes because they are not part of the file - tempBuffer = new byte[fileSize - 5]; + byte[] tempBuffer = new byte[fileSize - 5]; Array.Copy(buffer, 5, tempBuffer, 0, fileSize - 5); buffer = tempBuffer; + fileSize -= 5; //decompress gzip if (buffer.Length > 5 && (buffer[4] << 8) + buffer[5] == 0x1f8b) //gzip @@ -223,6 +223,7 @@ namespace RSCacheTool tempBuffer = new byte[fileSize - 4]; Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4); buffer = tempBuffer; + fileSize -= 4; GZipStream decompressionStream = new GZipStream(new MemoryStream(buffer), CompressionMode.Decompress); @@ -252,9 +253,10 @@ namespace RSCacheTool tempBuffer = new byte[fileSize - 4]; Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4); buffer = tempBuffer; + fileSize -= 4; //prepend file header - byte[] magic = new byte[] { + byte[] magic = { 0x42, 0x5a, //BZ (signature) 0x68, //h (version) 0x31 //*100kB block-size @@ -456,7 +458,7 @@ namespace RSCacheTool Dictionary trackIdNames = new Dictionary(); Dictionary fileIdTracks = new Dictionary(); - byte[] magicNumber = new byte[] { + byte[] magicNumber = { 0x00, 0x01, 0x69, diff --git a/RSCacheTool.csproj b/RSCacheTool.csproj index a697168..6e35a15 100644 --- a/RSCacheTool.csproj +++ b/RSCacheTool.csproj @@ -11,6 +11,21 @@ RSCacheTool v4.5 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true AnyCPU @@ -48,6 +63,23 @@ + + + False + Microsoft .NET Framework 4.5 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + +