ZipArchive icon indicating copy to clipboard operation
ZipArchive copied to clipboard

Will you add UnzipIsEncrypted testing method?

Open govo opened this issue 10 years ago • 1 comments

like this:

-(BOOL) UnzipIsEncrypted
{
    int ret = unzGoToFirstFile( _unzFile );
    if (ret == UNZ_OK) {
        do {
            ret = unzOpenCurrentFile( _unzFile );
            if( ret!=UNZ_OK ) {
                return NO;
            }
            unz_file_info   fileInfo ={0};
            ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
            if (ret!= UNZ_OK) {
                return NO;
            }
            else if((fileInfo.flag & 1) == 1) {
                return YES;
            }

            unzCloseCurrentFile( _unzFile );
            ret = unzGoToNextFile( _unzFile );
        }while( ret==UNZ_OK && UNZ_OK!=UNZ_END_OF_LIST_OF_FILE );


    }


    return NO;
}

posted in: here

Thanks!

govo avatar Feb 02 '15 14:02 govo

Send a pull request, and I'll merge it in.

mattconnolly avatar Feb 12 '15 04:02 mattconnolly