コード例 #1
0
ファイル: FPakInfo.cs プロジェクト: realhypex/FModel
        internal FPakInfo ReadPakInfo(BinaryReader reader)
        {
            long fileSize = reader.BaseStream.Length;

            long[] OffsetsToTry = new long[4] {
                _SIZE, _SIZE8, _SIZE8A, _SIZE9
            };
            for (int i = 0; i < OffsetsToTry.Length; i++)
            {
                if (fileSize - OffsetsToTry[i] > 0)
                {
                    reader.BaseStream.Seek(fileSize - OffsetsToTry[i], SeekOrigin.Begin);
                    FPakInfo info = new FPakInfo(reader, OffsetsToTry[i]);
                    if (info.Version != EPakVersion.INVALID)
                    {
                        return(info);
                    }
                }
            }
            return(default);
コード例 #2
0
ファイル: FPakInfo.cs プロジェクト: walied-hanna/FModel
        internal FPakInfo ReadPakInfo(BinaryReader reader)
        {
            long offset     = reader.BaseStream.Length - SERIALIZED_SIZE;
            long terminator = offset - 300;
            int  maxNumCompressionMethods = 0;

            while (offset > terminator)
            {
                reader.BaseStream.Seek(offset, SeekOrigin.Begin);
                FPakInfo info = new FPakInfo(reader, maxNumCompressionMethods);
                if (info.Version != EPakVersion.INVALID)
                {
                    return(info);
                }
                else
                {
                    offset -= COMPRESSION_METHOD_NAME_LEN;
                    maxNumCompressionMethods++;
                }
            }
            return(default);