public BytecodeContainer(byte[] rawBytes) { _rawBytes = rawBytes; Chunks = new List <BytecodeChunk>(); var reader = new BytecodeReader(rawBytes, 0, rawBytes.Length); var magicNumber = BitConverter.ToUInt32(rawBytes, 0); if (magicNumber == 0xFEFF2001) { Chunks.Add(EffectChunk.Parse(reader, (uint)rawBytes.Length)); return; } Header = BytecodeContainerHeader.Parse(reader); for (uint i = 0; i < Header.ChunkCount; i++) { uint chunkOffset = reader.ReadUInt32(); var chunkReader = reader.CopyAtOffset((int)chunkOffset); var chunk = BytecodeChunk.ParseChunk(chunkReader, this); if (chunk != null) { Chunks.Add(chunk); } } }
public BytecodeContainer(byte[] rawBytes) { _rawBytes = rawBytes; Chunks = new List <BytecodeChunk>(); var reader = new BytecodeReader(rawBytes, 0, rawBytes.Length); Header = BytecodeContainerHeader.Parse(reader); for (uint i = 0; i < Header.ChunkCount; i++) { uint chunkOffset = reader.ReadUInt32(); var chunkReader = reader.CopyAtOffset((int)chunkOffset); var chunk = BytecodeChunk.ParseChunk(chunkReader, this); if (chunk != null) { Chunks.Add(chunk); } } }