
KennyTM
By: a guest on Aug 24th, 2009 | syntax:
Objective C | size: 1.19 KB | hits: 83 | expires: Never
#import <Foundation/Foundation.h>
// From iWorkImport:
@end
-(id)initWithPath
:(NSString*)path collapseCommonRootDirectory
:(BOOL)directory;
-(id)initWithData
:(NSData*)data collapseCommonRootDirectory
:(BOOL)directory;
-(GQZEntry
*)entryWithName
:(NSString*)name;
-(BOOL)isEncrypted;
@end
int main (int argc, const char* argv[]) {
if (argc < 2) {
printf("Usage: show-zip-content <zipfile>\n\n");
return 0;
}
Class GQZArchive_ = objc_getClass("GQZArchive");
GQZArchive
* zip
= [[GQZArchive_ alloc
] initWithPath
:[NSString stringWithUTF8String
:argv
[1
]] collapseCommonRootDirectory
:NO];
if ([zip isEncrypted]) {
printf("Encrypted ZIP files are not supported with GQZArchive.");
} else {
for (NSString* path
in [zip entryNames
]) {
printf("[%s]:\n",
[path UTF8String
]);
char buf[64];
[[[zip entryWithName:path] data] getBytes:buf length:64];
// Print the first 64-bytes.
}
}
[zip release];
[pool drain];
return 0;
}