Oolite
Loading...
Searching...
No Matches
OOOXZManager(NSURLConnectionDataDelegate) Category Reference

Instance Methods

(NSString *) - manifestPath
(NSString *) - downloadPath
(NSString *) - extractionBasePathForIdentifier:andVersion:
(NSString *) - dataURL
(NSString *) - humanSize:
(BOOL) - ensureInstallPath
(BOOL) - beginDownload:
(BOOL) - processDownloadedManifests
(BOOL) - processDownloadedOXZ
(OXZInstallableState) - installableState:
(OOColor *) - colorForManifest:
(NSString *) - installStatusForManifest:
(BOOL) - validateFilter:
(void) - setOXZList:
(void) - setFilteredList:
(NSArray *) - applyCurrentFilter:
(void) - setCurrentDownload:withLabel:
(void) - setProgressStatus:
(BOOL) - installOXZ:
(BOOL) - updateAllOXZ
(BOOL) - removeOXZ:
(NSArray *) - installOptions
(NSArray *) - removeOptions
(NSString *) - extractOXZ:
(void) - connection:didFailWithError:
(void) - connection:didReceiveResponse:
(void) - connection:didReceiveData:
(void) - connectionDidFinishLoading:

Detailed Description

Definition at line 119 of file OOOXZManager.m.

Method Documentation

◆ applyCurrentFilter:

- (NSArray *) applyCurrentFilter: (NSArray *) list

Extends class OOOXZManager.

Definition at line 376 of file OOOXZManager.m.

376 :(NSArray*)list
377{
378 SEL filterSelector = @selector(applyFilterByNoFilter:);
379 NSString* parameter = nil;
380 if ([_currentFilter isEqualToString:kOOOXZFilterUpdates]) {
381 filterSelector = @selector(applyFilterByUpdateRequired:);
382 } else if ([_currentFilter isEqualToString:kOOOXZFilterInstallable]) {
383 filterSelector = @selector(applyFilterByInstallable:);
384 } else if ([_currentFilter hasPrefix:kOOOXZFilterKeyword]) {
385 filterSelector = @selector(applyFilterByKeyword:keyword:);
386 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterKeyword length]];
387 } else if ([_currentFilter hasPrefix:kOOOXZFilterAuthor]) {
388 filterSelector = @selector(applyFilterByAuthor:author:);
389 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterAuthor length]];
390 } else if ([_currentFilter hasPrefix:kOOOXZFilterDays]) {
391 filterSelector = @selector(applyFilterByDays:days:);
392 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterDays length]];
393 } else if ([_currentFilter hasPrefix:kOOOXZFilterTag]) {
394 filterSelector = @selector(applyFilterByTag:tag:);
395 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterTag length]];
396 } else if ([_currentFilter hasPrefix:kOOOXZFilterCategory]) {
397 filterSelector = @selector(applyFilterByCategory:category:);
398 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterCategory length]];
399 }
400
401 NSMutableArray* filteredList = [NSMutableArray arrayWithCapacity:[list count]];
402 NSDictionary* manifest = nil;
403 NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:filterSelector]];
404 [invocation setSelector:filterSelector];
405 [invocation setTarget:self];
406 if (parameter != nil) {
407 [invocation setArgument:&parameter atIndex:3];
408 }
409
410 foreach (manifest, list) {
411 [invocation setArgument:&manifest atIndex:2];
412 [invocation invoke];
413 BOOL filterAccepted = NO;
414 [invocation getReturnValue:&filterAccepted];
415 if (filterAccepted) {
416 [filteredList addObject:manifest];
417 }
418 }
419 // any bad filter that gets this far is also treated as '*'
420 // so don't need to explicitly test for '*' or ''
421 return [[filteredList copy] autorelease];
422}
static NSString *const kOOOXZFilterDays
static NSString *const kOOOXZFilterTag
static NSString *const kOOOXZFilterKeyword
static NSString *const kOOOXZFilterUpdates
static NSString *const kOOOXZFilterCategory
static NSString *const kOOOXZFilterInstallable
static NSString *const kOOOXZFilterAuthor
return nil

References kOOOXZFilterAuthor, kOOOXZFilterCategory, kOOOXZFilterDays, kOOOXZFilterInstallable, kOOOXZFilterKeyword, kOOOXZFilterTag, kOOOXZFilterUpdates, and nil.

Referenced by OOOXZManager::gui, and OOOXZManager::showOptionsUpdate.

Here is the caller graph for this function:

◆ beginDownload:

- (BOOL) beginDownload: (NSMutableURLRequest *) request

Extends class OOOXZManager.

Definition at line 560 of file OOOXZManager.m.

