Exemple #1
0
        private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader)
        {
            byte[] blocksInfoBytes;
            if (m_Header.version >= 7)
            {
                reader.AlignStream(16);
            }
            if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd
            {
                var position = reader.Position;
                reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
                reader.Position = position;
            }
            else //0x40 kArchiveBlocksAndDirectoryInfoCombined
            {
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
            }
            MemoryStream blocksInfoUncompresseddStream;
            var          uncompressedSize = m_Header.uncompressedBlocksInfoSize;

            switch (m_Header.flags & 0x3F) //kArchiveCompressionTypeMask
            {
            default:                       //None
            {
                blocksInfoUncompresseddStream = new MemoryStream(blocksInfoBytes);
                break;
            }

            case 1:     //LZMA
            {
                blocksInfoUncompresseddStream = new MemoryStream((int)(uncompressedSize));
                using (var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes))
                {
                    SevenZipHelper.StreamDecompress(blocksInfoCompressedStream, blocksInfoUncompresseddStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);
                }
                blocksInfoUncompresseddStream.Position = 0;
                break;
            }

            case 2:     //LZ4
            case 3:     //LZ4HC
            {
                var uncompressedBytes = new byte[uncompressedSize];
                var numWrite          = LZ4Codec.Decode(blocksInfoBytes, uncompressedBytes);
                if (numWrite != uncompressedSize)
                {
                    throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
                }
                blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
                break;
            }
            }
            using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream))
            {
                var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
                var blocksInfoCount      = blocksInfoReader.ReadInt32();
                m_BlocksInfo = new StorageBlock[blocksInfoCount];
                for (int i = 0; i < blocksInfoCount; i++)
                {
                    m_BlocksInfo[i] = new StorageBlock
                    {
                        uncompressedSize = blocksInfoReader.ReadUInt32(),
                        compressedSize   = blocksInfoReader.ReadUInt32(),
                        flags            = blocksInfoReader.ReadUInt16()
                    };
                }

                var nodesCount = blocksInfoReader.ReadInt32();
                m_DirectoryInfo = new Node[nodesCount];
                for (int i = 0; i < nodesCount; i++)
                {
                    m_DirectoryInfo[i] = new Node
                    {
                        offset = blocksInfoReader.ReadInt64(),
                        size   = blocksInfoReader.ReadInt64(),
                        flags  = blocksInfoReader.ReadUInt32(),
                        path   = blocksInfoReader.ReadStringToNull(),
                    };
                }
            }
        }
        public ConstantClip(EndianBinaryReader reader)
        {
            int numData = reader.ReadInt32();

            data = reader.ReadSingleArray(numData);
        }
 public QuaternionCurve(EndianBinaryReader reader, int[] version)
 {
     curve = new AnimationCurve <Quaternion>(reader, reader.ReadQuaternion, version);
     path  = reader.ReadAlignedString();
 }
        private static object ReadValue(List <ClassMember> members, EndianBinaryReader reader, ref int i)
        {
            var    member     = members[i];
            var    level      = member.Level;
            var    varTypeStr = member.Type;
            object value;
            var    align = (member.Flag & 0x4000) != 0;

            switch (varTypeStr)
            {
            case "SInt8":
                value = reader.ReadSByte();
                break;

            case "UInt8":
                value = reader.ReadByte();
                break;

            case "short":
            case "SInt16":
                value = reader.ReadInt16();
                break;

            case "UInt16":
            case "unsigned short":
                value = reader.ReadUInt16();
                break;

            case "int":
            case "SInt32":
                value = reader.ReadInt32();
                break;

            case "UInt32":
            case "unsigned int":
            case "Type*":
                value = reader.ReadUInt32();
                break;

            case "long long":
            case "SInt64":
                value = reader.ReadInt64();
                break;

            case "UInt64":
            case "unsigned long long":
                value = reader.ReadUInt64();
                break;

            case "float":
                value = reader.ReadSingle();
                break;

            case "double":
                value = reader.ReadDouble();
                break;

            case "bool":
                value = reader.ReadBoolean();
                break;

            case "string":
                value = reader.ReadAlignedString();
                i    += 3;
                break;

            case "vector":
            case "staticvector":
            case "set":
            {
                if ((members[i + 1].Flag & 0x4000) != 0)
                {
                    align = true;
                }
                var size   = reader.ReadInt32();
                var list   = new List <object>(size);
                var vector = GetMembers(members, level, i);
                i += vector.Count - 1;
                vector.RemoveRange(0, 3);
                for (int j = 0; j < size; j++)
                {
                    int tmp = 0;
                    list.Add(ReadValue(vector, reader, ref tmp));
                }
                value = list;
                break;
            }

            case "map":
            {
                if ((members[i + 1].Flag & 0x4000) != 0)
                {
                    align = true;
                }
                var size = reader.ReadInt32();
                var dic  = new List <KeyValuePair <object, object> >(size);
                var map  = GetMembers(members, level, i);
                i += map.Count - 1;
                map.RemoveRange(0, 4);
                var first = GetMembers(map, map[0].Level, 0);
                map.RemoveRange(0, first.Count);
                var second = map;
                for (int j = 0; j < size; j++)
                {
                    int tmp1 = 0;
                    int tmp2 = 0;
                    dic.Add(new KeyValuePair <object, object>(ReadValue(first, reader, ref tmp1), ReadValue(second, reader, ref tmp2)));
                }
                value = dic;
                break;
            }

            case "TypelessData":
            {
                var size = reader.ReadInt32();
                value = reader.ReadBytes(size);
                i    += 2;
                break;
            }

            default:
            {
                var @class = GetMembers(members, level, i);
                @class.RemoveAt(0);
                i += @class.Count;
                var obj    = new ExpandoObject();
                var objdic = (IDictionary <string, object>)obj;
                for (int j = 0; j < @class.Count; j++)
                {
                    var classmember = @class[j];
                    var name        = classmember.Name;
                    objdic[name] = ReadValue(@class, reader, ref j);
                }
                value = obj;
                break;
            }
            }
            if (align)
            {
                reader.AlignStream(4);
            }
            return(value);
        }
 public AABB(EndianBinaryReader reader)
 {
     m_Center = reader.ReadVector3();
     m_Extend = reader.ReadVector3();
 }
Exemple #6
0
 public static FileType CheckFileType(string fileName, out EndianBinaryReader reader)
 {
     reader = new EndianBinaryReader(File.OpenRead(fileName));
     return(CheckFileType(reader));
 }
 public static void ReadClassString(StringBuilder sb, List <ClassMember> members, EndianBinaryReader reader)
 {
     for (int i = 0; i < members.Count; i++)
     {
         ReadStringValue(sb, members, reader, ref i);
     }
 }
 public MotionNeighborList(EndianBinaryReader reader)
 {
     m_NeighborArray = reader.ReadUInt32Array(reader.ReadInt32());
 }
 public Blend1dDataConstant(EndianBinaryReader reader)
 {
     m_ChildThresholdArray = reader.ReadSingleArray(reader.ReadInt32());
 }
Exemple #10
0
 public static FileType CheckFileType(string fileName, out EndianBinaryReader reader)
 {
     reader = new EndianBinaryReader(File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
     return(CheckFileType(reader));
 }
 public LeafInfoConstant(EndianBinaryReader reader)
 {
     m_IDArray     = reader.ReadUInt32Array(reader.ReadInt32());
     m_IndexOffset = reader.ReadUInt32();
 }
Exemple #12
0
        public Human(EndianBinaryReader reader, int[] version)
        {
            m_RootX        = new xform(reader, version);
            m_Skeleton     = new Skeleton(reader, version);
            m_SkeletonPose = new SkeletonPose(reader, version);
            m_LeftHand     = new Hand(reader);
            m_RightHand    = new Hand(reader);

            if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
            {
                int numHandles = reader.ReadInt32();
                m_Handles = new List <Handle>(numHandles);
                for (int i = 0; i < numHandles; i++)
                {
                    m_Handles.Add(new Handle(reader, version));
                }

                int numColliders = reader.ReadInt32();
                m_ColliderArray = new List <Collider>(numColliders);
                for (int i = 0; i < numColliders; i++)
                {
                    m_ColliderArray.Add(new Collider(reader, version));
                }
            }

            int numIndexes = reader.ReadInt32();

            m_HumanBoneIndex = new List <int>(numIndexes);
            for (int i = 0; i < numIndexes; i++)
            {
                m_HumanBoneIndex.Add(reader.ReadInt32());
            }

            int numMasses = reader.ReadInt32();

            m_HumanBoneMass = new List <float>(numMasses);
            for (int i = 0; i < numMasses; i++)
            {
                m_HumanBoneMass.Add(reader.ReadSingle());
            }

            if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
            {
                int numColliderIndexes = reader.ReadInt32();
                m_ColliderIndex = new List <int>(numColliderIndexes);
                for (int i = 0; i < numColliderIndexes; i++)
                {
                    m_ColliderIndex.Add(reader.ReadInt32());
                }
            }

            m_Scale         = reader.ReadSingle();
            m_ArmTwist      = reader.ReadSingle();
            m_ForeArmTwist  = reader.ReadSingle();
            m_UpperLegTwist = reader.ReadSingle();
            m_LegTwist      = reader.ReadSingle();
            m_ArmStretch    = reader.ReadSingle();
            m_LegStretch    = reader.ReadSingle();
            m_FeetSpacing   = reader.ReadSingle();
            m_HasLeftHand   = reader.ReadBoolean();
            m_HasRightHand  = reader.ReadBoolean();
            m_HasTDoF       = reader.ReadBoolean();
            reader.AlignStream(4);
        }
Exemple #13
0
 public Handle(EndianBinaryReader reader, int[] version)
 {
     m_X = new xform(reader, version);
     m_ParentHumanIndex = reader.ReadUInt32();
     m_ID = reader.ReadUInt32();
 }
Exemple #14
0
 public Node(EndianBinaryReader reader)
 {
     m_ParentId = reader.ReadInt32();
     m_AxesId   = reader.ReadInt32();
 }
Exemple #15
0
        private static void LoadAssetsFile(string fullName, List <AssetsFile> assetsfileList, EndianBinaryReader reader, string parentPath = null)
        {
            var fileName = Path.GetFileName(fullName);

            StatusStripUpdate("Loading " + fileName);
            if (!assetsfileListHash.Value.Contains(fileName.ToUpper()))
            {
                var assetsFile = new AssetsFile(fullName, reader);
                if (assetsFile.valid)
                {
                    assetsFile.parentPath = parentPath;
                    assetsfileList.Add(assetsFile);
                    assetsfileListHash.Value.Add(assetsFile.upperFileName);

                    #region for 2.6.x find mainData and get string version
                    if (assetsFile.fileGen == 6 && fileName != "mainData")
                    {
                        var mainDataFile = assetsfileList.Find(aFile => aFile.fileName == "mainData");
                        if (mainDataFile != null)
                        {
                            assetsFile.m_Version = mainDataFile.m_Version;
                            assetsFile.version   = mainDataFile.version;
                            assetsFile.buildType = mainDataFile.buildType;
                        }
                        else if (File.Exists(Path.GetDirectoryName(fullName) + "\\mainData"))
                        {
                            mainDataFile         = new AssetsFile(Path.GetDirectoryName(fullName) + "\\mainData", new EndianBinaryReader(File.OpenRead(Path.GetDirectoryName(fullName) + "\\mainData")));
                            assetsFile.m_Version = mainDataFile.m_Version;
                            assetsFile.version   = mainDataFile.version;
                            assetsFile.buildType = mainDataFile.buildType;
                        }
                    }
                    #endregion

                    int value = 0;
                    foreach (var sharedFile in assetsFile.sharedAssetsList)
                    {
                        var sharedFilePath = Path.GetDirectoryName(fullName) + "\\" + sharedFile.fileName;
                        var sharedFileName = sharedFile.fileName;

                        if (!importFilesHash.Value.Contains(sharedFileName.ToUpper()))
                        {
                            if (!File.Exists(sharedFilePath))
                            {
                                var findFiles = Directory.GetFiles(Path.GetDirectoryName(fullName), sharedFileName, SearchOption.AllDirectories);
                                if (findFiles.Length > 0)
                                {
                                    sharedFilePath = findFiles[0];
                                }
                            }

                            if (File.Exists(sharedFilePath))
                            {
                                importFiles.Value.Add(sharedFilePath);
                                importFilesHash.Value.Add(sharedFileName.ToUpper());
                                value++;
                            }
                        }
                    }
                    if (value > 0)
                    {
                        ProgressBarMaximumAdd(value);
                    }
                }
                else
                {
                    reader.Dispose();
                }
            }
        }
 public BlendDirectDataConstant(EndianBinaryReader reader)
 {
     m_ChildBlendEventIDArray = reader.ReadUInt32Array(reader.ReadInt32());
     m_NormalizedBlendValues  = reader.ReadBoolean();
     reader.AlignStream(4);
 }
Exemple #17
0
 public static FileType CheckFileType(Stream stream, out EndianBinaryReader reader)
 {
     reader = new EndianBinaryReader(stream);
     return(CheckFileType(reader));
 }
 public SkeletonMaskElement(EndianBinaryReader reader)
 {
     m_PathHash = reader.ReadUInt32();
     m_Weight   = reader.ReadSingle();
 }
Exemple #19
0
        public static void ReadClassStruct(StringBuilder sb, List <ClassMember> members, EndianBinaryReader reader)
        {
            for (int i = 0; i < members.Count; i++)
            {
                var    member     = members[i];
                var    level      = member.Level;
                var    varTypeStr = member.Type;
                var    varNameStr = member.Name;
                object value      = null;
                var    align      = (member.Flag & 0x4000) != 0;
                var    append     = true;
                if (member.alignBefore)
                {
                    reader.AlignStream(4);
                }
                switch (varTypeStr)
                {
                case "SInt8":
                    value = reader.ReadSByte();
                    break;

                case "UInt8":
                    value = reader.ReadByte();
                    break;

                case "short":
                case "SInt16":
                    value = reader.ReadInt16();
                    break;

                case "UInt16":
                case "unsigned short":
                    value = reader.ReadUInt16();
                    break;

                case "int":
                case "SInt32":
                    value = reader.ReadInt32();
                    break;

                case "UInt32":
                case "unsigned int":
                case "Type*":
                    value = reader.ReadUInt32();
                    break;

                case "long long":
                case "SInt64":
                    value = reader.ReadInt64();
                    break;

                case "UInt64":
                case "unsigned long long":
                    value = reader.ReadUInt64();
                    break;

                case "float":
                    value = reader.ReadSingle();
                    break;

                case "double":
                    value = reader.ReadDouble();
                    break;

                case "bool":
                    value = reader.ReadBoolean();
                    break;

                case "string":
                    append = false;
                    var str = reader.ReadAlignedString();
                    sb.AppendFormat("{0}{1} {2} = \"{3}\"\r\n", (new string('\t', level)), varTypeStr, varNameStr, str);
                    i += 3;    //skip
                    break;

                case "Array":
                {
                    append = false;
                    if ((members[i - 1].Flag & 0x4000) != 0)
                    {
                        align = true;
                    }
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                    var size = reader.ReadInt32();
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), "int", "size", size);
                    var array = ReadArray(members, level, i);
                    for (int j = 0; j < size; j++)
                    {
                        sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 1)), j);
                        ReadClassStruct(sb, array, reader);
                    }
                    i += array.Count + 1;        //skip
                    break;
                }

                case "TypelessData":
                {
                    append = false;
                    var size = reader.ReadInt32();
                    reader.ReadBytes(size);
                    i += 2;
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), "int", "size", size);
                    break;
                }

                default:
                    append = false;
                    if (align)
                    {
                        align = false;
                        SetAlignBefore(members, level, i + 1);
                    }
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                    break;
                }
                if (append)
                {
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value);
                }
                if (align)
                {
                    reader.AlignStream(4);
                }
            }
        }
        public StateConstant(EndianBinaryReader reader, int[] version)
        {
            int numTransistions = reader.ReadInt32();

            m_TransitionConstantArray = new TransitionConstant[numTransistions];
            for (int i = 0; i < numTransistions; i++)
            {
                m_TransitionConstantArray[i] = new TransitionConstant(reader, version);
            }

            int numBlendIndices = reader.ReadInt32();

            m_BlendTreeConstantIndexArray = new int[numBlendIndices];
            for (int i = 0; i < numBlendIndices; i++)
            {
                m_BlendTreeConstantIndexArray[i] = reader.ReadInt32();
            }

            if (version[0] < 5) //5.0 down
            {
                int numInfos = reader.ReadInt32();
                m_LeafInfoArray = new LeafInfoConstant[numInfos];
                for (int i = 0; i < numInfos; i++)
                {
                    m_LeafInfoArray[i] = new LeafInfoConstant(reader);
                }
            }

            int numBlends = reader.ReadInt32();

            m_BlendTreeConstantArray = new BlendTreeConstant[numBlends];
            for (int i = 0; i < numBlends; i++)
            {
                m_BlendTreeConstantArray[i] = new BlendTreeConstant(reader, version);
            }

            m_NameID = reader.ReadUInt32();
            m_PathID = reader.ReadUInt32();
            if (version[0] >= 5) //5.0 and up
            {
                m_FullPathID = reader.ReadUInt32();
            }

            m_TagID = reader.ReadUInt32();
            if (version[0] >= 5) //5.0 and up
            {
                m_SpeedParamID       = reader.ReadUInt32();
                m_MirrorParamID      = reader.ReadUInt32();
                m_CycleOffsetParamID = reader.ReadUInt32();
            }

            if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
            {
                var m_TimeParamID = reader.ReadUInt32();
            }

            m_Speed       = reader.ReadSingle();
            m_CycleOffset = reader.ReadSingle();
            m_IKOnFeet    = reader.ReadBoolean();
            if (version[0] >= 5) //5.0 and up
            {
                m_WriteDefaultValues = reader.ReadBoolean();
            }

            m_Loop   = reader.ReadBoolean();
            m_Mirror = reader.ReadBoolean();
            reader.AlignStream(4);
        }
        private static void ReadStringValue(StringBuilder sb, List <ClassMember> members, EndianBinaryReader reader, ref int i)
        {
            var    member     = members[i];
            var    level      = member.Level;
            var    varTypeStr = member.Type;
            var    varNameStr = member.Name;
            object value      = null;
            var    append     = true;
            var    align      = (member.Flag & 0x4000) != 0;

            switch (varTypeStr)
            {
            case "SInt8":
                value = reader.ReadSByte();
                break;

            case "UInt8":
                value = reader.ReadByte();
                break;

            case "short":
            case "SInt16":
                value = reader.ReadInt16();
                break;

            case "UInt16":
            case "unsigned short":
                value = reader.ReadUInt16();
                break;

            case "int":
            case "SInt32":
                value = reader.ReadInt32();
                break;

            case "UInt32":
            case "unsigned int":
            case "Type*":
                value = reader.ReadUInt32();
                break;

            case "long long":
            case "SInt64":
                value = reader.ReadInt64();
                break;

            case "UInt64":
            case "unsigned long long":
                value = reader.ReadUInt64();
                break;

            case "float":
                value = reader.ReadSingle();
                break;

            case "double":
                value = reader.ReadDouble();
                break;

            case "bool":
                value = reader.ReadBoolean();
                break;

            case "string":
                append = false;
                var str = reader.ReadAlignedString();
                sb.AppendFormat("{0}{1} {2} = \"{3}\"\r\n", (new string('\t', level)), varTypeStr, varNameStr, str);
                i += 3;
                break;

            case "vector":
            case "staticvector":
            case "set":
            {
                if ((members[i + 1].Flag & 0x4000) != 0)
                {
                    align = true;
                }
                append = false;
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 1)), "Array", "Array");
                var size = reader.ReadInt32();
                sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level + 1)), "int", "size", size);
                var vector = GetMembers(members, level, i);
                i += vector.Count - 1;
                vector.RemoveRange(0, 3);
                for (int j = 0; j < size; j++)
                {
                    sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 2)), j);
                    int tmp = 0;
                    ReadStringValue(sb, vector, reader, ref tmp);
                }
                break;
            }

            case "map":
            {
                if ((members[i + 1].Flag & 0x4000) != 0)
                {
                    align = true;
                }
                append = false;
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 1)), "Array", "Array");
                var size = reader.ReadInt32();
                sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level + 1)), "int", "size", size);
                var map = GetMembers(members, level, i);
                i += map.Count - 1;
                map.RemoveRange(0, 4);
                var first = GetMembers(map, map[0].Level, 0);
                map.RemoveRange(0, first.Count);
                var second = map;
                for (int j = 0; j < size; j++)
                {
                    sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 2)), j);
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level + 2)), "pair", "data");
                    int tmp1 = 0;
                    int tmp2 = 0;
                    ReadStringValue(sb, first, reader, ref tmp1);
                    ReadStringValue(sb, second, reader, ref tmp2);
                }
                break;
            }

            case "TypelessData":
            {
                append = false;
                var size = reader.ReadInt32();
                reader.ReadBytes(size);
                i += 2;
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), "int", "size", size);
                break;
            }

            default:
            {
                append = false;
                sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                var @class = GetMembers(members, level, i);
                @class.RemoveAt(0);
                i += @class.Count;
                for (int j = 0; j < @class.Count; j++)
                {
                    ReadStringValue(sb, @class, reader, ref j);
                }
                break;
            }
            }
            if (append)
            {
                sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value);
            }
            if (align)
            {
                reader.AlignStream(4);
            }
        }
