-
Notifications
You must be signed in to change notification settings - Fork 4
/
Notes.txt
156 lines (123 loc) · 5.32 KB
/
Notes.txt
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## MANY OF THESE NOTES ARE OBSOLETE AND/OR INACCURATE
NEXT:
ServerExtensionsActivator:
- each call to .Run() should be done from within a separate Task
- all tasks should use the same cancellation token, which should be passed to each extension in Run()
- a loop should then run checking IsRunning on all tasks and signalling the service manager every few seconds
- if any IsRunning = false, log the details, signal the service manager once more, request cancellation and exit
- look at the windows service global exception trappers and duplicate in ExtensionRunner
--------------------------------------------------------------------------------
TO DO:
* Most ColorConsole use needs to be replaced with StringBuilders containing color codes
* OutputTokenizer needs to replace color coded text with text chunks enumerated against the output type (e.g. Info/Error/Success/etc.)
* output can be written using monospaced HTML
* output can be written to the console
* because text is tokenized according to purpose, it can easily be written out as plain text (for logging purposes)
* ConsoleWriter needs to write tokenized output colorised to the console
* [LATER] Table-formatted text can use a utility class TextTableWriter writes out a table/color-formatted text string formatted to fit the console.
|=|%*header1|=|%*header2|=|%*header3
|!|%@cell1%@ woot|!|cell2|!|cell3
|!|cell14|!|cell15|!|%~cell16%~
* color codes inside cells are automatically terminated when the cell closes.
* header cell is designated as such so text formatter can write dashes underneath headings
* Application needs to become a service console API
* ExecuteCommand and Handler delegates should return CommandResult, not string
* Notifications should be pushed out via a C# event and can contain color codes
- Source (Console/Service)
- Disposition
- Message
* Use Logger to trace all console activity (can enable/disable logging as needed)
* Program class needs to hook Application events and write console output
--------------------------------------------------------------------------------
ServerX
Contains ServerX control functionality. Launched from either Service or
directly from ServiceConsole (for testing purposes). Can have as many
dependencies as needed as it won't be referenced externally, such as by
web applications.
ServerX.Common
WCF contracts required for interaction with the service and extensions. Also
has any WCF client implementations. This should never have any external
dependencies. This is the assembly to reference externally (such as by web
applications) in order to interact with the service.
ServerX.ServiceConsole
Console application for interacting with the service and its extensions.
ServerX.Service
The windows service to host the main ServerX WCF service.
ServerX.ExtensionRunner
Used internally to launch service extensions.
--------------------------------------------------------------------------------
Mono.Options Documentation
http://www.ndesk.org/doc/ndesk-options/NDesk.Options/OptionSet.html
http://tirania.org/blog/archive/2008/Oct-14.html
Crontab Syntax:
http://code.google.com/p/ncrontab/wiki/CrontabExpression
--------------------------------------------------------------------------------
Console Strings - Color Coding
%@ - user input (something the user can type somewhere) - yellow
%* - heading - bright white
%! - error - red
%? - information - cyan
%~ - success message - green
%# - example - dark magenta
%> - sets default indent for wrapping
Here's an example colour-coded help text:
%*Usage:%*
%@mode [arg]%@
%*Arguments:%*
%@direct%@ - %>The server should run directly (no WCF/TCP required)
%@local%@ - %>The server should run locally (WCF over TCP)
%@remote%@ - %>The server should be running remotely (WCF)
%?Type %@mode%@ by itself to see what the current mode is.%?
--------------------------------------------------------------------------------
Features Desired:
- crontab scheduling
- javascript scripting support
- piped output/formatting
API scenarios:
command line \
javascript --> expose an object
WCF /
## plugins:
include /[dir]
exclude /[dir]
enable [plugin]
disable [plugin]
[re]start /[dir]
[re]start [plugin]
stop /[dir]
stop [plugin]
plugins --include:name --enable:name --start:name
order of processing is the order in which the args appear
## scripts
scripts --add:filename --exec:filename --delete:filename --display:filename --list
local script example:
console.EnableLogging(true);
console.StartService(true, true);
var plugins = console.ListPlugins();
for(var plugin in plugins)
console.out(plugin.Name);
var response = svc.ExecuteCommand('list -c arg1 "hello world"');
console.out(response);
if(svc.RestartPlugin('test1'))
console.out('done.');
var plugins = console.ListPlugins();
server script example:
svc.NotifyClients('yay!');
MACROS:
#set install execscr -local install.js
!install
#del install
#list
--------------------------------------------------------------------------------
Commands:
exit
help
list
plugins
svc start
svc stop
svc status
svc connect
cron list
cron del 1
cron add * * * * */5 !list