560 :(NSMutableURLRequest*)request
561{
562 NSString* userAgent = [NSString stringWithFormat:@"Oolite/%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
563 [request setValue:userAgent forHTTPHeaderField:@"User-Agent"];
564 [request setHTTPShouldHandleCookies:NO];
565 NSURLConnection* download = [[NSURLConnection alloc] initWithRequest:request delegate:self];
566 if (download) {
567 _downloadProgress = 0;
568 _downloadExpected = 0;
569 NSString* label = DESC(@"oolite-oxzmanager-download-label-list");
570 if (_interfaceState != OXZ_STATE_UPDATING) {
571 NSDictionary* expectedManifest = nil;
572 expectedManifest = [_filteredList objectAtIndex:_item];
573
574 label = [expectedManifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-download-label-oxz")];
575 }
576
577 [self setCurrentDownload:download withLabel:label]; // retains it
578 [download release];
579 OOLog(kOOOXZDebugLog, @"Download request received, using %@ and downloading to %@", [request URL], [self downloadPath]);
580 return YES;
581 } else {
582 OOLog(kOOOXZErrorLog, @"Unable to start downloading file at %@", [request URL]);
583 _downloadStatus = OXZ_DOWNLOAD_ERROR;
584 return NO;
585 }
586}
#define OOLog(class, format,...)
Definition OOLogging.h:84
@ OXZ_STATE_UPDATING
@ OXZ_DOWNLOAD_ERROR
static NSString *const kOOOXZErrorLog
static NSString *const kOOOXZDebugLog
#define DESC(key)
Definition Universe.h:832

References DESC, downloadPath, kOOOXZDebugLog, kOOOXZErrorLog, nil, OOLog, OXZ_DOWNLOAD_ERROR, OXZ_STATE_UPDATING, and OOOXZManager::setCurrentDownload:withLabel:.

Referenced by installOXZ:, and OOOXZManager::updateManifests.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ colorForManifest:

- (OOColor *) colorForManifest: (NSDictionary *) manifest

Extends class OOOXZManager.

Definition at line 951 of file OOOXZManager.m.

951 :(NSDictionary*)manifest
952{
953 switch ([self installableState:manifest]) {
955 return [OOColor yellowColor];
957 return [OOColor cyanColor];
959 return [OOColor orangeColor];
961 return [OOColor brownColor];
963 return [OOColor whiteColor];
965 return [OOColor redColor];
967 return [OOColor grayColor];
969 return [OOColor blueColor];
970 }
971 return [OOColor yellowColor]; // never
972}
@ OXZ_INSTALLABLE_UPDATE
@ OXZ_INSTALLABLE_DEPENDENCIES
@ OXZ_INSTALLABLE_CONFLICTS
@ OXZ_INSTALLABLE_OKAY
@ OXZ_UNINSTALLABLE_VERSION
@ OXZ_UNINSTALLABLE_ALREADY
@ OXZ_UNINSTALLABLE_NOREMOTE
@ OXZ_UNINSTALLABLE_MANUAL
OOColor * cyanColor()
Definition OOColor.m:274
OOColor * orangeColor()
Definition OOColor.m:289
OOColor * redColor()
Definition OOColor.m:259
OOColor * blueColor()
Definition OOColor.m:269
OOColor * grayColor()
Definition OOColor.m:254
OOColor * whiteColor()
Definition OOColor.m:249
OOColor * brownColor()
Definition OOColor.m:299
OOColor * yellowColor()
Definition OOColor.m:279

References OOColor::blueColor, OOColor::brownColor, OOColor::cyanColor, OOColor::grayColor, OOColor::orangeColor, OXZ_INSTALLABLE_CONFLICTS, OXZ_INSTALLABLE_DEPENDENCIES, OXZ_INSTALLABLE_OKAY, OXZ_INSTALLABLE_UPDATE, OXZ_UNINSTALLABLE_ALREADY, OXZ_UNINSTALLABLE_MANUAL, OXZ_UNINSTALLABLE_NOREMOTE, OXZ_UNINSTALLABLE_VERSION, OOColor::redColor, OOColor::whiteColor, and OOColor::yellowColor.

Referenced by OOOXZManager::showInstallOptions, and OOOXZManager::showRemoveOptions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connection:didFailWithError:

- (void) connection: (NSURLConnection *) connection
didFailWithError: (NSError *) error 

Extends class OOOXZManager.

Definition at line 2044 of file OOOXZManager.m.

2044 :(NSURLConnection*)connection didFailWithError:(NSError*)error
2045{
2046 _downloadStatus = OXZ_DOWNLOAD_ERROR;
2047 OOLog(kOOOXZErrorLog, @"Error downloading file: %@", [error description]);
2048 [_fileWriter closeFile];
2049 DESTROY(_fileWriter);
2050 DESTROY(_currentDownload);
2051}
#define DESTROY(x)

References DESTROY, kOOOXZErrorLog, OOLog, and OXZ_DOWNLOAD_ERROR.

◆ connection:didReceiveData:

- (void) connection: (NSURLConnection *) connection
didReceiveData: (NSData *) data 

Extends class OOOXZManager.

Definition at line 1995 of file OOOXZManager.m.

1995 :(NSURLConnection*)connection didReceiveData:(NSData*)data
1996{
1997 OOLog(kOOOXZDebugLog, @"Downloaded %zu bytes", [data length]);
1998 [_fileWriter seekToEndOfFile];
1999 [_fileWriter writeData:data];
2000 _downloadProgress += [data length];
2001 [self gui]; // update GUI
2002#if OOLITE_WINDOWS
2003 /* Irritating fix to issue https://github.com/OoliteProject/oolite/issues/95
2004 *
2005 * The problem is that on MINGW, GNUStep makes all socket streams
2006 * blocking, which causes problems with the run loop. Calling this
2007 * method of the run loop forces it to execute all already
2008 * scheduled items with a time in the past, before any more items
2009 * are placed on it, which means that the main game update gets a
2010 * chance to run.
2011 *
2012 * This stops the interface freezing - and Oolite appearing to
2013 * have stopped responding to the OS - when downloading large
2014 * (>20Mb) OXZ files.
2015 *
2016 * CIM 6 July 2014
2017 */
2018 [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
2019#endif
2020}

References OOOXZManager::gui, kOOOXZDebugLog, and OOLog.

Here is the call graph for this function:

◆ connection:didReceiveResponse:

- (void) connection: (NSURLConnection *) connection
didReceiveResponse: (NSURLResponse *) response 

Extends class OOOXZManager.

Definition at line 1979 of file OOOXZManager.m.

1979 :(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response
1980{
1981 _downloadStatus = OXZ_DOWNLOAD_RECEIVING;
1982 OOLog(kOOOXZDebugLog, @"%@", @"Download receiving");
1983 _downloadExpected = [response expectedContentLength];
1984 _downloadProgress = 0;
1985 DESTROY(_fileWriter);
1986 [[NSFileManager defaultManager] createFileAtPath:[self downloadPath] contents:nil attributes:nil];
1987 _fileWriter = [[NSFileHandle fileHandleForWritingAtPath:[self downloadPath]] retain];
1988 if (_fileWriter == nil) {
1989 // file system is full or read-only or something
1990 OOLog(kOOOXZErrorLog, @"%@", @"Unable to create download file");
1991 [self cancelUpdate];
1992 }
1993}
@ OXZ_DOWNLOAD_RECEIVING

References OOOXZManager::cancelUpdate, DESTROY, OOOXZManager::downloadPath, kOOOXZDebugLog, kOOOXZErrorLog, nil, OOLog, and OXZ_DOWNLOAD_RECEIVING.

Here is the call graph for this function:

◆ connectionDidFinishLoading:

- (void) connectionDidFinishLoading: (NSURLConnection *) connection

Extends class OOOXZManager.

Definition at line 2022 of file OOOXZManager.m.

2022 :(NSURLConnection*)connection
2023{
2024 _downloadStatus = OXZ_DOWNLOAD_COMPLETE;
2025 OOLog(kOOOXZDebugLog, @"%@", @"Download complete");
2026 [_fileWriter synchronizeFile];
2027 [_fileWriter closeFile];
2028 DESTROY(_fileWriter);
2029 DESTROY(_currentDownload);
2030 if (_interfaceState == OXZ_STATE_UPDATING) {
2031 if (![self processDownloadedManifests]) {
2032 _downloadStatus = OXZ_DOWNLOAD_ERROR;
2033 }
2034 } else if (_interfaceState == OXZ_STATE_INSTALLING) {
2035 if (![self processDownloadedOXZ]) {
2036 _downloadStatus = OXZ_DOWNLOAD_ERROR;
2037 }
2038 } else {
2039 OOLog(kOOOXZErrorLog, @"Error: download completed in unexpected state %d. This is an internal error - please report it.", _interfaceState);
2040 _downloadStatus = OXZ_DOWNLOAD_ERROR;
2041 }
2042}
@ OXZ_STATE_INSTALLING
@ OXZ_DOWNLOAD_COMPLETE

References DESTROY, kOOOXZDebugLog, kOOOXZErrorLog, OOLog, OXZ_DOWNLOAD_COMPLETE, OXZ_DOWNLOAD_ERROR, OXZ_STATE_INSTALLING, OXZ_STATE_UPDATING, processDownloadedManifests, and processDownloadedOXZ.

Here is the call graph for this function:

◆ dataURL

- (NSString *) dataURL

Extends class OOOXZManager.

Definition at line 325 of file OOOXZManager.m.

326{
327 /* Not expected to be set in general, but might be useful for some users */
328 NSString* url = [[NSUserDefaults standardUserDefaults] stringForKey:kOOOXZDataConfig];
329 if (url != nil) {
330 return url;
331 }
332 return kOOOXZDataURL;
333}
static NSString *const kOOOXZDataURL

References dataURL, kOOOXZDataURL, and nil.

Referenced by dataURL, and OOOXZManager::updateManifests.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ downloadPath

- (NSString *) downloadPath

Extends class OOOXZManager.

Definition at line 316 of file OOOXZManager.m.

317{
318 if (_interfaceState == OXZ_STATE_UPDATING) {
319 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZTmpPlistPath];
320 } else {
321 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZTmpPath];
322 }
323}
NSString * cacheDirectoryPathCreatingIfNecessary:(BOOL create)
OOCacheManager * sharedCache()

References OOCacheManager::cacheDirectoryPathCreatingIfNecessary:, downloadPath, OXZ_STATE_UPDATING, and OOCacheManager::sharedCache.

Referenced by beginDownload:, OOOXZManager::cancelUpdate, connection:didReceiveResponse:, downloadPath, processDownloadedManifests, and processDownloadedOXZ.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureInstallPath

- (BOOL) ensureInstallPath

Extends class OOOXZManager.

Definition at line 286 of file OOOXZManager.m.

287{
288 BOOL exists, directory;
289 NSFileManager* fmgr = [NSFileManager defaultManager];
290 NSString* path = [self installPath];
291
292 exists = [fmgr fileExistsAtPath:path isDirectory:&directory];
293
294 if (exists && !directory) {
295 OOLog(kOOOXZErrorLog, @"Expected %@ to be a folder, but it is a file.", path);
296 return NO;
297 }
298 if (!exists) {
299 if (![fmgr oo_createDirectoryAtPath:path attributes:nil]) {
300 OOLog(kOOOXZErrorLog, @"Could not create folder %@.", path);
301 return NO;
302 }
303 }
304
305 return YES;
306}

References ensureInstallPath, OOOXZManager::installPath, kOOOXZErrorLog, nil, and OOLog.

Referenced by ensureInstallPath, and processDownloadedOXZ.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extractionBasePathForIdentifier:andVersion:

- (NSString *) extractionBasePathForIdentifier: (NSString *) identifier
andVersion: (NSString *) version 

Extends class OOOXZManager.

Definition at line 277 of file OOOXZManager.m.

277 :(NSString*)identifier andVersion:(NSString*)version
278{
279 NSString* basePath = [[ResourceManager userRootPaths] lastObject];
280 NSString* rawMainDir = [NSString stringWithFormat:@"%@-%@.off", identifier, version];
281
282 NSCharacterSet* blacklist = [NSCharacterSet characterSetWithCharactersInString:@"'#%^&{}[]/~|\\?<,:\" "];
283 return [[[basePath stringByAppendingPathComponent:[[rawMainDir componentsSeparatedByCharactersInSet:blacklist] componentsJoinedByString:@""]] retain] autorelease];
284}
NSArray * userRootPaths()

References ResourceManager::userRootPaths.

Referenced by extractOXZ:, and OOOXZManager::gui.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extractOXZ:

- (NSString *) extractOXZ: (NSUInteger) item

Extends class OOOXZManager.

Definition at line 1870 of file OOOXZManager.m.

1870 :(NSUInteger)item
1871{
1872 NSFileManager* fmgr = [NSFileManager defaultManager];
1873 NSMutableString* extractionLog = [[NSMutableString alloc] init];
1874 NSDictionary* manifest = [_filteredList oo_dictionaryAtIndex:item];
1875 NSString* version = [manifest oo_stringForKey:kOOManifestVersion];
1876 NSString* identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
1877 NSString* path = [self extractionBasePathForIdentifier:identifier andVersion:version];
1878
1879 // OXZ errors should really never happen unless someone is messing
1880 // directly with the managed folder while Oolite is running, but
1881 // it's possible.
1882
1883 NSString* oxzfile = [manifest oo_stringForKey:kOOManifestFilePath];
1884 if (![fmgr fileExistsAtPath:oxzfile]) {
1885 OOLog(kOOOXZErrorLog, @"OXZ %@ could not be found", oxzfile);
1886 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-no-original")];
1887 return [extractionLog autorelease];
1888 }
1889 const char* zipname = [oxzfile UTF8String];
1890 unzFile uf = NULL;
1891 uf = unzOpen64(zipname);
1892 if (uf == NULL) {
1893 OOLog(kOOOXZErrorLog, @"Could not open .oxz at %@ as zip file", path);
1894 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-bad-original")];
1895 return [extractionLog autorelease];
1896 }
1897
1898 if ([fmgr fileExistsAtPath:path]) {
1899 OOLog(kOOOXZErrorLog, @"Path %@ already exists", path);
1900 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-exists")];
1901 unzClose(uf);
1902 return [extractionLog autorelease];
1903 }
1904 if (![fmgr oo_createDirectoryAtPath:path attributes:nil]) {
1905 OOLog(kOOOXZErrorLog, @"Path %@ could not be created", path);
1906 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-unmakeable")];
1907 unzClose(uf);
1908 return [extractionLog autorelease];
1909 }
1910 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-created")];
1911 NSUInteger counter = 0;
1912 char rawComponentName[512];
1913 BOOL error = NO;
1914 unz_file_info64 file_info = { 0 };
1915 if (unzGoToFirstFile(uf) == UNZ_OK) {
1916 do {
1917 unzGetCurrentFileInfo64(uf, &file_info,
1918 rawComponentName, 512,
1919 NULL, 0,
1920 NULL, 0);
1921 NSString* componentName = [NSString stringWithUTF8String:rawComponentName];
1922 if ([componentName hasSuffix:@"/"]) {
1923 // folder
1924 if (![fmgr oo_createDirectoryAtPath:[path stringByAppendingPathComponent:componentName] attributes:nil]) {
1925 OOLog(kOOOXZErrorLog, @"Subpath %@ could not be created", componentName);
1926 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
1927 error = YES;
1928 break;
1929 } else {
1930 OOLog(kOOOXZDebugLog, @"Subpath %@ created OK", componentName);
1931 }
1932 } else {
1933 // file
1934 // usually folder must now exist, but just in case...
1935 NSString* folder = [[path stringByAppendingPathComponent:componentName] stringByDeletingLastPathComponent];
1936 if ([folder length] > 0 && ![fmgr fileExistsAtPath:folder] && ![fmgr oo_createDirectoryAtPath:folder attributes:nil]) {
1937 OOLog(kOOOXZErrorLog, @"Subpath %@ could not be created", folder);
1938 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
1939 error = YES;
1940 break;
1941 }
1942
1943 // This is less efficient in memory use than just
1944 // streaming out of the ZIP file onto disk
1945 // but it makes error handling easier
1946 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
1947 NSData* tmp = [NSData oo_dataWithOXZFile:[oxzfile stringByAppendingPathComponent:componentName]];
1948 if (tmp == nil) {
1949 OOLog(kOOOXZErrorLog, @"Sub file %@ could not be extracted from the OXZ", componentName);
1950 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
1951 error = YES;
1952 [pool release];
1953 break;
1954 } else {
1955 if (![tmp writeToFile:[path stringByAppendingPathComponent:componentName] atomically:YES]) {
1956 OOLog(kOOOXZErrorLog, @"Sub file %@ could not be created", componentName);
1957 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
1958 error = YES;
1959 [pool release];
1960 break;
1961 } else {
1962 ++counter;
1963 }
1964 }
1965 [pool release];
1966 }
1967 } while (unzGoToNextFile(uf) == UNZ_OK);
1968 }
1969 unzClose(uf);
1970
1971 if (!error) {
1972 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-num-u-extracted"), counter];
1973 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-extracted-to-@"), path];
1974 }
1975
1976 return [extractionLog autorelease];
1977}
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition unzip.c:1058
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition unzip.c:1109
unzFile ZEXPORT unzOpen64(const void *path)
Definition unzip.c:758
int ZEXPORT unzGoToNextFile(unzFile file)
Definition unzip.c:1130
int ZEXPORT unzClose(unzFile file)
Definition unzip.c:768
struct unz_file_info64_s unz_file_info64
voidp unzFile
Definition unzip.h:72
#define UNZ_OK
Definition unzip.h:75

References OOOXZManager::extractionBasePathForIdentifier:andVersion:, kOOOXZDebugLog, kOOOXZErrorLog, nil, OOLog, UNZ_OK, unzClose(), unzGetCurrentFileInfo64(), unzGoToFirstFile(), unzGoToNextFile(), and unzOpen64().

Referenced by OOOXZManager::processSelection.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ humanSize:

- (NSString *) humanSize: (NSUInteger) bytes

Extends class OOOXZManager.

Definition at line 335 of file OOOXZManager.m.

335 :(NSUInteger)bytes
336{
337 if (bytes == 0) {
338 return DESC(@"oolite-oxzmanager-missing-field");
339 } else if (bytes < 1024) {
340 return @"<1 kB";
341 } else if (bytes < 1024 * 1024) {
342 return [NSString stringWithFormat:@"%zu kB", bytes >> 10];
343 } else {
344 return [NSString stringWithFormat:@"%.2f MB", ((float)(bytes >> 10)) / 1024];
345 }
346}

References DESC.

Referenced by OOOXZManager::gui, and OOOXZManager::showInstallOptions.

Here is the caller graph for this function:

◆ installableState:

- (OXZInstallableState) installableState: (NSDictionary *) manifest

Extends class OOOXZManager.

Definition at line 897 of file OOOXZManager.m.

897 :(NSDictionary*)manifest
898{
899 NSString* title = [manifest oo_stringForKey:kOOManifestTitle defaultValue:nil];
900 NSString* identifier = [manifest oo_stringForKey:kOOManifestIdentifier defaultValue:nil];
901 /* Check Oolite version */
902 if (![ResourceManager checkVersionCompatibility:manifest forOXP:title]) {
904 }
905 /* Check for current automated install */
906 NSDictionary* installed = [self installedManifestForIdentifier:identifier];
907 if (installed == nil) {
908 // check for manual install
909 installed = [ResourceManager manifestForIdentifier:identifier];
910 }
911
912 if (installed != nil) {
913 if (![[installed oo_stringForKey:kOOManifestFilePath] hasPrefix:[self installPath]]) {
914 // installed manually
916 }
917 if ([[installed oo_stringForKey:kOOManifestVersion] isEqualToString:[manifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[manifest oo_stringForKey:kOOManifestVersion]]]
918 && [[NSFileManager defaultManager] fileExistsAtPath:[installed oo_stringForKey:kOOManifestFilePath]]) {
919 // installed this exact version already, and haven't
920 // uninstalled it since entering the manager, and it's
921 // still available
923 } else if ([installed oo_stringForKey:kOOManifestAvailableVersion defaultValue:nil] == nil) {
924 // installed, but no remote copy is indexed any more
926 }
927 }
928 /* Check for dependencies being met */
929 if ([ResourceManager manifestHasConflicts:manifest logErrors:NO]) {
931 }
932 if (installed != nil) {
933 NSString* availableVersion = [manifest oo_stringForKey:kOOManifestAvailableVersion];
934 if (availableVersion == nil) {
935 availableVersion = [manifest oo_stringForKey:kOOManifestVersion];
936 }
937 NSString* installedVersion = [installed oo_stringForKey:kOOManifestVersion];
938 OOLog(@"version.debug", @"%@ mv:%@ mav:%@", identifier, installedVersion, availableVersion);
939 if (CompareVersions(ComponentsFromVersionString(installedVersion), ComponentsFromVersionString(availableVersion)) == NSOrderedDescending) {
940 // the installed copy is more recent than the server copy
942 }
944 }
945 if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO]) {
947 }
949}
static NSString *const kOOManifestAvailableVersion
static NSString *const kOOManifestVersion
static NSString *const kOOManifestFilePath
NSArray * ComponentsFromVersionString(NSString *string)
NSComparisonResult CompareVersions(NSArray *version1, NSArray *version2)
NSDictionary * manifestForIdentifier:(NSString *identifier)

