ARC-ified; removed ARCHelper.h
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// ARC Helper
|
||||
//
|
||||
// Version 2.1
|
||||
//
|
||||
// Created by Nick Lockwood on 05/01/2012.
|
||||
// Copyright 2012 Charcoal Design
|
||||
//
|
||||
// Distributed under the permissive zlib license
|
||||
// Get the latest version from here:
|
||||
//
|
||||
// https://gist.github.com/1563325
|
||||
//
|
||||
|
||||
#ifndef ah_retain
|
||||
#if __has_feature(objc_arc)
|
||||
#define ah_retain self
|
||||
#define ah_dealloc self
|
||||
#define release self
|
||||
#define autorelease self
|
||||
#else
|
||||
#define ah_retain retain
|
||||
#define ah_dealloc dealloc
|
||||
#define __bridge
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Weak reference support
|
||||
|
||||
#import <Availability.h>
|
||||
#if (!__has_feature(objc_arc)) || \
|
||||
(defined __IPHONE_OS_VERSION_MIN_REQUIRED && \
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0) || \
|
||||
(defined __MAC_OS_X_VERSION_MIN_REQUIRED && \
|
||||
__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7)
|
||||
#undef weak
|
||||
#define weak unsafe_unretained
|
||||
#undef __weak
|
||||
#define __weak __unsafe_unretained
|
||||
#endif
|
||||
|
||||
// Weak delegate support
|
||||
|
||||
#ifndef ah_weak
|
||||
#import <Availability.h>
|
||||
#if (__has_feature(objc_arc)) && \
|
||||
((defined __IPHONE_OS_VERSION_MIN_REQUIRED && \
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0) || \
|
||||
(defined __MAC_OS_X_VERSION_MIN_REQUIRED && \
|
||||
__MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_7))
|
||||
#define ah_weak weak
|
||||
#define __ah_weak __weak
|
||||
#else
|
||||
#define ah_weak unsafe_unretained
|
||||
#define __ah_weak __unsafe_unretained
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ARC Helper ends
|
||||
@@ -40,8 +40,8 @@
|
||||
Objective_ZipViewController *viewController;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIWindow *window;
|
||||
@property (nonatomic, retain) IBOutlet Objective_ZipViewController *viewController;
|
||||
@property (nonatomic, strong) IBOutlet UIWindow *window;
|
||||
@property (nonatomic, strong) IBOutlet Objective_ZipViewController *viewController;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -46,11 +46,4 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[viewController release];
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -72,43 +72,30 @@
|
||||
_textView.font= [UIFont fontWithName:@"Helvetica" size:11.0];
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[_testThread release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
}
|
||||
|
||||
- (IBAction) zipUnzip {
|
||||
if (_testThread)
|
||||
[_testThread release];
|
||||
|
||||
_testThread= [[NSThread alloc] initWithTarget:self selector:@selector(test1) object:nil];
|
||||
[_testThread start];
|
||||
}
|
||||
|
||||
- (IBAction) zipUnzip2 {
|
||||
if (_testThread)
|
||||
[_testThread release];
|
||||
|
||||
_testThread= [[NSThread alloc] initWithTarget:self selector:@selector(test2) object:nil];
|
||||
[_testThread start];
|
||||
}
|
||||
|
||||
- (IBAction) zipCheck1 {
|
||||
if (_testThread)
|
||||
[_testThread release];
|
||||
|
||||
_testThread= [[NSThread alloc] initWithTarget:self selector:@selector(test3) object:nil];
|
||||
[_testThread start];
|
||||
}
|
||||
|
||||
- (IBAction) zipCheck2 {
|
||||
if (_testThread)
|
||||
[_testThread release];
|
||||
|
||||
_testThread= [[NSThread alloc] initWithTarget:self selector:@selector(test4) object:nil];
|
||||
[_testThread start];
|
||||
@@ -119,134 +106,131 @@
|
||||
#pragma mark Test 1: zip & unzip
|
||||
|
||||
- (void) test1 {
|
||||
NSAutoreleasePool *pool= [[NSAutoreleasePool alloc] init];
|
||||
@autoreleasepool {
|
||||
|
||||
NSString *documentsDir= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
|
||||
NSString *filePath= [documentsDir stringByAppendingPathComponent:@"test.zip"];
|
||||
NSString *documentsDir= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
|
||||
NSString *filePath= [documentsDir stringByAppendingPathComponent:@"test.zip"];
|
||||
|
||||
@try {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
@try {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
|
||||
[self log:@"Test 1: opening zip file for writing..."];
|
||||
|
||||
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
|
||||
|
||||
[self log:@"Test 1: adding first file..."];
|
||||
|
||||
ZipWriteStream *stream1= [zipFile writeFileInZipWithName:@"abc.txt" fileDate:[NSDate dateWithTimeIntervalSinceNow:-86400.0] compressionLevel:ZipCompressionLevelBest];
|
||||
|
||||
[self log:@"Test 1: writing to first file's stream..."];
|
||||
|
||||
NSString *text= @"abc";
|
||||
[stream1 writeData:[text dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
[self log:@"Test 1: closing first file's stream..."];
|
||||
|
||||
[stream1 finishedWriting];
|
||||
|
||||
[self log:@"Test 1: adding second file..."];
|
||||
|
||||
NSString *file2name= @"x/y/z/xyz.txt";
|
||||
ZipWriteStream *stream2= [zipFile writeFileInZipWithName:file2name compressionLevel:ZipCompressionLevelNone];
|
||||
|
||||
[self log:@"Test 1: writing to second file's stream..."];
|
||||
|
||||
NSString *text2= @"XYZ";
|
||||
[stream2 writeData:[text2 dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
[self log:@"Test 1: closing second file's stream..."];
|
||||
|
||||
[stream2 finishedWriting];
|
||||
|
||||
[self log:@"Test 1: closing zip file..."];
|
||||
|
||||
[zipFile close];
|
||||
[zipFile release];
|
||||
|
||||
[self log:@"Test 1: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 1: reading file infos..."];
|
||||
|
||||
NSArray *infos= [unzipFile listFileInZipInfos];
|
||||
for (FileInZipInfo *info in infos)
|
||||
[self log:@"Test 1: - %@ %@ %d (%d)", info.name, info.date, info.size, info.level];
|
||||
|
||||
[self log:@"Test 1: opening first file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read1= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 1: reading from first file's stream..."];
|
||||
|
||||
NSMutableData *data1= [[[NSMutableData alloc] initWithLength:256] autorelease];
|
||||
int bytesRead1= [read1 readDataWithBuffer:data1];
|
||||
|
||||
BOOL ok= NO;
|
||||
if (bytesRead1 == 3) {
|
||||
NSString *fileText1= [[[NSString alloc] initWithBytes:[data1 bytes] length:bytesRead1 encoding:NSUTF8StringEncoding] autorelease];
|
||||
if ([fileText1 isEqualToString:@"abc"])
|
||||
ok= YES;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
[self log:@"Test 1: content of first file is OK"];
|
||||
else
|
||||
[self log:@"Test 1: content of first file is WRONG"];
|
||||
[self log:@"Test 1: opening zip file for writing..."];
|
||||
|
||||
[self log:@"Test 1: closing first file's stream..."];
|
||||
|
||||
[read1 finishedReading];
|
||||
|
||||
[self log:@"Test 1: opening second file..."];
|
||||
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
|
||||
|
||||
[unzipFile locateFileInZip:file2name];
|
||||
ZipReadStream *read2= [unzipFile readCurrentFileInZip];
|
||||
[self log:@"Test 1: adding first file..."];
|
||||
|
||||
ZipWriteStream *stream1= [zipFile writeFileInZipWithName:@"abc.txt" fileDate:[NSDate dateWithTimeIntervalSinceNow:-86400.0] compressionLevel:ZipCompressionLevelBest];
|
||||
|
||||
[self log:@"Test 1: reading from second file's stream..."];
|
||||
|
||||
NSMutableData *data2= [[[NSMutableData alloc] initWithLength:256] autorelease];
|
||||
int bytesRead2= [read2 readDataWithBuffer:data2];
|
||||
|
||||
ok= NO;
|
||||
if (bytesRead2 == 3) {
|
||||
NSString *fileText2= [[[NSString alloc] initWithBytes:[data2 bytes] length:bytesRead2 encoding:NSUTF8StringEncoding] autorelease];
|
||||
if ([fileText2 isEqualToString:@"XYZ"])
|
||||
ok= YES;
|
||||
[self log:@"Test 1: writing to first file's stream..."];
|
||||
|
||||
NSString *text= @"abc";
|
||||
[stream1 writeData:[text dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
[self log:@"Test 1: closing first file's stream..."];
|
||||
|
||||
[stream1 finishedWriting];
|
||||
|
||||
[self log:@"Test 1: adding second file..."];
|
||||
|
||||
NSString *file2name= @"x/y/z/xyz.txt";
|
||||
ZipWriteStream *stream2= [zipFile writeFileInZipWithName:file2name compressionLevel:ZipCompressionLevelNone];
|
||||
|
||||
[self log:@"Test 1: writing to second file's stream..."];
|
||||
|
||||
NSString *text2= @"XYZ";
|
||||
[stream2 writeData:[text2 dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
[self log:@"Test 1: closing second file's stream..."];
|
||||
|
||||
[stream2 finishedWriting];
|
||||
|
||||
[self log:@"Test 1: closing zip file..."];
|
||||
|
||||
[zipFile close];
|
||||
|
||||
[self log:@"Test 1: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 1: reading file infos..."];
|
||||
|
||||
NSArray *infos= [unzipFile listFileInZipInfos];
|
||||
for (FileInZipInfo *info in infos)
|
||||
[self log:@"Test 1: - %@ %@ %d (%d)", info.name, info.date, info.size, info.level];
|
||||
|
||||
[self log:@"Test 1: opening first file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read1= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 1: reading from first file's stream..."];
|
||||
|
||||
NSMutableData *data1= [[NSMutableData alloc] initWithLength:256];
|
||||
int bytesRead1= [read1 readDataWithBuffer:data1];
|
||||
|
||||
BOOL ok= NO;
|
||||
if (bytesRead1 == 3) {
|
||||
NSString *fileText1= [[NSString alloc] initWithBytes:[data1 bytes] length:bytesRead1 encoding:NSUTF8StringEncoding];
|
||||
if ([fileText1 isEqualToString:@"abc"])
|
||||
ok= YES;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
[self log:@"Test 1: content of first file is OK"];
|
||||
else
|
||||
[self log:@"Test 1: content of first file is WRONG"];
|
||||
|
||||
[self log:@"Test 1: closing first file's stream..."];
|
||||
|
||||
[read1 finishedReading];
|
||||
|
||||
[self log:@"Test 1: opening second file..."];
|
||||
|
||||
[unzipFile locateFileInZip:file2name];
|
||||
ZipReadStream *read2= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 1: reading from second file's stream..."];
|
||||
|
||||
NSMutableData *data2= [[NSMutableData alloc] initWithLength:256];
|
||||
int bytesRead2= [read2 readDataWithBuffer:data2];
|
||||
|
||||
ok= NO;
|
||||
if (bytesRead2 == 3) {
|
||||
NSString *fileText2= [[NSString alloc] initWithBytes:[data2 bytes] length:bytesRead2 encoding:NSUTF8StringEncoding];
|
||||
if ([fileText2 isEqualToString:@"XYZ"])
|
||||
ok= YES;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
[self log:@"Test 1: content of second file is OK"];
|
||||
else
|
||||
[self log:@"Test 1: content of second file is WRONG"];
|
||||
|
||||
[self log:@"Test 1: closing second file's stream..."];
|
||||
|
||||
[read2 finishedReading];
|
||||
|
||||
[self log:@"Test 1: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
|
||||
[self log:@"Test 1: test terminated succesfully"];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 1: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 1: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 1: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 1: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
|
||||
} @finally {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
}
|
||||
|
||||
if (ok)
|
||||
[self log:@"Test 1: content of second file is OK"];
|
||||
else
|
||||
[self log:@"Test 1: content of second file is WRONG"];
|
||||
|
||||
[self log:@"Test 1: closing second file's stream..."];
|
||||
|
||||
[read2 finishedReading];
|
||||
|
||||
[self log:@"Test 1: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
[unzipFile release];
|
||||
|
||||
[self log:@"Test 1: test terminated succesfully"];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 1: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 1: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 1: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 1: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
|
||||
} @finally {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
|
||||
@@ -254,104 +238,99 @@
|
||||
#pragma mark Test 2: zip & unzip 5 GB
|
||||
|
||||
- (void) test2 {
|
||||
NSAutoreleasePool *pool= [[NSAutoreleasePool alloc] init];
|
||||
@autoreleasepool {
|
||||
|
||||
NSString *documentsDir= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
|
||||
NSString *filePath= [documentsDir stringByAppendingPathComponent:@"huge_test.zip"];
|
||||
NSString *documentsDir= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
|
||||
NSString *filePath= [documentsDir stringByAppendingPathComponent:@"huge_test.zip"];
|
||||
|
||||
@try {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
@try {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
|
||||
[self log:@"Test 2: opening zip file for writing..."];
|
||||
|
||||
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
|
||||
|
||||
[self log:@"Test 2: adding file..."];
|
||||
|
||||
ZipWriteStream *stream= [zipFile writeFileInZipWithName:@"huge_file.txt" compressionLevel:ZipCompressionLevelBest];
|
||||
|
||||
[self log:@"Test 2: writing to file's stream..."];
|
||||
|
||||
NSMutableData *data= [[NSMutableData alloc] initWithLength:HUGE_TEST_BLOCK_LENGTH];
|
||||
SecRandomCopyBytes(kSecRandomDefault, [data length], [data mutableBytes]);
|
||||
|
||||
NSData *checkData= [data subdataWithRange:NSMakeRange(0, 100)];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:HUGE_TEST_BLOCK_LENGTH]; // For use later
|
||||
|
||||
for (int i= 0; i < HUGE_TEST_NUMBER_OF_BLOCKS; i++) {
|
||||
[stream writeData:data];
|
||||
[self log:@"Test 2: opening zip file for writing..."];
|
||||
|
||||
if (i % 100 == 0)
|
||||
[self log:@"Test 2: written %d KB...", ([data length] / 1024) * (i +1)];
|
||||
}
|
||||
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
|
||||
|
||||
[self log:@"Test 2: adding file..."];
|
||||
|
||||
ZipWriteStream *stream= [zipFile writeFileInZipWithName:@"huge_file.txt" compressionLevel:ZipCompressionLevelBest];
|
||||
|
||||
[self log:@"Test 2: writing to file's stream..."];
|
||||
|
||||
NSMutableData *data= [[NSMutableData alloc] initWithLength:HUGE_TEST_BLOCK_LENGTH];
|
||||
SecRandomCopyBytes(kSecRandomDefault, [data length], [data mutableBytes]);
|
||||
|
||||
NSData *checkData= [data subdataWithRange:NSMakeRange(0, 100)];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:HUGE_TEST_BLOCK_LENGTH]; // For use later
|
||||
|
||||
for (int i= 0; i < HUGE_TEST_NUMBER_OF_BLOCKS; i++) {
|
||||
[stream writeData:data];
|
||||
|
||||
[self log:@"Test 2: closing file's stream..."];
|
||||
|
||||
[stream finishedWriting];
|
||||
|
||||
[self log:@"Test 2: closing zip file..."];
|
||||
|
||||
[zipFile close];
|
||||
[zipFile release];
|
||||
|
||||
[self log:@"Test 2: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 2: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 2: reading from file's stream..."];
|
||||
|
||||
for (int i= 0; i < HUGE_TEST_NUMBER_OF_BLOCKS; i++) {
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
if (i % 100 == 0)
|
||||
[self log:@"Test 2: written %d KB...", ([data length] / 1024) * (i +1)];
|
||||
}
|
||||
|
||||
[self log:@"Test 2: closing file's stream..."];
|
||||
|
||||
BOOL ok= NO;
|
||||
if (bytesRead == [data length]) {
|
||||
NSRange range= [buffer rangeOfData:checkData options:0 range:NSMakeRange(0, [buffer length])];
|
||||
if (range.location == 0)
|
||||
ok= YES;
|
||||
[stream finishedWriting];
|
||||
|
||||
[self log:@"Test 2: closing zip file..."];
|
||||
|
||||
[zipFile close];
|
||||
|
||||
[self log:@"Test 2: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 2: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 2: reading from file's stream..."];
|
||||
|
||||
for (int i= 0; i < HUGE_TEST_NUMBER_OF_BLOCKS; i++) {
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
|
||||
BOOL ok= NO;
|
||||
if (bytesRead == [data length]) {
|
||||
NSRange range= [buffer rangeOfData:checkData options:0 range:NSMakeRange(0, [buffer length])];
|
||||
if (range.location == 0)
|
||||
ok= YES;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
[self log:@"Test 2: content of file is WRONG at position %d KB", ([buffer length] / 1024) * i];
|
||||
|
||||
if (i % 100 == 0)
|
||||
[self log:@"Test 2: read %d KB...", ([buffer length] / 1024) * (i +1)];
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
[self log:@"Test 2: content of file is WRONG at position %d KB", ([buffer length] / 1024) * i];
|
||||
[self log:@"Test 2: closing file's stream..."];
|
||||
|
||||
if (i % 100 == 0)
|
||||
[self log:@"Test 2: read %d KB...", ([buffer length] / 1024) * (i +1)];
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 2: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
|
||||
[self log:@"Test 2: test terminated succesfully"];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 2: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 2: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 2: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 2: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
|
||||
} @finally {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
}
|
||||
|
||||
[self log:@"Test 2: closing file's stream..."];
|
||||
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 2: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
[unzipFile release];
|
||||
|
||||
[self log:@"Test 2: test terminated succesfully"];
|
||||
|
||||
[data release];
|
||||
[buffer release];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 2: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 2: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 2: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 2: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
|
||||
} @finally {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:NULL];
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
|
||||
@@ -359,58 +338,53 @@
|
||||
#pragma mark Test 3: unzip & check Mac zip file
|
||||
|
||||
- (void) test3 {
|
||||
NSAutoreleasePool *pool= [[NSAutoreleasePool alloc] init];
|
||||
@autoreleasepool {
|
||||
|
||||
NSString *filePath= [[NSBundle mainBundle] pathForResource:@"mac_test_file" ofType:@"zip"];
|
||||
|
||||
@try {
|
||||
[self log:@"Test 3: opening zip file for reading..."];
|
||||
NSString *filePath= [[NSBundle mainBundle] pathForResource:@"mac_test_file" ofType:@"zip"];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 3: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 3: reading from file's stream..."];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:1024];
|
||||
@try {
|
||||
[self log:@"Test 3: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 3: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 3: reading from file's stream..."];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:1024];
|
||||
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
|
||||
NSString *fileText= [[[NSString alloc] initWithBytes:[buffer bytes] length:bytesRead encoding:NSUTF8StringEncoding] autorelease];
|
||||
if ([fileText isEqualToString:@"Objective-Zip Mac test file\n"])
|
||||
[self log:@"Test 3: content of Mac file is OK"];
|
||||
else
|
||||
[self log:@"Test 3: content of Mac file is WRONG"];
|
||||
|
||||
[self log:@"Test 3: closing file's stream..."];
|
||||
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 3: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
[unzipFile release];
|
||||
|
||||
[self log:@"Test 3: test terminated succesfully"];
|
||||
|
||||
[buffer release];
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
|
||||
NSString *fileText= [[NSString alloc] initWithBytes:[buffer bytes] length:bytesRead encoding:NSUTF8StringEncoding];
|
||||
if ([fileText isEqualToString:@"Objective-Zip Mac test file\n"])
|
||||
[self log:@"Test 3: content of Mac file is OK"];
|
||||
else
|
||||
[self log:@"Test 3: content of Mac file is WRONG"];
|
||||
|
||||
[self log:@"Test 3: closing file's stream..."];
|
||||
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 3: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
|
||||
[self log:@"Test 3: test terminated succesfully"];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 3: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 3: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 3: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 3: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 3: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 3: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 3: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 3: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
}
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
|
||||
@@ -418,57 +392,53 @@
|
||||
#pragma mark Test 4: unzip & check Win zip file
|
||||
|
||||
- (void) test4 {
|
||||
NSAutoreleasePool *pool= [[NSAutoreleasePool alloc] init];
|
||||
@autoreleasepool {
|
||||
|
||||
NSString *filePath= [[NSBundle mainBundle] pathForResource:@"win_test_file" ofType:@"zip"];
|
||||
|
||||
@try {
|
||||
[self log:@"Test 4: opening zip file for reading..."];
|
||||
NSString *filePath= [[NSBundle mainBundle] pathForResource:@"win_test_file" ofType:@"zip"];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 4: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 4: reading from file's stream..."];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:1024];
|
||||
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
|
||||
NSString *fileText= [[[NSString alloc] initWithBytes:[buffer bytes] length:bytesRead encoding:NSUTF8StringEncoding] autorelease];
|
||||
if ([fileText isEqualToString:@"Objective-Zip Windows test file\r\n"])
|
||||
[self log:@"Test 4: content of Win file is OK"];
|
||||
else
|
||||
[self log:@"Test 4: content of Win file is WRONG"];
|
||||
|
||||
[self log:@"Test 4: closing file's stream..."];
|
||||
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 4: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
[unzipFile release];
|
||||
|
||||
[self log:@"Test 4: test terminated succesfully"];
|
||||
|
||||
[buffer release];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 4: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 4: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 4: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 4: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
@try {
|
||||
[self log:@"Test 4: opening zip file for reading..."];
|
||||
|
||||
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
|
||||
|
||||
[self log:@"Test 4: opening file..."];
|
||||
|
||||
[unzipFile goToFirstFileInZip];
|
||||
ZipReadStream *read= [unzipFile readCurrentFileInZip];
|
||||
|
||||
[self log:@"Test 4: reading from file's stream..."];
|
||||
|
||||
NSMutableData *buffer= [[NSMutableData alloc] initWithLength:1024];
|
||||
|
||||
int bytesRead= [read readDataWithBuffer:buffer];
|
||||
|
||||
NSString *fileText= [[NSString alloc] initWithBytes:[buffer bytes] length:bytesRead encoding:NSUTF8StringEncoding];
|
||||
if ([fileText isEqualToString:@"Objective-Zip Windows test file\r\n"])
|
||||
[self log:@"Test 4: content of Win file is OK"];
|
||||
else
|
||||
[self log:@"Test 4: content of Win file is WRONG"];
|
||||
|
||||
[self log:@"Test 4: closing file's stream..."];
|
||||
|
||||
[read finishedReading];
|
||||
|
||||
[self log:@"Test 4: closing zip file..."];
|
||||
|
||||
[unzipFile close];
|
||||
|
||||
[self log:@"Test 4: test terminated succesfully"];
|
||||
|
||||
} @catch (ZipException *ze) {
|
||||
[self log:@"Test 4: caught a ZipException (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 4: ZipException caught: %d - %@", ze.error, [ze reason]);
|
||||
|
||||
} @catch (id e) {
|
||||
[self log:@"Test 4: caught a generic exception (see logs), terminating..."];
|
||||
|
||||
NSLog(@"Test 4: Exception caught: %@ - %@", [[e class] description], [e description]);
|
||||
}
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
|
||||
@@ -485,7 +455,6 @@
|
||||
|
||||
[self performSelectorOnMainThread:@selector(printLog:) withObject:logLine waitUntilDone:YES];
|
||||
|
||||
[logLine release];
|
||||
}
|
||||
|
||||
- (void) printLog:(NSString *)logLine {
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
8C83F49410E7CBCB002FB3CB /* FileInZipInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileInZipInfo.m; path = "Objective-Zip/FileInZipInfo.m"; sourceTree = "<group>"; };
|
||||
8C8F2D3910EBC94B00F75833 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
|
||||
8C8F2D9210EBCE0300F75833 /* ObjectiveZipIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ObjectiveZipIcon.png; sourceTree = "<group>"; };
|
||||
8C9893AF16E5511500E1190A /* ARCHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARCHelper.h; sourceTree = "<group>"; };
|
||||
8CBE431610E95FA300AC9ED3 /* ZipReadStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipReadStream.h; path = "Objective-Zip/ZipReadStream.h"; sourceTree = "<group>"; };
|
||||
8CBE431710E95FA300AC9ED3 /* ZipReadStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipReadStream.m; path = "Objective-Zip/ZipReadStream.m"; sourceTree = "<group>"; };
|
||||
8CD8B3E917766067005212EC /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = adler32.c; path = ZLib/adler32.c; sourceTree = "<group>"; };
|
||||
@@ -154,7 +153,6 @@
|
||||
8C6D353B10E56BA400B63EFA /* Objective-Zip */,
|
||||
8C6D350110E56A4B00B63EFA /* MiniZip */,
|
||||
8CD8B3E817766056005212EC /* ZLib */,
|
||||
8C9893AE16E550E600E1190A /* ARC Helper */,
|
||||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
@@ -231,15 +229,6 @@
|
||||
name = "Objective-Zip";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8C9893AE16E550E600E1190A /* ARC Helper */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8C9893AF16E5511500E1190A /* ARCHelper.h */,
|
||||
);
|
||||
name = "ARC Helper";
|
||||
path = ARCHelper;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8CD8B3E817766056005212EC /* ZLib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -299,7 +288,7 @@
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
LastUpgradeCheck = 0640;
|
||||
};
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Objective-Zip" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -379,6 +368,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
@@ -388,6 +378,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_THUMB_SUPPORT = NO;
|
||||
INFOPLIST_FILE = "Objective_Zip-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
PRODUCT_NAME = "Objective-Zip";
|
||||
PROVISIONING_PROFILE = "8D9AD182-36E0-47FE-AB6B-E87632E60994";
|
||||
};
|
||||
@@ -397,6 +388,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
@@ -404,6 +396,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_THUMB_SUPPORT = NO;
|
||||
INFOPLIST_FILE = "Objective_Zip-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
PRODUCT_NAME = "Objective-Zip";
|
||||
PROVISIONING_PROFILE = "8D9AD182-36E0-47FE-AB6B-E87632E60994";
|
||||
};
|
||||
@@ -412,10 +405,6 @@
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
armv6,
|
||||
);
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
@@ -423,6 +412,7 @@
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 3.1.2;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PROVISIONING_PROFILE = "8D9AD182-36E0-47FE-AB6B-E87632E60994";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "8D920AE2-DF44-48C7-A9B5-0AB3D42590BB";
|
||||
SDKROOT = iphoneos;
|
||||
@@ -432,10 +422,6 @@
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
armv6,
|
||||
);
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Gianluca Bertani (42HXKD6D45)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "ZipFile.h"
|
||||
#import "ARCHelper.h"
|
||||
|
||||
|
||||
@interface FileInZipInfo : NSObject {
|
||||
|
||||
@@ -38,24 +38,18 @@
|
||||
|
||||
- (id) initWithName:(NSString *)name length:(NSUInteger)length level:(ZipCompressionLevel)level crypted:(BOOL)crypted size:(NSUInteger)size date:(NSDate *)date crc32:(NSUInteger)crc32 {
|
||||
if (self= [super init]) {
|
||||
_name= [name ah_retain];
|
||||
_name= name;
|
||||
_length= length;
|
||||
_level= level;
|
||||
_crypted= crypted;
|
||||
_size= size;
|
||||
_date= [date ah_retain];
|
||||
_date= date;
|
||||
_crc32= crc32;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[_date release];
|
||||
[_name release];
|
||||
|
||||
[super ah_dealloc];
|
||||
}
|
||||
|
||||
@synthesize name= _name;
|
||||
@synthesize length= _length;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ARCHelper.h"
|
||||
|
||||
|
||||
@interface ZipException : NSException {
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ARCHelper.h"
|
||||
|
||||
#include "zip.h"
|
||||
#include "unzip.h"
|
||||
|
||||
+40
-45
@@ -45,7 +45,7 @@
|
||||
|
||||
- (id) initWithFileName:(NSString *)fileName mode:(ZipFileMode)mode {
|
||||
if (self= [super init]) {
|
||||
_fileName= [fileName ah_retain];
|
||||
_fileName= fileName;
|
||||
_mode= mode;
|
||||
|
||||
switch (mode) {
|
||||
@@ -53,7 +53,7 @@
|
||||
_unzFile= unzOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
if (_unzFile == NULL) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
_zipFile= zipOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_CREATE);
|
||||
if (_zipFile == NULL) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -69,13 +69,13 @@
|
||||
_zipFile= zipOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_ADDINZIP);
|
||||
if (_zipFile == NULL) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
NSString *reason= [NSString stringWithFormat:@"Unknown mode %d", _mode];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,16 +83,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[_fileName release];
|
||||
|
||||
[super ah_dealloc];
|
||||
}
|
||||
|
||||
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip compressionLevel:(ZipCompressionLevel)compressionLevel {
|
||||
if (_mode == ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
NSDate *now= [NSDate date];
|
||||
@@ -120,16 +115,16 @@
|
||||
NULL, 0, 1);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return [[[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip] autorelease];
|
||||
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
|
||||
}
|
||||
|
||||
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel {
|
||||
if (_mode == ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
NSCalendar *calendar= [NSCalendar currentCalendar];
|
||||
@@ -156,16 +151,16 @@
|
||||
NULL, 0, 1);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return [[[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip] autorelease];
|
||||
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
|
||||
}
|
||||
|
||||
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel password:(NSString *)password crc32:(NSUInteger)crc32 {
|
||||
if (_mode == ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
NSCalendar *calendar= [NSCalendar currentCalendar];
|
||||
@@ -192,10 +187,10 @@
|
||||
[password cStringUsingEncoding:NSUTF8StringEncoding], crc32, 1);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return [[[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip] autorelease];
|
||||
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
|
||||
}
|
||||
|
||||
- (NSString*) fileName {
|
||||
@@ -205,14 +200,14 @@
|
||||
- (NSUInteger) numFilesInZip {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
unz_global_info64 gi;
|
||||
int err= unzGetGlobalInfo64(_unzFile, &gi);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error getting global info in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return gi.number_entry;
|
||||
@@ -221,9 +216,9 @@
|
||||
- (NSArray *) listFileInZipInfos {
|
||||
int num= [self numFilesInZip];
|
||||
if (num < 1)
|
||||
return [[[NSArray alloc] init] autorelease];
|
||||
return [[NSArray alloc] init];
|
||||
|
||||
NSMutableArray *files= [[[NSMutableArray alloc] initWithCapacity:num] autorelease];
|
||||
NSMutableArray *files= [[NSMutableArray alloc] initWithCapacity:num];
|
||||
|
||||
[self goToFirstFileInZip];
|
||||
for (int i= 0; i < num; i++) {
|
||||
@@ -240,20 +235,20 @@
|
||||
- (void) goToFirstFileInZip {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
int err= unzGoToFirstFile(_unzFile);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error going to first file in zip in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) goToNextFileInZip {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
int err= unzGoToNextFile(_unzFile);
|
||||
@@ -262,7 +257,7 @@
|
||||
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error going to next file in zip in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return YES;
|
||||
@@ -271,7 +266,7 @@
|
||||
- (BOOL) locateFileInZip:(NSString *)fileNameInZip {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
int err= unzLocateFile(_unzFile, [fileNameInZip cStringUsingEncoding:NSUTF8StringEncoding], NULL);
|
||||
@@ -280,7 +275,7 @@
|
||||
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error localting file in zip in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return YES;
|
||||
@@ -289,7 +284,7 @@
|
||||
- (FileInZipInfo *) getCurrentFileInZipInfo {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
|
||||
@@ -298,7 +293,7 @@
|
||||
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
NSString *name= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
|
||||
@@ -322,7 +317,7 @@
|
||||
|
||||
BOOL crypted= ((file_info.flag & 1) != 0);
|
||||
|
||||
NSDateComponents *components= [[[NSDateComponents alloc] init] autorelease];
|
||||
NSDateComponents *components= [[NSDateComponents alloc] init];
|
||||
[components setDay:file_info.tmu_date.tm_mday];
|
||||
[components setMonth:file_info.tmu_date.tm_mon +1];
|
||||
[components setYear:file_info.tmu_date.tm_year];
|
||||
@@ -333,13 +328,13 @@
|
||||
NSDate *date= [calendar dateFromComponents:components];
|
||||
|
||||
FileInZipInfo *info= [[FileInZipInfo alloc] initWithName:name length:file_info.uncompressed_size level:level crypted:crypted size:file_info.compressed_size date:date crc32:file_info.crc];
|
||||
return [info autorelease];
|
||||
return info;
|
||||
}
|
||||
|
||||
- (ZipReadStream *) readCurrentFileInZip {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
|
||||
@@ -348,7 +343,7 @@
|
||||
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
NSString *fileNameInZip= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
|
||||
@@ -356,16 +351,16 @@
|
||||
err= unzOpenCurrentFilePassword(_unzFile, NULL);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error opening current file in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return [[[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip] autorelease];
|
||||
return [[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
|
||||
}
|
||||
|
||||
- (ZipReadStream *) readCurrentFileInZipWithPassword:(NSString *)password {
|
||||
if (_mode != ZipFileModeUnzip) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
|
||||
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
|
||||
@@ -374,7 +369,7 @@
|
||||
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
NSString *fileNameInZip= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
|
||||
@@ -382,10 +377,10 @@
|
||||
err= unzOpenCurrentFilePassword(_unzFile, [password cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error opening current file in '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return [[[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip] autorelease];
|
||||
return [[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
|
||||
}
|
||||
|
||||
- (void) close {
|
||||
@@ -394,7 +389,7 @@
|
||||
int err= unzClose(_unzFile);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -403,7 +398,7 @@
|
||||
int err= zipClose(_zipFile, NULL);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -412,14 +407,14 @@
|
||||
int err= zipClose(_zipFile, NULL);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
NSString *reason= [NSString stringWithFormat:@"Unknown mode %d", _mode];
|
||||
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithReason:reason];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ARCHelper.h"
|
||||
|
||||
#include "unzip.h"
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
int err= unzReadCurrentFile(_unzFile, [buffer mutableBytes], [buffer length]);
|
||||
if (err < 0) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error reading '%@' in the zipfile", _fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -63,7 +63,7 @@
|
||||
int err= unzCloseCurrentFile(_unzFile);
|
||||
if (err != UNZ_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error closing '%@' in the zipfile", _fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ARCHelper.h"
|
||||
|
||||
#include "zip.h"
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
int err= zipWriteInFileInZip(_zipFile, [data bytes], [data length]);
|
||||
if (err < 0) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error writing '%@' in the zipfile", _fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
int err= zipCloseFileInZip(_zipFile);
|
||||
if (err != ZIP_OK) {
|
||||
NSString *reason= [NSString stringWithFormat:@"Error closing '%@' in the zipfile", _fileNameInZip];
|
||||
@throw [[[ZipException alloc] initWithError:err reason:reason] autorelease];
|
||||
@throw [[ZipException alloc] initWithError:err reason:reason];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+195
-182
@@ -1,33 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1552</int>
|
||||
<string key="IBDocument.SystemVersion">12E55</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.39</string>
|
||||
<string key="IBDocument.HIToolboxVersion">626.00</string>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">14F27</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">7706</string>
|
||||
<string key="IBDocument.AppKitVersion">1348.17</string>
|
||||
<string key="IBDocument.HIToolboxVersion">758.70</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">2083</string>
|
||||
<string key="NS.object.0">7703</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUITextView</string>
|
||||
<string>IBUIView</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
@@ -39,25 +35,7 @@
|
||||
<object class="IBUIView" id="774585933">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIImageView" id="296619241">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{0, -20}, {320, 480}}</string>
|
||||
<reference key="NSSuperview" ref="774585933"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="422324197"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<int key="IBUIContentMode">4</int>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">Default.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIButton" id="422324197">
|
||||
<reference key="NSNextResponder" ref="774585933"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
@@ -71,15 +49,15 @@
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Zip & Unzip</string>
|
||||
<object class="NSColor" key="IBUINormalTitleColor" id="803445480">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUIHighlightedTitleColor" id="884333554">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
|
||||
</object>
|
||||
<string key="IBUINormalTitle">Zip & Unzip</string>
|
||||
<object class="NSColor" key="IBUINormalTitleShadowColor" id="114389561">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
@@ -109,12 +87,9 @@
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">5 GB Zip & Unzip (use with caution)</string>
|
||||
<reference key="IBUINormalTitleColor" ref="803445480"/>
|
||||
<reference key="IBUIHighlightedTitleColor" ref="884333554"/>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
|
||||
</object>
|
||||
<string key="IBUINormalTitle">5 GB Zip & Unzip (use with caution)</string>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="114389561"/>
|
||||
<reference key="IBUIFontDescription" ref="975473552"/>
|
||||
<reference key="IBUIFont" ref="64712977"/>
|
||||
@@ -132,12 +107,9 @@
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Unzip & Check Mac OS X Zip File</string>
|
||||
<reference key="IBUINormalTitleColor" ref="803445480"/>
|
||||
<reference key="IBUIHighlightedTitleColor" ref="884333554"/>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
|
||||
</object>
|
||||
<string key="IBUINormalTitle">Unzip & Check Mac OS X Zip File</string>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="114389561"/>
|
||||
<reference key="IBUIFontDescription" ref="975473552"/>
|
||||
<reference key="IBUIFont" ref="64712977"/>
|
||||
@@ -155,12 +127,9 @@
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Unzip & Check Windows Zip File</string>
|
||||
<reference key="IBUINormalTitleColor" ref="803445480"/>
|
||||
<reference key="IBUIHighlightedTitleColor" ref="884333554"/>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
|
||||
</object>
|
||||
<string key="IBUINormalTitle">Unzip & Check Windows Zip File</string>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="114389561"/>
|
||||
<reference key="IBUIFontDescription" ref="975473552"/>
|
||||
<reference key="IBUIFont" ref="64712977"/>
|
||||
@@ -202,34 +171,31 @@
|
||||
</object>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<int key="weightCategory">0</int>
|
||||
<double key="pointSize">17</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<string key="NSName">HelveticaNeue</string>
|
||||
<double key="NSSize">17</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="296619241"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC43NQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedSizeMetrics" key="IBUISimulatedDestinationMetrics">
|
||||
<string key="IBUISimulatedSizeMetricsClass">IBUISimulatedFreeformSizeMetricsSentinel</string>
|
||||
<string key="IBUIDisplayName">Freeform</string>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
@@ -282,15 +248,12 @@
|
||||
</object>
|
||||
<int key="connectionID">23</int>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
@@ -308,16 +271,14 @@
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="774585933"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="422324197"/>
|
||||
<reference ref="261814878"/>
|
||||
<reference ref="718446055"/>
|
||||
<reference ref="296619241"/>
|
||||
<reference ref="690801101"/>
|
||||
<reference ref="1005186811"/>
|
||||
<reference ref="68194376"/>
|
||||
</object>
|
||||
</array>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
@@ -328,9 +289,7 @@
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="261814878"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="children"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
@@ -338,11 +297,6 @@
|
||||
<reference key="object" ref="718446055"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">13</int>
|
||||
<reference key="object" ref="296619241"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">15</int>
|
||||
<reference key="object" ref="690801101"/>
|
||||
@@ -358,107 +312,57 @@
|
||||
<reference key="object" ref="68194376"/>
|
||||
<reference key="parent" ref="774585933"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.CustomClassName</string>
|
||||
<string>-1.IBPluginDependency</string>
|
||||
<string>-2.CustomClassName</string>
|
||||
<string>-2.IBPluginDependency</string>
|
||||
<string>10.IBPluginDependency</string>
|
||||
<string>13.IBPluginDependency</string>
|
||||
<string>15.IBPluginDependency</string>
|
||||
<string>18.IBPluginDependency</string>
|
||||
<string>19.IBPluginDependency</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
<string>9.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>Objective_ZipViewController</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>UIResponder</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">Objective_ZipViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<reference key="6.IBNSViewMetadataGestureRecognizers" ref="0"/>
|
||||
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">23</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">Objective_ZipViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>zipCheck1</string>
|
||||
<string>zipCheck2</string>
|
||||
<string>zipUnzip</string>
|
||||
<string>zipUnzip2</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="zipCheck1">id</string>
|
||||
<string key="zipCheck2">id</string>
|
||||
<string key="zipUnzip">id</string>
|
||||
<string key="zipUnzip2">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="zipCheck1">
|
||||
<string key="name">zipCheck1</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<object class="IBActionInfo" key="zipCheck2">
|
||||
<string key="name">zipCheck2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>zipCheck1</string>
|
||||
<string>zipCheck2</string>
|
||||
<string>zipUnzip</string>
|
||||
<string>zipUnzip2</string>
|
||||
<object class="IBActionInfo" key="zipUnzip">
|
||||
<string key="name">zipUnzip</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">zipCheck1</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">zipCheck2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">zipUnzip</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">zipUnzip2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="zipUnzip2">
|
||||
<string key="name">zipUnzip2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">_textView</string>
|
||||
<string key="NS.object.0">UITextView</string>
|
||||
@@ -472,23 +376,132 @@
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/Objective_ZipViewController.h</string>
|
||||
<string key="minorKey">../Classes/Objective_ZipViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">Objective_ZipViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="zipCheck1">id</string>
|
||||
<string key="zipCheck2">id</string>
|
||||
<string key="zipUnzip">id</string>
|
||||
<string key="zipUnzip2">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="zipCheck1">
|
||||
<string key="name">zipCheck1</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="zipCheck2">
|
||||
<string key="name">zipCheck2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="zipUnzip">
|
||||
<string key="name">zipUnzip</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="zipUnzip2">
|
||||
<string key="name">zipUnzip2</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">../Classes/Objective_ZipViewController.m</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIButton</string>
|
||||
<string key="superclassName">UIControl</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIButton.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIControl</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIGestureRecognizer</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIGestureRecognizer.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIResponder</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIScrollView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchBar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchDisplayController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UITextView</string>
|
||||
<string key="superclassName">UIScrollView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">NO</bool>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3100" key="NS.object.0"/>
|
||||
<integer value="4600" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="NS.key.0">Default.png</string>
|
||||
<string key="NS.object.0">{320, 480}</string>
|
||||
</object>
|
||||
<string key="IBCocoaTouchPluginVersion">2083</string>
|
||||
</data>
|
||||
</archive>
|
||||
|
||||
@@ -34,9 +34,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, nil);
|
||||
[pool release];
|
||||
return retVal;
|
||||
@autoreleasepool {
|
||||
int retVal = UIApplicationMain(argc, argv, nil, nil);
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user