Oolite 1.91.0.7712-251017-85ce217
Loading...
Searching...
No Matches
OOOXZManager Class Reference

#include <OOOXZManager.h>

Inheritance diagram for OOOXZManager:
Collaboration diagram for OOOXZManager:

Instance Methods

(NSString *) - installPath
(BOOL) - updateManifests
(BOOL) - cancelUpdate
(NSArray *) - manifests
(NSArray *) - managedOXZs
(void) - gui
(BOOL) - isRestarting
(BOOL) - isAcceptingTextInput
(BOOL) - isAcceptingGUIInput
(void) - processSelection
(void) - processTextInput:
(void) - refreshTextInput:
(void) - processFilterKey
(void) - processShowInfoKey
(void) - processExtractKey
(OOGUIRow- showInstallOptions
(OOGUIRow- showRemoveOptions
(void) - showOptionsUpdate
(void) - showOptionsPrev
(void) - showOptionsNext
(void) - processOptionsPrev
(void) - processOptionsNext
(id) - init [implementation]
(void) - dealloc [implementation]
(NSString *) - extractionBasePathForIdentifier:andVersion: [implementation]
(BOOL) - ensureInstallPath [implementation]
(NSString *) - manifestPath [implementation]
(NSString *) - downloadPath [implementation]
(NSString *) - dataURL [implementation]
(NSString *) - humanSize: [implementation]
(void) - setOXZList: [implementation]
(void) - setFilteredList: [implementation]
(void) - setFilter: [implementation]
(NSArray *) - applyCurrentFilter: [implementation]
(BOOL) - applyFilterByNoFilter: [implementation]
(BOOL) - applyFilterByUpdateRequired: [implementation]
(BOOL) - applyFilterByInstallable: [implementation]
(BOOL) - applyFilterByKeyword:keyword: [implementation]
(BOOL) - applyFilterByAuthor:author: [implementation]
(BOOL) - applyFilterByDays:days: [implementation]
(BOOL) - applyFilterByTag:tag: [implementation]
(BOOL) - applyFilterByCategory:category: [implementation]
(BOOL) - validateFilter: [implementation]
(void) - setCurrentDownload:withLabel: [implementation]
(void) - setProgressStatus: [implementation]
(BOOL) - beginDownload: [implementation]
(BOOL) - processDownloadedManifests [implementation]
(BOOL) - processDownloadedOXZ [implementation]
(NSDictionary *) - installedManifestForIdentifier: [implementation]
(OXZInstallableState- installableState: [implementation]
(OOColor *) - colorForManifest: [implementation]
(NSString *) - installStatusForManifest: [implementation]
(BOOL) - installOXZ: [implementation]
(BOOL) - updateAllOXZ [implementation]
(NSArray *) - installOptions [implementation]
(BOOL) - removeOXZ: [implementation]
(NSArray *) - removeOptions [implementation]
(NSString *) - extractOXZ: [implementation]
(void) - connection:didReceiveResponse: [implementation]
(void) - connection:didReceiveData: [implementation]
(void) - connectionDidFinishLoading: [implementation]
(void) - connection:didFailWithError: [implementation]

Class Methods

(OOOXZManager *) + sharedManager

Private Attributes

NSArray * _oxzList
NSArray * _managedList
NSArray * _filteredList
NSString * _currentFilter
OXZInterfaceState _interfaceState
BOOL _interfaceShowingOXZDetail
BOOL _changesMade
NSURLConnection * _currentDownload
NSString * _currentDownloadName
OXZDownloadStatus _downloadStatus
NSUInteger _downloadProgress
NSUInteger _downloadExpected
NSFileHandle * _fileWriter
NSUInteger _item
BOOL _downloadAllDependencies
NSUInteger _offset
NSString * _progressStatus
NSMutableSet * _dependencyStack

Detailed Description

Definition at line 60 of file OOOXZManager.h.

Method Documentation

◆ applyCurrentFilter:

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

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 370 of file OOOXZManager.m.

370 :(NSArray *)list
371{
372 SEL filterSelector = @selector(applyFilterByNoFilter:);
373 NSString *parameter = nil;
374 if ([_currentFilter isEqualToString:kOOOXZFilterUpdates])
375 {
376 filterSelector = @selector(applyFilterByUpdateRequired:);
377 }
378 else if ([_currentFilter isEqualToString:kOOOXZFilterInstallable])
379 {
380 filterSelector = @selector(applyFilterByInstallable:);
381 }
382 else if ([_currentFilter hasPrefix:kOOOXZFilterKeyword])
383 {
384 filterSelector = @selector(applyFilterByKeyword:keyword:);
385 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterKeyword length]];
386 }
387 else if ([_currentFilter hasPrefix:kOOOXZFilterAuthor])
388 {
389 filterSelector = @selector(applyFilterByAuthor:author:);
390 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterAuthor length]];
391 }
392 else if ([_currentFilter hasPrefix:kOOOXZFilterDays])
393 {
394 filterSelector = @selector(applyFilterByDays:days:);
395 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterDays length]];
396 }
397 else if ([_currentFilter hasPrefix:kOOOXZFilterTag])
398 {
399 filterSelector = @selector(applyFilterByTag:tag:);
400 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterTag length]];
401 }
402 else if ([_currentFilter hasPrefix:kOOOXZFilterCategory])
403 {
404 filterSelector = @selector(applyFilterByCategory:category:);
405 parameter = [_currentFilter substringFromIndex:[kOOOXZFilterCategory length]];
406 }
407
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)
414 {
415 [invocation setArgument:&parameter atIndex:3];
416 }
417
418 foreach(manifest, list)
419 {
420 [invocation setArgument:&manifest atIndex:2];
421 [invocation invoke];
422 BOOL filterAccepted = NO;
423 [invocation getReturnValue:&filterAccepted];
424 if (filterAccepted)
425 {
426 [filteredList addObject:manifest];
427 }
428 }
429 // any bad filter that gets this far is also treated as '*'
430 // so don't need to explicitly test for '*' or ''
431 return [[filteredList copy] autorelease];
432}
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
NSString * _currentFilter

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

Referenced by gui, and showOptionsUpdate.

Here is the caller graph for this function:

◆ applyFilterByAuthor:author:

- (BOOL) applyFilterByAuthor: (NSDictionary *) manifest
author: (NSString *) author 
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 483 of file OOOXZManager.m.