References CompareVersions(), ComponentsFromVersionString(), OOOXZManager::installedManifestForIdentifier:, kOOManifestAvailableVersion, kOOManifestFilePath, kOOManifestVersion, ResourceManager::manifestForIdentifier:, nil, OOLog, OXZ_INSTALLABLE_CONFLICTS, OXZ_INSTALLABLE_DEPENDENCIES, OXZ_INSTALLABLE_OKAY, OXZ_INSTALLABLE_UPDATE, OXZ_UNINSTALLABLE_ALREADY, OXZ_UNINSTALLABLE_MANUAL, OXZ_UNINSTALLABLE_NOREMOTE, and OXZ_UNINSTALLABLE_VERSION.

Here is the call graph for this function:

◆ installOptions

- (NSArray *) installOptions

Extends class OOOXZManager.

Definition at line 1519 of file OOOXZManager.m.

1520{
1521 NSUInteger start = _offset;
1522 if (start >= [_filteredList count]) {
1523 start = 0;
1524 _offset = 0;
1525 }
1526 NSUInteger end = start + OXZ_GUI_NUM_LISTROWS;
1527 if (end > [_filteredList count]) {
1528 end = [_filteredList count];
1529 }
1530 return [_filteredList subarrayWithRange:NSMakeRange(start, end - start)];
1531}
@ OXZ_GUI_NUM_LISTROWS
unsigned count