Exemple #22
0
        private void readBase5()
        {
            int classID = assetsFileReader.ReadInt32();

            if (fileGen > 15)//5.5.0 and up
            {
                assetsFileReader.ReadByte();
                int type1;
                if ((type1 = assetsFileReader.ReadInt16()) >= 0)
                {
                    type1 = -1 - type1;
                }
                else
                {
                    type1 = classID;
                }
                classIDs.Add(new[] { type1, classID });
                if (classID == 114)
                {
                    assetsFileReader.Position += 16;
                }
                classID = type1;
            }
            else if (classID < 0)
            {
                assetsFileReader.Position += 16;
            }
            assetsFileReader.Position += 16;

            if (baseDefinitions)
            {
                int varCount   = assetsFileReader.ReadInt32();
                int stringSize = assetsFileReader.ReadInt32();

                assetsFileReader.Position += varCount * 24;
                var    stringReader = new EndianBinaryReader(new MemoryStream(assetsFileReader.ReadBytes(stringSize)));
                string className    = "";
                var    classVar     = new List <ClassMember>();
                //build Class Structures
                assetsFileReader.Position -= varCount * 24 + stringSize;
                for (int i = 0; i < varCount; i++)
                {
                    ushort num0    = assetsFileReader.ReadUInt16();
                    byte   level   = assetsFileReader.ReadByte();
                    bool   isArray = assetsFileReader.ReadBoolean();

                    ushort varTypeIndex = assetsFileReader.ReadUInt16();
                    ushort test         = assetsFileReader.ReadUInt16();
                    string varTypeStr;
                    if (test == 0) //varType is an offset in the string block
                    {
                        stringReader.Position = varTypeIndex;
                        varTypeStr            = stringReader.ReadStringToNull();
                    }
                    else //varType is an index in an internal strig array
                    {
                        varTypeStr = baseStrings.ContainsKey(varTypeIndex) ? baseStrings[varTypeIndex] : varTypeIndex.ToString();
                    }

                    ushort varNameIndex = assetsFileReader.ReadUInt16();
                    test = assetsFileReader.ReadUInt16();
                    string varNameStr;
                    if (test == 0)
                    {
                        stringReader.Position = varNameIndex;
                        varNameStr            = stringReader.ReadStringToNull();
                    }
                    else
                    {
                        varNameStr = baseStrings.ContainsKey(varNameIndex) ? baseStrings[varNameIndex] : varNameIndex.ToString();
                    }

                    int size  = assetsFileReader.ReadInt32();
                    int index = assetsFileReader.ReadInt32();
                    int flag  = assetsFileReader.ReadInt32();

                    if (index == 0)
                    {
                        className = varTypeStr + " " + varNameStr;
                    }
                    else
                    {
                        classVar.Add(new ClassMember
                        {
                            Level = level - 1,
                            Type  = varTypeStr,
                            Name  = varNameStr,
                            Size  = size,
                            Flag  = flag
                        });
                    }
                }
                stringReader.Dispose();
                assetsFileReader.Position += stringSize;

                var aClass = new ClassStruct {
                    ID = classID, Text = className, members = classVar
                };
                aClass.SubItems.Add(classID.ToString());
                ClassStructures[classID] = aClass;
            }
        }
 public Vector3Curve(EndianBinaryReader reader, int[] version)
 {
     curve = new AnimationCurve <Vector3>(reader, reader.ReadVector3, version);
     path  = reader.ReadAlignedString();
 }
        public SerializedFile(AssetsManager assetsManager, string fullName, EndianBinaryReader reader)
        {
            this.assetsManager = assetsManager;
            this.reader        = reader;
            this.fullName      = fullName;
            fileName           = Path.GetFileName(fullName);
            upperFileName      = fileName.ToUpper();
            try
            {
                //ReadHeader
                header = new SerializedFileHeader();
                header.m_MetadataSize = reader.ReadUInt32();
                header.m_FileSize     = reader.ReadUInt32();
                header.m_Version      = reader.ReadUInt32();
                header.m_DataOffset   = reader.ReadUInt32();

                if (header.m_Version >= 9)
                {
                    header.m_Endianess = reader.ReadByte();
                    header.m_Reserved  = reader.ReadBytes(3);
                    m_FileEndianess    = (EndianType)header.m_Endianess;
                }
                else
                {
                    reader.Position = header.m_FileSize - header.m_MetadataSize;
                    m_FileEndianess = (EndianType)reader.ReadByte();
                }

                //ReadMetadata
                if (m_FileEndianess == EndianType.LittleEndian)
                {
                    reader.endian = EndianType.LittleEndian;
                }
                if (header.m_Version >= 7)
                {
                    unityVersion = reader.ReadStringToNull();
                    SetVersion(unityVersion);
                }
                if (header.m_Version >= 8)
                {
                    m_TargetPlatform = (BuildTarget)reader.ReadInt32();
                    if (!Enum.IsDefined(typeof(BuildTarget), m_TargetPlatform))
                    {
                        m_TargetPlatform = BuildTarget.UnknownPlatform;
                    }
                }
                if (header.m_Version >= 13)
                {
                    m_EnableTypeTree = reader.ReadBoolean();
                }

                //ReadTypes
                int typeCount = reader.ReadInt32();
                m_Types = new List <SerializedType>(typeCount);
                for (int i = 0; i < typeCount; i++)
                {
                    m_Types.Add(ReadSerializedType());
                }

                if (header.m_Version >= 7 && header.m_Version < 14)
                {
                    var bigIDEnabled = reader.ReadInt32();
                }

                //ReadObjects
                int objectCount = reader.ReadInt32();
                m_Objects = new List <ObjectInfo>(objectCount);
                for (int i = 0; i < objectCount; i++)
                {
                    var objectInfo = new ObjectInfo();
                    if (header.m_Version < 14)
                    {
                        objectInfo.m_PathID = reader.ReadInt32();
                    }
                    else
                    {
                        reader.AlignStream(4);
                        objectInfo.m_PathID = reader.ReadInt64();
                    }
                    objectInfo.byteStart  = reader.ReadUInt32();
                    objectInfo.byteStart += header.m_DataOffset;
                    objectInfo.byteSize   = reader.ReadUInt32();
                    objectInfo.typeID     = reader.ReadInt32();
                    if (header.m_Version < 16)
                    {
                        objectInfo.classID        = reader.ReadUInt16();
                        objectInfo.serializedType = m_Types.Find(x => x.classID == objectInfo.typeID);
                        var isDestroyed = reader.ReadUInt16();
                    }
                    else
                    {
                        var type = m_Types[objectInfo.typeID];
                        objectInfo.serializedType = type;
                        objectInfo.classID        = type.classID;
                    }
                    if (header.m_Version == 15 || header.m_Version == 16)
                    {
                        var stripped = reader.ReadByte();
                    }
                    m_Objects.Add(objectInfo);
                }

                if (header.m_Version >= 11)
                {
                    int scriptCount = reader.ReadInt32();
                    m_ScriptTypes = new List <LocalSerializedObjectIdentifier>(scriptCount);
                    for (int i = 0; i < scriptCount; i++)
                    {
                        var m_ScriptType = new LocalSerializedObjectIdentifier();
                        m_ScriptType.localSerializedFileIndex = reader.ReadInt32();
                        if (header.m_Version < 14)
                        {
                            m_ScriptType.localIdentifierInFile = reader.ReadInt32();
                        }
                        else
                        {
                            reader.AlignStream(4);
                            m_ScriptType.localIdentifierInFile = reader.ReadInt64();
                        }
                        m_ScriptTypes.Add(m_ScriptType);
                    }
                }

                int externalsCount = reader.ReadInt32();
                m_Externals = new List <FileIdentifier>(externalsCount);
                for (int i = 0; i < externalsCount; i++)
                {
                    var m_External = new FileIdentifier();
                    if (header.m_Version >= 6)
                    {
                        var tempEmpty = reader.ReadStringToNull();
                    }
                    if (header.m_Version >= 5)
                    {
                        m_External.guid = new Guid(reader.ReadBytes(16));
                        m_External.type = reader.ReadInt32();
                    }
                    m_External.pathName = reader.ReadStringToNull();
                    m_External.fileName = Path.GetFileName(m_External.pathName);
                    m_Externals.Add(m_External);
                }

                if (header.m_Version >= 5)
                {
                    //var userInformation = reader.ReadStringToNull();
                }

                valid = true;
            }
            catch
            {
                // ignored
            }
        }
 public xform(EndianBinaryReader reader, int[] version)
 {
     t = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
     q = reader.ReadQuaternion();
     s = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up
 }
