Created
July 22, 2012 16:09
-
-
Save Eric-Bro/3160157 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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