Skip to content

Commit 49506f5

Browse files
committed
allow dgblocks to have only one dzblock
1 parent f876e55 commit 49506f5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Code/V4/Mdf4Blocks.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ internal unsafe struct IDBlockRaw
2525
public ushort IdVer;
2626
public fixed byte IdReserved2[4];
2727
public ushort IdUnfinFlags;
28+
29+
public string IdFileStr
30+
{
31+
get
32+
{
33+
fixed (byte* p = IdFile)
34+
{
35+
return new string((sbyte*)p,0,8);
36+
}
37+
}
38+
}
2839
}
2940

3041

@@ -135,7 +146,7 @@ public override int CopyTo(byte[] fullBuffer, int offset)
135146
}
136147
}
137148

138-
internal class Mdf4DZBlock : Mdf4DataBlock
149+
internal class Mdf4DZBlock : Mdf4DataBlock, IMdf4DataRoot
139150
{
140151
public enum ZLibCompressionInfo : byte
141152
{
@@ -276,6 +287,19 @@ public struct Raw
276287
public byte ZLibHeader;
277288
public ZLibCompressionInfo CompressionInfo;
278289
}
290+
291+
public Mdf4DataBlock this[int index] => this;
292+
293+
public uint BlockCount => 1;
294+
public IEnumerable<Mdf4DataBlock> GetAllDataBlocks()
295+
{
296+
yield return this;
297+
}
298+
299+
public IEnumerable<DataBlockMap> GetBlockMap() => new DataBlockMap[1]
300+
{
301+
new DataBlockMap(Offset, 0, Parser)
302+
};
279303
}
280304

281305
internal class Mdf4DLBlock : Mdf4Block, IMdf4DataRoot

0 commit comments

Comments
 (0)