References count, installOptions, and OXZ_GUI_NUM_LISTROWS.

Referenced by installOptions, and OOOXZManager::showInstallOptions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ installOXZ:

- (BOOL) installOXZ: (NSUInteger) item

Extends class OOOXZManager.

Definition at line 1462 of file OOOXZManager.m.

1462 :(NSUInteger)item
1463{
1464 NSArray* picklist = _filteredList;
1465
1466 if ([picklist count] <= item) {
1467 return NO;
1468 }
1469 NSDictionary* manifest = [picklist objectAtIndex:item];
1470 _item = item;
1471
1472 if ([self installableState:manifest] >= OXZ_UNINSTALLABLE_ALREADY) {
1473 OOLog(kOOOXZDebugLog, @"Cannot install %@", manifest);
1474 // can't be installed on this version of Oolite, or already is installed
1475 return NO;
1476 }
1477 NSString* url = [manifest objectForKey:kOOManifestDownloadURL];
1478 if (url == nil) {
1479 OOLog(kOOOXZErrorLog, @"%@", @"Manifest does not have a download URL - cannot install");
1480 return NO;
1481 }
1482 NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
1483 if (_downloadStatus != OXZ_DOWNLOAD_NONE) {
1484 return NO;
1485 }
1486 _downloadStatus = OXZ_DOWNLOAD_STARTED;
1487 _interfaceState = OXZ_STATE_INSTALLING;
1488
1489 [self setProgressStatus:@""];
1490 return [self beginDownload:request];
1491}
@ OXZ_DOWNLOAD_STARTED
@ OXZ_DOWNLOAD_NONE

