Update fileSize after changing it

This commit is contained in:
Villermen 2014-12-08 09:47:48 +01:00
parent e862a3e3aa
commit d80eef4585
2 changed files with 38 additions and 4 deletions

View file

@ -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<int, string> trackIdNames = new Dictionary<int, string>();
Dictionary<uint, int> fileIdTracks = new Dictionary<uint, int>();
byte[] magicNumber = new byte[] {
byte[] magicNumber = {
0x00,
0x01,
0x69,

View file

@ -11,6 +11,21 @@
<AssemblyName>RSCacheTool</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -48,6 +63,23 @@
<ItemGroup>
<Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.