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"
12 #define APP_SUPPORT_PATH_STRING [@"~/Library/Application Support/MenuTunes/" stringByExpandingTildeInPath]
13 #define LICENSE_PATH_STRING [APP_SUPPORT_PATH_STRING stringByAppendingString:@"/.license"]
16 @interface MTBlingController (Private)
21 @implementation MTBlingController
37 if ( ( self = [super init] ) ) {
47 window = [MTShizzleWindow sharedWindowForSender:self];
51 [window makeKeyAndOrderFront:nil];
52 // [window setLevel:NSStatusWindowLevel];
55 - (void)showPanelIfNeeded
57 if ( ! (checkDone == 2475) ) {
58 if ( ! ([self checkKeyFile] == 7465) ) {
66 - (void)goToTheStore:(id)sender
68 [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://store.eSellerate.net/s.asp?s=STR090894476"]];
71 - (void)registerLater:(id)sender
73 [window orderOut:self];
76 - (void)verifyKey:(id)sender
78 NSString *o = [window owner];
79 NSString *k = [window key];
81 MTeSerialNumber *s = [[[MTeSerialNumber alloc] initWithSerialNumber:k
84 publisher:@"04611"] autorelease];
85 if ( ([s isValid] == ITeSerialNumberIsValid) && ( [[[s infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] ) ) {
87 NSFileManager *fm = [NSFileManager defaultManager];
89 if ( ! [fm fileExistsAtPath:APP_SUPPORT_PATH_STRING] ) {
90 [fm createDirectoryAtPath:APP_SUPPORT_PATH_STRING attributes:nil];
93 [[NSDictionary dictionaryWithObjectsAndKeys:
96 nil] writeToFile:LICENSE_PATH_STRING atomically:YES];
100 NSBeginInformationalAlertSheet(NSLocalizedString(@"validated_title", @"Validated Title"),
101 @"Thank You!", nil, nil,
104 @selector(finishValidSheet:returnCode:contextInfo:),
107 NSLocalizedString(@"validated_msg", @"Validated Message"));
111 NSBeginAlertSheet(NSLocalizedString(@"failed_title", @"Failed Title"),
112 @"Try Again", nil, nil,
116 NSLocalizedString(@"failed_msg", @"Failed Message"));
123 NSString *p = LICENSE_PATH_STRING;
124 MTeSerialNumber *k = [[[MTeSerialNumber alloc] initWithContentsOfFile:p
126 publisher:@"04611"] autorelease];
127 if ( k && ([k isValid] == ITeSerialNumberIsValid) && ( [[[k infoDictionary] objectForKey:@"appIdentifier"] isEqualToString:@"MT"] )) {
130 [[NSFileManager defaultManager] removeFileAtPath:p handler:nil];
138 if ( ! (checkDone == 2475) ) {
139 if ( ! ([self checkKeyFile] == 7465) ) {
148 - (void)finishValidSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
150 [window orderOut:self];