Exemple #26
0
        public AssetsFile(string fullName, EndianBinaryReader reader)
        {
            this.reader   = reader;
            filePath      = fullName;
            fileName      = Path.GetFileName(fullName);
            upperFileName = fileName.ToUpper();
            try
            {
                int tableSize = this.reader.ReadInt32();
                int dataEnd   = this.reader.ReadInt32();
                fileGen = this.reader.ReadInt32();
                uint dataOffset = this.reader.ReadUInt32();
                sharedAssetsList[0].fileName = fileName; //reference itself because sharedFileIDs start from 1

                switch (fileGen)
                {
                case 6:     //2.5.0 - 2.6.1
                {
                    this.reader.Position  = (dataEnd - tableSize);
                    this.reader.Position += 1;
                    break;
                }

                case 7:     //3.0.0 beta
                {
                    this.reader.Position  = (dataEnd - tableSize);
                    this.reader.Position += 1;
                    m_Version             = this.reader.ReadStringToNull();
                    break;
                }

                case 8:     //3.0.0 - 3.4.2
                {
                    this.reader.Position  = (dataEnd - tableSize);
                    this.reader.Position += 1;
                    m_Version             = this.reader.ReadStringToNull();
                    platform              = this.reader.ReadInt32();
                    break;
                }

                case 9:                        //3.5.0 - 4.6.x
                {
                    this.reader.Position += 4; //azero
                    m_Version             = this.reader.ReadStringToNull();
                    platform              = this.reader.ReadInt32();
                    break;
                }

                case 14:                       //5.0.0 beta and final
                case 15:                       //5.0.1 - 5.4
                case 16:                       //??.. no sure
                case 17:                       //5.5.0 and up
                {
                    this.reader.Position += 4; //azero
                    m_Version             = this.reader.ReadStringToNull();
                    platform              = this.reader.ReadInt32();
                    baseDefinitions       = this.reader.ReadBoolean();
                    break;
                }

                default:
                {
                    //MessageBox.Show("Unsupported version!" + fileGen, "AssetStudio Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                }

                if (platform > 255 || platform < 0)
                {
                    byte[] b32 = BitConverter.GetBytes(platform);
                    Array.Reverse(b32);
                    platform           = BitConverter.ToInt32(b32, 0);
                    this.reader.endian = EndianType.LittleEndian;
                }

                platformStr = Enum.IsDefined(typeof(BuildTarget), platform) ? ((BuildTarget)platform).ToString() : "Unknown Platform";

                int baseCount = this.reader.ReadInt32();
                for (int i = 0; i < baseCount; i++)
                {
                    if (fileGen < 14)
                    {
                        int    classID  = this.reader.ReadInt32();
                        string baseType = this.reader.ReadStringToNull();
                        string baseName = this.reader.ReadStringToNull();
                        this.reader.Position += 20;
                        int memberCount = this.reader.ReadInt32();

                        var cb = new List <ClassMember>();
                        for (int m = 0; m < memberCount; m++)
                        {
                            readBase(cb, 1);
                        }

                        var aClass = new ClassStruct {
                            ID = classID, Text = (baseType + " " + baseName), members = cb
                        };
                        aClass.SubItems.Add(classID.ToString());
                        ClassStructures.Add(classID, aClass);
                    }
                    else
                    {
                        readBase5();
                    }
                }

                if (fileGen >= 7 && fileGen < 14)
                {
                    this.reader.Position += 4; //azero
                }

                int assetCount = this.reader.ReadInt32();

                #region asset preload table
                string assetIDfmt = "D" + assetCount.ToString().Length; //format for unique ID

                for (int i = 0; i < assetCount; i++)
                {
                    //each table entry is aligned individually, not the whole table
                    if (fileGen >= 14)
                    {
                        this.reader.AlignStream(4);
                    }

                    AssetPreloadData asset = new AssetPreloadData();
                    asset.m_PathID = fileGen < 14 ? this.reader.ReadInt32() : this.reader.ReadInt64();
                    asset.Offset   = this.reader.ReadUInt32();
                    asset.Offset  += dataOffset;
                    asset.Size     = this.reader.ReadInt32();
                    if (fileGen > 15)
                    {
                        int index = this.reader.ReadInt32();
                        asset.Type1 = classIDs[index][0];
                        asset.Type2 = classIDs[index][1];
                    }
                    else
                    {
                        asset.Type1           = this.reader.ReadInt32();
                        asset.Type2           = this.reader.ReadUInt16();
                        this.reader.Position += 2;
                    }
                    if (fileGen == 15)
                    {
                        byte unknownByte = this.reader.ReadByte();
                        //this is a single byte, not an int32
                        //the next entry is aligned after this
                        //but not the last!
                    }

                    if (Enum.IsDefined(typeof(ClassIDReference), asset.Type2))
                    {
                        asset.Type       = (ClassIDReference)asset.Type2;
                        asset.TypeString = asset.Type.ToString();
                    }
                    else
                    {
                        asset.Type       = ClassIDReference.UnknownType;
                        asset.TypeString = "UnknownType " + asset.Type2;
                    }

                    asset.uniqueID = i.ToString(assetIDfmt);

                    asset.fullSize   = asset.Size;
                    asset.sourceFile = this;

                    preloadTable.Add(asset.m_PathID, asset);

                    #region read BuildSettings to get version for version 2.x files
                    if (asset.Type == ClassIDReference.BuildSettings && fileGen == 6)
                    {
                        long nextAsset = this.reader.Position;

                        BuildSettings BSettings = new BuildSettings(asset);
                        m_Version = BSettings.m_Version;

                        this.reader.Position = nextAsset;
                    }
                    #endregion
                }
                #endregion

                buildType = Regex.Replace(m_Version, @"\d", "").Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries);
                var firstVersion = int.Parse(m_Version.Split('.')[0]);
                version = Regex.Matches(m_Version, @"\d").Cast <Match>().Select(m => int.Parse(m.Value)).ToArray();
                if (firstVersion > 5)//2017 and up
                {
                    var nversion = new int[version.Length - 3];
                    nversion[0] = firstVersion;
                    Array.Copy(version, 4, nversion, 1, version.Length - 4);
                    version = nversion;
                }
                if (fileGen >= 14)
                {
                    //this looks like a list of assets that need to be preloaded in memory before anytihng else
                    int someCount = this.reader.ReadInt32();
                    for (int i = 0; i < someCount; i++)
                    {
                        int num1 = this.reader.ReadInt32();
                        this.reader.AlignStream(4);
                        long m_PathID = this.reader.ReadInt64();
                    }
                }

                int sharedFileCount = this.reader.ReadInt32();
                for (int i = 0; i < sharedFileCount; i++)
                {
                    var shared = new SharedAssets();
                    shared.aName          = this.reader.ReadStringToNull();
                    this.reader.Position += 20;
                    var sharedFilePath = this.reader.ReadStringToNull(); //relative path
                    shared.fileName = Path.GetFileName(sharedFilePath);
                    sharedAssetsList.Add(shared);
                }
                valid = true;
            }
            catch
            {
            }
        }
 public ValueDelta(EndianBinaryReader reader)
 {
     m_Start = reader.ReadSingle();
     m_Stop  = reader.ReadSingle();
 }
Exemple #28
0
        public ClipMuscleConstant(EndianBinaryReader reader, int[] version)
        {
            m_DeltaPose = new HumanPose(reader, version);
            m_StartX    = new xform(reader, version);
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
            {
                m_StopX = new xform(reader, version);
            }
            m_LeftFootStartX  = new xform(reader, version);
            m_RightFootStartX = new xform(reader, version);
            if (version[0] < 5)//5.0 down
            {
                m_MotionStartX = new xform(reader, version);
                m_MotionStopX  = new xform(reader, version);
            }
            m_AverageSpeed        = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4();//5.4 and up
            m_Clip                = new Clip(reader, version);
            m_StartTime           = reader.ReadSingle();
            m_StopTime            = reader.ReadSingle();
            m_OrientationOffsetY  = reader.ReadSingle();
            m_Level               = reader.ReadSingle();
            m_CycleOffset         = reader.ReadSingle();
            m_AverageAngularSpeed = reader.ReadSingle();

            int numIndices = reader.ReadInt32();

            m_IndexArray = reader.ReadInt32Array(numIndices);
            if (version[0] < 4 || (version[0] == 4 && version[1] < 3)) //4.3 down
            {
                int numAdditionalCurveIndexs    = reader.ReadInt32();
                var m_AdditionalCurveIndexArray = new List <int>(numAdditionalCurveIndexs);
                for (int i = 0; i < numAdditionalCurveIndexs; i++)
                {
                    m_AdditionalCurveIndexArray.Add(reader.ReadInt32());
                }
            }
            int numDeltas = reader.ReadInt32();

            m_ValueArrayDelta = new List <ValueDelta>(numDeltas);
            for (int i = 0; i < numDeltas; i++)
            {
                m_ValueArrayDelta.Add(new ValueDelta(reader));
            }
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
            {
                m_ValueArrayReferencePose = reader.ReadSingleArray(reader.ReadInt32());
            }

            m_Mirror               = reader.ReadBoolean();
            m_LoopTime             = reader.ReadBoolean();
            m_LoopBlend            = reader.ReadBoolean();
            m_LoopBlendOrientation = reader.ReadBoolean();
            m_LoopBlendPositionY   = reader.ReadBoolean();
            m_LoopBlendPositionXZ  = reader.ReadBoolean();
            if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
            {
                m_StartAtOrigin = reader.ReadBoolean();
            }
            m_KeepOriginalOrientation = reader.ReadBoolean();
            m_KeepOriginalPositionY   = reader.ReadBoolean();
            m_KeepOriginalPositionXZ  = reader.ReadBoolean();
            m_HeightFromFeet          = reader.ReadBoolean();
            reader.AlignStream(4);
        }
Exemple #29
0
        private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader)
        {
            byte[] blocksInfoBytes;
            if (m_Header.version >= 7)
            {
                reader.AlignStream(16);
            }
            if ((m_Header.flags & ArchiveFlags.BlocksInfoAtTheEnd) != 0)
            {
                var position = reader.Position;
                reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
                reader.Position = position;
            }
            else //0x40 BlocksAndDirectoryInfoCombined
            {
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
            }
            MemoryStream blocksInfoUncompresseddStream;
            var          uncompressedSize = m_Header.uncompressedBlocksInfoSize;
            var          compressionType  = (CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask);

            switch (compressionType)
            {
            case CompressionType.None:
            {
                blocksInfoUncompresseddStream = new MemoryStream(blocksInfoBytes);
                break;
            }

            case CompressionType.Lzma:
            {
                blocksInfoUncompresseddStream = new MemoryStream((int)(uncompressedSize));
                using (var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes))
                {
                    SevenZipHelper.StreamDecompress(blocksInfoCompressedStream, blocksInfoUncompresseddStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);
                }
                blocksInfoUncompresseddStream.Position = 0;
                break;
            }

            case CompressionType.Lz4:
            case CompressionType.Lz4HC:
            {
                var uncompressedBytes = new byte[uncompressedSize];
                var numWrite          = LZ4Codec.Decode(blocksInfoBytes, uncompressedBytes);
                if (numWrite != uncompressedSize)
                {
                    throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
                }
                blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
                break;
            }

            default:
                throw new IOException($"Unsupported compression type {compressionType}");
            }
            using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream))
            {
                var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
                var blocksInfoCount      = blocksInfoReader.ReadInt32();
                m_BlocksInfo = new StorageBlock[blocksInfoCount];
                for (int i = 0; i < blocksInfoCount; i++)
                {
                    m_BlocksInfo[i] = new StorageBlock
                    {
                        uncompressedSize = blocksInfoReader.ReadUInt32(),
                        compressedSize   = blocksInfoReader.ReadUInt32(),
                        flags            = (StorageBlockFlags)blocksInfoReader.ReadUInt16()
                    };
                }

                var nodesCount = blocksInfoReader.ReadInt32();
                m_DirectoryInfo = new Node[nodesCount];
                for (int i = 0; i < nodesCount; i++)
                {
                    m_DirectoryInfo[i] = new Node
                    {
                        offset = blocksInfoReader.ReadInt64(),
                        size   = blocksInfoReader.ReadInt64(),
                        flags  = blocksInfoReader.ReadUInt32(),
                        path   = blocksInfoReader.ReadStringToNull(),
                    };
                }
            }
            if ((m_Header.flags & ArchiveFlags.BlockInfoNeedPaddingAtStart) != 0)
            {
                reader.AlignStream(16);
            }
        }
