Beispiel #1
0
        private static void ReadSegmentHeader(FileReader reader, FileStream writer, out long size, out long seek)
        {
            var pos = reader.Position;
            var type = reader.ReadUInt8();

            Console.WriteLine($"type: {type}");
            var seekBytes = (type & 7) + 1;
            var sizeBytes = (type >> 3) + 1;

            size = DeltaTools.ReadInt(reader, sizeBytes);
            seek = DeltaTools.ReadInt(reader, seekBytes);

            reader.Position = pos;
            var len = 1 + sizeBytes + seekBytes;
            writer.Write(reader.ReadBytes(len), 0, len);
        }
Beispiel #2
0
        private static void ReadSegmentHeader(FileReader reader, FileStream writer, out long size, out long seek)
        {
            var pos  = reader.Position;
            var type = reader.ReadUInt8();

            var seekBytes = (type & 7) + 1;
            var sizeBytes = (type >> 3) + 1;

            Console.WriteLine($"pos={pos + 49216} type={type} seekBytes={seekBytes} sizeBytes={sizeBytes}");

            size = DeltaTools.ReadInt(reader, sizeBytes);
            seek = DeltaTools.ReadInt(reader, seekBytes);
            var len = 1 + sizeBytes + seekBytes;

            reader.Position = pos;
            var bytesRead = reader.ReadBytes(pos, len);

            reader.Position = pos;
            Console.WriteLine($"pos={pos+49216} type={type} seekBytes={seekBytes} sizeBytes={sizeBytes} size={size} seek={seek} len={len} bytesRead={Utils.ToHexString(bytesRead)}");
            writer.Write(reader.ReadBytes(len), 0, len);
        }