StyleCop clean OpenRA.Game
This commit is contained in:
@@ -42,19 +42,19 @@ namespace OpenRA.FileSystem
|
||||
reader.ReadBytes(4);
|
||||
/*var ArchiveSize = */reader.ReadUInt32();
|
||||
reader.ReadBytes(19);
|
||||
var TOCAddress = reader.ReadInt32();
|
||||
var tocAddress = reader.ReadInt32();
|
||||
reader.ReadBytes(4);
|
||||
var DirCount = reader.ReadUInt16();
|
||||
var dirCount = reader.ReadUInt16();
|
||||
|
||||
// Parse the directory list
|
||||
s.Seek(TOCAddress, SeekOrigin.Begin);
|
||||
var TOCreader = new BinaryReader(s);
|
||||
s.Seek(tocAddress, SeekOrigin.Begin);
|
||||
var tocReader = new BinaryReader(s);
|
||||
|
||||
var fileCountInDirs = new List<uint>();
|
||||
|
||||
// Parse directories
|
||||
for (var i = 0; i < DirCount; i++)
|
||||
fileCountInDirs.Add(ParseDirectory(TOCreader));
|
||||
for (var i = 0; i < dirCount; i++)
|
||||
fileCountInDirs.Add(ParseDirectory(tocReader));
|
||||
|
||||
// Parse files
|
||||
foreach (var fileCount in fileCountInDirs)
|
||||
@@ -65,35 +65,35 @@ namespace OpenRA.FileSystem
|
||||
static uint ParseDirectory(BinaryReader reader)
|
||||
{
|
||||
// Parse directory header
|
||||
var FileCount = reader.ReadUInt16();
|
||||
var ChunkSize = reader.ReadUInt16();
|
||||
var NameLength = reader.ReadUInt16();
|
||||
reader.ReadChars(NameLength); // var DirName = new String(reader.ReadChars(NameLength));
|
||||
var fileCount = reader.ReadUInt16();
|
||||
var chunkSize = reader.ReadUInt16();
|
||||
var nameLength = reader.ReadUInt16();
|
||||
reader.ReadChars(nameLength); // var DirName = new String(reader.ReadChars(NameLength));
|
||||
|
||||
// Skip to the end of the chunk
|
||||
reader.ReadBytes(ChunkSize - NameLength - 6);
|
||||
return FileCount;
|
||||
reader.ReadBytes(chunkSize - nameLength - 6);
|
||||
return fileCount;
|
||||
}
|
||||
|
||||
uint AccumulatedData = 0;
|
||||
uint accumulatedData = 0;
|
||||
void ParseFile(BinaryReader reader)
|
||||
{
|
||||
reader.ReadBytes(7);
|
||||
var CompressedSize = reader.ReadUInt32();
|
||||
var compressedSize = reader.ReadUInt32();
|
||||
reader.ReadBytes(12);
|
||||
var ChunkSize = reader.ReadUInt16();
|
||||
var chunkSize = reader.ReadUInt16();
|
||||
reader.ReadBytes(4);
|
||||
var NameLength = reader.ReadByte();
|
||||
var FileName = new string(reader.ReadChars(NameLength));
|
||||
var nameLength = reader.ReadByte();
|
||||
var fileName = new string(reader.ReadChars(nameLength));
|
||||
|
||||
var hash = PackageEntry.HashFilename(FileName, PackageHashType.Classic);
|
||||
var hash = PackageEntry.HashFilename(fileName, PackageHashType.Classic);
|
||||
if (!index.ContainsKey(hash))
|
||||
index.Add(hash, new PackageEntry(hash, AccumulatedData, CompressedSize));
|
||||
filenames.Add(FileName);
|
||||
AccumulatedData += CompressedSize;
|
||||
index.Add(hash, new PackageEntry(hash, accumulatedData, compressedSize));
|
||||
filenames.Add(fileName);
|
||||
accumulatedData += compressedSize;
|
||||
|
||||
// Skip to the end of the chunk
|
||||
reader.ReadBytes(ChunkSize - NameLength - 30);
|
||||
reader.ReadBytes(chunkSize - nameLength - 30);
|
||||
}
|
||||
|
||||
public Stream GetContent(uint hash)
|
||||
|
||||
Reference in New Issue
Block a user