5 // Created by Matthew L. Judy on Tue Aug 19 2003.
6 // Copyright (c) 2003 iThink Software. All rights reserved.
9 #import "MTBlingController.h"
10 #import "MTeSerialNumber.h"
11 #import "MainController.h"
13 #define APP_SUPPORT_PATH_STRING [@"~/Library/Application Support/MenuTunes/" stringByExpandingTildeInPath]
14 #define LICENSE_PATH_STRING [APP_SUPPORT_PATH_STRING stringByAppendingString:@"/.license"]
17 @interface MTBlingController (Private)
22 @implementation MTBlingController
37 - (void)_FIVERSKATES {}
41 if ( ( self = [super init] ) ) {
51 window = [MTShizzleWindow sharedWindowForSender:self];
53 [NSApp activateIgnoringOtherApps:YES];
55 [window orderFrontRegardless];
56 [window makeKeyWindow];
57 // [window setLevel:NSStatusWindowLevel];
60 - (void)showPanelIfNeeded
62 if ( ! (checkDone == 2475) ) {
63 if ( ! ([self checkKeyFile] == 7465) ) {
71 - (void)goToTheStore:(id)sender
73 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://store.eSellerate.net/s.asp?s=STR090894476"]];
76 - (void)registerLater:(id)sender
78 [window orderOut:self];
81 - (void)verifyKey:(id)sender
83 NSString *o = [window owner];
84 NSString *k = [window key];
86 MTeSerialNumber *s = [[[MTeSerialNumber alloc] initWithSerialNumber:k
89 publisher:@"04611"] autorelease];
90 if ( ([s isValid] == ITeSerialNumberIsValid) && ( [[[s infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] ) ) {
92 NSFileManager *fm = [NSFileManager defaultManager];
94 if ( ! [fm fileExistsAtPath:APP_SUPPORT_PATH_STRING] ) {
95 [fm createDirectoryAtPath:APP_SUPPORT_PATH_STRING attributes:nil];
98 [[NSDictionary dictionaryWithObjectsAndKeys:
101 nil] writeToFile:LICENSE_PATH_STRING atomically:YES];
105 NSBeginInformationalAlertSheet(NSLocalizedString(@"validated_title", @"Validated Title"),
106 @"Thank You!", nil, nil,
109 @selector(finishValidSheet:returnCode:contextInfo:),
112 NSLocalizedString(@"validated_msg", @"Validated Message"));
116 NSBeginAlertSheet(NSLocalizedString(@"failed_title", @"Failed Title"),
117 @"Try Again", nil, nil,
121 NSLocalizedString(@"failed_msg", @"Failed Message"));
123 [[MainController sharedController] blingTime];
128 NSString *p = LICENSE_PATH_STRING;
129 MTeSerialNumber *k = [[[MTeSerialNumber alloc] initWithContentsOfFile:p
131 publisher:@"04611"] autorelease];
132 if ( k && ([k isValid] == ITeSerialNumberIsValid) && ( [[[k infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] )) {
135 [[NSFileManager defaultManager] removeFileAtPath:p handler:nil];
143 if ( ! (checkDone == 2475) ) {
144 if ( ! ([self checkKeyFile] == 7465) ) {
153 - (void)finishValidSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
155 [window orderOut:self];