Пример #1
0
        /// <summary>
        /// Gets the information for a given file info
        /// </summary>
        /// <param name="fileinfo"></param>
        /// <param name="offset"></param>
        /// <param name="compSize"></param>
        /// <param name="decompSize"></param>
        /// <param name="regionIndex"></param>
        private void GetFileInformation(_sFileInformationV2 fileinfo, out long offset, out uint compSize, out uint decompSize, int regionIndex = 0)
        {
            var fileindex = fileInfoIndex[fileinfo.IndexIndex];

            //redirect
            if ((fileinfo.Flags & 0x00000010) == 0x10)
            {
                fileinfo = fileInfoV2[fileindex.FileInformationIndex];
            }

            var path     = fileInfoPath[fileinfo.PathIndex];
            var subindex = fileInfoSubIndex[fileinfo.SubIndexIndex];

            var subfile         = subFiles[subindex.SubFileIndex];
            var directoryOffset = directoryOffsets[subindex.DirectoryOffsetIndex];

            //regional
            if ((fileinfo.Flags & 0x00008000) == 0x8000)
            {
                subindex        = fileInfoSubIndex[fileinfo.SubIndexIndex + 1 + regionIndex];
                subfile         = subFiles[subindex.SubFileIndex];
                directoryOffset = directoryOffsets[subindex.DirectoryOffsetIndex];
            }

            offset     = (header.FileDataOffset + directoryOffset.Offset + (subfile.Offset << 2));
            compSize   = subfile.CompSize;
            decompSize = subfile.DecompSize;
        }
Пример #2
0
        /// <summary>
        /// Gets the information for a given file info
        /// </summary>
        /// <param name="fileinfo"></param>
        /// <param name="offset"></param>
        /// <param name="compSize"></param>
        /// <param name="decompSize"></param>
        /// <param name="regionIndex"></param>
        private void GetFileInformation(_sFileInformationV2 fileinfo, out long offset, out uint compSize, out uint decompSize, int regionIndex = 0)
        {
            GetSubInfo(fileinfo, out var subFile, out var directoryOffset, regionIndex);

            offset     = (header.FileDataOffset + directoryOffset.Offset + (subFile.Offset << 2));
            compSize   = subFile.CompSize;
            decompSize = subFile.DecompSize;
        }
Пример #3
0
 private bool GetArcFileInfoV2(string path, out _sFileInformationV2 fileOut)
 {
     if (pathToFileInfo.ContainsKey(path))
     {
         fileOut = pathToFileInfo[path];
         return(true);
     }
     fileOut = default(_sFileInformationV2);
     return(false);
 }
Пример #4
0
        private string GetFilePathFromInfo(_sFileInformationV2 file)
        {
            var path = fileInfoPath[file.PathIndex];

            string pathString = HashDict.GetString(path.Parent, (int)(path.Unk5 & 0xFF));
            string filename   = HashDict.GetString(path.FileName, (int)(path.Unk6 & 0xFF));

            if (filename.StartsWith("0x"))
            {
                filename += HashDict.GetString(path.Extension);
            }

            return(pathString + filename);
        }
Пример #5
0
        private void GetSubInfo(_sFileInformationV2 fileinfo, out UnderlyingData data, int regionIndex = 0)
        {
            var fileIndex = fileInfoIndex[fileinfo.IndexIndex];

            //redirect
            if ((fileinfo.Flags & 0x00000010) == 0x10)
            {
                fileinfo = fileInfoV2[fileIndex.FileInformationIndex];
            }

            var path     = fileInfoPath[fileinfo.PathIndex];
            var subIndex = fileInfoSubIndex[fileinfo.SubIndexIndex];

            data.subfileIndex         = subIndex.SubFileIndex;
            data.directoryOffsetIndex = subIndex.DirectoryOffsetIndex;

            //regional
            if ((fileinfo.Flags & 0x00008000) == 0x8000)
            {
                subIndex                  = fileInfoSubIndex[fileinfo.SubIndexIndex + 1 + regionIndex];
                data.subfileIndex         = subIndex.SubFileIndex;
                data.directoryOffsetIndex = subIndex.DirectoryOffsetIndex;
            }
        }
Пример #6
0
        public void GetSubInfo(_sFileInformationV2 fileinfo, out _sSubFileInfo subFile, out _sDirectoryOffset directoryOffset, int regionIndex = 0)
        {
            var fileIndex = fileInfoIndex[fileinfo.IndexIndex];

            //redirect
            if ((fileinfo.Flags & 0x00000010) == 0x10)
            {
                fileinfo = fileInfoV2[fileIndex.FileInformationIndex];
            }

            var path     = fileInfoPath[fileinfo.PathIndex];
            var subIndex = fileInfoSubIndex[fileinfo.SubIndexIndex];

            subFile         = subFiles[subIndex.SubFileIndex];
            directoryOffset = directoryOffsets[subIndex.DirectoryOffsetIndex];

            //regional
            if ((fileinfo.Flags & 0x00008000) == 0x8000)
            {
                subIndex        = fileInfoSubIndex[fileinfo.SubIndexIndex + 1 + regionIndex];
                subFile         = subFiles[subIndex.SubFileIndex];
                directoryOffset = directoryOffsets[subIndex.DirectoryOffsetIndex];
            }
        }
Пример #7
0
 private string GetFilePathFromInfo(_sFileInformationV2 file)
 {
     return(fileInfoPath[file.PathIndex].PathString);
 }