Exemple #30
0
        private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader)
        {
            byte[] blocksInfoBytes;
            if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd
            {
                var position = reader.Position;
                reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
                reader.Position = position;
            }
            else //0x40 kArchiveBlocksAndDirectoryInfoCombined
            {
                if (m_Header.version >= 7)
                {
                    reader.AlignStream(16);
                }
                blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
            }
            var          blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes);
            MemoryStream blocksInfoUncompresseddStream;

            switch (m_Header.flags & 0x3F) //kArchiveCompressionTypeMask
            {
            default:                       //None
            {
                blocksInfoUncompresseddStream = blocksInfoCompressedStream;
                break;
            }

            case 1:     //LZMA
            {
                blocksInfoUncompresseddStream = SevenZipHelper.StreamDecompress(blocksInfoCompressedStream);
                blocksInfoCompressedStream.Close();
                break;
            }

            case 2:     //LZ4
            case 3:     //LZ4HC
            {
                var uncompressedBytes = new byte[m_Header.uncompressedBlocksInfoSize];
                using (var decoder = new Lz4DecoderStream(blocksInfoCompressedStream))
                {
                    decoder.Read(uncompressedBytes, 0, uncompressedBytes.Length);
                }
                blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
                break;
            }
            }
            using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream))
            {
                var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
                var blocksInfoCount      = blocksInfoReader.ReadInt32();
                m_BlocksInfo = new StorageBlock[blocksInfoCount];
                for (int i = 0; i < blocksInfoCount; i++)
                {
                    m_BlocksInfo[i] = new StorageBlock
                    {
                        uncompressedSize = blocksInfoReader.ReadUInt32(),
                        compressedSize   = blocksInfoReader.ReadUInt32(),
                        flags            = blocksInfoReader.ReadUInt16()
                    };
                }

                var nodesCount = blocksInfoReader.ReadInt32();
                m_DirectoryInfo = new Node[nodesCount];
                for (int i = 0; i < nodesCount; i++)
                {
                    m_DirectoryInfo[i] = new Node
                    {
                        offset = blocksInfoReader.ReadInt64(),
                        size   = blocksInfoReader.ReadInt64(),
                        flags  = blocksInfoReader.ReadUInt32(),
                        path   = blocksInfoReader.ReadStringToNull(),
                    };
                }
            }
        }