Update fileSize after changing it

main
Villermen 10 years ago
parent e862a3e3aa
commit d80eef4585

@ -209,12 +209,12 @@ namespace RSCacheTool
//process file //process file
string outFileDir = outDir + archiveIndex + "\\"; string outFileDir = outDir + archiveIndex + "\\";
string outFileName = fileIndex.ToString(); string outFileName = fileIndex.ToString();
byte[] tempBuffer;
//remove the first 5 bytes because they are not part of the file //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); Array.Copy(buffer, 5, tempBuffer, 0, fileSize - 5);
buffer = tempBuffer; buffer = tempBuffer;
fileSize -= 5;
//decompress gzip //decompress gzip
if (buffer.Length > 5 && (buffer[4] << 8) + buffer[5] == 0x1f8b) //gzip if (buffer.Length > 5 && (buffer[4] << 8) + buffer[5] == 0x1f8b) //gzip
@ -223,6 +223,7 @@ namespace RSCacheTool
tempBuffer = new byte[fileSize - 4]; tempBuffer = new byte[fileSize - 4];
Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4); Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4);
buffer = tempBuffer; buffer = tempBuffer;
fileSize -= 4;
GZipStream decompressionStream = new GZipStream(new MemoryStream(buffer), CompressionMode.Decompress); GZipStream decompressionStream = new GZipStream(new MemoryStream(buffer), CompressionMode.Decompress);
@ -252,9 +253,10 @@ namespace RSCacheTool
tempBuffer = new byte[fileSize - 4]; tempBuffer = new byte[fileSize - 4];
Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4); Array.Copy(buffer, 4, tempBuffer, 0, fileSize - 4);
buffer = tempBuffer; buffer = tempBuffer;
fileSize -= 4;
//prepend file header //prepend file header
byte[] magic = new byte[] { byte[] magic = {
0x42, 0x5a, //BZ (signature) 0x42, 0x5a, //BZ (signature)
0x68, //h (version) 0x68, //h (version)
0x31 //*100kB block-size 0x31 //*100kB block-size
@ -456,7 +458,7 @@ namespace RSCacheTool
Dictionary<int, string> trackIdNames = new Dictionary<int, string>(); Dictionary<int, string> trackIdNames = new Dictionary<int, string>();
Dictionary<uint, int> fileIdTracks = new Dictionary<uint, int>(); Dictionary<uint, int> fileIdTracks = new Dictionary<uint, int>();
byte[] magicNumber = new byte[] { byte[] magicNumber = {
0x00, 0x00,
0x01, 0x01,
0x69, 0x69,

@ -11,6 +11,21 @@
<AssemblyName>RSCacheTool</AssemblyName> <AssemblyName>RSCacheTool</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <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>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -48,6 +63,23 @@
<ItemGroup> <ItemGroup>
<Folder Include="lib\" /> <Folder Include="lib\" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

Loading…
Cancel
Save