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];
55 [window makeKeyAndOrderFront:nil];
56 // [window setLevel:NSStatusWindowLevel];
59 - (void)showPanelIfNeeded
61 if ( ! (checkDone == 2475) ) {
62 if ( ! ([self checkKeyFile] == 7465) ) {
70 - (void)goToTheStore:(id)sender
72 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://store.eSellerate.net/s.asp?s=STR090894476"]];
75 - (void)registerLater:(id)sender
77 [window orderOut:self];
80 - (void)verifyKey:(id)sender
82 NSString *o = [window owner];
83 NSString *k = [window key];
85 MTeSerialNumber *s = [[[MTeSerialNumber alloc] initWithSerialNumber:k
88 publisher:@"04611"] autorelease];
89 if ( ([s isValid] == ITeSerialNumberIsValid) && ( [[[s infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] ) ) {
91 NSFileManager *fm = [NSFileManager defaultManager];
93 if ( ! [fm fileExistsAtPath:APP_SUPPORT_PATH_STRING] ) {
94 [fm createDirectoryAtPath:APP_SUPPORT_PATH_STRING attributes:nil];
97 [[NSDictionary dictionaryWithObjectsAndKeys:
100 nil] writeToFile:LICENSE_PATH_STRING atomically:YES];
104 NSBeginInformationalAlertSheet(NSLocalizedString(@"validated_title", @"Validated Title"),
105 @"Thank You!", nil, nil,
108 @selector(finishValidSheet:returnCode:contextInfo:),
111 NSLocalizedString(@"validated_msg", @"Validated Message"));
115 NSBeginAlertSheet(NSLocalizedString(@"failed_title", @"Failed Title"),
116 @"Try Again", nil, nil,
120 NSLocalizedString(@"failed_msg", @"Failed Message"));
122 [[MainController sharedController] blingTime];
127 NSString *p = LICENSE_PATH_STRING;
128 MTeSerialNumber *k = [[[MTeSerialNumber alloc] initWithContentsOfFile:p
130 publisher:@"04611"] autorelease];
131 if ( k && ([k isValid] == ITeSerialNumberIsValid) && ( [[[k infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] )) {
134 [[NSFileManager defaultManager] removeFileAtPath:p handler:nil];
142 if ( ! (checkDone == 2475) ) {
143 if ( ! ([self checkKeyFile] == 7465) ) {
152 - (void)finishValidSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
154 [window orderOut:self];