Auto status change to "Under Review"
@@ -0,0 +1,98 | |||||
|
1 | using System; | |||
|
2 | using System.Threading; | |||
|
3 | using Implab.Diagnostics; | |||
|
4 | ||||
|
5 | namespace Implab.Components { | |||
|
6 | public class PollingRunnableComponent : RunnableComponent { | |||
|
7 | readonly Timer m_timer; | |||
|
8 | readonly Func<Func<IPromise>, IPromise> m_dispatcher; | |||
|
9 | readonly TimeSpan m_interval; | |||
|
10 | ||||
|
11 | int m_processing; | |||
|
12 | Promise m_pending; | |||
|
13 | ||||
|
14 | protected PollingRunnableComponent(TimeSpan interval, Func<Func<IPromise>, IPromise> dispatcher, bool initialized) : base(initialized) { | |||
|
15 | m_timer = new Timer(OnInternalTick); | |||
|
16 | ||||
|
17 | m_interval = interval; | |||
|
18 | m_dispatcher = dispatcher; | |||
|
19 | } | |||
|
20 | ||||
|
21 | protected override IPromise OnStart() { | |||
|
22 | m_timer.Change(TimeSpan.Zero, m_interval); | |||
|
23 | ||||
|
24 | return base.OnStart(); | |||
|
25 | } | |||
|
26 | ||||
|
27 | void OnInternalTick(object state) { | |||
|
28 | if (StartTick()) { | |||
|
29 | try { | |||
|
30 | AwaitTick(m_dispatcher != null ? m_dispatcher(OnTick) : OnTick()); | |||
|
31 | } catch (Exception error) { | |||
|
32 | HandleTickError(error); | |||
|
33 | } | |||
|
34 | } | |||
|
35 | } | |||
|
36 | ||||
|
37 | /// <summary> | |||
|
38 | /// Starts the tick handler. | |||
|
39 | /// </summary> | |||
|
40 | /// <returns>boolean value, true - the new tick handler may be invoked, false - a tick handler is already running or a component isn't running.</returns> | |||
|
41 | /// <remarks> | |||
|
42 | /// If the component is stopping no new handlers can be run. Every successful call to this method must be completed with either AwaitTick or HandleTickError handlers. | |||
|
43 | /// </remarks> | |||
|
44 | protected virtual bool StartTick() { | |||
|
45 | if (State == ExecutionState.Running && Interlocked.CompareExchange(ref m_processing, 1, 0) == 0) { | |||
|
46 | m_pending = new Promise(); | |||
|
47 | m_pending | |||
|
48 | .On(() => m_processing = 0, PromiseEventType.All) | |||
|
49 | .On(null, LogTickError); | |||
|
50 | return true; | |||
|
51 | } | |||
|
52 | return false; | |||
|
53 | } | |||
|
54 | ||||
|
55 | protected virtual void AwaitTick(IPromise tick) { | |||
|
56 | if (tick == null) { | |||
|
57 | m_pending.Resolve(); | |||
|
58 | } else { | |||
|
59 | tick.On( | |||
|
60 | m_pending.Resolve, | |||
|
61 | m_pending.Reject, | |||
|
62 | m_pending.CancelOperation | |||
|
63 | ); | |||
|
64 | m_pending.CancellationRequested(tick.Cancel); | |||
|
65 | } | |||
|
66 | } | |||
|
67 | ||||
|
68 | protected virtual void HandleTickError(Exception error) { | |||
|
69 | m_pending.Reject(error); | |||
|
70 | } | |||
|
71 | ||||
|
72 | protected virtual void LogTickError(Exception error) { | |||
|
73 | } | |||
|
74 | ||||
|
75 | protected virtual IPromise OnTick() { | |||
|
76 | return Promise.SUCCESS; | |||
|
77 | } | |||
|
78 | ||||
|
79 | protected override IPromise OnStop() { | |||
|
80 | m_timer.Change(-1, -1); | |||
|
81 | ||||
|
82 | if (m_pending != null) { | |||
|
83 | m_pending.Cancel(); | |||
|
84 | return m_pending.Then(base.OnStop); | |||
|
85 | } | |||
|
86 | ||||
|
87 | return base.OnStop(); | |||
|
88 | } | |||
|
89 | ||||
|
90 | protected override void Dispose(bool disposing, Exception lastError) { | |||
|
91 | if (disposing) | |||
|
92 | Safe.Dispose(m_timer); | |||
|
93 | ||||
|
94 | base.Dispose(disposing, lastError); | |||
|
95 | } | |||
|
96 | } | |||
|
97 | } | |||
|
98 |
@@ -1,264 +1,265 | |||||
1 | using System; |
|
1 | using System; | |
2 |
|
2 | |||
3 | namespace Implab.Components { |
|
3 | namespace Implab.Components { | |
4 | public abstract class RunnableComponent : IDisposable, IRunnable, IInitializable { |
|
4 | public abstract class RunnableComponent : IDisposable, IRunnable, IInitializable { | |
5 | enum Commands { |
|
5 | enum Commands { | |
6 | Ok = 0, |
|
6 | Ok = 0, | |
7 | Fail, |
|
7 | Fail, | |
8 | Init, |
|
8 | Init, | |
9 | Start, |
|
9 | Start, | |
10 | Stop, |
|
10 | Stop, | |
11 | Dispose, |
|
11 | Dispose, | |
12 | Last = Dispose |
|
12 | Last = Dispose | |
13 | } |
|
13 | } | |
14 |
|
14 | |||
15 | class StateMachine { |
|
15 | class StateMachine { | |
16 | static readonly ExecutionState[,] _transitions; |
|
16 | static readonly ExecutionState[,] _transitions; | |
17 |
|
17 | |||
18 | static StateMachine() { |
|
18 | static StateMachine() { | |
19 | _transitions = new ExecutionState[(int)ExecutionState.Last + 1, (int)Commands.Last + 1]; |
|
19 | _transitions = new ExecutionState[(int)ExecutionState.Last + 1, (int)Commands.Last + 1]; | |
20 |
|
20 | |||
21 | Edge(ExecutionState.Created, ExecutionState.Initializing, Commands.Init); |
|
21 | Edge(ExecutionState.Created, ExecutionState.Initializing, Commands.Init); | |
22 | Edge(ExecutionState.Created, ExecutionState.Disposed, Commands.Dispose); |
|
22 | Edge(ExecutionState.Created, ExecutionState.Disposed, Commands.Dispose); | |
23 |
|
23 | |||
24 | Edge(ExecutionState.Initializing, ExecutionState.Ready, Commands.Ok); |
|
24 | Edge(ExecutionState.Initializing, ExecutionState.Ready, Commands.Ok); | |
25 | Edge(ExecutionState.Initializing, ExecutionState.Failed, Commands.Fail); |
|
25 | Edge(ExecutionState.Initializing, ExecutionState.Failed, Commands.Fail); | |
26 |
|
26 | |||
27 | Edge(ExecutionState.Ready, ExecutionState.Starting, Commands.Start); |
|
27 | Edge(ExecutionState.Ready, ExecutionState.Starting, Commands.Start); | |
28 | Edge(ExecutionState.Ready, ExecutionState.Disposed, Commands.Dispose); |
|
28 | Edge(ExecutionState.Ready, ExecutionState.Disposed, Commands.Dispose); | |
29 |
|
29 | |||
30 | Edge(ExecutionState.Starting, ExecutionState.Running, Commands.Ok); |
|
30 | Edge(ExecutionState.Starting, ExecutionState.Running, Commands.Ok); | |
31 | Edge(ExecutionState.Starting, ExecutionState.Failed, Commands.Fail); |
|
31 | Edge(ExecutionState.Starting, ExecutionState.Failed, Commands.Fail); | |
32 | Edge(ExecutionState.Starting, ExecutionState.Stopping, Commands.Stop); |
|
32 | Edge(ExecutionState.Starting, ExecutionState.Stopping, Commands.Stop); | |
33 | Edge(ExecutionState.Starting, ExecutionState.Disposed, Commands.Dispose); |
|
33 | Edge(ExecutionState.Starting, ExecutionState.Disposed, Commands.Dispose); | |
34 |
|
34 | |||
35 | Edge(ExecutionState.Running, ExecutionState.Failed, Commands.Fail); |
|
35 | Edge(ExecutionState.Running, ExecutionState.Failed, Commands.Fail); | |
36 | Edge(ExecutionState.Running, ExecutionState.Stopping, Commands.Stop); |
|
36 | Edge(ExecutionState.Running, ExecutionState.Stopping, Commands.Stop); | |
37 | Edge(ExecutionState.Running, ExecutionState.Disposed, Commands.Dispose); |
|
37 | Edge(ExecutionState.Running, ExecutionState.Disposed, Commands.Dispose); | |
38 |
|
38 | |||
39 | Edge(ExecutionState.Stopping, ExecutionState.Failed, Commands.Fail); |
|
39 | Edge(ExecutionState.Stopping, ExecutionState.Failed, Commands.Fail); | |
40 | Edge(ExecutionState.Stopping, ExecutionState.Disposed, Commands.Ok); |
|
40 | Edge(ExecutionState.Stopping, ExecutionState.Disposed, Commands.Ok); | |
41 |
|
41 | |||
42 | Edge(ExecutionState.Failed, ExecutionState.Disposed, Commands.Dispose); |
|
42 | Edge(ExecutionState.Failed, ExecutionState.Disposed, Commands.Dispose); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | static void Edge(ExecutionState s1, ExecutionState s2, Commands cmd) { |
|
45 | static void Edge(ExecutionState s1, ExecutionState s2, Commands cmd) { | |
46 | _transitions[(int)s1, (int)cmd] = s2; |
|
46 | _transitions[(int)s1, (int)cmd] = s2; | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | public ExecutionState State { |
|
49 | public ExecutionState State { | |
50 | get; |
|
50 | get; | |
51 | private set; |
|
51 | private set; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | public StateMachine(ExecutionState initial) { |
|
54 | public StateMachine(ExecutionState initial) { | |
55 | State = initial; |
|
55 | State = initial; | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | public bool Move(Commands cmd) { |
|
58 | public bool Move(Commands cmd) { | |
59 | var next = _transitions[(int)State, (int)cmd]; |
|
59 | var next = _transitions[(int)State, (int)cmd]; | |
60 | if (next == ExecutionState.Undefined) |
|
60 | if (next == ExecutionState.Undefined) | |
61 | return false; |
|
61 | return false; | |
62 | State = next; |
|
62 | State = next; | |
63 | return true; |
|
63 | return true; | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | IPromise m_pending; |
|
67 | IPromise m_pending; | |
68 | Exception m_lastError; |
|
68 | Exception m_lastError; | |
69 |
|
69 | |||
70 | readonly StateMachine m_stateMachine; |
|
70 | readonly StateMachine m_stateMachine; | |
71 |
|
71 | |||
72 | protected RunnableComponent(bool initialized) { |
|
72 | protected RunnableComponent(bool initialized) { | |
73 | m_stateMachine = new StateMachine(initialized ? ExecutionState.Ready : ExecutionState.Created); |
|
73 | m_stateMachine = new StateMachine(initialized ? ExecutionState.Ready : ExecutionState.Created); | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | protected virtual int DisposeTimeout { |
|
76 | protected virtual int DisposeTimeout { | |
77 | get { |
|
77 | get { | |
78 | return 10000; |
|
78 | return 10000; | |
79 | } |
|
79 | } | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | void ThrowInvalidCommand(Commands cmd) { |
|
82 | void ThrowInvalidCommand(Commands cmd) { | |
83 | if (m_stateMachine.State == ExecutionState.Disposed) |
|
83 | if (m_stateMachine.State == ExecutionState.Disposed) | |
84 | throw new ObjectDisposedException(ToString()); |
|
84 | throw new ObjectDisposedException(ToString()); | |
85 |
|
85 | |||
86 | throw new InvalidOperationException(String.Format("Commnd {0} is not allowed in the state {1}", cmd, m_stateMachine.State)); |
|
86 | throw new InvalidOperationException(String.Format("Commnd {0} is not allowed in the state {1}", cmd, m_stateMachine.State)); | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | void Move(Commands cmd) { |
|
89 | void Move(Commands cmd) { | |
90 | if (!m_stateMachine.Move(cmd)) |
|
90 | if (!m_stateMachine.Move(cmd)) | |
91 | ThrowInvalidCommand(cmd); |
|
91 | ThrowInvalidCommand(cmd); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | void Invoke(Commands cmd, Action action) { |
|
94 | void Invoke(Commands cmd, Action action) { | |
95 | lock (m_stateMachine) |
|
95 | lock (m_stateMachine) | |
96 | Move(cmd); |
|
96 | Move(cmd); | |
97 |
|
97 | |||
98 | try { |
|
98 | try { | |
99 | action(); |
|
99 | action(); | |
100 | lock(m_stateMachine) |
|
100 | lock(m_stateMachine) | |
101 | Move(Commands.Ok); |
|
101 | Move(Commands.Ok); | |
102 |
|
102 | |||
103 | } catch (Exception err) { |
|
103 | } catch (Exception err) { | |
104 | lock (m_stateMachine) { |
|
104 | lock (m_stateMachine) { | |
105 | Move(Commands.Fail); |
|
105 | Move(Commands.Fail); | |
106 | m_lastError = err; |
|
106 | m_lastError = err; | |
107 | } |
|
107 | } | |
108 | throw; |
|
108 | throw; | |
109 | } |
|
109 | } | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | IPromise InvokeAsync(Commands cmd, Func<IPromise> action, Action<IPromise, IDeferred> chain) { |
|
112 | IPromise InvokeAsync(Commands cmd, Func<IPromise> action, Action<IPromise, IDeferred> chain) { | |
113 | IPromise promise = null; |
|
113 | IPromise promise = null; | |
114 | IPromise prev; |
|
114 | IPromise prev; | |
115 |
|
115 | |||
116 | var task = new ActionChainTask(action, null, null, true); |
|
116 | var task = new ActionChainTask(action, null, null, true); | |
117 |
|
117 | |||
118 | lock (m_stateMachine) { |
|
118 | lock (m_stateMachine) { | |
119 | Move(cmd); |
|
119 | Move(cmd); | |
120 |
|
120 | |||
121 | prev = m_pending; |
|
121 | prev = m_pending; | |
122 |
|
122 | |||
123 | Action<Exception> errorOrCancel = e => { |
|
123 | Action<Exception> errorOrCancel = e => { | |
124 | if (e == null) |
|
124 | if (e == null) | |
125 | e = new OperationCanceledException(); |
|
125 | e = new OperationCanceledException(); | |
126 |
|
126 | |||
127 | lock (m_stateMachine) { |
|
127 | lock (m_stateMachine) { | |
128 | if (m_pending == promise) { |
|
128 | if (m_pending == promise) { | |
129 | Move(Commands.Fail); |
|
129 | Move(Commands.Fail); | |
130 | m_pending = null; |
|
130 | m_pending = null; | |
131 | m_lastError = e; |
|
131 | m_lastError = e; | |
132 | } |
|
132 | } | |
133 | } |
|
133 | } | |
134 | throw new PromiseTransientException(e); |
|
134 | throw new PromiseTransientException(e); | |
135 | }; |
|
135 | }; | |
136 |
|
136 | |||
137 | promise = task.Then( |
|
137 | promise = task.Then( | |
138 | () => { |
|
138 | () => { | |
139 | lock(m_stateMachine) { |
|
139 | lock(m_stateMachine) { | |
140 | if (m_pending == promise) { |
|
140 | if (m_pending == promise) { | |
141 | Move(Commands.Ok); |
|
141 | Move(Commands.Ok); | |
142 | m_pending = null; |
|
142 | m_pending = null; | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 | }, |
|
145 | }, | |
146 | errorOrCancel, |
|
146 | errorOrCancel, | |
147 | errorOrCancel |
|
147 | errorOrCancel | |
148 | ); |
|
148 | ); | |
149 |
|
149 | |||
150 | m_pending = promise; |
|
150 | m_pending = promise; | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 | if (prev == null) |
|
153 | if (prev == null) | |
154 | task.Resolve(); |
|
154 | task.Resolve(); | |
155 | else |
|
155 | else | |
156 | chain(prev, task); |
|
156 | chain(prev, task); | |
157 |
|
157 | |||
158 | return promise; |
|
158 | return promise; | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 |
|
161 | |||
162 | #region IInitializable implementation |
|
162 | #region IInitializable implementation | |
163 |
|
163 | |||
164 | public void Init() { |
|
164 | public void Init() { | |
165 | Invoke(Commands.Init, OnInitialize); |
|
165 | Invoke(Commands.Init, OnInitialize); | |
166 | } |
|
166 | } | |
167 |
|
167 | |||
168 | protected virtual void OnInitialize() { |
|
168 | protected virtual void OnInitialize() { | |
169 | } |
|
169 | } | |
170 |
|
170 | |||
171 | #endregion |
|
171 | #endregion | |
172 |
|
172 | |||
173 | #region IRunnable implementation |
|
173 | #region IRunnable implementation | |
174 |
|
174 | |||
175 | public IPromise Start() { |
|
175 | public IPromise Start() { | |
176 | return InvokeAsync(Commands.Start, OnStart, null); |
|
176 | return InvokeAsync(Commands.Start, OnStart, null); | |
177 | } |
|
177 | } | |
178 |
|
178 | |||
179 | protected virtual IPromise OnStart() { |
|
179 | protected virtual IPromise OnStart() { | |
180 | return Promise.SUCCESS; |
|
180 | return Promise.SUCCESS; | |
181 | } |
|
181 | } | |
182 |
|
182 | |||
183 | public IPromise Stop() { |
|
183 | public IPromise Stop() { | |
184 | return InvokeAsync(Commands.Stop, OnStop, StopPending).Then(Dispose); |
|
184 | return InvokeAsync(Commands.Stop, OnStop, StopPending).Then(Dispose); | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | protected virtual IPromise OnStop() { |
|
187 | protected virtual IPromise OnStop() { | |
188 | return Promise.SUCCESS; |
|
188 | return Promise.SUCCESS; | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | /// <summary> |
|
191 | /// <summary> | |
192 | /// Stops the current operation if one exists. |
|
192 | /// Stops the current operation if one exists. | |
193 | /// </summary> |
|
193 | /// </summary> | |
194 | /// <param name="current">Current.</param> |
|
194 | /// <param name="current">Current.</param> | |
195 | /// <param name="stop">Stop.</param> |
|
195 | /// <param name="stop">Stop.</param> | |
196 | protected virtual void StopPending(IPromise current, IDeferred stop) { |
|
196 | protected virtual void StopPending(IPromise current, IDeferred stop) { | |
197 | if (current == null) { |
|
197 | if (current == null) { | |
198 | stop.Resolve(); |
|
198 | stop.Resolve(); | |
199 | } else { |
|
199 | } else { | |
200 | // ΡΠ²ΡΠ·Π²Π°Π΅ΠΌ ΡΠ΅ΠΊΡΡΡΡ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠ΅ΠΉ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ |
|
200 | // ΡΠ²ΡΠ·Π²Π°Π΅ΠΌ ΡΠ΅ΠΊΡΡΡΡ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠ΅ΠΉ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ | |
201 | current.On( |
|
201 | current.On( | |
202 | stop.Resolve, // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Π·Π°Π²Π΅ΡΡΠΈΠ»Π°ΡΡ, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΡΠΈΠ½Π°ΡΡ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΡ |
|
202 | stop.Resolve, // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Π·Π°Π²Π΅ΡΡΠΈΠ»Π°ΡΡ, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΡΠΈΠ½Π°ΡΡ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΡ | |
203 | stop.Reject, // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Π΄Π°Π»Π° ΠΎΡΠΈΠ±ΠΊΡ - ΡΠΎ Π²ΡΠ΅ ΠΏΠ»ΠΎΡ ΠΎ, Π½Π΅Π»ΡΠ·Ρ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠ°ΡΡ |
|
203 | stop.Reject, // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ Π΄Π°Π»Π° ΠΎΡΠΈΠ±ΠΊΡ - ΡΠΎ Π²ΡΠ΅ ΠΏΠ»ΠΎΡ ΠΎ, Π½Π΅Π»ΡΠ·Ρ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠ°ΡΡ | |
204 | e => stop.Resolve() // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΡΠΌΠ΅Π½ΠΈΠ»Π°ΡΡ, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΡΠΈΠ½Π°ΡΡ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΡ |
|
204 | e => stop.Resolve() // Π΅ΡΠ»ΠΈ ΡΠ΅ΠΊΡΡΠ°Ρ ΠΎΡΠΌΠ΅Π½ΠΈΠ»Π°ΡΡ, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π½Π°ΡΠΈΠ½Π°ΡΡ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΡ | |
205 | ); |
|
205 | ); | |
206 | // ΠΏΠΎΡΡΠ»Π°Π΅ΠΌ ΡΠ΅ΠΊΡΡΠ΅ΠΉ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ ΡΠΈΠ³Π½Π°Π» ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ |
|
206 | // ΠΏΠΎΡΡΠ»Π°Π΅ΠΌ ΡΠ΅ΠΊΡΡΠ΅ΠΉ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ ΡΠΈΠ³Π½Π°Π» ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ | |
207 | current.Cancel(); |
|
207 | current.Cancel(); | |
208 | } |
|
208 | } | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 | public ExecutionState State { |
|
211 | public ExecutionState State { | |
212 | get { |
|
212 | get { | |
|
213 | lock (m_stateMachine) | |||
213 | return m_stateMachine.State; |
|
214 | return m_stateMachine.State; | |
214 | } |
|
215 | } | |
215 | } |
|
216 | } | |
216 |
|
217 | |||
217 | public Exception LastError { |
|
218 | public Exception LastError { | |
218 | get { |
|
219 | get { | |
219 | return m_lastError; |
|
220 | return m_lastError; | |
220 | } |
|
221 | } | |
221 | } |
|
222 | } | |
222 |
|
223 | |||
223 | #endregion |
|
224 | #endregion | |
224 |
|
225 | |||
225 | #region IDisposable implementation |
|
226 | #region IDisposable implementation | |
226 |
|
227 | |||
227 | public void Dispose() { |
|
228 | public void Dispose() { | |
228 | IPromise pending; |
|
229 | IPromise pending; | |
229 | lock (m_stateMachine) { |
|
230 | lock (m_stateMachine) { | |
230 | if (m_stateMachine.State == ExecutionState.Disposed) |
|
231 | if (m_stateMachine.State == ExecutionState.Disposed) | |
231 | return; |
|
232 | return; | |
232 |
|
233 | |||
233 | Move(Commands.Dispose); |
|
234 | Move(Commands.Dispose); | |
234 |
|
235 | |||
235 | GC.SuppressFinalize(this); |
|
236 | GC.SuppressFinalize(this); | |
236 |
|
237 | |||
237 | pending = m_pending; |
|
238 | pending = m_pending; | |
238 | m_pending = null; |
|
239 | m_pending = null; | |
239 | } |
|
240 | } | |
240 | if (pending != null) { |
|
241 | if (pending != null) { | |
241 | pending.Cancel(); |
|
242 | pending.Cancel(); | |
242 | pending.Timeout(DisposeTimeout).On( |
|
243 | pending.Timeout(DisposeTimeout).On( | |
243 | () => Dispose(true, null), |
|
244 | () => Dispose(true, null), | |
244 | err => Dispose(true, err), |
|
245 | err => Dispose(true, err), | |
245 | reason => Dispose(true, new OperationCanceledException("The operation is cancelled", reason)) |
|
246 | reason => Dispose(true, new OperationCanceledException("The operation is cancelled", reason)) | |
246 | ); |
|
247 | ); | |
247 | } else { |
|
248 | } else { | |
248 | Dispose(true, m_lastError); |
|
249 | Dispose(true, m_lastError); | |
249 | } |
|
250 | } | |
250 | } |
|
251 | } | |
251 |
|
252 | |||
252 | ~RunnableComponent() { |
|
253 | ~RunnableComponent() { | |
253 | Dispose(false, null); |
|
254 | Dispose(false, null); | |
254 | } |
|
255 | } | |
255 |
|
256 | |||
256 | #endregion |
|
257 | #endregion | |
257 |
|
258 | |||
258 | protected virtual void Dispose(bool disposing, Exception lastError) { |
|
259 | protected virtual void Dispose(bool disposing, Exception lastError) { | |
259 |
|
260 | |||
260 | } |
|
261 | } | |
261 |
|
262 | |||
262 | } |
|
263 | } | |
263 | } |
|
264 | } | |
264 |
|
265 |
@@ -1,275 +1,276 | |||||
1 | ο»Ώ<?xml version="1.0" encoding="utf-8"?> |
|
1 | ο»Ώ<?xml version="1.0" encoding="utf-8"?> | |
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
3 | <PropertyGroup> |
|
3 | <PropertyGroup> | |
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
6 | <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid> |
|
6 | <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid> | |
7 | <OutputType>Library</OutputType> |
|
7 | <OutputType>Library</OutputType> | |
8 | <RootNamespace>Implab</RootNamespace> |
|
8 | <RootNamespace>Implab</RootNamespace> | |
9 | <AssemblyName>Implab</AssemblyName> |
|
9 | <AssemblyName>Implab</AssemblyName> | |
10 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
|
10 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |
11 | <ReleaseVersion>0.2</ReleaseVersion> |
|
11 | <ReleaseVersion>0.2</ReleaseVersion> | |
12 | <ProductVersion>8.0.30703</ProductVersion> |
|
12 | <ProductVersion>8.0.30703</ProductVersion> | |
13 | <SchemaVersion>2.0</SchemaVersion> |
|
13 | <SchemaVersion>2.0</SchemaVersion> | |
14 | </PropertyGroup> |
|
14 | </PropertyGroup> | |
15 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
15 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |
16 | <DebugSymbols>true</DebugSymbols> |
|
16 | <DebugSymbols>true</DebugSymbols> | |
17 | <DebugType>full</DebugType> |
|
17 | <DebugType>full</DebugType> | |
18 | <Optimize>false</Optimize> |
|
18 | <Optimize>false</Optimize> | |
19 | <OutputPath>bin\Debug</OutputPath> |
|
19 | <OutputPath>bin\Debug</OutputPath> | |
20 | <DefineConstants>TRACE;DEBUG;</DefineConstants> |
|
20 | <DefineConstants>TRACE;DEBUG;</DefineConstants> | |
21 | <ErrorReport>prompt</ErrorReport> |
|
21 | <ErrorReport>prompt</ErrorReport> | |
22 | <WarningLevel>4</WarningLevel> |
|
22 | <WarningLevel>4</WarningLevel> | |
23 | <ConsolePause>false</ConsolePause> |
|
23 | <ConsolePause>false</ConsolePause> | |
24 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
24 | <RunCodeAnalysis>true</RunCodeAnalysis> | |
25 | </PropertyGroup> |
|
25 | </PropertyGroup> | |
26 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
26 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |
27 | <DebugType>full</DebugType> |
|
27 | <DebugType>full</DebugType> | |
28 | <Optimize>true</Optimize> |
|
28 | <Optimize>true</Optimize> | |
29 | <OutputPath>bin\Release</OutputPath> |
|
29 | <OutputPath>bin\Release</OutputPath> | |
30 | <ErrorReport>prompt</ErrorReport> |
|
30 | <ErrorReport>prompt</ErrorReport> | |
31 | <WarningLevel>4</WarningLevel> |
|
31 | <WarningLevel>4</WarningLevel> | |
32 | <ConsolePause>false</ConsolePause> |
|
32 | <ConsolePause>false</ConsolePause> | |
33 | </PropertyGroup> |
|
33 | </PropertyGroup> | |
34 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' "> |
|
34 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' "> | |
35 | <DebugSymbols>true</DebugSymbols> |
|
35 | <DebugSymbols>true</DebugSymbols> | |
36 | <DebugType>full</DebugType> |
|
36 | <DebugType>full</DebugType> | |
37 | <Optimize>false</Optimize> |
|
37 | <Optimize>false</Optimize> | |
38 | <OutputPath>bin\Debug</OutputPath> |
|
38 | <OutputPath>bin\Debug</OutputPath> | |
39 | <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants> |
|
39 | <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants> | |
40 | <ErrorReport>prompt</ErrorReport> |
|
40 | <ErrorReport>prompt</ErrorReport> | |
41 | <WarningLevel>4</WarningLevel> |
|
41 | <WarningLevel>4</WarningLevel> | |
42 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
42 | <RunCodeAnalysis>true</RunCodeAnalysis> | |
43 | <ConsolePause>false</ConsolePause> |
|
43 | <ConsolePause>false</ConsolePause> | |
44 | </PropertyGroup> |
|
44 | </PropertyGroup> | |
45 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' "> |
|
45 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' "> | |
46 | <Optimize>true</Optimize> |
|
46 | <Optimize>true</Optimize> | |
47 | <OutputPath>bin\Release</OutputPath> |
|
47 | <OutputPath>bin\Release</OutputPath> | |
48 | <ErrorReport>prompt</ErrorReport> |
|
48 | <ErrorReport>prompt</ErrorReport> | |
49 | <WarningLevel>4</WarningLevel> |
|
49 | <WarningLevel>4</WarningLevel> | |
50 | <ConsolePause>false</ConsolePause> |
|
50 | <ConsolePause>false</ConsolePause> | |
51 | <DefineConstants>NET_4_5</DefineConstants> |
|
51 | <DefineConstants>NET_4_5</DefineConstants> | |
52 | </PropertyGroup> |
|
52 | </PropertyGroup> | |
53 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' "> |
|
53 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' "> | |
54 | <DebugSymbols>true</DebugSymbols> |
|
54 | <DebugSymbols>true</DebugSymbols> | |
55 | <DebugType>full</DebugType> |
|
55 | <DebugType>full</DebugType> | |
56 | <Optimize>false</Optimize> |
|
56 | <Optimize>false</Optimize> | |
57 | <OutputPath>bin\Debug</OutputPath> |
|
57 | <OutputPath>bin\Debug</OutputPath> | |
58 | <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants> |
|
58 | <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants> | |
59 | <ErrorReport>prompt</ErrorReport> |
|
59 | <ErrorReport>prompt</ErrorReport> | |
60 | <WarningLevel>4</WarningLevel> |
|
60 | <WarningLevel>4</WarningLevel> | |
61 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
61 | <RunCodeAnalysis>true</RunCodeAnalysis> | |
62 | <ConsolePause>false</ConsolePause> |
|
62 | <ConsolePause>false</ConsolePause> | |
63 | </PropertyGroup> |
|
63 | </PropertyGroup> | |
64 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' "> |
|
64 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' "> | |
65 | <Optimize>true</Optimize> |
|
65 | <Optimize>true</Optimize> | |
66 | <OutputPath>bin\Release</OutputPath> |
|
66 | <OutputPath>bin\Release</OutputPath> | |
67 | <DefineConstants>NET_4_5;MONO;</DefineConstants> |
|
67 | <DefineConstants>NET_4_5;MONO;</DefineConstants> | |
68 | <ErrorReport>prompt</ErrorReport> |
|
68 | <ErrorReport>prompt</ErrorReport> | |
69 | <WarningLevel>4</WarningLevel> |
|
69 | <WarningLevel>4</WarningLevel> | |
70 | <ConsolePause>false</ConsolePause> |
|
70 | <ConsolePause>false</ConsolePause> | |
71 | </PropertyGroup> |
|
71 | </PropertyGroup> | |
72 | <ItemGroup> |
|
72 | <ItemGroup> | |
73 | <Reference Include="System" /> |
|
73 | <Reference Include="System" /> | |
74 | <Reference Include="System.Xml" /> |
|
74 | <Reference Include="System.Xml" /> | |
75 | <Reference Include="mscorlib" /> |
|
75 | <Reference Include="mscorlib" /> | |
76 | </ItemGroup> |
|
76 | </ItemGroup> | |
77 | <ItemGroup> |
|
77 | <ItemGroup> | |
78 | <Compile Include="CustomEqualityComparer.cs" /> |
|
78 | <Compile Include="CustomEqualityComparer.cs" /> | |
79 | <Compile Include="Diagnostics\ConsoleTraceListener.cs" /> |
|
79 | <Compile Include="Diagnostics\ConsoleTraceListener.cs" /> | |
80 | <Compile Include="Diagnostics\LogChannel.cs" /> |
|
80 | <Compile Include="Diagnostics\LogChannel.cs" /> | |
81 | <Compile Include="Diagnostics\LogicalOperation.cs" /> |
|
81 | <Compile Include="Diagnostics\LogicalOperation.cs" /> | |
82 | <Compile Include="Diagnostics\TextFileListener.cs" /> |
|
82 | <Compile Include="Diagnostics\TextFileListener.cs" /> | |
83 | <Compile Include="Diagnostics\TraceLog.cs" /> |
|
83 | <Compile Include="Diagnostics\TraceLog.cs" /> | |
84 | <Compile Include="Diagnostics\TraceEvent.cs" /> |
|
84 | <Compile Include="Diagnostics\TraceEvent.cs" /> | |
85 | <Compile Include="Diagnostics\TraceEventType.cs" /> |
|
85 | <Compile Include="Diagnostics\TraceEventType.cs" /> | |
86 | <Compile Include="ICancellable.cs" /> |
|
86 | <Compile Include="ICancellable.cs" /> | |
87 | <Compile Include="IProgressHandler.cs" /> |
|
87 | <Compile Include="IProgressHandler.cs" /> | |
88 | <Compile Include="IProgressNotifier.cs" /> |
|
88 | <Compile Include="IProgressNotifier.cs" /> | |
89 | <Compile Include="IPromiseT.cs" /> |
|
89 | <Compile Include="IPromiseT.cs" /> | |
90 | <Compile Include="IPromise.cs" /> |
|
90 | <Compile Include="IPromise.cs" /> | |
91 | <Compile Include="IServiceLocator.cs" /> |
|
91 | <Compile Include="IServiceLocator.cs" /> | |
92 | <Compile Include="ITaskController.cs" /> |
|
92 | <Compile Include="ITaskController.cs" /> | |
93 | <Compile Include="Parallels\DispatchPool.cs" /> |
|
93 | <Compile Include="Parallels\DispatchPool.cs" /> | |
94 | <Compile Include="Parallels\ArrayTraits.cs" /> |
|
94 | <Compile Include="Parallels\ArrayTraits.cs" /> | |
95 | <Compile Include="Parallels\MTQueue.cs" /> |
|
95 | <Compile Include="Parallels\MTQueue.cs" /> | |
96 | <Compile Include="Parallels\WorkerPool.cs" /> |
|
96 | <Compile Include="Parallels\WorkerPool.cs" /> | |
97 | <Compile Include="ProgressInitEventArgs.cs" /> |
|
97 | <Compile Include="ProgressInitEventArgs.cs" /> | |
98 | <Compile Include="Properties\AssemblyInfo.cs" /> |
|
98 | <Compile Include="Properties\AssemblyInfo.cs" /> | |
99 | <Compile Include="Parallels\AsyncPool.cs" /> |
|
99 | <Compile Include="Parallels\AsyncPool.cs" /> | |
100 | <Compile Include="Safe.cs" /> |
|
100 | <Compile Include="Safe.cs" /> | |
101 | <Compile Include="ValueEventArgs.cs" /> |
|
101 | <Compile Include="ValueEventArgs.cs" /> | |
102 | <Compile Include="PromiseExtensions.cs" /> |
|
102 | <Compile Include="PromiseExtensions.cs" /> | |
103 | <Compile Include="SyncContextPromise.cs" /> |
|
103 | <Compile Include="SyncContextPromise.cs" /> | |
104 | <Compile Include="Diagnostics\OperationContext.cs" /> |
|
104 | <Compile Include="Diagnostics\OperationContext.cs" /> | |
105 | <Compile Include="Diagnostics\TraceContext.cs" /> |
|
105 | <Compile Include="Diagnostics\TraceContext.cs" /> | |
106 | <Compile Include="Diagnostics\LogEventArgs.cs" /> |
|
106 | <Compile Include="Diagnostics\LogEventArgs.cs" /> | |
107 | <Compile Include="Diagnostics\LogEventArgsT.cs" /> |
|
107 | <Compile Include="Diagnostics\LogEventArgsT.cs" /> | |
108 | <Compile Include="Diagnostics\Extensions.cs" /> |
|
108 | <Compile Include="Diagnostics\Extensions.cs" /> | |
109 | <Compile Include="PromiseEventType.cs" /> |
|
109 | <Compile Include="PromiseEventType.cs" /> | |
110 | <Compile Include="Parallels\AsyncQueue.cs" /> |
|
110 | <Compile Include="Parallels\AsyncQueue.cs" /> | |
111 | <Compile Include="PromiseT.cs" /> |
|
111 | <Compile Include="PromiseT.cs" /> | |
112 | <Compile Include="IDeferred.cs" /> |
|
112 | <Compile Include="IDeferred.cs" /> | |
113 | <Compile Include="IDeferredT.cs" /> |
|
113 | <Compile Include="IDeferredT.cs" /> | |
114 | <Compile Include="Promise.cs" /> |
|
114 | <Compile Include="Promise.cs" /> | |
115 | <Compile Include="PromiseTransientException.cs" /> |
|
115 | <Compile Include="PromiseTransientException.cs" /> | |
116 | <Compile Include="Parallels\Signal.cs" /> |
|
116 | <Compile Include="Parallels\Signal.cs" /> | |
117 | <Compile Include="Parallels\SharedLock.cs" /> |
|
117 | <Compile Include="Parallels\SharedLock.cs" /> | |
118 | <Compile Include="Diagnostics\ILogWriter.cs" /> |
|
118 | <Compile Include="Diagnostics\ILogWriter.cs" /> | |
119 | <Compile Include="Diagnostics\ListenerBase.cs" /> |
|
119 | <Compile Include="Diagnostics\ListenerBase.cs" /> | |
120 | <Compile Include="Parallels\BlockingQueue.cs" /> |
|
120 | <Compile Include="Parallels\BlockingQueue.cs" /> | |
121 | <Compile Include="AbstractEvent.cs" /> |
|
121 | <Compile Include="AbstractEvent.cs" /> | |
122 | <Compile Include="AbstractPromise.cs" /> |
|
122 | <Compile Include="AbstractPromise.cs" /> | |
123 | <Compile Include="AbstractPromiseT.cs" /> |
|
123 | <Compile Include="AbstractPromiseT.cs" /> | |
124 | <Compile Include="FuncTask.cs" /> |
|
124 | <Compile Include="FuncTask.cs" /> | |
125 | <Compile Include="FuncTaskBase.cs" /> |
|
125 | <Compile Include="FuncTaskBase.cs" /> | |
126 | <Compile Include="FuncTaskT.cs" /> |
|
126 | <Compile Include="FuncTaskT.cs" /> | |
127 | <Compile Include="ActionChainTaskBase.cs" /> |
|
127 | <Compile Include="ActionChainTaskBase.cs" /> | |
128 | <Compile Include="ActionChainTask.cs" /> |
|
128 | <Compile Include="ActionChainTask.cs" /> | |
129 | <Compile Include="ActionChainTaskT.cs" /> |
|
129 | <Compile Include="ActionChainTaskT.cs" /> | |
130 | <Compile Include="FuncChainTaskBase.cs" /> |
|
130 | <Compile Include="FuncChainTaskBase.cs" /> | |
131 | <Compile Include="FuncChainTask.cs" /> |
|
131 | <Compile Include="FuncChainTask.cs" /> | |
132 | <Compile Include="FuncChainTaskT.cs" /> |
|
132 | <Compile Include="FuncChainTaskT.cs" /> | |
133 | <Compile Include="ActionTaskBase.cs" /> |
|
133 | <Compile Include="ActionTaskBase.cs" /> | |
134 | <Compile Include="ActionTask.cs" /> |
|
134 | <Compile Include="ActionTask.cs" /> | |
135 | <Compile Include="ActionTaskT.cs" /> |
|
135 | <Compile Include="ActionTaskT.cs" /> | |
136 | <Compile Include="ICancellationToken.cs" /> |
|
136 | <Compile Include="ICancellationToken.cs" /> | |
137 | <Compile Include="SuccessPromise.cs" /> |
|
137 | <Compile Include="SuccessPromise.cs" /> | |
138 | <Compile Include="SuccessPromiseT.cs" /> |
|
138 | <Compile Include="SuccessPromiseT.cs" /> | |
139 | <Compile Include="PromiseAwaiterT.cs" /> |
|
139 | <Compile Include="PromiseAwaiterT.cs" /> | |
140 | <Compile Include="PromiseAwaiter.cs" /> |
|
140 | <Compile Include="PromiseAwaiter.cs" /> | |
141 | <Compile Include="Components\ComponentContainer.cs" /> |
|
141 | <Compile Include="Components\ComponentContainer.cs" /> | |
142 | <Compile Include="Components\Disposable.cs" /> |
|
142 | <Compile Include="Components\Disposable.cs" /> | |
143 | <Compile Include="Components\DisposablePool.cs" /> |
|
143 | <Compile Include="Components\DisposablePool.cs" /> | |
144 | <Compile Include="Components\ObjectPool.cs" /> |
|
144 | <Compile Include="Components\ObjectPool.cs" /> | |
145 | <Compile Include="Components\ServiceLocator.cs" /> |
|
145 | <Compile Include="Components\ServiceLocator.cs" /> | |
146 | <Compile Include="Components\IInitializable.cs" /> |
|
146 | <Compile Include="Components\IInitializable.cs" /> | |
147 | <Compile Include="TaskController.cs" /> |
|
147 | <Compile Include="TaskController.cs" /> | |
148 | <Compile Include="Components\App.cs" /> |
|
148 | <Compile Include="Components\App.cs" /> | |
149 | <Compile Include="Components\IRunnable.cs" /> |
|
149 | <Compile Include="Components\IRunnable.cs" /> | |
150 | <Compile Include="Components\ExecutionState.cs" /> |
|
150 | <Compile Include="Components\ExecutionState.cs" /> | |
151 | <Compile Include="Components\RunnableComponent.cs" /> |
|
151 | <Compile Include="Components\RunnableComponent.cs" /> | |
152 | <Compile Include="Components\IFactory.cs" /> |
|
152 | <Compile Include="Components\IFactory.cs" /> | |
153 | <Compile Include="Automaton\IAlphabet.cs" /> |
|
153 | <Compile Include="Automaton\IAlphabet.cs" /> | |
154 | <Compile Include="Automaton\ParserException.cs" /> |
|
154 | <Compile Include="Automaton\ParserException.cs" /> | |
155 | <Compile Include="Automaton\IndexedAlphabetBase.cs" /> |
|
155 | <Compile Include="Automaton\IndexedAlphabetBase.cs" /> | |
156 | <Compile Include="Automaton\IAlphabetBuilder.cs" /> |
|
156 | <Compile Include="Automaton\IAlphabetBuilder.cs" /> | |
157 | <Compile Include="Automaton\RegularExpressions\AltToken.cs" /> |
|
157 | <Compile Include="Automaton\RegularExpressions\AltToken.cs" /> | |
158 | <Compile Include="Automaton\RegularExpressions\BinaryToken.cs" /> |
|
158 | <Compile Include="Automaton\RegularExpressions\BinaryToken.cs" /> | |
159 | <Compile Include="Automaton\RegularExpressions\CatToken.cs" /> |
|
159 | <Compile Include="Automaton\RegularExpressions\CatToken.cs" /> | |
160 | <Compile Include="Automaton\RegularExpressions\StarToken.cs" /> |
|
160 | <Compile Include="Automaton\RegularExpressions\StarToken.cs" /> | |
161 | <Compile Include="Automaton\RegularExpressions\SymbolToken.cs" /> |
|
161 | <Compile Include="Automaton\RegularExpressions\SymbolToken.cs" /> | |
162 | <Compile Include="Automaton\RegularExpressions\EmptyToken.cs" /> |
|
162 | <Compile Include="Automaton\RegularExpressions\EmptyToken.cs" /> | |
163 | <Compile Include="Automaton\RegularExpressions\Token.cs" /> |
|
163 | <Compile Include="Automaton\RegularExpressions\Token.cs" /> | |
164 | <Compile Include="Automaton\RegularExpressions\IVisitor.cs" /> |
|
164 | <Compile Include="Automaton\RegularExpressions\IVisitor.cs" /> | |
165 | <Compile Include="Automaton\AutomatonTransition.cs" /> |
|
165 | <Compile Include="Automaton\AutomatonTransition.cs" /> | |
166 | <Compile Include="Formats\JSON\JSONElementContext.cs" /> |
|
166 | <Compile Include="Formats\JSON\JSONElementContext.cs" /> | |
167 | <Compile Include="Formats\JSON\JSONElementType.cs" /> |
|
167 | <Compile Include="Formats\JSON\JSONElementType.cs" /> | |
168 | <Compile Include="Formats\JSON\JSONGrammar.cs" /> |
|
168 | <Compile Include="Formats\JSON\JSONGrammar.cs" /> | |
169 | <Compile Include="Formats\JSON\JSONParser.cs" /> |
|
169 | <Compile Include="Formats\JSON\JSONParser.cs" /> | |
170 | <Compile Include="Formats\JSON\JSONScanner.cs" /> |
|
170 | <Compile Include="Formats\JSON\JSONScanner.cs" /> | |
171 | <Compile Include="Formats\JSON\JsonTokenType.cs" /> |
|
171 | <Compile Include="Formats\JSON\JsonTokenType.cs" /> | |
172 | <Compile Include="Formats\JSON\JSONWriter.cs" /> |
|
172 | <Compile Include="Formats\JSON\JSONWriter.cs" /> | |
173 | <Compile Include="Formats\JSON\JSONXmlReader.cs" /> |
|
173 | <Compile Include="Formats\JSON\JSONXmlReader.cs" /> | |
174 | <Compile Include="Formats\JSON\JSONXmlReaderOptions.cs" /> |
|
174 | <Compile Include="Formats\JSON\JSONXmlReaderOptions.cs" /> | |
175 | <Compile Include="Formats\JSON\StringTranslator.cs" /> |
|
175 | <Compile Include="Formats\JSON\StringTranslator.cs" /> | |
176 | <Compile Include="Automaton\MapAlphabet.cs" /> |
|
176 | <Compile Include="Automaton\MapAlphabet.cs" /> | |
177 | <Compile Include="Formats\CharAlphabet.cs" /> |
|
177 | <Compile Include="Formats\CharAlphabet.cs" /> | |
178 | <Compile Include="Formats\ByteAlphabet.cs" /> |
|
178 | <Compile Include="Formats\ByteAlphabet.cs" /> | |
179 | <Compile Include="Automaton\IDFATable.cs" /> |
|
179 | <Compile Include="Automaton\IDFATable.cs" /> | |
180 | <Compile Include="Automaton\IDFATableBuilder.cs" /> |
|
180 | <Compile Include="Automaton\IDFATableBuilder.cs" /> | |
181 | <Compile Include="Automaton\DFATable.cs" /> |
|
181 | <Compile Include="Automaton\DFATable.cs" /> | |
182 | <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitor.cs" /> |
|
182 | <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitor.cs" /> | |
183 | <Compile Include="Automaton\RegularExpressions\ITaggedDFABuilder.cs" /> |
|
183 | <Compile Include="Automaton\RegularExpressions\ITaggedDFABuilder.cs" /> | |
184 | <Compile Include="Formats\TextScanner.cs" /> |
|
184 | <Compile Include="Formats\TextScanner.cs" /> | |
185 | <Compile Include="Formats\StringScanner.cs" /> |
|
185 | <Compile Include="Formats\StringScanner.cs" /> | |
186 | <Compile Include="Formats\ReaderScanner.cs" /> |
|
186 | <Compile Include="Formats\ReaderScanner.cs" /> | |
187 | <Compile Include="Formats\ScannerContext.cs" /> |
|
187 | <Compile Include="Formats\ScannerContext.cs" /> | |
188 | <Compile Include="Formats\Grammar.cs" /> |
|
188 | <Compile Include="Formats\Grammar.cs" /> | |
189 | <Compile Include="Automaton\RegularExpressions\EndTokenT.cs" /> |
|
189 | <Compile Include="Automaton\RegularExpressions\EndTokenT.cs" /> | |
190 | <Compile Include="Automaton\RegularExpressions\EndToken.cs" /> |
|
190 | <Compile Include="Automaton\RegularExpressions\EndToken.cs" /> | |
191 | <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitorT.cs" /> |
|
191 | <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitorT.cs" /> | |
192 | <Compile Include="Automaton\AutomatonConst.cs" /> |
|
192 | <Compile Include="Automaton\AutomatonConst.cs" /> | |
193 | <Compile Include="Automaton\RegularExpressions\RegularDFA.cs" /> |
|
193 | <Compile Include="Automaton\RegularExpressions\RegularDFA.cs" /> | |
194 | <Compile Include="Components\LazyAndWeak.cs" /> |
|
194 | <Compile Include="Components\LazyAndWeak.cs" /> | |
195 | <Compile Include="AbstractTask.cs" /> |
|
195 | <Compile Include="AbstractTask.cs" /> | |
196 | <Compile Include="AbstractTaskT.cs" /> |
|
196 | <Compile Include="AbstractTaskT.cs" /> | |
|
197 | <Compile Include="Components\PollingRunnableComponent.cs" /> | |||
197 | </ItemGroup> |
|
198 | </ItemGroup> | |
198 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
|
199 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | |
199 | <ItemGroup /> |
|
200 | <ItemGroup /> | |
200 | <ProjectExtensions> |
|
201 | <ProjectExtensions> | |
201 | <MonoDevelop> |
|
202 | <MonoDevelop> | |
202 | <Properties> |
|
203 | <Properties> | |
203 | <Policies> |
|
204 | <Policies> | |
204 | <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" /> |
|
205 | <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" /> | |
205 | <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" /> |
|
206 | <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" /> | |
206 | <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" /> |
|
207 | <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" /> | |
207 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" /> |
|
208 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" /> | |
208 | <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" /> |
|
209 | <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" /> | |
209 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" /> |
|
210 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" /> | |
210 | <NameConventionPolicy> |
|
211 | <NameConventionPolicy> | |
211 | <Rules> |
|
212 | <Rules> | |
212 | <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
213 | <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
213 | <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
214 | <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
214 | <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
215 | <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> | |
215 | <RequiredPrefixes> |
|
216 | <RequiredPrefixes> | |
216 | <String>I</String> |
|
217 | <String>I</String> | |
217 | </RequiredPrefixes> |
|
218 | </RequiredPrefixes> | |
218 | </NamingRule> |
|
219 | </NamingRule> | |
219 | <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
220 | <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> | |
220 | <RequiredSuffixes> |
|
221 | <RequiredSuffixes> | |
221 | <String>Attribute</String> |
|
222 | <String>Attribute</String> | |
222 | </RequiredSuffixes> |
|
223 | </RequiredSuffixes> | |
223 | </NamingRule> |
|
224 | </NamingRule> | |
224 | <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
225 | <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> | |
225 | <RequiredSuffixes> |
|
226 | <RequiredSuffixes> | |
226 | <String>EventArgs</String> |
|
227 | <String>EventArgs</String> | |
227 | </RequiredSuffixes> |
|
228 | </RequiredSuffixes> | |
228 | </NamingRule> |
|
229 | </NamingRule> | |
229 | <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
230 | <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> | |
230 | <RequiredSuffixes> |
|
231 | <RequiredSuffixes> | |
231 | <String>Exception</String> |
|
232 | <String>Exception</String> | |
232 | </RequiredSuffixes> |
|
233 | </RequiredSuffixes> | |
233 | </NamingRule> |
|
234 | </NamingRule> | |
234 | <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
235 | <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
235 | <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" /> |
|
236 | <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" /> | |
236 | <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
237 | <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
237 | <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" /> |
|
238 | <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" /> | |
238 | <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> |
|
239 | <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> | |
239 | <RequiredPrefixes> |
|
240 | <RequiredPrefixes> | |
240 | <String>m_</String> |
|
241 | <String>m_</String> | |
241 | </RequiredPrefixes> |
|
242 | </RequiredPrefixes> | |
242 | </NamingRule> |
|
243 | </NamingRule> | |
243 | <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True"> |
|
244 | <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True"> | |
244 | <RequiredPrefixes> |
|
245 | <RequiredPrefixes> | |
245 | <String>_</String> |
|
246 | <String>_</String> | |
246 | </RequiredPrefixes> |
|
247 | </RequiredPrefixes> | |
247 | </NamingRule> |
|
248 | </NamingRule> | |
248 | <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> |
|
249 | <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> | |
249 | <RequiredPrefixes> |
|
250 | <RequiredPrefixes> | |
250 | <String>m_</String> |
|
251 | <String>m_</String> | |
251 | </RequiredPrefixes> |
|
252 | </RequiredPrefixes> | |
252 | </NamingRule> |
|
253 | </NamingRule> | |
253 | <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
254 | <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
254 | <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
255 | <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
255 | <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
256 | <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
256 | <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
257 | <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
257 | <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
258 | <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> | |
258 | <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
259 | <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> | |
259 | <RequiredPrefixes> |
|
260 | <RequiredPrefixes> | |
260 | <String>T</String> |
|
261 | <String>T</String> | |
261 | </RequiredPrefixes> |
|
262 | </RequiredPrefixes> | |
262 | </NamingRule> |
|
263 | </NamingRule> | |
263 | </Rules> |
|
264 | </Rules> | |
264 | </NameConventionPolicy> |
|
265 | </NameConventionPolicy> | |
265 | </Policies> |
|
266 | </Policies> | |
266 | </Properties> |
|
267 | </Properties> | |
267 | </MonoDevelop> |
|
268 | </MonoDevelop> | |
268 | </ProjectExtensions> |
|
269 | </ProjectExtensions> | |
269 | <ItemGroup> |
|
270 | <ItemGroup> | |
270 | <Folder Include="Components\" /> |
|
271 | <Folder Include="Components\" /> | |
271 | <Folder Include="Automaton\RegularExpressions\" /> |
|
272 | <Folder Include="Automaton\RegularExpressions\" /> | |
272 | <Folder Include="Formats\" /> |
|
273 | <Folder Include="Formats\" /> | |
273 | <Folder Include="Formats\JSON\" /> |
|
274 | <Folder Include="Formats\JSON\" /> | |
274 | </ItemGroup> |
|
275 | </ItemGroup> | |
275 | </Project> No newline at end of file |
|
276 | </Project> |
General Comments 3
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now