forked from wafflesoftware/thisservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TSService.h
88 lines (69 loc) · 2.79 KB
/
TSService.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// TSService.h
// ThisService
//
// Created by Jesper on 2011-07-20.
// Copyright 2011-2012 waffle software. All rights reserved.
// BSD licensed - see license.txt for more information.
//
#import <Cocoa/Cocoa.h>
@class IconFamily;
typedef enum {
TSServiceInputOnlyType,
TSServiceOutputOnlyType,
TSServiceFilterType,
TSServiceNoInputOutputType
} TSServiceType;
typedef enum {
TSServiceScriptCopied,
TSServiceScriptReferenced
} TSServiceScriptReferenceType;
@class TSServiceTester;
@interface TSService : NSObject {
NSString *serviceName;
NSString *serviceFileName;
NSString *executableName;
NSDictionary *infoPlistDictionary;
IconFamily *serviceIcon;
TSServiceType serviceType;
TSServiceScriptReferenceType scriptReferenceType;
NSArray *allInputRules;
NSSet *applicationIDs;
NSFileWrapper *serviceFileWrapper;
NSString *pathToScriptInFileWrapper;
NSString *pathToScriptOutsideService;
NSURL *existingServiceURL;
NSNumber *timeoutInSeconds;
}
+ (TSService *)serviceWithServiceName:(NSString *)name
serviceType:(TSServiceType)serviceType
scriptReferenceType:(TSServiceScriptReferenceType)scriptReferenceType
inputRules:(NSArray *)allInputRules
timeoutInSeconds:(NSNumber *)timeoutInSeconds
scriptPath:(NSString *)path
serviceIcon:(IconFamily *)image
applicationIDs:(NSSet *)applicationIDs;
// returns nil if the service is not a ThisService service
+ (TSService *)serviceAtURL:(NSURL *)serviceURL;
+ (NSString *)cleanseName:(NSString *)name;
+ (NSString *)camelCize:(NSString *)name;
- (BOOL)renameService:(NSString *)newServiceName;
- (NSString *)serviceName;
- (NSString *)serviceFileName;
- (NSURL *)existingServiceURL;
// returns an NSFileWrapper to a reconstructed, upgraded service with the info plist rebuilt and the latest ServiceSkeleton
- (NSFileWrapper *)upgradedServiceFileWrapper;
// for a referenced-script-style-service, instates the reference alias (which can only be done to a path/URL and not to a file wrapper)
// for a copy-style-service, does nothing
- (void)writeReferenceAliasForServiceAtURL:(NSURL *)serviceURL;
// chmods the script skeleton and runs the service once with a specific parameter that tells it to register itself and quit
- (void)installServiceAfterFileWrapperWrittenAtURL:(NSURL *)serviceURL;
- (TSServiceTester *)testRunServiceAfterFileWrapperWrittenAtURL:(NSURL *)serviceURL;
- (BOOL)freshenScriptInFileWrapperWrittenAtURL:(NSURL *)serviceURL;
// key is NSURL *, value is TSService *.
+ (NSDictionary *)allServicesInUserBoundary;
- (NSString *)pathToScriptOutsideService;
@property (readonly) BOOL supportsOutput;
@property (readonly) BOOL supportsInput;
- (NSTimeInterval)effectiveTimeout;
@end