Пример #1
0
        public void ReadFromStream(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);

            IsFirstBlock = stream.Position == YkdHeader.Size;

            Type            = br.ReadUInt32();
            Index           = br.ReadUInt32();
            AssociatedIndex = br.ReadUInt32();
            Unknown         = br.ReadUInt32();

            for (int i = 0; i < TransformationMatrix.Length; i++)
            {
                TransformationMatrix[i] = br.ReadBigInt32();
            }

            Offsets = stream.ReadContent <YkdOffsets>();
            Entries = new YkdBlockEntry[Offsets.Count];
            for (int i = 0; i < Offsets.Count; i++)
            {
                stream.SetPosition(Offsets[i]);
                Entries[i] = stream.ReadContent <YkdBlockEntry>();
            }

            if (!IsFirstBlock)
            {
                switch (Type)
                {
                case 0:
                    ZeroTail = stream.ReadContent <YkdBlockOptionalTail>();
                    break;

                case 4:
                    Tails4 = stream.ReadContent <YkdBlockOptionalTails>();
                    break;

                case 5:
                case 6:
                    Tail56 = new int[12];
                    for (int i = 0; i < Tail56.Length; i++)
                    {
                        Tail56[i] = br.ReadInt32();
                    }
                    break;
                }
            }
        }
Пример #2
0
        public void ReadFromStream(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);

            IsFirstBlock = stream.Position == YkdHeader.Size;

            Type = br.ReadUInt32();
            Index = br.ReadUInt32();
            AssociatedIndex = br.ReadUInt32();
            Unknown = br.ReadUInt32();

            for (int i = 0; i < TransformationMatrix.Length; i++)
                TransformationMatrix[i] = br.ReadBigInt32();

            Offsets = stream.ReadContent<YkdOffsets>();
            Entries = new YkdBlockEntry[Offsets.Count];
            for (int i = 0; i < Offsets.Count; i++)
            {
                stream.SetPosition(Offsets[i]);
                Entries[i] = stream.ReadContent<YkdBlockEntry>();
            }

            if (!IsFirstBlock)
            {
                switch (Type)
                {
                    case 0:
                        ZeroTail = stream.ReadContent<YkdBlockOptionalTail>();
                        break;
                    case 4:
                        Tails4 = stream.ReadContent<YkdBlockOptionalTails>();
                        break;
                    case 5:
                    case 6:
                        Tail56 = new int[12];
                        for (int i = 0; i < Tail56.Length; i++)
                            Tail56[i] = br.ReadInt32();
                        break;
                }
            }
        }