Skip to content

Instantly share code, notes, and snippets.

@Eric-Bro
Created July 22, 2012 16:09
Show Gist options
  • Save Eric-Bro/3160157 to your computer and use it in GitHub Desktop.
Save Eric-Bro/3160157 to your computer and use it in GitHub Desktop.
- (void)imageView:(id)view didReceivedBundle:(NSBundle *)bundle
{
NSAlert *alert = [NSAlert alertWithMessageText: @""
defaultButton: @"Okay"
alternateButton: nil
otherButton: nil
informativeTextWithFormat: @""];
if (!bundle) {
/* The case should never be occurred */
[alert setMessageText: @"No such bundle"];
[alert setInformativeText: @"No such bundle"];
goto show_alert;
}
NSError *error = nil;
Patcher *patcher = [[Patcher alloc] initWithBundle: bundle getError: &error];
if (!patcher) {
[alert setMessageText: @"Something went wrong!"];
[alert setInformativeText: error.localizedDescription];
} else if ([patcher doMagic]) {
[alert setMessageText: @"It's okay" ];
[alert setInformativeText: [NSString stringWithFormat: @"The %@ (v%@) should works just fine now.\n\nRegister the app with ANY name and serial if necessary.",
patcher.application, patcher.version]];
} else {
[alert setMessageText: @"Epic fail" ];
[alert setInformativeText: @"Can't patch the application, sorry :("];
}
show_alert:
[alert beginSheetModalForWindow: self.window
modalDelegate: self
didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:)
contextInfo: view];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment