public void ReadFromStream(Stream stream) { Header = stream.ReadContent<YkdHeader>(); Background = stream.ReadContent<YkdBlock>(); Offsets = stream.ReadContent<YkdOffsets>(); Blocks = new YkdBlock[Offsets.Count]; for (int i = 0; i < Blocks.Length; i++) { stream.SetPosition(Offsets[i]); Blocks[i] = stream.ReadContent<YkdBlock>(); } Resources = stream.ReadContent<YkdResources>(); }
public void ReadFromStream(Stream stream) { BinaryReader br = new BinaryReader(stream); Unknown1 = br.ReadInt32(); Unknown2 = br.ReadInt32(); int count = br.ReadInt32(); Unknown3 = br.ReadInt32(); int[] offsets = new int[count]; for (int i = 0; i < count; i++) offsets[i] = br.ReadInt32(); int alignment = ((4 - (count % 4)) % 4); for (int i = 0; i < alignment; i++) br.Check(r => r.ReadInt32(), 0); Frames = new YkdFrame[count]; for (int i = 0; i < count; i++) { stream.SetPosition(offsets[i]); Frames[i] = stream.ReadContent<YkdFrame>(); } }