483 :(NSDictionary *)manifest author:(NSString *)author
484{
485 // trim any eventual leading whitespace from input string
486 author = [author stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
487
488 NSString *mAuth = [manifest oo_stringForKey:kOOManifestAuthor];
489 return ([mAuth rangeOfString:author options:NSCaseInsensitiveSearch].location != NSNotFound);
490}

◆ applyFilterByCategory:category:

- (BOOL) applyFilterByCategory: (NSDictionary *) manifest
category: (NSString *) category 
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 529 of file OOOXZManager.m.

529 :(NSDictionary *)manifest category:(NSString *)category
530{
531 // trim any eventual leading whitespace from input string
532 category = [category stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
533
534 NSString *mCategory = [manifest oo_stringForKey:kOOManifestCategory];
535 return ([mCategory rangeOfString:category options:NSCaseInsensitiveSearch].location != NSNotFound);
536}

◆ applyFilterByDays:days:

- (BOOL) applyFilterByDays: (NSDictionary *) manifest
days: (NSString *) days 
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 493 of file OOOXZManager.m.

493 :(NSDictionary *)manifest days:(NSString *)days
494{
495 NSInteger i = [days integerValue];
496 if (i < 1)
497 {
498 return NO;
499 }
500 else
501 {
502 NSUInteger updated = [manifest oo_unsignedIntegerForKey:kOOManifestUploadDate];
503 NSUInteger now = (NSUInteger)[[NSDate date] timeIntervalSince1970];
504 return (updated + (86400 * i) > now);
505 }
506}

◆ applyFilterByInstallable:

- (BOOL) applyFilterByInstallable: (NSDictionary *) manifest
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 448 of file OOOXZManager.m.

448 :(NSDictionary *)manifest
449{
450 return ([self installableState:manifest] < OXZ_UNINSTALLABLE_ALREADY);
451}
@ OXZ_UNINSTALLABLE_ALREADY

References OXZ_UNINSTALLABLE_ALREADY.

◆ applyFilterByKeyword:keyword:

- (BOOL) applyFilterByKeyword: (NSDictionary *) manifest
keyword: (NSString *) keyword 
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 454 of file OOOXZManager.m.

454 :(NSDictionary *)manifest keyword:(NSString *)keyword
455{
456 NSString *parameter = nil;
457 NSArray *parameters = [NSArray arrayWithObjects:kOOManifestTitle,kOOManifestDescription,kOOManifestCategory,nil];
458
459 // trim any eventual leading whitespace from input string
460 keyword = [keyword stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
461
462 foreach (parameter,parameters)
463 {
464 if ([[manifest oo_stringForKey:parameter] rangeOfString:keyword options:NSCaseInsensitiveSearch].location != NSNotFound)
465 {
466 return YES;
467 }
468 }
469 // tags are slightly different
470 parameters = [manifest oo_arrayForKey:kOOManifestTags];
471 foreach (parameter,parameters)
472 {
473 if ([parameter rangeOfString:keyword options:NSCaseInsensitiveSearch].location != NSNotFound)
474 {
475 return YES;
476 }
477 }
478
479 return NO;
480}

References nil.

◆ applyFilterByNoFilter:

- (BOOL) applyFilterByNoFilter: (NSDictionary *) manifest
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 436 of file OOOXZManager.m.

436 :(NSDictionary *)manifest
437{
438 return YES;
439}

◆ applyFilterByTag:tag:

- (BOOL) applyFilterByTag: (NSDictionary *) manifest
tag: (NSString *) tag 
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 509 of file OOOXZManager.m.

509 :(NSDictionary *)manifest tag:(NSString *)tag
510{
511 NSString *parameter = nil;
512 NSArray *parameters = [manifest oo_arrayForKey:kOOManifestTags];
513
514 // trim any eventual leading whitespace from input string
515 tag = [tag stringByTrimmingLeadingWhitespaceAndNewlineCharacters];
516
517 foreach (parameter,parameters)
518 {
519 if ([parameter rangeOfString:tag options:NSCaseInsensitiveSearch].location != NSNotFound)
520 {
521 return YES;
522 }
523 }
524
525 return NO;
526}

References nil.

◆ applyFilterByUpdateRequired:

- (BOOL) applyFilterByUpdateRequired: (NSDictionary *) manifest
implementation

Provided by category OOOXZManager(OOFilterRules).

Definition at line 442 of file OOOXZManager.m.

442 :(NSDictionary *)manifest
443{
444 return ([self installableState:manifest] == OXZ_INSTALLABLE_UPDATE);
445}
@ OXZ_INSTALLABLE_UPDATE

References OXZ_INSTALLABLE_UPDATE.

◆ beginDownload:

- (BOOL) beginDownload: (NSMutableURLRequest *) request
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 595 of file OOOXZManager.m.

595 :(NSMutableURLRequest *)request
596{
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];
600 if (download)
601 {
604 NSString *label = DESC(@"oolite-oxzmanager-download-label-list");
606 {
607 NSDictionary *expectedManifest = nil;
608 expectedManifest = [_filteredList objectAtIndex:_item];
609
610 label = [expectedManifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-download-label-oxz")];
611 }
612
613 [self setCurrentDownload:download withLabel:label]; // retains it
614 [download release];
615 OOLog(kOOOXZDebugLog,@"Download request received, using %@ and downloading to %@",[request URL],[self downloadPath]);
616 return YES;
617 }
618 else
619 {
620 OOLog(kOOOXZErrorLog,@"Unable to start downloading file at %@",[request URL]);
622 return NO;
623 }
624}
#define OOLog(class, format,...)
Definition OOLogging.h:88
@ OXZ_STATE_UPDATING
@ OXZ_DOWNLOAD_ERROR
static NSString *const kOOOXZErrorLog
static NSString *const kOOOXZDebugLog
#define DESC(key)
Definition Universe.h:846
OXZDownloadStatus _downloadStatus
NSUInteger _downloadExpected
NSString * downloadPath()
OXZInterfaceState _interfaceState
NSUInteger _downloadProgress

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

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::installOXZ:, and updateManifests.

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

◆ cancelUpdate

- (BOOL) cancelUpdate

Definition at line 627 of file OOOXZManager.m.

628{
630 {
631 return NO;
632 }
633 OOLog(kOOOXZDebugLog, @"%@", @"Trying to cancel file download");
634 if (_currentDownload != nil)
635 {
636 [_currentDownload cancel];
637 }
639 {
640 NSString *path = [self downloadPath];
641 [[NSFileManager defaultManager] oo_removeItemAtPath:path];
642 }
645 {
647 }
648 else
649 {
651 }
652 [self gui];
653 return YES;
654}
@ OXZ_STATE_INSTALLING
@ OXZ_STATE_PICK_INSTALL
@ OXZ_STATE_MAIN
@ OXZ_DOWNLOAD_COMPLETE
@ OXZ_DOWNLOAD_NONE
NSURLConnection * _currentDownload

References _currentDownload, _downloadStatus, _interfaceState, cancelUpdate, downloadPath, gui, kOOOXZDebugLog, nil, OOLog, OXZ_DOWNLOAD_COMPLETE, OXZ_DOWNLOAD_NONE, OXZ_STATE_INSTALLING, OXZ_STATE_MAIN, OXZ_STATE_PICK_INSTALL, and OXZ_STATE_UPDATING.

Referenced by cancelUpdate, OOOXZManager(NSURLConnectionDataDelegate)::connection:didReceiveResponse:, and processSelection.

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

◆ colorForManifest:

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

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1059 of file OOOXZManager.m.

1059 :(NSDictionary *)manifest
1060{
1061 switch ([self installableState:manifest])
1062 {
1064 return [OOColor yellowColor];
1066 return [OOColor cyanColor];
1068 return [OOColor orangeColor];
1070 return [OOColor brownColor];
1072 return [OOColor whiteColor];
1074 return [OOColor redColor];
1076 return [OOColor grayColor];
1078 return [OOColor blueColor];
1079 }
1080 return [OOColor yellowColor]; // never
1081}
@ OXZ_INSTALLABLE_DEPENDENCIES
@ OXZ_INSTALLABLE_CONFLICTS
@ OXZ_INSTALLABLE_OKAY
@ OXZ_UNINSTALLABLE_VERSION
@ OXZ_UNINSTALLABLE_NOREMOTE
@ OXZ_UNINSTALLABLE_MANUAL
OOColor * cyanColor()
Definition OOColor.m:286
OOColor * orangeColor()
Definition OOColor.m:304
OOColor * redColor()
Definition OOColor.m:268
OOColor * blueColor()
Definition OOColor.m:280
OOColor * grayColor()
Definition OOColor.m:262
OOColor * whiteColor()
Definition OOColor.m:256
OOColor * brownColor()
Definition OOColor.m:316
OOColor * yellowColor()
Definition OOColor.m:292

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 showInstallOptions, and 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 
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 2344 of file OOOXZManager.m.

2344 :(NSURLConnection *)connection didFailWithError:(NSError *)error
2345{
2347 OOLog(kOOOXZErrorLog,@"Error downloading file: %@",[error description]);
2348 [_fileWriter closeFile];
2351}
#define DESTROY(x)
Definition OOCocoa.h:77
NSFileHandle * _fileWriter

References DESTROY, kOOOXZErrorLog, OOLog, and OXZ_DOWNLOAD_ERROR.

◆ connection:didReceiveData:

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

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 2286 of file OOOXZManager.m.

2286 :(NSURLConnection *)connection didReceiveData:(NSData *)data
2287{
2288 OOLog(kOOOXZDebugLog,@"Downloaded %lu bytes",[data length]);
2289 [_fileWriter seekToEndOfFile];
2290 [_fileWriter writeData:data];
2291 _downloadProgress += [data length];
2292 [self gui]; // update GUI
2293#if OOLITE_WINDOWS
2294 /* Irritating fix to issue https://github.com/OoliteProject/oolite/issues/95
2295 *
2296 * The problem is that on MINGW, GNUStep makes all socket streams
2297 * blocking, which causes problems with the run loop. Calling this
2298 * method of the run loop forces it to execute all already
2299 * scheduled items with a time in the past, before any more items
2300 * are placed on it, which means that the main game update gets a
2301 * chance to run.
2302 *
2303 * This stops the interface freezing - and Oolite appearing to
2304 * have stopped responding to the OS - when downloading large
2305 * (>20Mb) OXZ files.
2306 *
2307 * CIM 6 July 2014
2308 */
2309 [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
2310#endif
2311}

References gui, kOOOXZDebugLog, and OOLog.

Here is the call graph for this function:

◆ connection:didReceiveResponse:

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

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 2268 of file OOOXZManager.m.

2268 :(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
2269{
2271 OOLog(kOOOXZDebugLog, @"%@", @"Download receiving");
2272 _downloadExpected = [response expectedContentLength];
2275 [[NSFileManager defaultManager] createFileAtPath:[self downloadPath] contents:nil attributes:nil];
2276 _fileWriter = [[NSFileHandle fileHandleForWritingAtPath:[self downloadPath]] retain];
2277 if (_fileWriter == nil)
2278 {
2279 // file system is full or read-only or something
2280 OOLog(kOOOXZErrorLog, @"%@", @"Unable to create download file");
2281 [self cancelUpdate];
2282 }
2283}
@ OXZ_DOWNLOAD_RECEIVING

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

Here is the call graph for this function:

◆ connectionDidFinishLoading:

- (void) connectionDidFinishLoading: (NSURLConnection *) connection
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 2314 of file OOOXZManager.m.

2314 :(NSURLConnection *)connection
2315{
2317 OOLog(kOOOXZDebugLog, @"%@", @"Download complete");
2318 [_fileWriter synchronizeFile];
2319 [_fileWriter closeFile];
2323 {
2324 if (![self processDownloadedManifests])
2325 {
2327 }
2328 }
2330 {
2331 if (![self processDownloadedOXZ])
2332 {
2334 }
2335 }
2336 else
2337 {
2338 OOLog(kOOOXZErrorLog,@"Error: download completed in unexpected state %d. This is an internal error - please report it.",_interfaceState);
2340 }
2341}
BOOL processDownloadedOXZ()
BOOL processDownloadedManifests()

References DESTROY, kOOOXZDebugLog, kOOOXZErrorLog, OOLog, OXZ_DOWNLOAD_COMPLETE, OXZ_DOWNLOAD_ERROR, OXZ_STATE_INSTALLING, OXZ_STATE_UPDATING, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedManifests, and OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ.

Here is the call graph for this function:

◆ dataURL

- (NSString *) dataURL
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 311 of file OOOXZManager.m.

312{
313 /* Not expected to be set in general, but might be useful for some users */
314 NSString *url = [[NSUserDefaults standardUserDefaults] stringForKey:kOOOXZDataConfig];
315 if (url != nil)
316 {
317 return url;
318 }
319 return kOOOXZDataURL;
320}
static NSString *const kOOOXZDataURL

References OOOXZManager(NSURLConnectionDataDelegate)::dataURL, kOOOXZDataURL, and nil.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::dataURL, and updateManifests.

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 216 of file OOOXZManager.m.

217{
218 if (sSingleton == self) sSingleton = nil;
219
220 [self setCurrentDownload:nil withLabel:nil];
224
225 [super dealloc];
226}
static OODebugMonitor * sSingleton
NSArray * _managedList
NSArray * _filteredList
NSArray * _oxzList

References _filteredList, _managedList, _oxzList, dealloc, DESTROY, nil, setCurrentDownload:withLabel:, and sSingleton.

Referenced by dealloc.

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

◆ downloadPath

- (NSString *) downloadPath
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 298 of file OOOXZManager.m.

299{
301 {
302 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZTmpPlistPath];
303 }
304 else
305 {
306 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZTmpPath];
307 }
308}
NSString * cacheDirectoryPathCreatingIfNecessary:(BOOL create)
OOCacheManager * sharedCache()

References OOCacheManager::cacheDirectoryPathCreatingIfNecessary:, OOOXZManager(NSURLConnectionDataDelegate)::downloadPath, OXZ_STATE_UPDATING, and OOCacheManager::sharedCache.

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

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

◆ ensureInstallPath

- (BOOL) ensureInstallPath
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 263 of file OOOXZManager.m.

264{
265 BOOL exists, directory;
266 NSFileManager *fmgr = [NSFileManager defaultManager];
267 NSString *path = [self installPath];
268
269 exists = [fmgr fileExistsAtPath:path isDirectory:&directory];
270
271 if (exists && !directory)
272 {
273 OOLog(kOOOXZErrorLog, @"Expected %@ to be a folder, but it is a file.", path);
274 return NO;
275 }
276 if (!exists)
277 {
278 if (![fmgr oo_createDirectoryAtPath:path attributes:nil])
279 {
280 OOLog(kOOOXZErrorLog, @"Could not create folder %@.", path);
281 return NO;
282 }
283 }
284
285 return YES;
286}

References OOOXZManager(NSURLConnectionDataDelegate)::ensureInstallPath, installPath, kOOOXZErrorLog, nil, and OOLog.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::ensureInstallPath, and OOOXZManager(NSURLConnectionDataDelegate)::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 
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 253 of file OOOXZManager.m.

253 :(NSString *)identifier andVersion:(NSString *)version
254{
255 NSString *basePath = [[ResourceManager userRootPaths] lastObject];
256 NSString *rawMainDir = [NSString stringWithFormat:@"%@-%@.off",identifier,version];
257
258 NSCharacterSet *blacklist = [NSCharacterSet characterSetWithCharactersInString:@"'#%^&{}[]/~|\\?<,:\" "];
259 return [[[basePath stringByAppendingPathComponent:[[rawMainDir componentsSeparatedByCharactersInSet:blacklist] componentsJoinedByString:@""]] retain] autorelease];
260}
NSArray * userRootPaths()

References ResourceManager::userRootPaths.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::extractOXZ:, and gui.

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

◆ extractOXZ:

- (NSString *) extractOXZ: (NSUInteger) item
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 2133 of file OOOXZManager.m.

2133 :(NSUInteger)item
2134{
2135 NSFileManager *fmgr = [NSFileManager defaultManager];
2136 NSMutableString *extractionLog = [[NSMutableString alloc] init];
2137 NSDictionary *manifest = [_filteredList oo_dictionaryAtIndex:item];
2138 NSString *version = [manifest oo_stringForKey:kOOManifestVersion];
2139 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
2140 NSString *path = [self extractionBasePathForIdentifier:identifier andVersion:version];
2141
2142 // OXZ errors should really never happen unless someone is messing
2143 // directly with the managed folder while Oolite is running, but
2144 // it's possible.
2145
2146 NSString *oxzfile = [manifest oo_stringForKey:kOOManifestFilePath];
2147 if (![fmgr fileExistsAtPath:oxzfile])
2148 {
2149 OOLog(kOOOXZErrorLog,@"OXZ %@ could not be found",oxzfile);
2150 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-no-original")];
2151 return [extractionLog autorelease];
2152 }
2153 const char* zipname = [oxzfile UTF8String];
2154 unzFile uf = NULL;
2155 uf = unzOpen64(zipname);
2156 if (uf == NULL)
2157 {
2158 OOLog(kOOOXZErrorLog,@"Could not open .oxz at %@ as zip file",path);
2159 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-bad-original")];
2160 return [extractionLog autorelease];
2161 }
2162
2163 if ([fmgr fileExistsAtPath:path])
2164 {
2165 OOLog(kOOOXZErrorLog,@"Path %@ already exists",path);
2166 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-exists")];
2167 unzClose(uf);
2168 return [extractionLog autorelease];
2169 }
2170 if (![fmgr oo_createDirectoryAtPath:path attributes:nil])
2171 {
2172 OOLog(kOOOXZErrorLog,@"Path %@ could not be created",path);
2173 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-unmakeable")];
2174 unzClose(uf);
2175 return [extractionLog autorelease];
2176 }
2177 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-main-created")];
2178 NSUInteger counter = 0;
2179 char rawComponentName[512];
2180 BOOL error = NO;
2181 unz_file_info64 file_info = {0};
2182 if (unzGoToFirstFile(uf) == UNZ_OK)
2183 {
2184 do
2185 {
2186 unzGetCurrentFileInfo64(uf, &file_info,
2187 rawComponentName, 512,
2188 NULL, 0,
2189 NULL, 0);
2190 NSString *componentName = [NSString stringWithUTF8String:rawComponentName];
2191 if ([componentName hasSuffix:@"/"])
2192 {
2193 // folder
2194 if (![fmgr oo_createDirectoryAtPath:[path stringByAppendingPathComponent:componentName] attributes:nil])
2195 {
2196 OOLog(kOOOXZErrorLog,@"Subpath %@ could not be created",componentName);
2197 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2198 error = YES;
2199 break;
2200 }
2201 else
2202 {
2203 OOLog(kOOOXZDebugLog,@"Subpath %@ created OK",componentName);
2204 }
2205 }
2206 else
2207 {
2208 // file
2209 // usually folder must now exist, but just in case...
2210 NSString *folder = [[path stringByAppendingPathComponent:componentName] stringByDeletingLastPathComponent];
2211 if ([folder length] > 0 && ![fmgr fileExistsAtPath:folder] && ![fmgr oo_createDirectoryAtPath:folder attributes:nil])
2212 {
2213 OOLog(kOOOXZErrorLog,@"Subpath %@ could not be created",folder);
2214 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2215 error = YES;
2216 break;
2217 }
2218
2219
2220 // This is less efficient in memory use than just
2221 // streaming out of the ZIP file onto disk
2222 // but it makes error handling easier
2223 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2224 NSData *tmp = [NSData oo_dataWithOXZFile:[oxzfile stringByAppendingPathComponent:componentName]];
2225 if (tmp == nil)
2226 {
2227 OOLog(kOOOXZErrorLog,@"Sub file %@ could not be extracted from the OXZ",componentName);
2228 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2229 error = YES;
2230 [pool release];
2231 break;
2232 }
2233 else
2234 {
2235 if (![tmp writeToFile:[path stringByAppendingPathComponent:componentName] atomically:YES])
2236 {
2237 OOLog(kOOOXZErrorLog,@"Sub file %@ could not be created",componentName);
2238 [extractionLog appendString:DESC(@"oolite-oxzmanager-extract-log-sub-failed")];
2239 error = YES;
2240 [pool release];
2241 break;
2242 }
2243 else
2244 {
2245 ++counter;
2246 }
2247 }
2248 [pool release];
2249
2250 }
2251 }
2252 while (unzGoToNextFile(uf) == UNZ_OK);
2253 }
2254 unzClose(uf);
2255
2256 if (!error)
2257 {
2258 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-num-u-extracted"),counter];
2259 [extractionLog appendFormat:DESC(@"oolite-oxzmanager-extract-log-extracted-to-@"),path];
2260 }
2261
2262 return [extractionLog autorelease];
2263}
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:1130
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition unzip.c:1184
unzFile ZEXPORT unzOpen64(const void *path)
Definition unzip.c:801
int ZEXPORT unzGoToNextFile(unzFile file)
Definition unzip.c:1205
int ZEXPORT unzClose(unzFile file)
Definition unzip.c:811
struct unz_file_info64_s unz_file_info64
voidp unzFile
Definition unzip.h:70
#define UNZ_OK
Definition unzip.h:74

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

Referenced by processSelection.

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

◆ gui

- (void) gui

Definition at line 1110 of file OOOXZManager.m.

1111{
1112 GuiDisplayGen *gui = [UNIVERSE gui];
1113 OOGUIRow startRow = OXZ_GUI_ROW_EXIT;
1114
1115#if OOLITE_WINDOWS
1116 /* unlock OXZs ahead of potential changes by making sure sound
1117 * files aren't being held open */
1119 [PLAYER destroySound];
1120#endif
1121
1122 [gui clearAndKeepBackground:YES];
1123 [gui setTitle:DESC(@"oolite-oxzmanager-title")];
1124
1125 /* This switch will give warnings unless all states are
1126 * covered. */
1127 switch (_interfaceState)
1128 {
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];
1132 [gui addLongText:DESC(@"oolite-oxzmanager-filterhelp") startingAtRow:OXZ_GUI_ROW_FILTERHELP align:GUI_ALIGN_LEFT];
1133
1134
1135 return; // don't do normal row selection stuff
1136 case OXZ_STATE_NODATA:
1137 if (_oxzList == nil)
1138 {
1139 [gui addLongText:DESC(@"oolite-oxzmanager-firstrun") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
1140 [gui setText:DESC(@"oolite-oxzmanager-download-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1141 [gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
1142
1143 startRow = OXZ_GUI_ROW_UPDATE;
1144 }
1145 else
1146 {
1147 // update data
1148 [gui addLongText:DESC(@"oolite-oxzmanager-secondrun") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
1149 [gui setText:DESC(@"oolite-oxzmanager-download-noupdate") forRow:OXZ_GUI_ROW_PROCEED align:GUI_ALIGN_CENTER];
1150 [gui setKey:@"_MAIN" forRow:OXZ_GUI_ROW_PROCEED];
1151
1152 [gui setText:DESC(@"oolite-oxzmanager-update-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1153 [gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
1154
1155 startRow = OXZ_GUI_ROW_PROCEED;
1156 }
1157 break;
1159 [gui addLongText:DESC(@"oolite-oxzmanager-restart") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
1160 return; // yes, return, not break: controls are pointless here
1161 case OXZ_STATE_MAIN:
1162 [gui addLongText:DESC(@"oolite-oxzmanager-intro") startingAtRow:OXZ_GUI_ROW_FIRSTRUN align:GUI_ALIGN_LEFT];
1163 // fall through
1168 {
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];
1170 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTFILTER];
1171 }
1172
1173 [gui setText:DESC(@"oolite-oxzmanager-install") forRow:OXZ_GUI_ROW_INSTALL align:GUI_ALIGN_CENTER];
1174 [gui setKey:@"_INSTALL" forRow:OXZ_GUI_ROW_INSTALL];
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];
1178 [gui setKey:@"_REMOVE" forRow:OXZ_GUI_ROW_REMOVE];
1179 [gui setText:DESC(@"oolite-oxzmanager-update-list") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1180 [gui setKey:@"_UPDATE" forRow:OXZ_GUI_ROW_UPDATE];
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];
1183
1184 startRow = OXZ_GUI_ROW_INSTALL;
1185 break;
1186 case OXZ_STATE_UPDATING:
1188 [gui setTitle:DESC(@"oolite-oxzmanager-title-downloading")];
1189
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];
1191
1192 [gui addLongText:_progressStatus startingAtRow:OXZ_GUI_ROW_PROGRESS+2 align:GUI_ALIGN_LEFT];
1193
1194 [gui setText:DESC(@"oolite-oxzmanager-cancel") forRow:OXZ_GUI_ROW_CANCEL align:GUI_ALIGN_CENTER];
1195 [gui setKey:@"_CANCEL" forRow:OXZ_GUI_ROW_CANCEL];
1196 startRow = OXZ_GUI_ROW_UPDATE;
1197 break;
1199 [gui setTitle:DESC(@"oolite-oxzmanager-title-dependencies")];
1200
1201 [gui setText:DESC(@"oolite-oxzmanager-dependencies-decision") forRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
1202
1203 [gui addLongText:_progressStatus startingAtRow:OXZ_GUI_ROW_PROGRESS+2 align:GUI_ALIGN_LEFT];
1204
1205 startRow = OXZ_GUI_ROW_INSTALLED;
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];
1208
1209 [gui setText:DESC(@"oolite-oxzmanager-dependencies-yes") forRow:OXZ_GUI_ROW_PROCEED align:GUI_ALIGN_CENTER];
1210 [gui setKey:@"_PROCEED" forRow:OXZ_GUI_ROW_PROCEED];
1211
1212 [gui setText:DESC(@"oolite-oxzmanager-dependencies-no") forRow:OXZ_GUI_ROW_CANCEL align:GUI_ALIGN_CENTER];
1213 [gui setKey:@"_CANCEL" forRow:OXZ_GUI_ROW_CANCEL];
1214 break;
1215
1216 case OXZ_STATE_REMOVING:
1217 [gui addLongText:DESC(@"oolite-oxzmanager-removal-done") startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
1218 [gui setText:DESC(@"oolite-oxzmanager-acknowledge") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1219 [gui setKey:@"_ACK" forRow:OXZ_GUI_ROW_UPDATE];
1220 startRow = OXZ_GUI_ROW_UPDATE;
1221 break;
1222 case OXZ_STATE_TASKDONE:
1224 {
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];
1226 }
1227 else
1228 {
1229 [gui addLongText:OOExpandKey(@"oolite-oxzmanager-progress-error") startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
1230 }
1231 [gui addLongText:_progressStatus startingAtRow:OXZ_GUI_ROW_PROGRESS+4 align:GUI_ALIGN_LEFT];
1232
1233 [gui setText:DESC(@"oolite-oxzmanager-acknowledge") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1234 [gui setKey:@"_ACK" forRow:OXZ_GUI_ROW_UPDATE];
1235 startRow = OXZ_GUI_ROW_UPDATE;
1236 break;
1237 case OXZ_STATE_EXTRACT:
1238 {
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-@"),
1245 title,
1246 version]
1247 forRow:0 align:GUI_ALIGN_LEFT];
1248 [gui addLongText:DESC(@"oolite-oxzmanager-extract-info") startingAtRow:2 align:GUI_ALIGN_LEFT];
1249#ifdef NDEBUG
1250 [gui addLongText:DESC(@"oolite-oxzmanager-extract-releasebuild") startingAtRow:7 align:GUI_ALIGN_LEFT];
1251 [gui setColor:[OOColor orangeColor] forRow:7];
1252 [gui setColor:[OOColor orangeColor] forRow:8];
1253#endif
1254 NSString *path = [self extractionBasePathForIdentifier:identifier andVersion:version];
1255 if ([[NSFileManager defaultManager] fileExistsAtPath:path])
1256 {
1257 [gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-extract-@-already-exists"), path]
1258 startingAtRow:10 align:GUI_ALIGN_LEFT];
1259 startRow = OXZ_GUI_ROW_CANCEL;
1260 [gui setText:DESC(@"oolite-oxzmanager-extract-unavailable") forRow:OXZ_GUI_ROW_PROCEED align:GUI_ALIGN_CENTER];
1261 [gui setColor:[OOColor grayColor] forRow:OXZ_GUI_ROW_PROCEED];
1262 }
1263 else
1264 {
1265 [gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-extract-to-@"), path]
1266 startingAtRow:10 align:GUI_ALIGN_LEFT];
1267 startRow = OXZ_GUI_ROW_PROCEED;
1268 [gui setText:DESC(@"oolite-oxzmanager-extract-proceed") forRow:OXZ_GUI_ROW_PROCEED align:GUI_ALIGN_CENTER];
1269 [gui setKey:@"_PROCEED" forRow:OXZ_GUI_ROW_PROCEED];
1270
1271 }
1272 [gui setText:DESC(@"oolite-oxzmanager-extract-cancel") forRow:OXZ_GUI_ROW_CANCEL align:GUI_ALIGN_CENTER];
1273 [gui setKey:@"_CANCEL" forRow:OXZ_GUI_ROW_CANCEL];
1274
1275 }
1276 break;
1278 [gui addLongText:_progressStatus startingAtRow:1 align:GUI_ALIGN_LEFT];
1279 [gui setText:DESC(@"oolite-oxzmanager-acknowledge") forRow:OXZ_GUI_ROW_UPDATE align:GUI_ALIGN_CENTER];
1280 [gui setKey:@"_ACK" forRow:OXZ_GUI_ROW_UPDATE];
1281 startRow = OXZ_GUI_ROW_UPDATE;
1282 break;
1283
1284 }
1285
1287 {
1288 [gui setTitle:DESC(@"oolite-oxzmanager-title-install")];
1289 [self setFilteredList:[self applyCurrentFilter:_oxzList]];
1290 startRow = [self showInstallOptions];
1291 }
1293 {
1294 [gui setTitle:DESC(@"oolite-oxzmanager-title-installed")];
1295 [self setFilteredList:[self applyCurrentFilter:[self managedOXZs]]];
1296 startRow = [self showInstallOptions];
1297 }
1299 {
1300 [gui setTitle:DESC(@"oolite-oxzmanager-title-remove")];
1301 [self setFilteredList:[self applyCurrentFilter:[self managedOXZs]]];
1302 startRow = [self showRemoveOptions];
1303 }
1304
1305
1306 if (_changesMade)
1307 {
1308 [gui setText:DESC(@"oolite-oxzmanager-exit-restart") forRow:OXZ_GUI_ROW_EXIT align:GUI_ALIGN_CENTER];
1309 }
1310 else
1311 {
1312 [gui setText:DESC(@"oolite-oxzmanager-exit") forRow:OXZ_GUI_ROW_EXIT align:GUI_ALIGN_CENTER];
1313 }
1314 [gui setKey:@"_EXIT" forRow:OXZ_GUI_ROW_EXIT];
1315 [gui setSelectableRange:NSMakeRange(startRow,2+(OXZ_GUI_ROW_EXIT-startRow))];
1316 if (startRow < OXZ_GUI_ROW_INSTALL)
1317 {
1318 [gui setSelectedRow:OXZ_GUI_ROW_INSTALL];
1319 }
1321 {
1322 [gui setSelectedRow:OXZ_GUI_ROW_UPDATE];
1323 }
1324 else
1325 {
1326 [gui setSelectedRow:startRow];
1327 }
1328
1329}
NSInteger OOGUIRow
@ OXZ_STATE_PICK_INSTALLED
@ OXZ_STATE_RESTARTING
@ OXZ_STATE_SETFILTER
@ OXZ_STATE_NODATA
@ OXZ_STATE_TASKDONE
@ OXZ_STATE_DEPENDENCIES
@ OXZ_STATE_REMOVING
@ OXZ_STATE_PICK_REMOVE
@ OXZ_STATE_EXTRACTDONE
@ OXZ_STATE_EXTRACT
@ OXZ_GUI_ROW_CANCEL
@ OXZ_GUI_ROW_EXIT
@ OXZ_GUI_ROW_INSTALL
@ OXZ_GUI_ROW_INSTALLED
@ OXZ_GUI_ROW_PROCEED
@ OXZ_GUI_ROW_UPDATE
BOOL setSelectedRow:(OOGUIRow row)
OOGUIRow addLongText:startingAtRow:align:(NSString *str,[startingAtRow] OOGUIRow row,[align] OOGUIAlignment alignment)
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 setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
OOColor * greenColor()
Definition OOColor.m:274

References _changesMade, _downloadStatus, _interfaceState, _oxzList, GuiDisplayGen::addLongText:startingAtRow:align:, applyCurrentFilter:, GuiDisplayGen::clearAndKeepBackground:, ResourceManager::clearCaches, extractionBasePathForIdentifier:andVersion:, OOColor::grayColor, OOColor::greenColor, gui, humanSize:, managedOXZs, nil, OOColor::orangeColor, OXZ_DOWNLOAD_COMPLETE, OXZ_GUI_ROW_CANCEL, OXZ_GUI_ROW_EXIT, OXZ_GUI_ROW_INSTALL, OXZ_GUI_ROW_INSTALLED, OXZ_GUI_ROW_PROCEED, OXZ_GUI_ROW_UPDATE, OXZ_STATE_DEPENDENCIES, OXZ_STATE_EXTRACT, OXZ_STATE_EXTRACTDONE, OXZ_STATE_INSTALLING, OXZ_STATE_MAIN, OXZ_STATE_NODATA, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, OXZ_STATE_REMOVING, OXZ_STATE_RESTARTING, OXZ_STATE_SETFILTER, OXZ_STATE_TASKDONE, OXZ_STATE_UPDATING, GuiDisplayGen::setColor:forRow:, setFilteredList:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, showInstallOptions, and showRemoveOptions.

Referenced by cancelUpdate, OOOXZManager(NSURLConnectionDataDelegate)::connection:didReceiveData:, gui, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedManifests, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ, processExtractKey, processFilterKey, processSelection, processShowInfoKey, processTextInput:, refreshTextInput:, OOOXZManager(NSURLConnectionDataDelegate)::removeOXZ:, PlayerEntity::setGuiToOXZManager, showInstallOptions, showOptionsNext, showOptionsPrev, and showRemoveOptions.

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

◆ humanSize:

- (NSString *) humanSize: (NSUInteger) bytes
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 323 of file OOOXZManager.m.

323 :(NSUInteger)bytes
324{
325 if (bytes == 0)
326 {
327 return DESC(@"oolite-oxzmanager-missing-field");
328 }
329 else if (bytes < 1024)
330 {
331 return @"<1 kB";
332 }
333 else if (bytes < 1024*1024)
334 {
335 return [NSString stringWithFormat:@"%lu kB",bytes>>10];
336 }
337 else
338 {
339 return [NSString stringWithFormat:@"%.2f MB",((float)(bytes>>10))/1024];
340 }
341}

References DESC.

Referenced by gui, and showInstallOptions.

Here is the caller graph for this function:

◆ init

- (id) init
implementation

Definition at line 194 of file OOOXZManager.m.

195{
196 self = [super init];
197 if (self != nil)
198 {
200 // if the file has not been downloaded, this will be nil
201 [self setOXZList:OOArrayFromFile([self manifestPath])];
202 OOLog(kOOOXZDebugLog,@"Initialised with %@",_oxzList);
204 _currentFilter = @"*";
205
207 _changesMade = NO;
209 _dependencyStack = [[NSMutableSet alloc] initWithCapacity:8];
210 [self setProgressStatus:@""];
211 }
212 return self;
213}
BOOL _downloadAllDependencies
BOOL _interfaceShowingOXZDetail
NSMutableSet * _dependencyStack

References _changesMade, _currentFilter, _dependencyStack, _downloadAllDependencies, _downloadStatus, _interfaceShowingOXZDetail, _interfaceState, _oxzList, init, kOOOXZDebugLog, manifestPath, nil, OOLog, OXZ_DOWNLOAD_NONE, OXZ_STATE_NODATA, setOXZList:, and setProgressStatus:.

Referenced by init.

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

◆ installableState:

- (OXZInstallableState) installableState: (NSDictionary *) manifest
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 992 of file OOOXZManager.m.

992 :(NSDictionary *)manifest
993{
994 NSString *title = [manifest oo_stringForKey:kOOManifestTitle defaultValue:nil];
995 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier defaultValue:nil];
996 /* Check Oolite version */
997 if (![ResourceManager checkVersionCompatibility:manifest forOXP:title])
998 {
1000 }
1001 /* Check for current automated install */
1002 NSDictionary *installed = [self installedManifestForIdentifier:identifier];
1003 if (installed == nil)
1004 {
1005 // check for manual install
1006 installed = [ResourceManager manifestForIdentifier:identifier];
1007 }
1008
1009 if (installed != nil)
1010 {
1011 if (![[installed oo_stringForKey:kOOManifestFilePath] hasPrefix:[self installPath]])
1012 {
1013 // installed manually
1015 }
1016 if ([[installed oo_stringForKey:kOOManifestVersion] isEqualToString:[manifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[manifest oo_stringForKey:kOOManifestVersion]]]
1017 && [[NSFileManager defaultManager] fileExistsAtPath:[installed oo_stringForKey:kOOManifestFilePath]])
1018 {
1019 // installed this exact version already, and haven't
1020 // uninstalled it since entering the manager, and it's
1021 // still available
1023 }
1024 else if ([installed oo_stringForKey:kOOManifestAvailableVersion defaultValue:nil] == nil)
1025 {
1026 // installed, but no remote copy is indexed any more
1028 }
1029 }
1030 /* Check for dependencies being met */
1031 if ([ResourceManager manifestHasConflicts:manifest logErrors:NO])
1032 {
1034 }
1035 if (installed != nil)
1036 {
1037 NSString *availableVersion = [manifest oo_stringForKey:kOOManifestAvailableVersion];
1038 if (availableVersion == nil)
1039 {
1040 availableVersion = [manifest oo_stringForKey:kOOManifestVersion];
1041 }
1042 NSString *installedVersion = [installed oo_stringForKey:kOOManifestVersion];
1043 OOLog(@"version.debug",@"%@ mv:%@ mav:%@",identifier,installedVersion,availableVersion);
1044 if (CompareVersions(ComponentsFromVersionString(installedVersion),ComponentsFromVersionString(availableVersion)) == NSOrderedDescending)
1045 {
1046 // the installed copy is more recent than the server copy
1048 }
1050 }
1051 if ([ResourceManager manifestHasMissingDependencies:manifest logErrors:NO])
1052 {
1054 }
1055 return OXZ_INSTALLABLE_OKAY;
1056}
static NSString *const kOOManifestAvailableVersion
static NSString *const kOOManifestVersion
static NSString *const kOOManifestFilePath
NSArray * ComponentsFromVersionString(NSString *string)
NSComparisonResult CompareVersions(NSArray *version1, NSArray *version2)
NSString * installPath()
NSDictionary * manifestForIdentifier:(NSString *identifier)

References CompareVersions(), ComponentsFromVersionString(), 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:

◆ installedManifestForIdentifier:

- (NSDictionary *) installedManifestForIdentifier: (NSString *) identifier
implementation

Definition at line 977 of file OOOXZManager.m.

977 :(NSString *)identifier
978{
979 NSArray *installed = [self managedOXZs];
980 NSDictionary *manifest = nil;
981 foreach (manifest,installed)
982 {
983 if ([[manifest oo_stringForKey:kOOManifestIdentifier] isEqualToString:identifier])
984 {
985 return manifest;
986 }
987 }
988 return nil;
989}
static NSString *const kOOManifestIdentifier

References kOOManifestIdentifier, managedOXZs, and nil.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::installableState:.

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

◆ installOptions

- (NSArray *) installOptions
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1712 of file OOOXZManager.m.

1713{
1714 NSUInteger start = _offset;
1715 if (start >= [_filteredList count])
1716 {
1717 start = 0;
1718 _offset = 0;
1719 }
1720 NSUInteger end = start + OXZ_GUI_NUM_LISTROWS;
1721 if (end > [_filteredList count])
1722 {
1723 end = [_filteredList count];
1724 }
1725 return [_filteredList subarrayWithRange:NSMakeRange(start,end-start)];
1726}
@ OXZ_GUI_NUM_LISTROWS
unsigned count
NSUInteger _offset

References count, OOOXZManager(NSURLConnectionDataDelegate)::installOptions, and OXZ_GUI_NUM_LISTROWS.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::installOptions, and showInstallOptions.

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

◆ installOXZ:

- (BOOL) installOXZ: (NSUInteger) item
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1644 of file OOOXZManager.m.

1644 :(NSUInteger)item
1645{
1646 NSArray *picklist = _filteredList;
1647
1648 if ([picklist count] <= item)
1649 {
1650 return NO;
1651 }
1652 NSDictionary *manifest = [picklist objectAtIndex:item];
1653 _item = item;
1654
1655 if ([self installableState:manifest] >= OXZ_UNINSTALLABLE_ALREADY)
1656 {
1657 OOLog(kOOOXZDebugLog,@"Cannot install %@",manifest);
1658 // can't be installed on this version of Oolite, or already is installed
1659 return NO;
1660 }
1661 NSString *url = [manifest objectForKey:kOOManifestDownloadURL];
1662 if (url == nil)
1663 {
1664 OOLog(kOOOXZErrorLog, @"%@", @"Manifest does not have a download URL - cannot install");
1665 return NO;
1666 }
1667 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
1668 [request setHTTPShouldHandleCookies:NO];
1670 {
1671 return NO;
1672 }
1675
1676 [self setProgressStatus:@""];
1677 return [self beginDownload:request];
1678}
@ OXZ_DOWNLOAD_STARTED
NSUInteger _item

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

Referenced by processSelection, and OOOXZManager(NSURLConnectionDataDelegate)::updateAllOXZ.

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

◆ installPath

- (NSString *) installPath

Definition at line 232 of file OOOXZManager.m.

233{
234 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,NSUserDomainMask,YES);
235 NSString *appPath = [paths objectAtIndex:0];
236 if (appPath != nil)
237 {
238 appPath = [appPath stringByAppendingPathComponent:@"Oolite"];
239#if OOLITE_MAC_OS_X
240 appPath = [appPath stringByAppendingPathComponent:@"Managed AddOns"];
241#else
242 /* GNUStep uses "ApplicationSupport" rather than "Application
243 * Support" so match convention by not putting a space in the
244 * path either */
245 appPath = [appPath stringByAppendingPathComponent:@"ManagedAddOns"];
246#endif
247 return appPath;
248 }
249 return nil;
250}

References installPath, and nil.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::ensureInstallPath, installPath, managedOXZs, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ, ResourceManager::rootPaths, and showInstallOptions.

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

◆ installStatusForManifest:

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

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1084 of file OOOXZManager.m.

1084 :(NSDictionary *)manifest
1085{
1086 switch ([self installableState:manifest])
1087 {
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");
1104 }
1105 return nil; // never
1106}

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 showInstallOptions, and showRemoveOptions.

Here is the caller graph for this function:

◆ isAcceptingGUIInput

- (BOOL) isAcceptingGUIInput

Definition at line 1496 of file OOOXZManager.m.

1497{
1499}

References _interfaceShowingOXZDetail, and isAcceptingGUIInput.

Referenced by isAcceptingGUIInput.

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

◆ isAcceptingTextInput

- (BOOL) isAcceptingTextInput

Definition at line 1490 of file OOOXZManager.m.

1491{
1493}

References _interfaceState, isAcceptingTextInput, and OXZ_STATE_SETFILTER.

Referenced by isAcceptingTextInput.

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

◆ isRestarting

- (BOOL) isRestarting

Definition at line 1332 of file OOOXZManager.m.

1333{
1334 // for the restart
1336 {
1337 // Rebuilds OXP search
1339 [UNIVERSE reinitAndShowDemo:YES];
1340 _changesMade = NO;
1342 _downloadStatus = OXZ_DOWNLOAD_NONE; // clear error state
1343 return YES;
1344 }
1345 else
1346 {
1347 return NO;
1348 }
1349}
#define EXPECT_NOT(x)

References _changesMade, _downloadStatus, _interfaceState, EXPECT_NOT, isRestarting, OXZ_DOWNLOAD_NONE, OXZ_STATE_MAIN, OXZ_STATE_RESTARTING, and ResourceManager::reset.

Referenced by isRestarting.

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

◆ managedOXZs

- (NSArray *) managedOXZs

Definition at line 663 of file OOOXZManager.m.

664{
665 if (_managedList == nil)
666 {
667 // if this list is being reset, also reset the current install list
669 NSArray *managedOXZs = [[NSFileManager defaultManager] oo_directoryContentsAtPath:[self installPath]];
670 NSMutableArray *manifests = [NSMutableArray arrayWithCapacity:[managedOXZs count]];
671 NSString *filename = nil;
672 NSString *fullpath = nil;
673 NSDictionary *manifest = nil;
674 foreach (filename, managedOXZs)
675 {
676 fullpath = [[self installPath] stringByAppendingPathComponent:filename];
677 manifest = OODictionaryFromFile([fullpath stringByAppendingPathComponent:@"manifest.plist"]);
678 if (manifest != nil)
679 {
680 NSMutableDictionary *adjManifest = [NSMutableDictionary dictionaryWithDictionary:manifest];
681 [adjManifest setObject:fullpath forKey:kOOManifestFilePath];
682
683 NSDictionary *stored = nil;
684 /* The list is already sorted to put the latest
685 * versions first. This flag means that it stops
686 * checking the list for versions once it finds one
687 * that is plausibly installable */
688 BOOL foundInstallable = NO;
689 foreach (stored, _oxzList)
690 {
691 if ([[stored oo_stringForKey:kOOManifestIdentifier] isEqualToString:[manifest oo_stringForKey:kOOManifestIdentifier]])
692 {
693 if (foundInstallable == NO)
694 {
695 [adjManifest setObject:[stored oo_stringForKey:kOOManifestVersion] forKey:kOOManifestAvailableVersion];
696 [adjManifest setObject:[stored oo_stringForKey:kOOManifestDownloadURL] forKey:kOOManifestDownloadURL];
697 if ([ResourceManager checkVersionCompatibility:manifest forOXP:nil])
698 {
699 foundInstallable = YES;
700 }
701 }
702 }
703 }
704
705 [manifests addObject:adjManifest];
706 }
707 }
708 [manifests sortUsingFunction:oxzSort context:NULL];
709
710 _managedList = [manifests copy];
711 }
712 return _managedList;
713}
NSDictionary * OODictionaryFromFile(NSString *path)
NSArray * managedOXZs()
NSArray * manifests()
void resetManifestKnowledgeForOXZManager()
const char * filename
Definition ioapi.h:133

References _managedList, _oxzList, installPath, kOOManifestIdentifier, managedOXZs, manifests, nil, OODictionaryFromFile(), and ResourceManager::resetManifestKnowledgeForOXZManager.

Referenced by gui, installedManifestForIdentifier:, managedOXZs, showOptionsUpdate, and showRemoveOptions.

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

◆ manifestPath

- (NSString *) manifestPath
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 289 of file OOOXZManager.m.

290{
291 return [[[OOCacheManager sharedCache] cacheDirectoryPathCreatingIfNecessary:YES] stringByAppendingPathComponent:kOOOXZManifestCache];
292}

References OOCacheManager::cacheDirectoryPathCreatingIfNecessary:, OOOXZManager(NSURLConnectionDataDelegate)::manifestPath, and OOCacheManager::sharedCache.

Referenced by init, OOOXZManager(NSURLConnectionDataDelegate)::manifestPath, and OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedManifests.

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

◆ manifests

- (NSArray *) manifests

Definition at line 657 of file OOOXZManager.m.

658{
659 return _oxzList;
660}

References _oxzList, and manifests.

Referenced by managedOXZs, and manifests.

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

◆ processDownloadedManifests

- (BOOL) processDownloadedManifests
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 716 of file OOOXZManager.m.

717{
719 {
720 return NO;
721 }
722 [self setOXZList:OOArrayFromFile([self downloadPath])];
723 if (_oxzList != nil)
724 {
725 [_oxzList writeToFile:[self manifestPath] atomically:YES];
726 // and clean up the temp file
727 [[NSFileManager defaultManager] oo_removeItemAtPath:[self downloadPath]];
728 // invalidate the managed list
731 [self gui];
732 return YES;
733 }
734 else
735 {
737 OOLog(kOOOXZErrorLog,@"Downloaded manifest was not a valid plist, has been left in %@",[self downloadPath]);
738 // revert to the old one
739 [self setOXZList:OOArrayFromFile([self manifestPath])];
741 [self gui];
742 return NO;
743 }
744}

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

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::connectionDidFinishLoading:, and OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedManifests.

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

◆ processDownloadedOXZ

- (BOOL) processDownloadedOXZ
implementation

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.

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 747 of file OOOXZManager.m.

748{
750 {
751 return NO;
752 }
753
754 NSDictionary *downloadedManifest = OODictionaryFromFile([[self downloadPath] stringByAppendingPathComponent:@"manifest.plist"]);
755 if (downloadedManifest == nil)
756 {
758 OOLog(kOOOXZErrorLog,@"Downloaded OXZ does not contain a manifest.plist, has been left in %@",[self downloadPath]);
760 [self gui];
761 return NO;
762 }
763 NSDictionary *expectedManifest = nil;
764 expectedManifest = [_filteredList objectAtIndex:_item];
765
766 if (expectedManifest == nil ||
767 (![[downloadedManifest oo_stringForKey:kOOManifestIdentifier] isEqualToString:[expectedManifest oo_stringForKey:kOOManifestIdentifier]]) ||
768 (![[downloadedManifest oo_stringForKey:kOOManifestVersion] isEqualToString:[expectedManifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[expectedManifest oo_stringForKey:kOOManifestVersion]]])
769 )
770 {
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.");
774 [self gui];
775 return NO;
776 }
777 // this appears to be the OXZ we expected
778 // filename is going to be identifier.oxz
779 NSString *filename = [[downloadedManifest oo_stringForKey:kOOManifestIdentifier] stringByAppendingString:@".oxz"];
780
781 if (![self ensureInstallPath])
782 {
784 OOLog(kOOOXZErrorLog, @"%@", @"Unable to create installation folder.");
786 [self gui];
787 return NO;
788 }
789
790 // delete filename if it exists from OXZ folder
791 NSString *destination = [[self installPath] stringByAppendingPathComponent:filename];
792 [[NSFileManager defaultManager] oo_removeItemAtPath:destination];
793
794 // move the temp file on to it
795 if (![[NSFileManager defaultManager] oo_moveItemAtPath:[self downloadPath] toPath:destination])
796 {
798 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
800 [self gui];
801 return NO;
802 }
803 _changesMade = YES;
804 DESTROY(_managedList); // will need updating
805 // do this now to cope with circular dependencies on download
807
820 NSArray *requires = [downloadedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
821 if (requires == nil)
822 {
823 // just in case the requirements are only specified in the online copy
824 requires = [expectedManifest oo_arrayForKey:kOOManifestRequiresOXPs defaultValue:nil];
825 }
826 NSDictionary *requirement = nil;
827 NSMutableString *progress = [NSMutableString stringWithCapacity:2048];
828 OOLog(kOOOXZDebugLog,@"Dependency stack has %lu elements",[_dependencyStack count]);
829
830 if ([_dependencyStack count] > 0)
831 {
832 // will remove as iterate, so create a temp copy to iterate over
833 NSSet *tempStack = [NSSet setWithSet:_dependencyStack];
834 foreach (requirement, tempStack)
835 {
836 OOLog(kOOOXZDebugLog,@"Dependency stack: checking %@",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
837 if (![ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO]
838 && requires != nil && [requires containsObject:requirement])
839 {
840 // it was unmet, but now it's met
841 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-now-has-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
842 [_dependencyStack removeObject:requirement];
843 OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: requirement met");
844 } else if ([[requirement oo_stringForKey:kOOManifestRelationIdentifier] isEqualToString:[downloadedManifest oo_stringForKey:kOOManifestIdentifier]]) {
845 // remove the requirement for the just downloaded OXP
846 [_dependencyStack removeObject:requirement];
847 }
848 }
849 }
850 if (requires != nil)
851 {
852 foreach (requirement, requires)
853 {
854 if ([ResourceManager manifest:downloadedManifest HasUnmetDependency:requirement logErrors:NO])
855 {
856 OOLog(kOOOXZDebugLog,@"Dependency stack: adding %@",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
857 [_dependencyStack addObject:requirement];
858 [progress appendFormat:DESC(@"oolite-oxzmanager-progress-requires-@"),[requirement oo_stringForKey:kOOManifestRelationDescription defaultValue:[requirement oo_stringForKey:kOOManifestRelationIdentifier]]];
859 }
860 }
861 }
862 if ([_dependencyStack count] > 0)
863 {
864 // get an object from the requirements list, and download it
865 // if it can be found
866 BOOL undownloadedRequirement = NO;
867 NSDictionary *availableDownload = nil;
868 BOOL foundDownload = NO;
869 NSUInteger index = 0;
870 NSString *needsIdentifier = nil;
871
872 do
873 {
874 undownloadedRequirement = YES;
875 requirement = [_dependencyStack anyObject];
876 OOLog(kOOOXZDebugLog,@"Dependency stack: next is %@",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
877
879 {
880 [progress appendString:DESC(@"oolite-oxzmanager-progress-get-required")];
881 }
882 needsIdentifier = [requirement oo_stringForKey:kOOManifestRelationIdentifier];
883
884 foreach (availableDownload, _oxzList)
885 {
886 if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:needsIdentifier])
887 {
888 if ([ResourceManager matchVersions:requirement withVersion:[availableDownload oo_stringForKey:kOOManifestVersion]])
889 {
890 OOLog(kOOOXZDebugLog, @"%@", @"Dependency stack: found download for next item");
891 foundDownload = YES;
892 index = [_oxzList indexOfObject:availableDownload];
893 break;
894 }
895 }
896 }
897
898 if (foundDownload)
899 {
900 if ([self installableState:[_oxzList objectAtIndex:index]] == OXZ_UNINSTALLABLE_ALREADY)
901 {
902 OOLog(kOOOXZDebugLog,@"Dependency stack: %@ is downloaded but not yet loadable, removing from list.",[requirement oo_stringForKey:kOOManifestRelationIdentifier]);
903 // then this has already been downloaded, but
904 // can't be configured yet presumably because
905 // another dependency is still to be loaded
906 [_dependencyStack removeObject:requirement];
907 if ([_dependencyStack count] > 0)
908 {
909 // try again
910 undownloadedRequirement = NO;
911 }
912 else
913 {
914 // this case should probably never happen
915 // is handled below just in case
916 foundDownload = NO;
917 }
918 }
919 }
920 }
921 while (!undownloadedRequirement);
922
923 if (foundDownload)
924 {
925 // must clear filters entirely at this point
926 [self setFilteredList:_oxzList];
927 // then download that item
930 {
931 OOLog(kOOOXZDebugLog,@"Dependency stack: installing %lu from list",index);
932 if (![self installOXZ:index]) {
933 // if a required dependency is somehow uninstallable
934 // e.g. required+maximum version don't match this Oolite
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);
939 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
941 [self gui];
942 return NO;
943 }
944 }
945 else
946 {
948 _item = index;
949 }
950 [self setProgressStatus:progress];
951 [self gui];
952 return YES;
953 }
954 // this is probably always the case, see above
955 else if ([_dependencyStack count] > 0)
956 {
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);
961 OOLog(kOOOXZErrorLog, @"%@", @"Downloaded OXZ could not be installed.");
963 [self gui];
964 return NO;
965 }
966 }
967
968 [self setProgressStatus:@""];
970 [_dependencyStack removeAllObjects]; // just in case
972 [self gui];
973 return YES;
974}
static NSString *const kOOManifestRelationIdentifier
BOOL ensureInstallPath()

References count, DESTROY, OOOXZManager(NSURLConnectionDataDelegate)::downloadPath, OOOXZManager(NSURLConnectionDataDelegate)::ensureInstallPath, gui, 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, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ, ResourceManager::resetManifestKnowledgeForOXZManager, setFilteredList:, and setProgressStatus:.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::connectionDidFinishLoading:, and OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ.

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

◆ processExtractKey

- (void) processExtractKey

Definition at line 1622 of file OOOXZManager.m.

1623{
1624 // TODO: Extraction functionality - converts an installed OXZ to
1625 // an OXP in the main AddOns folder if it's safe to do so.
1627 {
1628 GuiDisplayGen *gui = [UNIVERSE gui];
1629 OOGUIRow selection = [gui selectedRow];
1630
1631 if (selection < OXZ_GUI_ROW_LISTSTART || selection >= OXZ_GUI_ROW_LISTSTART + OXZ_GUI_NUM_LISTROWS)
1632 {
1633 // not on an OXZ
1634 return;
1635 }
1636
1637 _item = _offset + selection - OXZ_GUI_ROW_LISTSTART;
1639 [self gui];
1640 }
1641}
@ OXZ_GUI_ROW_LISTSTART
OOGUIRow selectedRow

References _interfaceShowingOXZDetail, _interfaceState, _item, _offset, gui, OXZ_GUI_NUM_LISTROWS, OXZ_GUI_ROW_LISTSTART, OXZ_STATE_EXTRACT, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, processExtractKey, and GuiDisplayGen::selectedRow.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and processExtractKey.

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

◆ processFilterKey

- (void) processFilterKey

Definition at line 1532 of file OOOXZManager.m.

1533{
1535 {
1537 }
1539 {
1541 [[UNIVERSE gameView] resetTypedString];
1542 [self gui];
1543 }
1544 // else this key does nothing
1545}

References _interfaceShowingOXZDetail, _interfaceState, gui, OXZ_STATE_MAIN, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, OXZ_STATE_SETFILTER, and processFilterKey.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and processFilterKey.

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

◆ processOptionsNext

- (void) processOptionsNext

Definition at line 2109 of file OOOXZManager.m.

2110{
2112 {
2114 }
2115 [self showOptionsUpdate];
2116 return;
2117}

References _filteredList, _offset, count, OXZ_GUI_NUM_LISTROWS, processOptionsNext, and showOptionsUpdate.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, processOptionsNext, and processSelection.

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

◆ processOptionsPrev

- (void) processOptionsPrev

Definition at line 2095 of file OOOXZManager.m.

2096{
2098 {
2099 _offset = 0;
2100 }
2101 else
2102 {
2104 }
2105 [self showOptionsUpdate];
2106}

References _offset, OXZ_GUI_NUM_LISTROWS, processOptionsPrev, and showOptionsUpdate.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, processOptionsPrev, and processSelection.

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

◆ processSelection

- (void) processSelection

Definition at line 1352 of file OOOXZManager.m.

1353{
1354 GuiDisplayGen *gui = [UNIVERSE gui];
1355 OOGUIRow selection = [gui selectedRow];
1356
1357 if (selection == OXZ_GUI_ROW_EXIT)
1358 {
1359 [self cancelUpdate]; // doesn't hurt if no update in progress
1360 [_dependencyStack removeAllObjects]; // cleanup
1362 _downloadStatus = OXZ_DOWNLOAD_NONE; // clear error state
1363 if (_changesMade)
1364 {
1366 }
1367 else
1368 {
1369 [PLAYER setGuiToIntroFirstGo:YES];
1370 if (_oxzList != nil)
1371 {
1373 }
1374 else
1375 {
1377 }
1378 return;
1379 }
1380 }
1381 else if (selection == OXZ_GUI_ROW_UPDATE) // also == _CANCEL
1382 {
1384 {
1387 }
1389 {
1390 [_dependencyStack removeAllObjects];
1394 }
1396 {
1397 [_dependencyStack removeAllObjects];
1401 }
1403 {
1404 [self cancelUpdate]; // sets interface state and download status
1405 }
1407 {
1409 }
1410 else
1411 {
1412 [self updateManifests];
1413 }
1414 }
1415 else if (selection == OXZ_GUI_ROW_INSTALL)
1416 {
1418 }
1419 else if (selection == OXZ_GUI_ROW_INSTALLED)
1420 {
1421 if (_interfaceState == OXZ_STATE_DEPENDENCIES) // also == _PROCEED_ALL
1422 {
1424 [self installOXZ:_item];
1425 }
1426 else
1427 {
1429 }
1430 }
1431 else if (selection == OXZ_GUI_ROW_REMOVE) // also == _PROCEED
1432 {
1434 {
1435 [self installOXZ:_item];
1436 }
1438 {
1440 }
1442 {
1443 [self setProgressStatus:[self extractOXZ:_item]];
1445 }
1446 else
1447 {
1449 }
1450 }
1451 else if (selection == OXZ_GUI_ROW_UPDATE_ALL)
1452 {
1453 OOLog(kOOOXZDebugLog, @"%@", @"Trying to update all managed OXPs");
1454 [self updateAllOXZ];
1455 }
1456 else if (selection == OXZ_GUI_ROW_LISTPREV)
1457 {
1458 [self processOptionsPrev];
1459 return;
1460 }
1461 else if (selection == OXZ_GUI_ROW_LISTNEXT)
1462 {
1463 [self processOptionsNext];
1464 return;
1465 }
1466 else
1467 {
1468 NSUInteger item = _offset + selection - OXZ_GUI_ROW_LISTSTART;
1470 {
1471 [self removeOXZ:item];
1472 }
1474 {
1475 OOLog(kOOOXZDebugLog, @"Trying to install index %lu", (unsigned long)item);
1476 [self installOXZ:item];
1477 }
1479 {
1480 OOLog(kOOOXZDebugLog, @"Trying to install index %lu", (unsigned long)item);
1481 [self installOXZ:item];
1482 }
1483
1484 }
1485
1486 [self gui]; // update GUI
1487}
@ OXZ_GUI_ROW_REMOVE
@ OXZ_GUI_ROW_UPDATE_ALL
@ OXZ_GUI_ROW_LISTPREV
@ OXZ_GUI_ROW_LISTNEXT

References _changesMade, _downloadAllDependencies, _downloadStatus, _interfaceState, _offset, _oxzList, cancelUpdate, extractOXZ:, gui, installOXZ:, kOOOXZDebugLog, nil, OOLog, OXZ_DOWNLOAD_NONE, OXZ_GUI_ROW_EXIT, OXZ_GUI_ROW_INSTALL, OXZ_GUI_ROW_INSTALLED, OXZ_GUI_ROW_LISTNEXT, OXZ_GUI_ROW_LISTPREV, OXZ_GUI_ROW_LISTSTART, OXZ_GUI_ROW_REMOVE, OXZ_GUI_ROW_UPDATE, OXZ_GUI_ROW_UPDATE_ALL, OXZ_STATE_DEPENDENCIES, OXZ_STATE_EXTRACT, OXZ_STATE_EXTRACTDONE, OXZ_STATE_INSTALLING, OXZ_STATE_MAIN, OXZ_STATE_NODATA, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, OXZ_STATE_REMOVING, OXZ_STATE_RESTARTING, OXZ_STATE_TASKDONE, OXZ_STATE_UPDATING, processOptionsNext, processOptionsPrev, processSelection, removeOXZ:, GuiDisplayGen::selectedRow, setProgressStatus:, updateAllOXZ, and updateManifests.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, processSelection, showOptionsNext, and showOptionsPrev.

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

◆ processShowInfoKey

- (void) processShowInfoKey

Definition at line 1548 of file OOOXZManager.m.

1549{
1551 {
1552 GuiDisplayGen *gui = [UNIVERSE gui];
1553
1555 {
1557 [self gui]; // restore screen
1558 // reset list selection position
1559 [gui setSelectedRow:(_item - _offset + OXZ_GUI_ROW_LISTSTART)];
1560 // and do the GUI again with the correct positions
1561 [self showOptionsUpdate]; // restore screen
1562 }
1563 else
1564 {
1565 OOGUIRow selection = [gui selectedRow];
1566
1567 if (selection < OXZ_GUI_ROW_LISTSTART || selection >= OXZ_GUI_ROW_LISTSTART + OXZ_GUI_NUM_LISTROWS)
1568 {
1569 // not on an OXZ
1570 return;
1571 }
1572
1573
1574 _item = _offset + selection - OXZ_GUI_ROW_LISTSTART;
1575
1576 NSDictionary *manifest = [_filteredList oo_dictionaryAtIndex:_item];
1578
1579 [gui clearAndKeepBackground:YES];
1580 [gui setTitle:DESC(@"oolite-oxzmanager-title-infopage")];
1581
1582// title, version
1583 [gui setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-title-@-version-@"),
1584 [manifest oo_stringForKey:kOOManifestTitle],
1585 [manifest oo_stringForKey:kOOManifestVersion]]
1586 forRow:0 align:GUI_ALIGN_LEFT];
1587
1588// author
1589 [gui setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-author-@"),
1590 [manifest oo_stringForKey:kOOManifestAuthor]]
1591 forRow:1 align:GUI_ALIGN_LEFT];
1592
1593// license
1594 [gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-license-@"),
1595 [manifest oo_stringForKey:kOOManifestLicense]]
1596 startingAtRow:2 align:GUI_ALIGN_LEFT];
1597// tags
1598
1599 [gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-tags-@"),[[manifest oo_arrayForKey:kOOManifestTags] componentsJoinedByString: @", "]]
1600 startingAtRow:4 align:GUI_ALIGN_LEFT];
1601// description
1602 [gui addLongText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-description-@"),[manifest oo_stringForKey:kOOManifestDescription]]
1603 startingAtRow:7 align:GUI_ALIGN_LEFT];
1604
1605// infoURL
1606 NSString *infoURLString = [manifest oo_stringForKey:kOOManifestInformationURL];
1607 [gui setText:[NSString stringWithFormat:DESC(@"oolite-oxzmanager-infopage-infourl-@"),
1608 infoURLString]
1609 forRow:25 align:GUI_ALIGN_LEFT];
1610 // copy url info text to clipboard automatically once we are in the oxz info page
1611 [[UNIVERSE gameView] stringToClipboard:infoURLString];
1612
1613// instructions
1614 [gui setText:OOExpand(DESC(@"oolite-oxzmanager-infopage-return")) forRow:27 align:GUI_ALIGN_CENTER];
1615 [gui setColor:[OOColor greenColor] forRow:27];
1616
1617 }
1618 }
1619}

References _interfaceShowingOXZDetail, _interfaceState, _item, _offset, GuiDisplayGen::addLongText:startingAtRow:align:, GuiDisplayGen::clearAndKeepBackground:, OOColor::greenColor, gui, OXZ_GUI_NUM_LISTROWS, OXZ_GUI_ROW_LISTSTART, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, processShowInfoKey, GuiDisplayGen::selectedRow, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setSelectedRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, and showOptionsUpdate.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and processShowInfoKey.

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

◆ processTextInput:

- (void) processTextInput: (NSString *) input

Definition at line 1502 of file OOOXZManager.m.

1502 :(NSString *)input
1503{
1504 if ([self validateFilter:input])
1505 {
1506 if ([input length] > 0)
1507 {
1508 [self setFilter:input];
1509 } // else keep previous filter
1511 [self gui];
1512 }
1513 // else nothing
1514}

References _interfaceState, gui, OXZ_STATE_PICK_INSTALL, and setFilter:.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

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

◆ refreshTextInput:

- (void) refreshTextInput: (NSString *) input

Definition at line 1517 of file OOOXZManager.m.

1517 :(NSString *)input
1518{
1519 GuiDisplayGen *gui = [UNIVERSE gui];
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])
1522 {
1523 [gui setColor:[OOColor cyanColor] forRow:OXZ_GUI_ROW_INPUT];
1524 }
1525 else
1526 {
1527 [gui setColor:[OOColor orangeColor] forRow:OXZ_GUI_ROW_INPUT];
1528 }
1529}

