示例#1
0
文件: ArcNEKO.cs 项目: Casidi/GARbro
        static byte[] ReadBlock(ArcView.Frame view, INekoEncryption enc, long offset, out int length)
        {
            uint hash = view.ReadUInt32 (offset);
            length = view.ReadInt32 (offset+4);
            // parity check
            //            if (CalcParity (((NekoEncryption32bit)enc).Parity, (uint)length) != hash)
            //                throw new InvalidFormatException();

            int aligned_size = (length+7) & ~7;
            byte[] buffer = new byte[aligned_size];
            length = view.Read (offset+8, buffer, 0, (uint)length);
            if (0 != hash)
            {
                enc.Decrypt (hash, buffer, 0, aligned_size);
            }
            return buffer;
        }