OSDN Git Service

UIを調整
[kcd/KCD.git] / KCD / HMJSONViewCommand.m
1 //
2 //  HMJSONViewCommand.m
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2014/02/09.
6 //  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
7 //
8
9 #import "HMJSONViewCommand.h"
10 #import "HMAppDelegate.h"
11
12 #if ENABLE_JSON_LOG
13
14
15 @interface HMJSONViewCommand ()
16
17 @end
18
19 @implementation HMJSONViewCommand
20 + (BOOL)canExcuteAPI:(NSString *)api
21 {
22         return YES;
23 }
24
25 - (void)execute
26 {
27         dispatch_async(dispatch_get_main_queue(), ^{
28                 HMAppDelegate *appDelegate = [[NSApplication sharedApplication] delegate];
29                 if(!self.api) {
30                         NSLog(@"api is nil.");
31                         return;
32                 }
33                 if(!self.argumentArray) {
34                         NSLog(@"argmentArray is nil.");
35                         return;
36                 }
37                 if(!self.jsonTree) {
38                         NSLog(@"jsonTree is nil");
39                         return;
40                 }
41                 if(!self.recieveDate) {
42                         NSLog(@"recieveDate is nil.");
43                         return;
44                 }
45                 [appDelegate.jsonViewWindowController setCommand:@{@"api":self.api,
46                                                                                                                    @"argument":self.argumentArray,
47                                                                                                                    @"json":self.jsonTree,
48                                                                                                                    @"recieveDate":self.recieveDate,
49                                                                                                                    @"date": [NSDate dateWithTimeIntervalSinceNow:0]}];
50         });
51 }
52
53 @end
54
55 #endif