References OOColor::cyanColor, gui, OOColor::orangeColor, GuiDisplayGen::setColor:forRow:, and GuiDisplayGen::setText:forRow:align:.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

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

◆ removeOptions

- (NSArray *) removeOptions
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1933 of file OOOXZManager.m.

1934{
1935 NSArray *remList = _filteredList;
1936 if ([remList count] == 0)
1937 {
1938 return nil;
1939 }
1940 NSUInteger start = _offset;
1941 if (start >= [remList count])
1942 {
1943 start = 0;
1944 _offset = 0;
1945 }
1946 NSUInteger end = start + OXZ_GUI_NUM_LISTROWS;
1947 if (end > [remList count])
1948 {
1949 end = [remList count];
1950 }
1951 return [remList subarrayWithRange:NSMakeRange(start,end-start)];
1952}

References count, nil, OXZ_GUI_NUM_LISTROWS, and OOOXZManager(NSURLConnectionDataDelegate)::removeOptions.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::removeOptions, and showRemoveOptions.

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

◆ removeOXZ:

- (BOOL) removeOXZ: (NSUInteger) item
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1905 of file OOOXZManager.m.

1905 :(NSUInteger)item
1906{
1907 NSArray *remList = _filteredList;
1908 if ([remList count] <= item)
1909 {
1910 OOLog(kOOOXZDebugLog, @"Unable to remove item %lu as only %lu in list", (unsigned long)item, (unsigned long)[remList count]);
1911 return NO;
1912 }
1913 NSString *filename = [[remList objectAtIndex:item] oo_stringForKey:kOOManifestFilePath];
1914 if (filename == nil)
1915 {
1916 OOLog(kOOOXZDebugLog, @"Unable to remove item %lu as filename not found", (unsigned long)item);
1917 return NO;
1918 }
1919
1920 if (![[NSFileManager defaultManager] oo_removeItemAtPath:filename])
1921 {
1922 OOLog(kOOOXZErrorLog, @"Unable to remove file %@", filename);
1923 return NO;
1924 }
1925 _changesMade = YES;
1926 DESTROY(_managedList); // will need updating
1928 [self gui];
1929 return YES;
1930}

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