References OOOXZManager::beginDownload:, count, kOOOXZDebugLog, kOOOXZErrorLog, nil, OOLog, OXZ_DOWNLOAD_NONE, OXZ_DOWNLOAD_STARTED, OXZ_STATE_INSTALLING, OXZ_UNINSTALLABLE_ALREADY, and OOOXZManager::setProgressStatus:.

Referenced by OOOXZManager::processSelection, and updateAllOXZ.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ installStatusForManifest:

- (NSString *) installStatusForManifest: (NSDictionary *) manifest

Extends class OOOXZManager.

Definition at line 974 of file OOOXZManager.m.

974 :(NSDictionary*)manifest
975{
976 switch ([self installableState:manifest]) {
978 return DESC(@"oolite-oxzmanager-installable-okay");
980 return DESC(@"oolite-oxzmanager-installable-update");
982 return DESC(@"oolite-oxzmanager-installable-depend");
984 return DESC(@"oolite-oxzmanager-installable-conflicts");
986 return DESC(@"oolite-oxzmanager-installable-already");
988 return DESC(@"oolite-oxzmanager-installable-manual");
990 return DESC(@"oolite-oxzmanager-installable-version");
992 return DESC(@"oolite-oxzmanager-installable-noremote");
993 }
994 return nil; // never
995}

References DESC, nil, OXZ_INSTALLABLE_CONFLICTS, OXZ_INSTALLABLE_DEPENDENCIES, OXZ_INSTALLABLE_OKAY, OXZ_INSTALLABLE_UPDATE, OXZ_UNINSTALLABLE_ALREADY, OXZ_UNINSTALLABLE_MANUAL, OXZ_UNINSTALLABLE_NOREMOTE, and OXZ_UNINSTALLABLE_VERSION.

Referenced by OOOXZManager::showInstallOptions, and OOOXZManager::showRemoveOptions.

Here is the caller graph for this function:

◆ manifestPath

- (NSString *) manifestPath

Extends class OOOXZManager.

Definition at line 308 of file OOOXZManager.m.

309{
310 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZManifestCache];
311}

References OOCacheManager::cacheDirectoryPathCreatingIfNecessary:, manifestPath, and OOCacheManager::sharedCache.

Referenced by OOOXZManager::init, manifestPath, and processDownloadedManifests.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processDownloadedManifests

- (BOOL) processDownloadedManifests

Extends class OOOXZManager.

Definition at line 660 of file OOOXZManager.m.

661{
662 if (_downloadStatus != OXZ_DOWNLOAD_COMPLETE) {
663 return NO;
664 }
665 [self setOXZList:OOArrayFromFile([self downloadPath])];
666 if (_oxzList != nil) {
667 [_oxzList writeToFile:[self manifestPath] atomically:YES];
668 // and clean up the temp file
669 [[NSFileManager defaultManager] oo_removeItemAtPath:[self downloadPath]];
670 // invalidate the managed list
671 DESTROY(_managedList);
672 _interfaceState = OXZ_STATE_TASKDONE;
673 [self gui];
674 return YES;
675 } else {
676 _downloadStatus = OXZ_DOWNLOAD_ERROR;
677 OOLog(kOOOXZErrorLog, @"Downloaded manifest was not a valid plist, has been left in %@", [self downloadPath]);
678 // revert to the old one
679 [self setOXZList:OOArrayFromFile([self manifestPath])];
680 _interfaceState = OXZ_STATE_TASKDONE;
681 [self gui];
682 return NO;
683 }
684}
@ OXZ_STATE_TASKDONE

References DESTROY, OOOXZManager::downloadPath, downloadPath, OOOXZManager::gui, kOOOXZErrorLog, OOOXZManager::manifestPath, nil, OOLog, OXZ_DOWNLOAD_COMPLETE, OXZ_DOWNLOAD_ERROR, OXZ_STATE_TASKDONE, processDownloadedManifests, and OOOXZManager::setOXZList:.

Referenced by connectionDidFinishLoading:, and processDownloadedManifests.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processDownloadedOXZ

- (BOOL) processDownloadedOXZ

If downloadedManifest is in _dependencyStack, remove it Get downloadedManifest requires_oxp list Add entries ones to _dependencyStack If _dependencyStack has contents, update _progressStatus ...and start the download of the 'first' item in _dependencyStack ...which isn't already installed (_dependencyStack is unordered ...so 'first' isn't really defined)

...if the item in _dependencyStack is not findable (e.g. wrong ...version) then stop here.

Extends class OOOXZManager.

Definition at line 686 of file OOOXZManager.m.

687{
688 if (_downloadStatus != OXZ_DOWNLOAD_COMPLETE) {
689 return NO;
690 }
691
692 NSDictionary* downloadedManifest = OODictionaryFromFile([[self downloadPath] stringByAppendingPathComponent:@"manifest.plist"]);
693 if (downloadedManifest == nil) {
694 _downloadStatus = OXZ_DOWNLOAD_ERROR;
695 OOLog(kOOOXZErrorLog, @"Downloaded OXZ does not contain a manifest.plist, has been left in %@", [self downloadPath]);
696 _interfaceState = OXZ_STATE_TASKDONE;
697 [self gui];
698 return NO;
699 }
700 NSDictionary* expectedManifest = nil;
701 expectedManifest = [_filteredList objectAtIndex:_item];
702
703 if (expectedManifest == nil || (![[downloadedManifest oo_stringForKey:kOOManifestIdentifier] isEqualToString:[expectedManifest oo_stringForKey:kOOManifestIdentifier]]) || (![[downloadedManifest oo_stringForKey:kOOManifestVersion] isEqualToString:[expectedManifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[expectedManifest oo_stringForKey:kOOManifestVersion]]])) {
704 _downloadStatus = OXZ_DOWNLOAD_ERROR;
705 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.");
706 _interfaceState = OXZ_STATE_TASKDONE;
707 [self gui];
708 return NO;
709 }
710 // this appears to be the OXZ we expected
711 // filename is going to be identifier.oxz
712 NSString* filename = [[downloadedManifest oo_stringForKey:kOOManifestIdentifier] stringByAppendingString:@".oxz"];
713
714 if (![self ensureInstallPath]) {
715 _downloadStatus = OXZ_DOWNLOAD_ERROR;
716 OOLog(kOOOXZErrorLog, @"%@", @"Unable to create installation folder.");
717 _interfaceState = OXZ_STATE_TASKDONE;
718 [self gui];
719 return NO;
720 }
721
722 // delete filename if it exists from OXZ folder
723 NSString* destination = [[self installPath] stringByAppendingPathComponent:filename];
724 [[NSFileManager defaultManager] oo_removeItemAtPath:destination];
725
726 // move the temp file on to it
727 if (![[NSFileManager defaultManager] oo_moveItemAtPath:[self downloadPath] toPath:destination]) {
728 _downloadStatus = OXZ_DOWNLOAD_ERROR;
729 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
730 _interfaceState = OXZ_STATE_TASKDONE;
731 [self gui];
732 return NO;
733 }
734 _changesMade = YES;
735 DESTROY(_managedList); // will need updating
736 // do this now to cope with circular dependencies on download
738
751 NSArray*
752 requires
753 = [downloadedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
754 if (requires == nil) {
755 // just in case the requirements are only specified in the online copy
756 requires = [expectedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
757 }
758 NSDictionary* requirement = nil;
759 NSMutableString* progress = [NSMutableString stringWithCapacity:2048];
760 OOLog(kOOOXZDebugLog, @"Dependency stack has %zu elements", [_dependencyStack count]);
761
762 if ([_dependencyStack count] > 0) {
763 // will remove as iterate, so create a temp copy to iterate over
764 NSSet* tempStack = [NSSet setWithSet:_dependencyStack];
765 foreach (requirement, tempStack) {
766 OOLog(kOOOXZDebugLog, @"Dependency stack: checking %@", [requirement oo_stringForKey:kOOManifestRelationIdentifier]);
767 if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]
768 && requires != nil && [requires containsObject:requirement]) {
769 // it was unmet, but now it's met
770 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-now-has-@"), [requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
771 [_dependencyStack removeObject:requirement];
772 OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: requirement met");
773 } else if ([[requirement oo_stringForKey:kOOManifestRelationIdentifier] isEqualToString:[downloadedManifest oo_stringForKey:kOOManifestIdentifier]]) {
774 // remove the requirement for the just downloaded OXP
775 [_dependencyStack removeObject:requirement];
776 }
777 }
778 }
779 if (requires != nil) {
780 foreach (requirement, requires) {
781 if ([ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]) {
782 OOLog(kOOOXZDebugLog, @"Dependency stack: adding %@", [requirement oo_stringForKey:kOOManifestRelationIdentifier]);
783 [_dependencyStack addObject:requirement];
784 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-requires-@"), [requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
785 }
786 }
787 }
788 if ([_dependencyStack count] > 0) {
789 // get an object from the requirements list, and download it
790 // if it can be found
791 BOOL undownloadedRequirement = NO;
792 NSDictionary* availableDownload = nil;
793 BOOL foundDownload = NO;
794 NSUInteger index = 0;
795 NSString* needsIdentifier = nil;
796
797 do {
798 undownloadedRequirement = YES;
799 requirement = [_dependencyStack anyObject];
800 OOLog(kOOOXZDebugLog, @"Dependency stack: next is %@", [requirement oo_stringForKey:kOOManifestRelationIdentifier]);
801
802 if (!_downloadAllDependencies) {
803 [progress appendString:DESC(@"oolite-oxzmanager-progress-get-required")];
804 }
805 needsIdentifier = [requirement oo_stringForKey:kOOManifestRelationIdentifier];
806
807 foreach (availableDownload, _oxzList) {
808 if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:needsIdentifier]) {
809 if ([ResourceManager matchVersions:requirement withVersion:[availableDownload oo_stringForKey:kOOManifestVersion]]) {
810 OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: found download for next item");
811 foundDownload = YES;
812 index = [_oxzList indexOfObject:availableDownload];
813 break;
814 }
815 }
816 }
817
818 if (foundDownload) {
819 if ([self installableState:[_oxzList objectAtIndex:index]] == OXZ_UNINSTALLABLE_ALREADY) {
820 OOLog(kOOOXZDebugLog, @"Dependency stack: %@ is downloaded but not yet loadable, removing from list.", [requirement oo_stringForKey:kOOManifestRelationIdentifier]);
821 // then this has already been downloaded, but
822 // can't be configured yet presumably because
823 // another dependency is still to be loaded
824 [_dependencyStack removeObject:requirement];
825 if ([_dependencyStack count] > 0) {
826 // try again
827 undownloadedRequirement = NO;
828 } else {
829 // this case should probably never happen
830 // is handled below just in case
831 foundDownload = NO;
832 }
833 }
834 }
835 } while (!undownloadedRequirement);
836
837 if (foundDownload) {
838 // must clear filters entirely at this point
839 [self setFilteredList:_oxzList];
840 // then download that item
841 _downloadStatus = OXZ_DOWNLOAD_NONE;
842 if (_downloadAllDependencies) {
843 OOLog(kOOOXZDebugLog, @"Dependency stack: installing %zu from list", index);
844 if (![self installOXZ:index]) {
845 // if a required dependency is somehow uninstallable
846 // e.g. required+maximum version don't match this Oolite
847 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-required-@-not-found"), [requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
848 [self setProgressStatus:progress];
849 OOLog(kOOOXZErrorLog, @"OXZ dependency %@ could not be found for automatic download.", needsIdentifier);
850 _downloadStatus = OXZ_DOWNLOAD_ERROR;
851 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
852 _interfaceState = OXZ_STATE_TASKDONE;
853 [self gui];
854 return NO;
855 }
856 } else {
857 _interfaceState = OXZ_STATE_DEPENDENCIES;
858 _item = index;
859 }
860 [self setProgressStatus:progress];
861 [self gui];
862 return YES;
863 }
864 // this is probably always the case, see above
865 else if ([_dependencyStack count] > 0) {
866 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-required-@-not-found"), [requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
867 [self setProgressStatus:progress];
868 OOLog(kOOOXZErrorLog, @"OXZ dependency %@ could not be found for automatic download.", needsIdentifier);
869 _downloadStatus = OXZ_DOWNLOAD_ERROR;
870 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
871 _interfaceState = OXZ_STATE_TASKDONE;
872 [self gui];
873 return NO;
874 }
875 }
876
877 [self setProgressStatus:@""];
878 _interfaceState = OXZ_STATE_TASKDONE;
879 [_dependencyStack removeAllObjects]; // just in case
880 _downloadAllDependencies = NO;
881 [self gui];
882 return YES;
883}
static NSString *const kOOManifestRelationIdentifier
static NSString *const kOOManifestIdentifier
@ OXZ_STATE_DEPENDENCIES
NSDictionary * OODictionaryFromFile(NSString *path)
void resetManifestKnowledgeForOXZManager()
const char * filename
Definition ioapi.h:125

References count, DESTROY, downloadPath, ensureInstallPath, OOOXZManager::gui, OOOXZManager::installPath, kOOManifestAvailableVersion, kOOManifestIdentifier, kOOManifestRelationIdentifier, kOOManifestVersion, kOOOXZDebugLog, kOOOXZErrorLog, nil, OODictionaryFromFile(), OOLog, OXZ_DOWNLOAD_COMPLETE, OXZ_DOWNLOAD_ERROR, OXZ_DOWNLOAD_NONE, OXZ_STATE_DEPENDENCIES, OXZ_STATE_TASKDONE, OXZ_UNINSTALLABLE_ALREADY, processDownloadedOXZ, ResourceManager::resetManifestKnowledgeForOXZManager, OOOXZManager::setFilteredList:, and OOOXZManager::setProgressStatus:.

Referenced by connectionDidFinishLoading:, and processDownloadedOXZ.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeOptions

- (NSArray *) removeOptions

Extends class OOOXZManager.

Definition at line 1703 of file OOOXZManager.m.

1704{
1705 NSArray* remList = _filteredList;
1706 if ([remList count] == 0) {
1707 return nil;
1708 }
1709 NSUInteger start = _offset;
1710 if (start >= [remList count]) {
1711 start = 0;
1712 _offset = 0;
1713 }
1714 NSUInteger end = start + OXZ_GUI_NUM_LISTROWS;
1715 if (end > [remList count]) {
1716 end = [remList count];
1717 }
1718 return [remList subarrayWithRange:NSMakeRange(start, end - start)];
1719}

References count, nil, OXZ_GUI_NUM_LISTROWS, and removeOptions.

Referenced by removeOptions, and OOOXZManager::showRemoveOptions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeOXZ:

- (BOOL) removeOXZ: (NSUInteger) item

Extends class OOOXZManager.

Definition at line 1679 of file OOOXZManager.m.

1679 :(NSUInteger)item
1680{
1681 NSArray* remList = _filteredList;
1682 if ([remList count] <= item) {
1683 OOLog(kOOOXZDebugLog, @"Unable to remove item %zu as only %zu in list", item, [remList count]);
1684 return NO;
1685 }
1686 NSString* filename = [[remList objectAtIndex:item] oo_stringForKey:kOOManifestFilePath];
1687 if (filename == nil) {
1688 OOLog(kOOOXZDebugLog, @"Unable to remove item %zu as filename not found", item);
1689 return NO;
1690 }
1691
1692 if (![[NSFileManager defaultManager] oo_removeItemAtPath:filename]) {
1693 OOLog(kOOOXZErrorLog, @"Unable to remove file %@", filename);
1694 return NO;
1695 }
1696 _changesMade = YES;
1697 DESTROY(_managedList); // will need updating
1698 _interfaceState = OXZ_STATE_REMOVING;
1699 [self gui];
1700 return YES;
1701}
@ OXZ_STATE_REMOVING

References count, DESTROY, OOOXZManager::gui, kOOOXZDebugLog, kOOOXZErrorLog, nil, OOLog, and OXZ_STATE_REMOVING.

Referenced by OOOXZManager::processSelection.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentDownload:withLabel:

- (void) setCurrentDownload: (NSURLConnection *) download
withLabel: (NSString *) label 

Extends class OOOXZManager.

Definition at line 531 of file OOOXZManager.m.

531 :(NSURLConnection*)download withLabel:(NSString*)label
532{
533 if (_currentDownload != nil) {
534 [_currentDownload cancel]; // releases via delegate
535 }
536 _currentDownload = [download retain];
537 DESTROY(_currentDownloadName);
538 _currentDownloadName = [label copy];
539}

References DESTROY, and nil.

Referenced by beginDownload:, and OOOXZManager::dealloc.

Here is the caller graph for this function:

◆ setFilteredList:

- (void) setFilteredList: (NSArray *) list

Extends class OOOXZManager.

Definition at line 358 of file OOOXZManager.m.

358 :(NSArray*)list
359{
360 DESTROY(_filteredList);
361 _filteredList = [list copy]; // copy retains
362}

References DESTROY.

Referenced by OOOXZManager::gui, processDownloadedOXZ, OOOXZManager::showOptionsUpdate, and updateAllOXZ.

Here is the caller graph for this function:

◆ setOXZList:

- (void) setOXZList: (NSArray *) list

Extends class OOOXZManager.

Definition at line 348 of file OOOXZManager.m.

348 :(NSArray*)list
349{
350 DESTROY(_oxzList);
351 if (list != nil) {
352 _oxzList = [[list sortedArrayUsingFunction:oxzSort context:NULL] retain];
353 // needed for update to available versions
354 DESTROY(_managedList);
355 }
356}

References DESTROY, and nil.

Referenced by OOOXZManager::init, and processDownloadedManifests.

Here is the caller graph for this function:

◆ setProgressStatus:

- (void) setProgressStatus: (NSString *) newStatus

Extends class OOOXZManager.

Definition at line 541 of file OOOXZManager.m.

541 :(NSString*)new
542{
543 DESTROY(_progressStatus);
544 _progressStatus = [new copy];
545}

References DESTROY.

Referenced by OOOXZManager::init, installOXZ:, processDownloadedOXZ, OOOXZManager::processSelection, and OOOXZManager::updateManifests.

Here is the caller graph for this function:

◆ updateAllOXZ

- (BOOL) updateAllOXZ

Extends class OOOXZManager.

Definition at line 1493 of file OOOXZManager.m.

1494{
1495 [_dependencyStack removeAllObjects];
1496 _downloadAllDependencies = YES;
1497 [self setFilteredList:_oxzList];
1498 NSDictionary* manifest = nil;
1499
1500 foreach (manifest, _oxzList) {
1501 if ([self installableState:manifest] == OXZ_INSTALLABLE_UPDATE) {
1502 OOLog(kOOOXZDebugLog, @"Queuing in for update: %@", manifest);
1503 [_dependencyStack addObject:manifest];
1504 }
1505 }
1506 NSDictionary* first = [_dependencyStack anyObject];
1507 NSString* identifier = [first oo_stringForKey:kOOManifestRelationIdentifier];
1508 NSUInteger item = NSUIntegerMax;
1509 NSDictionary* availableDownload = nil;
1510 foreach (availableDownload, _oxzList) {
1511 if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:identifier]) {
1512 item = [_oxzList indexOfObject:availableDownload];
1513 break;
1514 }
1515 }
1516 return [self installOXZ:item];
1517}

References OOOXZManager::installOXZ:, kOOManifestIdentifier, kOOOXZDebugLog, nil, OOLog, OXZ_INSTALLABLE_UPDATE, OOOXZManager::setFilteredList:, and updateAllOXZ.

Referenced by OOOXZManager::processSelection, and updateAllOXZ.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateFilter:

- (BOOL) validateFilter: (NSString *) input

Extends class OOOXZManager.

Definition at line 513 of file OOOXZManager.m.

513 :(NSString*)input
514{
515 NSString* filter = [input lowercaseString];
516 if (([filter length] == 0) // empty is valid
517 || ([filter isEqualToString:kOOOXZFilterAll])
518 || ([filter isEqualToString:kOOOXZFilterUpdates])
519 || ([filter isEqualToString:kOOOXZFilterInstallable])
520 || ([filter hasPrefix:kOOOXZFilterKeyword] && [filter length] > [kOOOXZFilterKeyword length])
521 || ([filter hasPrefix:kOOOXZFilterAuthor] && [filter length] > [kOOOXZFilterAuthor length])
522 || ([filter hasPrefix:kOOOXZFilterDays] && [[filter substringFromIndex:[kOOOXZFilterDays length]] intValue] > 0)
523 || ([filter hasPrefix:kOOOXZFilterTag] && [filter length] > [kOOOXZFilterTag length])
524 || ([filter hasPrefix:kOOOXZFilterCategory] && [filter length] > [kOOOXZFilterCategory length])) {
525 return YES;
526 }
527
528 return NO;
529}
static NSString *const kOOOXZFilterAll

References kOOOXZFilterAll, kOOOXZFilterAuthor, kOOOXZFilterCategory, kOOOXZFilterDays, kOOOXZFilterInstallable, kOOOXZFilterKeyword, kOOOXZFilterTag, and kOOOXZFilterUpdates.


The documentation for this category was generated from the following file: