Beispiel #1
0
 private void ReadCL2ArchiveOffsets(BinaryReader r)
 {
     var headerOffsets = new uint[8];
     for (int i = 0; i < 8; ++i)
         headerOffsets[i] = r.ReadU32();
     for (int i = 0; i < 8; ++i) {
         r.Seek((int)headerOffsets[i]);
         ReadNormalOffsets(r, headerOffsets[i]);
     }
 }
Beispiel #2
0
 private void ReadNormalOffsets(BinaryReader r, uint offsetOffset = 0)
 {
     uint numFrames = r.ReadU32();
     var offsets = new uint[numFrames + 1];
     for (var i = 0; i <= numFrames; ++i)
         offsets[i] = r.ReadU32();
     for (var i = 0; i < numFrames; ++i) {
         frames.Add(new FrameInfo {
             Offset = (int)(offsets[i] + offsetOffset),
             Size = (int)(offsets[i + 1] - offsets[i])
         });
     }
 }
Beispiel #3
0
        public CELFile(byte[] fileData, bool isCL2 = false)
        {
            this.fileData = fileData;
            this.isCL2 = isCL2;
            //this.isTileCel = !isCL2;

            var r = new BinaryReader(fileData);
            var first = r.ReadU32();
            if (first == 32) {
                if (isCL2) {
                    r.Seek(0);
                    ReadCL2ArchiveOffsets(r);
                } else {
                    r.Seek(32);
                    for (int i = 0; i < 8; ++i)
                        ReadNormalOffsets(r);
                }
            } else {
                r.Seek(0);
                ReadNormalOffsets(r);
            }

            Debug.WriteLine("NumFrames: " + NumFrames);
        }