Referenced by 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 
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 562 of file OOOXZManager.m.

562 :(NSURLConnection *)download withLabel:(NSString *)label
563{
564 if (_currentDownload != nil)
565 {
566 [_currentDownload cancel]; // releases via delegate
567 }
568 _currentDownload = [download retain];
570 _currentDownloadName = [label copy];
571}
NSString * _currentDownloadName

References DESTROY, and nil.

Referenced by OOOXZManager(NSURLConnectionDataDelegate)::beginDownload:, and dealloc.

Here is the caller graph for this function:

◆ setFilter:

- (void) setFilter: (NSString *) filter
implementation

Definition at line 363 of file OOOXZManager.m.

363 :(NSString *)filter
364{
366 _currentFilter = [[filter lowercaseString] copy]; // copy retains
367}

References _currentFilter, and DESTROY.

Referenced by processTextInput:.

Here is the caller graph for this function:

◆ setFilteredList:

- (void) setFilteredList: (NSArray *) list
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 356 of file OOOXZManager.m.

356 :(NSArray *)list
357{
359 _filteredList = [list copy]; // copy retains
360}

References DESTROY.

Referenced by gui, OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedOXZ, showOptionsUpdate, and OOOXZManager(NSURLConnectionDataDelegate)::updateAllOXZ.

Here is the caller graph for this function:

◆ setOXZList:

- (void) setOXZList: (NSArray *) list
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 344 of file OOOXZManager.m.

344 :(NSArray *)list
345{
347 if (list != nil)
348 {
349 _oxzList = [[list sortedArrayUsingFunction:oxzSort context:NULL] retain];
350 // needed for update to available versions
352 }
353}

References DESTROY, and nil.

Referenced by init, and OOOXZManager(NSURLConnectionDataDelegate)::processDownloadedManifests.

Here is the caller graph for this function:

◆ setProgressStatus:

- (void) setProgressStatus: (NSString *) new
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 574 of file OOOXZManager.m.

574 :(NSString *)new
575{
577 _progressStatus = [new copy];
578}
NSString * _progressStatus

References DESTROY.

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

Here is the caller graph for this function:

◆ sharedManager

+ (OOOXZManager *) sharedManager

Definition at line 186 of file OOOXZManager.m.

187{
188 // NOTE: assumes single-threaded first access.
189 if (sSingleton == nil) sSingleton = [[self alloc] init];
190 return sSingleton;
191}

References nil, sharedManager, and sSingleton.

Referenced by GameController::applicationDidFinishLaunching:, PlayerEntity(OOControlsPrivate)::pollDemoControls:, ResourceManager::rootPaths, PlayerEntity::setGuiToOXZManager, and sharedManager.

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

