Пример #1
0
        public void ReadData(Stream stream)
        {
            stream.Seek(offset, SeekOrigin.Begin);

            string nodeType = stream.ReadUtf8String(4);
            switch (nodeType)
            {
                case "BLCK":
                    {
                        data = Blck.Read(stream);
                        break;
                    }
                default:
                    throw new UnknownNodeTypeException(nodeType);
            }
        }
Пример #2
0
        public static Blck Read(Stream stream)
        {
            var result = new Blck();
            var b = (byte)stream.ReadByte();
            result.unknown = (b & 0x80) == 0x80;
            if (!result.unknown) throw new UnknownNodeFlagException();

            result.nameLength = (short)(b & 0x7f);
            result.name = stream.ReadUtf8String(result.nameLength);

            result.length = stream.ReadInt32();
            using (var memStream = new MemoryStream(stream.ReadBytes(result.length)))
                result.children = Aval.Read(memStream).ToList();

            return result;
        }