-
Notifications
You must be signed in to change notification settings - Fork 2
/
StackingFileIndex.cs
44 lines (41 loc) · 1.33 KB
/
StackingFileIndex.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.IO;
namespace DoubleFine
{
public class StackingFileIndex : FileIndex
{
public StackingFileIndex()
{
this.Uncompressed = (byte) 4;
this.Compressed = (byte) 8;
}
public StackingFileIndex(BinaryReader r)
: this()
{
byte[] data = r.ReadBytes(16);
if (this.debug)
this.debugBitData(data);
this.ContentSize = this.toInt32(data, 0, 0, 24);
this.FileNameOffset = this.toInt32(data, 3, 0, 21);
this.UnknownFlag1 = this.toInt32(data, 5, 5, 19);
this.Offset = (long) this.toInt32(data, 8, 0, 29);
this.Size = this.toInt32(data, 11, 5, 23);
this.FileTypeIndex = (byte) this.toInt32(data, 14, 4, 8);
this.CompressFlag = (byte) ((uint) data[15] & 15U);
}
public override void Write(BinaryWriter w)
{
byte[] numArray = new byte[16];
this.mapToData(numArray, this.ContentSize, 0, 0, 24);
this.mapToData(numArray, this.FileNameOffset, 3, 0, 21);
this.mapToData(numArray, this.UnknownFlag1, 5, 5, 19);
this.mapToData(numArray, this.Offset, 8, 0, 29);
this.mapToData(numArray, this.Size, 11, 5, 23);
this.mapToData(numArray, (short) this.FileTypeIndex, 14, 4, 8);
this.mapToData(numArray, new byte[1]
{
this.CompressFlag
}, 15, 4, 4);
w.Write(numArray);
}
}
}