42#import "MyOpenGLView.h"
51static NSString *
const kOOOXZDataURL =
@"http://addons.oolite.space/api/1.0/overview";
118NSComparisonResult
oxzSort(
id m1,
id m2,
void *context);
123#if OOLITE_MAC_OS_X_10_7
124@interface OOOXZManager (OOPrivate) <NSURLConnectionDataDelegate>
126@interface OOOXZManager (NSURLConnectionDataDelegate)
129- (NSString *) manifestPath;
130- (NSString *) downloadPath;
131- (NSString *) extractionBasePathForIdentifier:(NSString *)identifier andVersion:(NSString *)version;
132- (NSString *) dataURL;
133- (NSString *) humanSize:(NSUInteger)bytes;
135- (BOOL) ensureInstallPath;
137- (BOOL) beginDownload:(NSMutableURLRequest *)request;
138- (BOOL) processDownloadedManifests;
139- (BOOL) processDownloadedOXZ;
142- (
OOColor *) colorForManifest:(NSDictionary *)manifest;
143- (NSString *) installStatusForManifest:(NSDictionary *)manifest;
145- (BOOL) validateFilter:(NSString *)input;
147- (void) setOXZList:(NSArray *)list;
148- (void) setFilteredList:(NSArray *)list;
149- (NSArray *) applyCurrentFilter:(NSArray *)list;
151- (void) setCurrentDownload:(NSURLConnection *)download withLabel:(NSString *)label;
152- (void) setProgressStatus:(NSString *)newStatus;
154- (BOOL) installOXZ:(NSUInteger)item;
155- (BOOL) updateAllOXZ;
156- (BOOL) removeOXZ:(NSUInteger)item;
157- (NSArray *) installOptions;
158- (NSArray *) removeOptions;
160- (NSString *) extractOXZ:(NSUInteger)item;
163- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
164- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
165- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
166- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
170@interface OOOXZManager (OOFilterRules)
171- (BOOL) applyFilterByNoFilter:(NSDictionary *)manifest;
172- (BOOL) applyFilterByUpdateRequired:(NSDictionary *)manifest;
173- (BOOL) applyFilterByInstallable:(NSDictionary *)manifest;
174- (BOOL) applyFilterByKeyword:(NSDictionary *)manifest keyword:(NSString *)keyword;
175- (BOOL) applyFilterByAuthor:(NSDictionary *)manifest author:(NSString *)author;
176- (BOOL) applyFilterByDays:(NSDictionary *)manifest days:(NSString *)days;
177- (BOOL) applyFilterByTag:(NSDictionary *)manifest tag:(NSString *)tag;
178- (BOOL) applyFilterByCategory:(NSDictionary *)manifest category:(NSString *)category;
201 [
self setOXZList:OOArrayFromFile([
self manifestPath])];
204 _currentFilter =
@"*";
206 _interfaceShowingOXZDetail = NO;
208 _downloadAllDependencies = NO;
209 _dependencyStack = [[NSMutableSet alloc] initWithCapacity:8];
210 [
self setProgressStatus:@""];
220 [
self setCurrentDownload:nil withLabel:nil];
232- (NSString *) installPath
234 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,NSUserDomainMask,YES);
235 NSString *appPath = [paths objectAtIndex:0];
238 appPath = [appPath stringByAppendingPathComponent:@"Oolite"];
240 appPath = [appPath stringByAppendingPathComponent:@"Managed AddOns"];
245 appPath = [appPath stringByAppendingPathComponent:@"ManagedAddOns"];
253- (NSString *) extractionBasePathForIdentifier:(NSString *)identifier andVersion:(NSString *)version
256 NSString *rawMainDir = [NSString stringWithFormat:@"%@-%@.off",identifier,version];
258 NSCharacterSet *blacklist = [NSCharacterSet characterSetWithCharactersInString:@"'#%^&{}[]/~|\\?<,:\" "];
259 return [[[basePath stringByAppendingPathComponent:[[rawMainDir componentsSeparatedByCharactersInSet:blacklist] componentsJoinedByString:@""]] retain] autorelease];
263- (BOOL) ensureInstallPath
265 BOOL exists, directory;
266 NSFileManager *fmgr = [NSFileManager defaultManager];
267 NSString *path = [
self installPath];
269 exists = [fmgr fileExistsAtPath:path isDirectory:&directory];
271 if (exists && !directory)
278 if (![fmgr oo_createDirectoryAtPath:path attributes:
nil])
289- (NSString *) manifestPath
298- (NSString *) downloadPath
311- (NSString *) dataURL
314 NSString *url = [[NSUserDefaults standardUserDefaults] stringForKey:kOOOXZDataConfig];
323- (NSString *) humanSize:(NSUInteger)bytes
327 return DESC(
@"oolite-oxzmanager-missing-field");
329 else if (bytes < 1024)
333 else if (bytes < 1024*1024)
335 return [NSString stringWithFormat:@"%lu kB",bytes>>10];
339 return [NSString stringWithFormat:@"%.2f MB",((float)(bytes>>10))/1024];
344- (void) setOXZList:(NSArray *)list
349 _oxzList = [[list sortedArrayUsingFunction:oxzSort context:NULL] retain];
356- (void) setFilteredList:(NSArray *)list
359 _filteredList = [list copy];
363- (void) setFilter:(NSString *)filter
366 _currentFilter = [[filter lowercaseString] copy];
370- (NSArray *) applyCurrentFilter:(NSArray *)list
372 SEL filterSelector =
@selector(applyFilterByNoFilter:);
373 NSString *parameter =
nil;
376 filterSelector =
@selector(applyFilterByUpdateRequired:);
380 filterSelector =
@selector(applyFilterByInstallable:);
384 filterSelector =
@selector(applyFilterByKeyword:keyword:);
385 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterKeyword length]];
389 filterSelector =
@selector(applyFilterByAuthor:author:);
390 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterAuthor length]];
394 filterSelector =
@selector(applyFilterByDays:days:);
395 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterDays length]];
399 filterSelector =
@selector(applyFilterByTag:tag:);
400 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterTag length]];
404 filterSelector =
@selector(applyFilterByCategory:category:);
405 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterCategory length]];
408 NSMutableArray *filteredList = [NSMutableArray arrayWithCapacity:[list count]];
409 NSDictionary *manifest =
nil;
410 NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[
self class] instanceMethodSignatureForSelector:filterSelector]];
411 [invocation setSelector:filterSelector];
412 [invocation setTarget:self];
413 if (parameter !=
nil)
415 [invocation setArgument:¶meter atIndex:3];
418 foreach(manifest, list)
420 [invocation setArgument:&manifest atIndex:2];
422 BOOL filterAccepted = NO;
423 [invocation getReturnValue:&filterAccepted];
426 [filteredList addObject:manifest];
431 return [[filteredList copy] autorelease];
436- (BOOL) applyFilterByNoFilter:(NSDictionary *)manifest
442- (BOOL) applyFilterByUpdateRequired:(NSDictionary *)manifest
448- (BOOL) applyFilterByInstallable:(NSDictionary *)manifest
454- (BOOL) applyFilterByKeyword:(NSDictionary *)manifest keyword:(NSString *)keyword
456 NSString *parameter =
nil;
457 NSArray *parameters = [NSArray arrayWithObjects:kOOManifestTitle,kOOManifestDescription,kOOManifestCategory,nil];
460 keyword = [keyword stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
462 foreach (parameter,parameters)
464 if ([[manifest oo_stringForKey:parameter] rangeOfString:keyword options:NSCaseInsensitiveSearch].location != NSNotFound)
470 parameters = [manifest oo_arrayForKey:kOOManifestTags];
471 foreach (parameter,parameters)
473 if ([parameter rangeOfString:keyword options:NSCaseInsensitiveSearch].location != NSNotFound)
483- (BOOL) applyFilterByAuthor:(NSDictionary *)manifest author:(NSString *)author
486 author = [author stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
488 NSString *mAuth = [manifest oo_stringForKey:kOOManifestAuthor];
489 return ([mAuth rangeOfString:author options:NSCaseInsensitiveSearch].location != NSNotFound);
493- (BOOL) applyFilterByDays:(NSDictionary *)manifest days:(NSString *)days
495 NSInteger i = [days integerValue];
502 NSUInteger updated = [manifest oo_unsignedIntegerForKey:kOOManifestUploadDate];
503 NSUInteger now = (NSUInteger)[[NSDate date] timeIntervalSince1970];
504 return (updated + (86400 * i) > now);
509- (BOOL) applyFilterByTag:(NSDictionary *)manifest tag:(NSString *)tag
511 NSString *parameter =
nil;
512 NSArray *parameters = [manifest oo_arrayForKey:kOOManifestTags];
515 tag = [tag stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
517 foreach (parameter,parameters)
519 if ([parameter rangeOfString:tag options:NSCaseInsensitiveSearch].location != NSNotFound)
529- (BOOL) applyFilterByCategory:(NSDictionary *)manifest category:(NSString *)category
532 category = [category stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
534 NSString *mCategory = [manifest oo_stringForKey:kOOManifestCategory];
535 return ([mCategory rangeOfString:category options:NSCaseInsensitiveSearch].location != NSNotFound);
541- (BOOL) validateFilter:(NSString *)input
543 NSString *filter = [input lowercaseString];
544 if (([filter length] == 0)
562- (void) setCurrentDownload:(NSURLConnection *)download withLabel:(NSString *)label
564 if (_currentDownload !=
nil)
566 [_currentDownload cancel];
568 _currentDownload = [download retain];
570 _currentDownloadName = [label copy];
574- (void) setProgressStatus:(NSString *)new
577 _progressStatus = [new copy];
580- (BOOL) updateManifests
582 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[
self dataURL]]];
589 [
self setProgressStatus:@""];
591 return [
self beginDownload:request];
595- (BOOL) beginDownload:(NSMutableURLRequest *)request
597 NSString *userAgent = [NSString stringWithFormat:@"Oolite/%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
598 [request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
599 NSURLConnection *download = [[NSURLConnection alloc] initWithRequest:request delegate:self];
602 _downloadProgress = 0;
603 _downloadExpected = 0;
604 NSString *label =
DESC(
@"oolite-oxzmanager-download-label-list");
607 NSDictionary *expectedManifest =
nil;
608 expectedManifest = [_filteredList objectAtIndex:_item];
610 label = [expectedManifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-download-label-oxz")];
613 [
self setCurrentDownload:download withLabel:label];
615 OOLog(
kOOOXZDebugLog,
@"Download request received, using %@ and downloading to %@",[request URL],[
self downloadPath]);
634 if (_currentDownload !=
nil)
636 [_currentDownload cancel];
640 NSString *path = [
self downloadPath];
641 [[NSFileManager defaultManager] oo_removeItemAtPath:path];
657- (NSArray *) manifests
663- (NSArray *) managedOXZs
665 if (_managedList ==
nil)
669 NSArray *managedOXZs = [[NSFileManager defaultManager] oo_directoryContentsAtPath:[
self installPath]];
670 NSMutableArray *manifests = [NSMutableArray arrayWithCapacity:[managedOXZs count]];
672 NSString *fullpath =
nil;
673 NSDictionary *manifest =
nil;
676 fullpath = [[
self installPath] stringByAppendingPathComponent:filename];
680 NSMutableDictionary *adjManifest = [NSMutableDictionary dictionaryWithDictionary:manifest];
681 [adjManifest setObject:fullpath forKey:kOOManifestFilePath];
683 NSDictionary *stored =
nil;
688 BOOL foundInstallable = NO;
689 foreach (stored, _oxzList)
693 if (foundInstallable == NO)
695 [adjManifest setObject:[stored oo_stringForKey:kOOManifestVersion] forKey:kOOManifestAvailableVersion];
696 [adjManifest setObject:[stored oo_stringForKey:kOOManifestDownloadURL] forKey:kOOManifestDownloadURL];
699 foundInstallable = YES;
705 [manifests addObject:adjManifest];
708 [manifests sortUsingFunction:oxzSort context:NULL];
710 _managedList = [manifests copy];
716- (BOOL) processDownloadedManifests
722 [
self setOXZList:OOArrayFromFile([
self downloadPath])];
725 [_oxzList writeToFile:[
self manifestPath] atomically:YES];
727 [[NSFileManager defaultManager] oo_removeItemAtPath:[
self downloadPath]];
737 OOLog(
kOOOXZErrorLog,
@"Downloaded manifest was not a valid plist, has been left in %@",[
self downloadPath]);
739 [
self setOXZList:OOArrayFromFile([
self manifestPath])];
747- (BOOL) processDownloadedOXZ
754 NSDictionary *downloadedManifest =
OODictionaryFromFile([[
self downloadPath] stringByAppendingPathComponent:
@"manifest.plist"]);
755 if (downloadedManifest ==
nil)
758 OOLog(
kOOOXZErrorLog,
@"Downloaded OXZ does not contain a manifest.plist, has been left in %@",[
self downloadPath]);
763 NSDictionary *expectedManifest =
nil;
764 expectedManifest = [_filteredList objectAtIndex:_item];
766 if (expectedManifest ==
nil ||
772 OOLog(
kOOOXZErrorLog,
@"%@",
@"Downloaded OXZ does not have the same identifer and version as expected. This might be due to your manifests list being out of date - try updating it.");
779 NSString *
filename = [[downloadedManifest oo_stringForKey:kOOManifestIdentifier] stringByAppendingString:@".oxz"];
781 if (![
self ensureInstallPath])
791 NSString *destination = [[
self installPath] stringByAppendingPathComponent:filename];
792 [[NSFileManager defaultManager] oo_removeItemAtPath:destination];
795 if (![[NSFileManager defaultManager] oo_moveItemAtPath:[
self downloadPath] toPath:destination])
820 NSArray *
requires = [downloadedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
824 requires = [expectedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
826 NSDictionary *requirement =
nil;
827 NSMutableString *progress = [NSMutableString stringWithCapacity:2048];
830 if ([_dependencyStack
count] > 0)
833 NSSet *tempStack = [NSSet setWithSet:_dependencyStack];
834 foreach (requirement, tempStack)
837 if (![
ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]
838 &&
requires !=
nil && [
requires containsObject:requirement])
841 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-now-has-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
842 [_dependencyStack removeObject:requirement];
846 [_dependencyStack removeObject:requirement];
852 foreach (requirement,
requires)
854 if ([
ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO])
857 [_dependencyStack addObject:requirement];
858 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-requires-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
862 if ([_dependencyStack
count] > 0)
866 BOOL undownloadedRequirement = NO;
867 NSDictionary *availableDownload =
nil;
868 BOOL foundDownload = NO;
869 NSUInteger index = 0;
870 NSString *needsIdentifier =
nil;
874 undownloadedRequirement = YES;
875 requirement = [_dependencyStack anyObject];
878 if (!_downloadAllDependencies)
880 [progress appendString:DESC(@"oolite-oxzmanager-progress-get-required")];
882 needsIdentifier = [requirement oo_stringForKey:kOOManifestRelationIdentifier];
884 foreach (availableDownload, _oxzList)
892 index = [_oxzList indexOfObject:availableDownload];
906 [_dependencyStack removeObject:requirement];
907 if ([_dependencyStack
count] > 0)
910 undownloadedRequirement = NO;
921 while (!undownloadedRequirement);
926 [
self setFilteredList:_oxzList];
929 if (_downloadAllDependencies)
932 if (![
self installOXZ:index]) {
935 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-required-@-not-found"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
936 [
self setProgressStatus:progress];
937 OOLog(
kOOOXZErrorLog,
@"OXZ dependency %@ could not be found for automatic download.",needsIdentifier);
950 [
self setProgressStatus:progress];
955 else if ([_dependencyStack
count] > 0)
957 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-required-@-not-found"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
958 [
self setProgressStatus:progress];
959 OOLog(
kOOOXZErrorLog,
@"OXZ dependency %@ could not be found for automatic download.",needsIdentifier);
968 [
self setProgressStatus:@""];
970 [_dependencyStack removeAllObjects];
971 _downloadAllDependencies = NO;
977- (NSDictionary *) installedManifestForIdentifier:(NSString *)identifier
979 NSArray *installed = [
self managedOXZs];
980 NSDictionary *manifest =
nil;
981 foreach (manifest,installed)
994 NSString *title = [manifest oo_stringForKey:kOOManifestTitle defaultValue:nil];
995 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier defaultValue:nil];
997 if (![
ResourceManager checkVersionCompatibility:manifest forOXP:title])
1002 NSDictionary *installed = [
self installedManifestForIdentifier:identifier];
1003 if (installed ==
nil)
1009 if (installed !=
nil)
1017 && [[NSFileManager defaultManager] fileExistsAtPath:[installed oo_stringForKey:
kOOManifestFilePath]])
1035 if (installed !=
nil)
1037 NSString *availableVersion = [manifest oo_stringForKey:kOOManifestAvailableVersion];
1038 if (availableVersion ==
nil)
1040 availableVersion = [manifest oo_stringForKey:kOOManifestVersion];
1042 NSString *installedVersion = [installed oo_stringForKey:kOOManifestVersion];
1043 OOLog(
@"version.debug",
@"%@ mv:%@ mav:%@",identifier,installedVersion,availableVersion);
1051 if ([
ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
1059- (
OOColor *) colorForManifest:(NSDictionary *)manifest
1061 switch ([
self installableState:manifest])
1084- (NSString *) installStatusForManifest:(NSDictionary *)manifest
1086 switch ([
self installableState:manifest])
1089 return DESC(
@"oolite-oxzmanager-installable-okay");
1091 return DESC(
@"oolite-oxzmanager-installable-update");
1093 return DESC(
@"oolite-oxzmanager-installable-depend");
1095 return DESC(
@"oolite-oxzmanager-installable-conflicts");
1097 return DESC(
@"oolite-oxzmanager-installable-already");
1099 return DESC(
@"oolite-oxzmanager-installable-manual");
1101 return DESC(
@"oolite-oxzmanager-installable-version");
1103 return DESC(
@"oolite-oxzmanager-installable-noremote");
1119 [PLAYER destroySound];
1123 [gui
setTitle:DESC(@"oolite-oxzmanager-title")];
1127 switch (_interfaceState)
1130 [gui
setTitle:DESC(@"oolite-oxzmanager-title-setfilter")];
1131 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-currentfilter-is-@"),_currentFilter]
forRow:OXZ_GUI_ROW_FILTERCURRENT
align:GUI_ALIGN_LEFT];
1137 if (_oxzList ==
nil)
1140 [gui
setText:DESC(@"oolite-oxzmanager-download-list")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1149 [gui
setText:DESC(@"oolite-oxzmanager-download-noupdate")
forRow:OXZ_GUI_ROW_PROCEED
align:GUI_ALIGN_CENTER];
1152 [gui
setText:DESC(@"oolite-oxzmanager-update-list")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1169 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-currentfilter-is-@-@"),OOExpand(@"[oolite_key_oxzmanager_setfilter]"),_currentFilter]
forRow:OXZ_GUI_ROW_LISTFILTER
align:GUI_ALIGN_LEFT];
1173 [gui
setText:DESC(@"oolite-oxzmanager-install")
forRow:OXZ_GUI_ROW_INSTALL
align:GUI_ALIGN_CENTER];
1175 [gui
setText:DESC(@"oolite-oxzmanager-installed")
forRow:OXZ_GUI_ROW_INSTALLED
align:GUI_ALIGN_CENTER];
1176 [gui
setKey:@"_INSTALLED"
forRow:OXZ_GUI_ROW_INSTALLED];
1177 [gui
setText:DESC(@"oolite-oxzmanager-remove")
forRow:OXZ_GUI_ROW_REMOVE
align:GUI_ALIGN_CENTER];
1179 [gui
setText:DESC(@"oolite-oxzmanager-update-list")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1181 [gui
setText:DESC(@"oolite-oxzmanager-update-all")
forRow:OXZ_GUI_ROW_UPDATE_ALL
align:GUI_ALIGN_CENTER];
1182 [gui
setKey:@"_UPDATE_ALL"
forRow:OXZ_GUI_ROW_UPDATE_ALL];
1188 [gui
setTitle:DESC(@"oolite-oxzmanager-title-downloading")];
1190 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-progress-@-is-@-of-@"),_currentDownloadName,[
self humanSize:_downloadProgress],[
self humanSize:_downloadExpected]]
startingAtRow:OXZ_GUI_ROW_PROGRESS
align:GUI_ALIGN_LEFT];
1194 [gui
setText:DESC(@"oolite-oxzmanager-cancel")
forRow:OXZ_GUI_ROW_CANCEL
align:GUI_ALIGN_CENTER];
1199 [gui
setTitle:DESC(@"oolite-oxzmanager-title-dependencies")];
1201 [gui
setText:DESC(@"oolite-oxzmanager-dependencies-decision")
forRow:OXZ_GUI_ROW_PROGRESS
align:GUI_ALIGN_LEFT];
1206 [gui
setText:DESC(@"oolite-oxzmanager-dependencies-yes-all")
forRow:OXZ_GUI_ROW_INSTALLED
align:GUI_ALIGN_CENTER];
1207 [gui
setKey:@"_PROCEED_ALL"
forRow:OXZ_GUI_ROW_INSTALLED];
1209 [gui
setText:DESC(@"oolite-oxzmanager-dependencies-yes")
forRow:OXZ_GUI_ROW_PROCEED
align:GUI_ALIGN_CENTER];
1212 [gui
setText:DESC(@"oolite-oxzmanager-dependencies-no")
forRow:OXZ_GUI_ROW_CANCEL
align:GUI_ALIGN_CENTER];
1218 [gui
setText:DESC(@"oolite-oxzmanager-acknowledge")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1225 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-progress-done-%u-%u"),[_oxzList count],[[
self managedOXZs] count]]
startingAtRow:OXZ_GUI_ROW_PROGRESS
align:GUI_ALIGN_LEFT];
1233 [gui
setText:DESC(@"oolite-oxzmanager-acknowledge")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1239 NSDictionary *manifest = [_filteredList oo_dictionaryAtIndex:_item];
1240 NSString *title = [manifest oo_stringForKey:kOOManifestTitle];
1241 NSString *version = [manifest oo_stringForKey:kOOManifestVersion];
1242 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
1243 [gui
setTitle:DESC(@"oolite-oxzmanager-title-extract")];
1244 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-title-@-version-@"),
1254 NSString *path = [
self extractionBasePathForIdentifier:identifier andVersion:version];
1255 if ([[NSFileManager defaultManager] fileExistsAtPath:path])
1257 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-extract-@-already-exists"), path]
1260 [gui
setText:DESC(@"oolite-oxzmanager-extract-unavailable")
forRow:OXZ_GUI_ROW_PROCEED
align:GUI_ALIGN_CENTER];
1265 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-extract-to-@"), path]
1268 [gui
setText:DESC(@"oolite-oxzmanager-extract-proceed")
forRow:OXZ_GUI_ROW_PROCEED
align:GUI_ALIGN_CENTER];
1272 [gui
setText:DESC(@"oolite-oxzmanager-extract-cancel")
forRow:OXZ_GUI_ROW_CANCEL
align:GUI_ALIGN_CENTER];
1279 [gui
setText:DESC(@"oolite-oxzmanager-acknowledge")
forRow:OXZ_GUI_ROW_UPDATE
align:GUI_ALIGN_CENTER];
1288 [gui
setTitle:DESC(@"oolite-oxzmanager-title-install")];
1289 [
self setFilteredList:[
self applyCurrentFilter:_oxzList]];
1290 startRow = [
self showInstallOptions];
1294 [gui
setTitle:DESC(@"oolite-oxzmanager-title-installed")];
1295 [
self setFilteredList:[
self applyCurrentFilter:[
self managedOXZs]]];
1296 startRow = [
self showInstallOptions];
1300 [gui
setTitle:DESC(@"oolite-oxzmanager-title-remove")];
1301 [
self setFilteredList:[
self applyCurrentFilter:[
self managedOXZs]]];
1302 startRow = [
self showRemoveOptions];
1308 [gui
setText:DESC(@"oolite-oxzmanager-exit-restart")
forRow:OXZ_GUI_ROW_EXIT
align:GUI_ALIGN_CENTER];
1312 [gui
setText:DESC(@"oolite-oxzmanager-exit")
forRow:OXZ_GUI_ROW_EXIT
align:GUI_ALIGN_CENTER];
1332- (BOOL) isRestarting
1339 [UNIVERSE reinitAndShowDemo:YES];
1352- (void) processSelection
1359 [
self cancelUpdate];
1360 [_dependencyStack removeAllObjects];
1361 _downloadAllDependencies = NO;
1369 [PLAYER setGuiToIntroFirstGo:YES];
1370 if (_oxzList !=
nil)
1390 [_dependencyStack removeAllObjects];
1391 _downloadAllDependencies = NO;
1397 [_dependencyStack removeAllObjects];
1398 _downloadAllDependencies = NO;
1404 [
self cancelUpdate];
1412 [
self updateManifests];
1423 _downloadAllDependencies = YES;
1424 [
self installOXZ:_item];
1435 [
self installOXZ:_item];
1443 [
self setProgressStatus:[
self extractOXZ:_item]];
1454 [
self updateAllOXZ];
1458 [
self processOptionsPrev];
1463 [
self processOptionsNext];
1471 [
self removeOXZ:item];
1476 [
self installOXZ:item];
1481 [
self installOXZ:item];
1490- (BOOL) isAcceptingTextInput
1496- (BOOL) isAcceptingGUIInput
1498 return !_interfaceShowingOXZDetail;
1502- (void) processTextInput:(NSString *)input
1504 if ([
self validateFilter:input])
1506 if ([input length] > 0)
1508 [
self setFilter:input];
1517- (void) refreshTextInput:(NSString *)input
1520 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-text-prompt-@"), input]
forRow:OXZ_GUI_ROW_INPUT
align:GUI_ALIGN_LEFT];
1521 if ([
self validateFilter:input])
1532- (void) processFilterKey
1534 if (_interfaceShowingOXZDetail)
1536 _interfaceShowingOXZDetail = NO;
1541 [[UNIVERSE gameView] resetTypedString];
1548- (void) processShowInfoKey
1554 if (_interfaceShowingOXZDetail)
1556 _interfaceShowingOXZDetail = NO;
1561 [
self showOptionsUpdate];
1576 NSDictionary *manifest = [_filteredList oo_dictionaryAtIndex:_item];
1577 _interfaceShowingOXZDetail = YES;
1580 [gui
setTitle:DESC(@"oolite-oxzmanager-title-infopage")];
1583 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-title-@-version-@"),
1584 [manifest oo_stringForKey:kOOManifestTitle],
1585 [manifest oo_stringForKey:kOOManifestVersion]]
1589 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-author-@"),
1590 [manifest oo_stringForKey:kOOManifestAuthor]]
1594 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-license-@"),
1595 [manifest oo_stringForKey:kOOManifestLicense]]
1599 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-tags-@"),[[manifest oo_arrayForKey:kOOManifestTags] componentsJoinedByString: @", "]]
1602 [gui
addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-description-@"),[manifest oo_stringForKey:kOOManifestDescription]]
1606 NSString *infoURLString = [manifest oo_stringForKey:kOOManifestInformationURL];
1607 [gui
setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-infourl-@"),
1611 [[UNIVERSE gameView] stringToClipboard:infoURLString];
1614 [gui
setText:OOExpand(DESC(@"oolite-oxzmanager-infopage-return"))
forRow:27
align:GUI_ALIGN_CENTER];
1622- (void) processExtractKey
1644- (BOOL) installOXZ:(NSUInteger)item
1646 NSArray *picklist = _filteredList;
1648 if ([picklist
count] <= item)
1652 NSDictionary *manifest = [picklist objectAtIndex:item];
1661 NSString *url = [manifest objectForKey:kOOManifestDownloadURL];
1667 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
1675 [
self setProgressStatus:@""];
1676 return [
self beginDownload:request];
1680- (BOOL) updateAllOXZ
1682 [_dependencyStack removeAllObjects];
1683 _downloadAllDependencies = YES;
1684 [
self setFilteredList:_oxzList];
1685 NSDictionary *manifest =
nil;
1687 foreach (manifest,_oxzList)
1692 [_dependencyStack addObject:manifest];
1695 NSDictionary *first = [_dependencyStack anyObject];
1696 NSString* identifier = [first oo_stringForKey:kOOManifestRelationIdentifier];
1697 NSUInteger item = NSUIntegerMax;
1698 NSDictionary *availableDownload =
nil;
1699 foreach (availableDownload, _oxzList)
1703 item = [_oxzList indexOfObject:availableDownload];
1707 return [
self installOXZ:item];
1711- (NSArray *) installOptions
1713 NSUInteger start = _offset;
1714 if (start >= [_filteredList
count])
1720 if (end > [_filteredList
count])
1722 end = [_filteredList count];
1724 return [_filteredList subarrayWithRange:NSMakeRange(start,end-start)];
1732 NSArray *options = [
self installOptions];
1733 NSUInteger optCount = [_filteredList count];
1743 [gui
setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-heading-category"),
1744 DESC(@"oolite-oxzmanager-heading-title"),
1745 DESC(@"oolite-oxzmanager-heading-installed"),
1746 DESC(@"oolite-oxzmanager-heading-downloadable"),
1747 nil]
forRow:OXZ_GUI_ROW_LISTHEAD];
1752 [gui
setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"",@"",@" <-- ", nil]
forRow:OXZ_GUI_ROW_LISTPREV];
1764 if (_offset + 10 < optCount)
1767 [gui
setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"",@"",@" --> ", nil]
forRow:OXZ_GUI_ROW_LISTNEXT];
1794 NSDictionary *manifest =
nil;
1795 BOOL oxzLineSelected = NO;
1797 foreach (manifest, options)
1800 NSString *localPath = [[[
self installPath] stringByAppendingPathComponent:[manifest oo_stringForKey:kOOManifestIdentifier]] stringByAppendingPathExtension:@"oxz"];
1801 if (installed ==
nil)
1804 installed =
OODictionaryFromFile([localPath stringByAppendingPathComponent:
@"manifest.plist"]);
1809 if ([[NSFileManager defaultManager] fileExistsAtPath:localPath])
1812 installed =
OODictionaryFromFile([localPath stringByAppendingPathComponent:
@"manifest.plist"]);
1824 NSString *installedVersion =
DESC(
@"oolite-oxzmanager-version-none");
1825 if (installed !=
nil)
1827 installedVersion = [installed oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-version-none")];
1832 [gui
setArray:[NSArray arrayWithObjects:
1833 [manifest oo_stringForKey:kOOManifestCategory defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
1834 [manifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
1836 [manifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[manifest oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-version-none")]],
1839 [gui
setKey:[manifest oo_stringForKey:kOOManifestIdentifier]
forRow:row];
1843 if (row == [gui selectedRow])
1845 oxzLineSelected = YES;
1847 [gui
setText:[
self installStatusForManifest:manifest]
forRow:OXZ_GUI_ROW_LISTSTATUS];
1850 [gui
addLongText:[[[manifest oo_stringForKey:kOOManifestDescription] componentsSeparatedByString:@"\n"] oo_stringAtIndex:0]
startingAtRow:OXZ_GUI_ROW_LISTDESC
align:GUI_ALIGN_LEFT];
1852 NSString *infoUrl = [manifest oo_stringForKey:kOOManifestInformationURL];
1855 [gui
setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-url"),infoUrl,nil]
forRow:OXZ_GUI_ROW_LISTINFO1];
1857 NSUInteger
size = [manifest oo_unsignedIntForKey:kOOManifestFileSize defaultValue:0];
1858 NSString *updatedDesc =
nil;
1860 NSUInteger timestamp = [manifest oo_unsignedIntegerForKey:kOOManifestUploadDate defaultValue:0];
1864 NSDate *updated = [NSDate dateWithTimeIntervalSince1970:timestamp];
1867 updatedDesc = [[[updated description] componentsSeparatedByString:@" "] oo_stringAtIndex:0];
1869 [gui
setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-size"),[
self humanSize:size],DESC(@"oolite-oxzmanager-infoline-date"),updatedDesc,nil]
forRow:OXZ_GUI_ROW_LISTINFO2];
1874 [gui
setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-size"),[
self humanSize:size],nil]
forRow:OXZ_GUI_ROW_LISTINFO2];
1884 if (!oxzLineSelected)
1904- (BOOL) removeOXZ:(NSUInteger)item
1906 NSArray *remList = _filteredList;
1907 if ([remList
count] <= item)
1909 OOLog(
kOOOXZDebugLog,
@"Unable to remove item %lu as only %lu in list", (
unsigned long)item, (
unsigned long)[remList
count]);
1912 NSString *
filename = [[remList objectAtIndex:item] oo_stringForKey:kOOManifestFilePath];
1915 OOLog(
kOOOXZDebugLog,
@"Unable to remove item %lu as filename not found", (
unsigned long)item);
1919 if (![[NSFileManager defaultManager] oo_removeItemAtPath:
filename])
1932- (NSArray *) removeOptions
1934 NSArray *remList = _filteredList;
1935 if ([remList
count] == 0)
1939 NSUInteger start = _offset;
1940 if (start >= [remList
count])
1946 if (end > [remList
count])
1948 end = [remList count];
1950 return [remList subarrayWithRange:NSMakeRange(start,end-start)];
1958 NSArray *options = [
self removeOptions];
1972 [gui
setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-heading-category"),
1973 DESC(@"oolite-oxzmanager-heading-title"),
1974 DESC(@"oolite-oxzmanager-heading-version"),
1975 nil]
forRow:OXZ_GUI_ROW_LISTHEAD];
1979 [gui
setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"",@" <-- ", nil]
forRow:OXZ_GUI_ROW_LISTPREV];
1994 [gui
setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"",@" --> ", nil]
forRow:OXZ_GUI_ROW_LISTNEXT];
2022 NSDictionary *manifest =
nil;
2023 BOOL oxzSelected = NO;
2025 foreach (manifest, options)
2028 [gui
setArray:[NSArray arrayWithObjects:
2029 [manifest oo_stringForKey:kOOManifestCategory defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2030 [manifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2031 [manifest oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2033 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
2038 if (row == [gui selectedRow])
2040 [gui
setText:[
self installStatusForManifest:manifest]
forRow:OXZ_GUI_ROW_LISTSTATUS];
2043 [gui
addLongText:[[[manifest oo_stringForKey:kOOManifestDescription] componentsSeparatedByString:@"\n"] oo_stringAtIndex:0]
startingAtRow:OXZ_GUI_ROW_LISTDESC
align:GUI_ALIGN_LEFT];
2059- (void) showOptionsUpdate
2064 [
self setFilteredList:[
self applyCurrentFilter:_oxzList]];
2065 [
self showInstallOptions];
2069 [
self setFilteredList:[
self applyCurrentFilter:[
self managedOXZs]]];
2070 [
self showInstallOptions];
2074 [
self setFilteredList:[
self applyCurrentFilter:[
self managedOXZs]]];
2075 [
self showRemoveOptions];
2081- (void) showOptionsPrev
2088 [
self processSelection];
2094- (void) processOptionsPrev
2104 [
self showOptionsUpdate];
2108- (void) processOptionsNext
2114 [
self showOptionsUpdate];
2119- (void) showOptionsNext
2126 [
self processSelection];
2132- (NSString *) extractOXZ:(NSUInteger)item
2134 NSFileManager *fmgr = [NSFileManager defaultManager];
2135 NSMutableString *extractionLog = [[NSMutableString alloc] init];
2136 NSDictionary *manifest = [_filteredList oo_dictionaryAtIndex:item];
2137 NSString *version = [manifest oo_stringForKey:kOOManifestVersion];
2138 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
2139 NSString *path = [
self extractionBasePathForIdentifier:identifier andVersion:version];
2145 NSString *oxzfile = [manifest oo_stringForKey:kOOManifestFilePath];
2146 if (![fmgr fileExistsAtPath:oxzfile])
2149 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-no-original")];
2150 return [extractionLog autorelease];
2152 const char* zipname = [oxzfile UTF8String];
2158 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-bad-original")];
2159 return [extractionLog autorelease];
2162 if ([fmgr fileExistsAtPath:path])
2165 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-exists")];
2167 return [extractionLog autorelease];
2169 if (![fmgr oo_createDirectoryAtPath:path attributes:
nil])
2172 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-unmakeable")];
2174 return [extractionLog autorelease];
2176 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-created")];
2177 NSUInteger counter = 0;
2178 char rawComponentName[512];
2186 rawComponentName, 512,
2189 NSString *componentName = [NSString stringWithUTF8String:rawComponentName];
2190 if ([componentName hasSuffix:
@"/"])
2193 if (![fmgr oo_createDirectoryAtPath:[path stringByAppendingPathComponent:componentName] attributes:
nil])
2196 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2209 NSString *folder = [[path stringByAppendingPathComponent:componentName] stringByDeletingLastPathComponent];
2210 if ([folder length] > 0 && ![fmgr fileExistsAtPath:folder] && ![fmgr oo_createDirectoryAtPath:folder attributes:
nil])
2213 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2222 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2223 NSData *tmp = [NSData oo_dataWithOXZFile:[oxzfile stringByAppendingPathComponent:componentName]];
2227 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2234 if (![tmp writeToFile:[path stringByAppendingPathComponent:componentName] atomically:YES])
2237 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2257 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-num-u-extracted"),counter];
2258 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-extracted-to-@"),path];
2261 return [extractionLog autorelease];
2267- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
2271 _downloadExpected = [response expectedContentLength];
2272 _downloadProgress = 0;
2274 [[NSFileManager defaultManager] createFileAtPath:[
self downloadPath] contents:nil attributes:nil];
2275 _fileWriter = [[NSFileHandle fileHandleForWritingAtPath:[
self downloadPath]] retain];
2276 if (_fileWriter ==
nil)
2280 [
self cancelUpdate];
2285- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
2288 [_fileWriter seekToEndOfFile];
2289 [_fileWriter writeData:data];
2290 _downloadProgress += [data length];
2308 [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
2313- (void)connectionDidFinishLoading:(NSURLConnection *)connection
2317 [_fileWriter synchronizeFile];
2318 [_fileWriter closeFile];
2323 if (![
self processDownloadedManifests])
2330 if (![
self processDownloadedOXZ])
2337 OOLog(
kOOOXZErrorLog,
@"Error: download completed in unexpected state %d. This is an internal error - please report it.",_interfaceState);
2343- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
2347 [_fileWriter closeFile];
2358NSComparisonResult
oxzSort(
id m1,
id m2,
void *context)
2360 NSComparisonResult result = [[m1 oo_stringForKey:kOOManifestCategory defaultValue:@"zz"] localizedCompare:[m2 oo_stringForKey:kOOManifestCategory defaultValue:@"zz"]];
2361 if (result == NSOrderedSame)
2363 result = [[m1 oo_stringForKey:kOOManifestTitle defaultValue:@"zz"] localizedCompare:[m2 oo_stringForKey:kOOManifestTitle defaultValue:@"zz"]];
2364 if (result == NSOrderedSame)
2366 result = [[m2 oo_stringForKey:kOOManifestVersion defaultValue:@"0"] localizedCompare:[m1 oo_stringForKey:kOOManifestVersion defaultValue:@"0"]];
OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS]
static OODebugMonitor * sSingleton
#define OOLog(class, format,...)
static NSString *const kOOManifestAvailableVersion
static NSString *const kOOManifestRelationIdentifier
static NSString *const kOOManifestIdentifier
static NSString *const kOOManifestVersion
static NSString *const kOOManifestFilePath
@ OXZ_STATE_PICK_INSTALLED
static NSString *const kOOOXZFilterDays
static NSString *const kOOOXZErrorLog
static NSString *const kOOOXZFilterTag
static NSString *const kOOOXZFilterKeyword
@ OXZ_INSTALLABLE_DEPENDENCIES
@ OXZ_INSTALLABLE_CONFLICTS
@ OXZ_UNINSTALLABLE_VERSION
@ OXZ_UNINSTALLABLE_ALREADY
@ OXZ_UNINSTALLABLE_NOREMOTE
@ OXZ_UNINSTALLABLE_MANUAL
static NSString *const kOOOXZManifestCache
static NSString *const kOOOXZFilterUpdates
static NSString *const kOOOXZFilterAll
static NSString *const kOOOXZFilterCategory
static NSString *const kOOOXZFilterInstallable
static NSString *const kOOOXZTmpPlistPath
static NSString *const kOOOXZFilterAuthor
NSComparisonResult oxzSort(id m1, id m2, void *context)
static NSString *const kOOOXZDataURL
static NSString *const kOOOXZTmpPath
static NSString *const kOOOXZDataConfig
static OOOXZManager * sSingleton
static NSString *const kOOOXZDebugLog
@ OXZ_GUI_ROW_FILTERCURRENT
NSDictionary * OODictionaryFromFile(NSString *path)
NSArray * ComponentsFromVersionString(NSString *string)
NSComparisonResult CompareVersions(NSArray *version1, NSArray *version2)
BOOL setSelectedRow:(OOGUIRow row)
OOGUIRow addLongText:startingAtRow:align:(NSString *str,[startingAtRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void setText:forRow:(NSString *str,[forRow] OOGUIRow row)
void setText:forRow:align:(NSString *str,[forRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void clearAndKeepBackground:(BOOL keepBackground)
void setSelectableRange:(NSRange range)
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
void setTitle:(NSString *str)
void setTabStops:(OOGUITabSettings stops)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
void setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
NSString * cacheDirectoryPathCreatingIfNecessary:(BOOL create)
OOCacheManager * sharedCache()
void resetManifestKnowledgeForOXZManager()
NSDictionary * manifestForIdentifier:(NSString *identifier)
NSArray * userRootPaths()
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
int ZEXPORT unzGoToFirstFile(unzFile file)
unzFile ZEXPORT unzOpen64(const void *path)
int ZEXPORT unzGoToNextFile(unzFile file)
int ZEXPORT unzClose(unzFile file)