AppDelegate.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // AppDelegate.m
  3. // UUTUtils2.1
  4. //
  5. // Created by 刘玉涛 on 2018/4/10.
  6. // Copyright © 2018年 dym. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. #import "ProjectListWC.h"
  10. #import "DataUtils.h"
  11. #import "ZGWebUtils.h"
  12. #import "AdWorthJsonGenerator.h"
  13. #import "UrlCrptyUtils.h"
  14. #import "ZGJsonUtils.h"
  15. @class AMPathPopUpButton;
  16. @interface AppDelegate ()
  17. @property (weak) IBOutlet NSWindow *window;
  18. @property (strong) ProjectListWC *ProjectListWC;
  19. @end
  20. @implementation AppDelegate
  21. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  22. // Insert code here to initialize your application
  23. if (NO) {
  24. NSMutableDictionary *md = [NSMutableDictionary dictionaryWithCapacity:0];
  25. // cfg = @"zhuge test";
  26. md[@"packname"] = @"com.billiards.shooting.ball.pool";
  27. md[@"sdkVersion"] = @(1);
  28. NSString *cfg = [NSString stringWithContentsOfFile:@"/Users/zhuge/workspace/git/Billiards/Billiards/Resources/ad.json" encoding:NSUTF8StringEncoding error:nil];
  29. // NSDictionary *dicAd = [ZGJsonUtils stringToObject:cfg];
  30. // NSMutableDictionary *mdAd = [NSMutableDictionary dictionaryWithCapacity:0];
  31. // mdAd[@"ad"] = dicAd;
  32. // mdAd[@"parameters"] = @"{\"LSR\":\"1000\",\"GTSR\":\"1000\"}";
  33. // cfg = [ZGJsonUtils dictionaryToString:cfg];
  34. cfg = [UrlCrptyUtils encrypt:cfg];
  35. md[@"adJson"] = cfg;
  36. md[@"group"] = @(1);
  37. NSString *url = [NSString stringWithFormat:@"http://adsaccount.appcpi.net/adsaccount/www/gateway.php?act=205"];
  38. NSString *post = [NSString stringWithFormat:@"data=%@", [ZGJsonUtils dictionaryToString:md]];
  39. NSLog(@"%@&%@", url, post);
  40. NSData *data = [post dataUsingEncoding:NSUTF8StringEncoding];
  41. NSString *ret = [ZGWebUtils stringOfURLByPost:url postData:data];
  42. NSLog(@"%@", ret);
  43. } else {
  44. if ([DataUtils isRootPathConfiged]) {
  45. [self showProjectListWindow];
  46. } else {
  47. self.dropView.delegate = self;
  48. }
  49. }
  50. }
  51. - (void)applicationWillTerminate:(NSNotification *)aNotification {
  52. // Insert code here to tear down your application
  53. }
  54. #pragma mark window change
  55. - (void) showProjectListWindow {
  56. self.ProjectListWC = [[ProjectListWC alloc] initWithWindowNibName:@"ProjectListWC"];
  57. [self.ProjectListWC showWindow:self.window];
  58. [self.ProjectListWC.window makeMainWindow];
  59. [self.window close];
  60. }
  61. #pragma mark btn
  62. - (IBAction)onSaveBtn:(id)sender {
  63. [self showProjectListWindow];
  64. }
  65. #pragma mark dropview delegate
  66. - (void)dropImageView:(DropImageView *)dropImageView didSelectFile:(NSString *)filePath {
  67. }
  68. - (void)dropImageView:(DropImageView *)dropImageView didSelectDirectory:(NSString *)dirPath {
  69. }
  70. @end