◆ showInstallOptions

- (OOGUIRow) showInstallOptions

Definition at line 1729 of file OOOXZManager.m.

1730{
1731 // shows the current installation options page
1732 OOGUIRow startRow = OXZ_GUI_ROW_LISTPREV;
1733 NSArray *options = [self installOptions];
1734 NSUInteger optCount = [_filteredList count];
1735 GuiDisplayGen *gui = [UNIVERSE gui];
1736 OOGUITabSettings tab_stops;
1737 tab_stops[0] = 0;
1738 tab_stops[1] = 100;
1739 tab_stops[2] = 320;
1740 tab_stops[3] = 400;
1741 [gui setTabStops:tab_stops];
1742
1743
1744 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-heading-category"),
1745 DESC(@"oolite-oxzmanager-heading-title"),
1746 DESC(@"oolite-oxzmanager-heading-installed"),
1747 DESC(@"oolite-oxzmanager-heading-downloadable"),
1748 nil] forRow:OXZ_GUI_ROW_LISTHEAD];
1749
1750 if (_offset > 0)
1751 {
1752 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTPREV];
1753 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"",@"",@" <-- ", nil] forRow:OXZ_GUI_ROW_LISTPREV];
1754 [gui setKey:@"_BACK" forRow:OXZ_GUI_ROW_LISTPREV];
1755 }
1756 else
1757 {
1758 if ([gui selectedRow] == OXZ_GUI_ROW_LISTPREV)
1759 {
1760 [gui setSelectedRow:OXZ_GUI_ROW_LISTSTART];
1761 }
1762 [gui setText:@"" forRow:OXZ_GUI_ROW_LISTPREV align:GUI_ALIGN_LEFT];
1763 [gui setKey:GUI_KEY_SKIP forRow:OXZ_GUI_ROW_LISTPREV];
1764 }
1765 if (_offset + 10 < optCount)
1766 {
1767 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTNEXT];
1768 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"",@"",@" --> ", nil] forRow:OXZ_GUI_ROW_LISTNEXT];
1769 [gui setKey:@"_NEXT" forRow:OXZ_GUI_ROW_LISTNEXT];
1770 }
1771 else
1772 {
1773 if ([gui selectedRow] == OXZ_GUI_ROW_LISTNEXT)
1774 {
1775 [gui setSelectedRow:OXZ_GUI_ROW_LISTSTART];
1776 }
1777 [gui setText:@"" forRow:OXZ_GUI_ROW_LISTNEXT align:GUI_ALIGN_LEFT];
1778 [gui setKey:GUI_KEY_SKIP forRow:OXZ_GUI_ROW_LISTNEXT];
1779 }
1780
1781 // clear any previous longtext
1782 for (NSUInteger i = OXZ_GUI_ROW_LISTSTATUS; i < OXZ_GUI_ROW_INSTALL-1; i++)
1783 {
1784 [gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
1785 [gui setKey:GUI_KEY_SKIP forRow:i];
1786 }
1787 // and any previous listed entries
1788 for (NSUInteger i = OXZ_GUI_ROW_LISTSTART; i < OXZ_GUI_ROW_LISTNEXT; i++)
1789 {
1790 [gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
1791 [gui setKey:GUI_KEY_SKIP forRow:i];
1792 }
1793
1795 NSDictionary *manifest = nil;
1796 BOOL oxzLineSelected = NO;
1797
1798 foreach (manifest, options)
1799 {
1800 NSDictionary *installed = [ResourceManager manifestForIdentifier:[manifest oo_stringForKey:kOOManifestIdentifier]];
1801 NSString *localPath = [[[self installPath] stringByAppendingPathComponent:[manifest oo_stringForKey:kOOManifestIdentifier]] stringByAppendingPathExtension:@"oxz"];
1802 if (installed == nil)
1803 {
1804 // check that there's not one just been downloaded
1805 installed = OODictionaryFromFile([localPath stringByAppendingPathComponent:@"manifest.plist"]);
1806 }
1807 else
1808 {
1809 // check for a more recent download
1810 if ([[NSFileManager defaultManager] fileExistsAtPath:localPath])
1811 {
1812
1813 installed = OODictionaryFromFile([localPath stringByAppendingPathComponent:@"manifest.plist"]);
1814 }
1815 else
1816 {
1817 // check if this was a managed OXZ which has been deleted
1818 if ([[installed oo_stringForKey:kOOManifestFilePath] hasPrefix:[self installPath]])
1819 {
1820 installed = nil;
1821 }
1822 }
1823 }
1824
1825 NSString *installedVersion = DESC(@"oolite-oxzmanager-version-none");
1826 if (installed != nil)
1827 {
1828 installedVersion = [installed oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-version-none")];
1829 }
1830
1831 /* If the filter is in use, the available_version key will
1832 * contain the version which can be downloaded. */
1833 [gui setArray:[NSArray arrayWithObjects:
1834 [manifest oo_stringForKey:kOOManifestCategory defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
1835 [manifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
1836 installedVersion,
1837 [manifest oo_stringForKey:kOOManifestAvailableVersion defaultValue:[manifest oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-version-none")]],
1838 nil] forRow:row];
1839
1840 [gui setKey:[manifest oo_stringForKey:kOOManifestIdentifier] forRow:row];
1841 /* yellow for installable, orange for dependency issues, grey and unselectable for version issues, white and unselectable for already installed (manually or otherwise) at the current version, red and unselectable for already installed manually at a different version. */
1842 [gui setColor:[self colorForManifest:manifest] forRow:row];
1843
1844 if (row == [gui selectedRow])
1845 {
1846 oxzLineSelected = YES;
1847
1848 [gui setText:[self installStatusForManifest:manifest] forRow:OXZ_GUI_ROW_LISTSTATUS];
1849 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTSTATUS];
1850
1851 [gui addLongText:[[[manifest oo_stringForKey:kOOManifestDescription] componentsSeparatedByString:@"\n"] oo_stringAtIndex:0] startingAtRow:OXZ_GUI_ROW_LISTDESC align:GUI_ALIGN_LEFT];
1852
1853 NSString *infoUrl = [manifest oo_stringForKey:kOOManifestInformationURL];
1854 if (infoUrl != nil)
1855 {
1856 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-url"),infoUrl,nil] forRow:OXZ_GUI_ROW_LISTINFO1];
1857 }
1858 NSUInteger size = [manifest oo_unsignedIntForKey:kOOManifestFileSize defaultValue:0];
1859 NSString *updatedDesc = nil;
1860
1861 NSUInteger timestamp = [manifest oo_unsignedIntegerForKey:kOOManifestUploadDate defaultValue:0];
1862 if (timestamp > 0)
1863 {
1864 // list of installable OXZs
1865 NSDate *updated = [NSDate dateWithTimeIntervalSince1970:timestamp];
1866
1867 //keep only the first part of the date string description, which should be in YYYY-MM-DD format
1868 updatedDesc = [[[updated description] componentsSeparatedByString:@" "] oo_stringAtIndex:0];
1869
1870 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-size"),[self humanSize:size],DESC(@"oolite-oxzmanager-infoline-date"),updatedDesc,nil] forRow:OXZ_GUI_ROW_LISTINFO2];
1871 }
1872 else if (size > 0)
1873 {
1874 // list of installed/removable OXZs
1875 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-infoline-size"),[self humanSize:size],nil] forRow:OXZ_GUI_ROW_LISTINFO2];
1876 }
1877
1878
1879 }
1880
1881
1882 row++;
1883 }
1884
1885 if (!oxzLineSelected)
1886 {
1888 {
1889 // installeD
1890 [gui addLongText:OOExpand(DESC(@"oolite-oxzmanager-installed-nonepicked")) startingAtRow:OXZ_GUI_ROW_LISTDESC align:GUI_ALIGN_LEFT];
1891 }
1892 else
1893 {
1894 // installeR
1895 [gui addLongText:OOExpand(DESC(@"oolite-oxzmanager-installer-nonepicked")) startingAtRow:OXZ_GUI_ROW_LISTDESC align:GUI_ALIGN_LEFT];
1896 }
1897
1898 }
1899
1900
1901 return startRow;
1902}
OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS]
@ OXZ_GUI_ROW_LISTSTATUS
void setText:forRow:(NSString *str,[forRow] OOGUIRow row)
void setTabStops:(OOGUITabSettings stops)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
voidpf void uLong size
Definition ioapi.h:134

References _interfaceState, _offset, GuiDisplayGen::addLongText:startingAtRow:align:, colorForManifest:, DESC, OOColor::greenColor, gui, humanSize:, installOptions, installPath, installStatusForManifest:, kOOManifestFilePath, ResourceManager::manifestForIdentifier:, nil, OODictionaryFromFile(), OXZ_GUI_ROW_INSTALL, OXZ_GUI_ROW_LISTNEXT, OXZ_GUI_ROW_LISTPREV, OXZ_GUI_ROW_LISTSTART, OXZ_GUI_ROW_LISTSTATUS, OXZ_STATE_PICK_INSTALLED, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectedRow:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setText:forRow:align:, and showInstallOptions.

Referenced by gui, showInstallOptions, and showOptionsUpdate.

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

◆ showOptionsNext

- (void) showOptionsNext

Definition at line 2120 of file OOOXZManager.m.

2121{
2122 GuiDisplayGen *gui = [UNIVERSE gui];
2124 {
2125 if ([gui selectedRow] == OXZ_GUI_ROW_LISTNEXT)
2126 {
2127 [self processSelection];
2128 }
2129 }
2130}

References _interfaceState, gui, OXZ_GUI_ROW_LISTNEXT, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, processSelection, and showOptionsNext.

Referenced by showOptionsNext.

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

◆ showOptionsPrev

- (void) showOptionsPrev

Definition at line 2082 of file OOOXZManager.m.

2083{
2084 GuiDisplayGen *gui = [UNIVERSE gui];
2086 {
2087 if ([gui selectedRow] == OXZ_GUI_ROW_LISTPREV)
2088 {
2089 [self processSelection];
2090 }
2091 }
2092}

References _interfaceState, gui, OXZ_GUI_ROW_LISTPREV, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, processSelection, and showOptionsPrev.

Referenced by showOptionsPrev.

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

◆ showOptionsUpdate

- (void) showOptionsUpdate

Definition at line 2060 of file OOOXZManager.m.

2061{
2062
2064 {
2065 [self setFilteredList:[self applyCurrentFilter:_oxzList]];
2066 [self showInstallOptions];
2067 }
2069 {
2070 [self setFilteredList:[self applyCurrentFilter:[self managedOXZs]]];
2071 [self showInstallOptions];
2072 }
2074 {
2075 [self setFilteredList:[self applyCurrentFilter:[self managedOXZs]]];
2076 [self showRemoveOptions];
2077 }
2078 // else nothing necessary
2079}

References _interfaceState, applyCurrentFilter:, managedOXZs, OXZ_STATE_PICK_INSTALL, OXZ_STATE_PICK_INSTALLED, OXZ_STATE_PICK_REMOVE, setFilteredList:, showInstallOptions, showOptionsUpdate, and showRemoveOptions.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, processOptionsNext, processOptionsPrev, processShowInfoKey, and showOptionsUpdate.

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

◆ showRemoveOptions

- (OOGUIRow) showRemoveOptions

Definition at line 1955 of file OOOXZManager.m.

1956{
1957 // shows the current installation options page
1958 OOGUIRow startRow = OXZ_GUI_ROW_LISTPREV;
1959 NSArray *options = [self removeOptions];
1960 GuiDisplayGen *gui = [UNIVERSE gui];
1961 if (options == nil)
1962 {
1963 [gui addLongText:DESC(@"oolite-oxzmanager-nothing-removable") startingAtRow:OXZ_GUI_ROW_PROGRESS align:GUI_ALIGN_LEFT];
1964 return startRow;
1965 }
1966
1967 OOGUITabSettings tab_stops;
1968 tab_stops[0] = 0;
1969 tab_stops[1] = 100;
1970 tab_stops[2] = 400;
1971 [gui setTabStops:tab_stops];
1972
1973 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-oxzmanager-heading-category"),
1974 DESC(@"oolite-oxzmanager-heading-title"),
1975 DESC(@"oolite-oxzmanager-heading-version"),
1976 nil] forRow:OXZ_GUI_ROW_LISTHEAD];
1977 if (_offset > 0)
1978 {
1979 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTPREV];
1980 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"",@" <-- ", nil] forRow:OXZ_GUI_ROW_LISTPREV];
1981 [gui setKey:@"_BACK" forRow:OXZ_GUI_ROW_LISTPREV];
1982 }
1983 else
1984 {
1985 if ([gui selectedRow] == OXZ_GUI_ROW_LISTPREV)
1986 {
1987 [gui setSelectedRow:OXZ_GUI_ROW_LISTSTART];
1988 }
1989 [gui setText:@"" forRow:OXZ_GUI_ROW_LISTPREV align:GUI_ALIGN_LEFT];
1990 [gui setKey:GUI_KEY_SKIP forRow:OXZ_GUI_ROW_LISTPREV];
1991 }
1993 {
1994 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTNEXT];
1995 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"",@" --> ", nil] forRow:OXZ_GUI_ROW_LISTNEXT];
1996 [gui setKey:@"_NEXT" forRow:OXZ_GUI_ROW_LISTNEXT];
1997 }
1998 else
1999 {
2000 if ([gui selectedRow] == OXZ_GUI_ROW_LISTNEXT)
2001 {
2002 [gui setSelectedRow:OXZ_GUI_ROW_LISTSTART];
2003 }
2004 [gui setText:@"" forRow:OXZ_GUI_ROW_LISTNEXT align:GUI_ALIGN_LEFT];
2005 [gui setKey:GUI_KEY_SKIP forRow:OXZ_GUI_ROW_LISTNEXT];
2006 }
2007
2008 // clear any previous longtext
2009 for (NSUInteger i = OXZ_GUI_ROW_LISTDESC; i < OXZ_GUI_ROW_INSTALL-1; i++)
2010 {
2011 [gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
2012 [gui setKey:GUI_KEY_SKIP forRow:i];
2013 }
2014 // and any previous listed entries
2015 for (NSUInteger i = OXZ_GUI_ROW_LISTSTART; i < OXZ_GUI_ROW_LISTNEXT; i++)
2016 {
2017 [gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
2018 [gui setKey:GUI_KEY_SKIP forRow:i];
2019 }
2020
2021
2023 NSDictionary *manifest = nil;
2024 BOOL oxzSelected = NO;
2025
2026 foreach (manifest, options)
2027 {
2028
2029 [gui setArray:[NSArray arrayWithObjects:
2030 [manifest oo_stringForKey:kOOManifestCategory defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2031 [manifest oo_stringForKey:kOOManifestTitle defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2032 [manifest oo_stringForKey:kOOManifestVersion defaultValue:DESC(@"oolite-oxzmanager-missing-field")],
2033 nil] forRow:row];
2034 NSString *identifier = [manifest oo_stringForKey:kOOManifestIdentifier];
2035 [gui setKey:identifier forRow:row];
2036
2037 [gui setColor:[self colorForManifest:manifest] forRow:row];
2038
2039 if (row == [gui selectedRow])
2040 {
2041 [gui setText:[self installStatusForManifest:manifest] forRow:OXZ_GUI_ROW_LISTSTATUS];
2042 [gui setColor:[OOColor greenColor] forRow:OXZ_GUI_ROW_LISTSTATUS];
2043
2044 [gui addLongText:[[[manifest oo_stringForKey:kOOManifestDescription] componentsSeparatedByString:@"\n"] oo_stringAtIndex:0] startingAtRow:OXZ_GUI_ROW_LISTDESC align:GUI_ALIGN_LEFT];
2045
2046 oxzSelected = YES;
2047 }
2048 row++;
2049 }
2050
2051 if (!oxzSelected)
2052 {
2053 [gui addLongText:DESC(@"oolite-oxzmanager-remover-nonepicked") startingAtRow:OXZ_GUI_ROW_LISTDESC align:GUI_ALIGN_LEFT];
2054 }
2055
2056 return startRow;
2057}
@ OXZ_GUI_ROW_LISTDESC

References _offset, GuiDisplayGen::addLongText:startingAtRow:align:, colorForManifest:, count, OOColor::greenColor, gui, installStatusForManifest:, managedOXZs, nil, OXZ_GUI_NUM_LISTROWS, OXZ_GUI_ROW_INSTALL, OXZ_GUI_ROW_LISTDESC, OXZ_GUI_ROW_LISTNEXT, OXZ_GUI_ROW_LISTPREV, OXZ_GUI_ROW_LISTSTART, removeOptions, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectedRow:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setText:forRow:align:, and showRemoveOptions.

Referenced by gui, showOptionsUpdate, and showRemoveOptions.

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

◆ updateAllOXZ

- (BOOL) updateAllOXZ
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 1681 of file OOOXZManager.m.

1682{
1683 [_dependencyStack removeAllObjects];
1685 [self setFilteredList:_oxzList];
1686 NSDictionary *manifest = nil;
1687
1688 foreach (manifest,_oxzList)
1689 {
1690 if ([self installableState:manifest] == OXZ_INSTALLABLE_UPDATE)
1691 {
1692 OOLog(kOOOXZDebugLog, @"Queuing in for update: %@", manifest);
1693 [_dependencyStack addObject:manifest];
1694 }
1695 }
1696 NSDictionary *first = [_dependencyStack anyObject];
1697 NSString* identifier = [first oo_stringForKey:kOOManifestRelationIdentifier];
1698 NSUInteger item = NSUIntegerMax;
1699 NSDictionary *availableDownload = nil;
1700 foreach (availableDownload, _oxzList)
1701 {
1702 if ([[availableDownload oo_stringForKey:kOOManifestIdentifier] isEqualToString:identifier])
1703 {
1704 item = [_oxzList indexOfObject:availableDownload];
1705 break;
1706 }
1707 }
1708 return [self installOXZ:item];
1709}

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

Referenced by processSelection, and OOOXZManager(NSURLConnectionDataDelegate)::updateAllOXZ.

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

◆ updateManifests

- (BOOL) updateManifests

Definition at line 580 of file OOOXZManager.m.

581{
582 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[self dataURL]]];
584 {
585 return NO;
586 }
589 [self setProgressStatus:@""];
590
591 return [self beginDownload:request];
592}

References _downloadStatus, _interfaceState, beginDownload:, dataURL, OXZ_DOWNLOAD_NONE, OXZ_DOWNLOAD_STARTED, OXZ_STATE_UPDATING, setProgressStatus:, and updateManifests.

Referenced by processSelection, and updateManifests.

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

◆ validateFilter:

- (BOOL) validateFilter: (NSString *) input
implementation

Provided by category OOOXZManager(NSURLConnectionDataDelegate).

Definition at line 541 of file OOOXZManager.m.

541 :(NSString *)input
542{
543 NSString *filter = [input lowercaseString];
544 if (([filter length] == 0) // empty is valid
545 || ([filter isEqualToString:kOOOXZFilterAll])
546 || ([filter isEqualToString:kOOOXZFilterUpdates])
547 || ([filter isEqualToString:kOOOXZFilterInstallable])
548 || ([filter hasPrefix:kOOOXZFilterKeyword] && [filter length] > [kOOOXZFilterKeyword length])
549 || ([filter hasPrefix:kOOOXZFilterAuthor] && [filter length] > [kOOOXZFilterAuthor length])
550 || ([filter hasPrefix:kOOOXZFilterDays] && [[filter substringFromIndex:[kOOOXZFilterDays length]] intValue] > 0)
551 || ([filter hasPrefix:kOOOXZFilterTag] && [filter length] > [kOOOXZFilterTag length])
552 || ([filter hasPrefix:kOOOXZFilterCategory] && [filter length] > [kOOOXZFilterCategory length])
553 )
554 {
555 return YES;
556 }
557
558 return NO;
559}
static NSString *const kOOOXZFilterAll

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

Member Data Documentation

◆ _changesMade

- (BOOL) _changesMade
private

Definition at line 70 of file OOOXZManager.h.

Referenced by gui, init, isRestarting, and processSelection.

◆ _currentDownload

- (NSURLConnection*) _currentDownload
private

Definition at line 72 of file OOOXZManager.h.

Referenced by cancelUpdate.

◆ _currentDownloadName

- (NSString*) _currentDownloadName
private

Definition at line 73 of file OOOXZManager.h.

◆ _currentFilter

- (NSString*) _currentFilter
private

Definition at line 66 of file OOOXZManager.h.

Referenced by init, and setFilter:.

◆ _dependencyStack

- (NSMutableSet*) _dependencyStack
private

Definition at line 86 of file OOOXZManager.h.

Referenced by init.

◆ _downloadAllDependencies

- (BOOL) _downloadAllDependencies
private

Definition at line 81 of file OOOXZManager.h.

Referenced by init, and processSelection.

◆ _downloadExpected

- (NSUInteger) _downloadExpected
private

Definition at line 77 of file OOOXZManager.h.

◆ _downloadProgress

- (NSUInteger) _downloadProgress
private

Definition at line 76 of file OOOXZManager.h.

◆ _downloadStatus

- (OXZDownloadStatus) _downloadStatus
private

Definition at line 75 of file OOOXZManager.h.

Referenced by cancelUpdate, gui, init, isRestarting, processSelection, and updateManifests.

◆ _fileWriter

- (NSFileHandle*) _fileWriter
private

Definition at line 78 of file OOOXZManager.h.

◆ _filteredList

- (NSArray*) _filteredList
private

Definition at line 65 of file OOOXZManager.h.

Referenced by dealloc, and processOptionsNext.

◆ _interfaceShowingOXZDetail

- (BOOL) _interfaceShowingOXZDetail
private

◆ _interfaceState

◆ _item

- (NSUInteger) _item
private

Definition at line 79 of file OOOXZManager.h.

Referenced by processExtractKey, and processShowInfoKey.

◆ _managedList

- (NSArray*) _managedList
private

Definition at line 64 of file OOOXZManager.h.

Referenced by dealloc, and managedOXZs.

◆ _offset

- (NSUInteger) _offset
private

◆ _oxzList

- (NSArray*) _oxzList
private

Definition at line 63 of file OOOXZManager.h.

Referenced by dealloc, gui, init, managedOXZs, manifests, and processSelection.

◆ _progressStatus

- (NSString*) _progressStatus
private

Definition at line 85 of file OOOXZManager.h.


The documentation for this class was generated from the following files: