@@ -0,0 +1,36 | |||
|
1 | using System; | |
|
2 | ||
|
3 | namespace Implab { | |
|
4 | public interface ICancelationToken { | |
|
5 | /// <summary> | |
|
6 | /// Indicates wherther the cancellation was requested. | |
|
7 | /// </summary> | |
|
8 | bool IsCancelRequested { get ; } | |
|
9 | ||
|
10 | /// <summary> | |
|
11 | /// The reason why the operation should be cancelled. | |
|
12 | /// </summary> | |
|
13 | Exception CancelReason { get ; } | |
|
14 | ||
|
15 | /// <summary> | |
|
16 | /// Accepts if requested. | |
|
17 | /// </summary> | |
|
18 | /// <returns><c>true</c>, if if requested was accepted, <c>false</c> otherwise.</returns> | |
|
19 | bool AcceptIfRequested(); | |
|
20 | ||
|
21 | /// <summary> | |
|
22 | /// Sets the token to cancelled state. | |
|
23 | /// </summary> | |
|
24 | /// <param name="reason">The reason why the operation was cancelled.</param> | |
|
25 | void SetCancelled(Exception reason); | |
|
26 | ||
|
27 | /// <summary> | |
|
28 | /// Adds the listener for the cancellation request, is the cancellation was requested the <paramref name="handler"/> | |
|
29 | /// is executed immediatelly. | |
|
30 | /// </summary> | |
|
31 | /// <param name="handler">The handler which will be executed if the cancel occurs.</param> | |
|
32 | void CancellationRequested(Action<Exception> handler); | |
|
33 | ||
|
34 | } | |
|
35 | } | |
|
36 |
@@ -1,308 +1,296 | |||
|
1 | 1 | using System; |
|
2 | 2 | using Implab.Parallels; |
|
3 | 3 | using System.Threading; |
|
4 | 4 | using System.Reflection; |
|
5 | 5 | |
|
6 | 6 | namespace Implab { |
|
7 | 7 | public abstract class AbstractPromise<THandler> { |
|
8 | 8 | |
|
9 | 9 | const int UNRESOLVED_SATE = 0; |
|
10 | 10 | const int TRANSITIONAL_STATE = 1; |
|
11 | 11 | const int SUCCEEDED_STATE = 2; |
|
12 | 12 | const int REJECTED_STATE = 3; |
|
13 | 13 | const int CANCELLED_STATE = 4; |
|
14 | 14 | |
|
15 | 15 | const int RESERVED_HANDLERS_COUNT = 4; |
|
16 | 16 | |
|
17 | 17 | int m_state; |
|
18 | 18 | Exception m_error; |
|
19 | 19 | int m_handlersCount; |
|
20 | 20 | |
|
21 | 21 | readonly THandler[] m_handlers = new THandler[RESERVED_HANDLERS_COUNT]; |
|
22 | 22 | MTQueue<THandler> m_extraHandlers; |
|
23 | 23 | int m_handlerPointer = -1; |
|
24 | 24 | int m_handlersCommited; |
|
25 | 25 | |
|
26 | 26 | #region state managment |
|
27 | 27 | bool BeginTransit() { |
|
28 | 28 | return UNRESOLVED_SATE == Interlocked.CompareExchange(ref m_state, TRANSITIONAL_STATE, UNRESOLVED_SATE); |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | void CompleteTransit(int state) { |
|
32 | 32 | if (TRANSITIONAL_STATE != Interlocked.CompareExchange(ref m_state, state, TRANSITIONAL_STATE)) |
|
33 | 33 | throw new InvalidOperationException("Can't complete transition when the object isn't in the transitional state"); |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | void WaitTransition() { |
|
37 | 37 | while (m_state == TRANSITIONAL_STATE) { |
|
38 | 38 | Thread.MemoryBarrier(); |
|
39 | 39 | } |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | protected bool BeginSetResult() { |
|
43 | 43 | if (!BeginTransit()) { |
|
44 | 44 | WaitTransition(); |
|
45 | 45 | if (m_state != CANCELLED_STATE) |
|
46 | 46 | throw new InvalidOperationException("The promise is already resolved"); |
|
47 | 47 | return false; |
|
48 | 48 | } |
|
49 | 49 | return true; |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | protected void EndSetResult() { |
|
53 | 53 | CompleteTransit(SUCCEEDED_STATE); |
|
54 | 54 | OnSuccess(); |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 | |
|
59 | 59 | /// <summary> |
|
60 | 60 | /// ΠΡΠΏΠΎΠ»Π½ΡΠ΅Ρ ΠΎΠ±Π΅ΡΠ°Π½ΠΈΠ΅, ΡΠΎΠΎΠ±ΡΠ°Ρ ΠΎΠ± ΠΎΡΠΈΠ±ΠΊΠ΅ |
|
61 | 61 | /// </summary> |
|
62 | 62 | /// <remarks> |
|
63 | 63 | /// ΠΠΎΡΠΊΠΎΠ»ΡΠΊΡ ΠΎΠ±Π΅ΡΠ°Π½ΠΈΠ΅ Π΄ΠΎΠ»ΠΆΠ½ΠΎ ΡΠ°Π±ΠΎΡΠ°ΡΡ Π² ΠΌΠ½ΠΎΠ³ΠΎΠΏΡΠΎΡΠ½ΠΎΠΉ ΡΡΠ΅Π΄Π΅, ΠΏΡΠΈ Π΅Π³ΠΎ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠΈ ΡΡΠ°Π·Ρ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΎ ΠΏΠΎΡΠΎΠΊΠΎΠ² |
|
64 | 64 | /// ΠΌΠΎΠ³Ρ Π²Π΅ΡΠ½ΡΡΡ ΠΎΡΠΈΠ±ΠΊΡ, ΠΏΡΠΈ ΡΡΠΎΠΌ ΡΠΎΠ»ΡΠΊΠΎ ΠΏΠ΅ΡΠ²Π°Ρ Π±ΡΠ΄Π΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½Π° Π² ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ°, ΠΎΡΡΠ°Π»ΡΠ½ΡΠ΅ |
|
65 | 65 | /// Π±ΡΠ΄ΡΡ ΠΏΡΠΎΠΈΠ³Π½ΠΎΡΠΈΡΠΎΠ²Π°Π½Ρ. |
|
66 | 66 | /// </remarks> |
|
67 | 67 | /// <param name="error">ΠΡΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ Π²ΠΎΠ·Π½ΠΈΠΊΡΠ΅Π΅ ΠΏΡΠΈ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠΈ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΈ</param> |
|
68 | 68 | /// <exception cref="InvalidOperationException">ΠΠ°Π½Π½ΠΎΠ΅ ΠΎΠ±Π΅ΡΠ°Π½ΠΈΠ΅ ΡΠΆΠ΅ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΎ</exception> |
|
69 | 69 | protected void SetError(Exception error) { |
|
70 | 70 | if (BeginTransit()) { |
|
71 | 71 | if (error is OperationCanceledException) { |
|
72 | 72 | CompleteTransit(CANCELLED_STATE); |
|
73 | 73 | m_error = error.InnerException; |
|
74 | 74 | OnCancelled(); |
|
75 | 75 | } else { |
|
76 | 76 | m_error = error is PromiseTransientException ? error.InnerException : error; |
|
77 | 77 | CompleteTransit(REJECTED_STATE); |
|
78 | 78 | OnError(); |
|
79 | 79 | } |
|
80 | 80 | } else { |
|
81 | 81 | WaitTransition(); |
|
82 | 82 | if (m_state == SUCCEEDED_STATE) |
|
83 | 83 | throw new InvalidOperationException("The promise is already resolved"); |
|
84 | 84 | } |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | /// <summary> |
|
88 | 88 | /// ΠΡΠΌΠ΅Π½ΡΠ΅Ρ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ, Π΅ΡΠ»ΠΈ ΡΡΠΎ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ. |
|
89 | 89 | /// </summary> |
|
90 | 90 | /// <remarks>ΠΠ»Ρ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ Π±ΡΠ»Π° Π»ΠΈ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΡ ΠΎΡΠΌΠ΅Π½Π΅Π½Π° ΡΠ»Π΅Π΄ΡΠ΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ΡΠ²ΠΎΠΉΡΡΠ²ΠΎ <see cref="IsCancelled"/>.</remarks> |
|
91 | 91 | protected void SetCancelled(Exception reason) { |
|
92 | 92 | if (BeginTransit()) { |
|
93 | 93 | m_error = reason; |
|
94 | 94 | CompleteTransit(CANCELLED_STATE); |
|
95 | 95 | OnCancelled(); |
|
96 | 96 | } |
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | protected abstract void SignalSuccess(THandler handler); |
|
100 | 100 | |
|
101 | 101 | protected abstract void SignalError(THandler handler, Exception error); |
|
102 | 102 | |
|
103 | 103 | protected abstract void SignalCancelled(THandler handler, Exception reason); |
|
104 | 104 | |
|
105 | 105 | void OnSuccess() { |
|
106 | 106 | var hp = m_handlerPointer; |
|
107 | 107 | var slot = hp +1 ; |
|
108 | 108 | while (slot < m_handlersCommited) { |
|
109 | 109 | if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) == hp) { |
|
110 | 110 | SignalSuccess(m_handlers[slot]); |
|
111 | 111 | } |
|
112 | 112 | hp = m_handlerPointer; |
|
113 | 113 | slot = hp +1 ; |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | |
|
117 | 117 | if (m_extraHandlers != null) { |
|
118 | 118 | THandler handler; |
|
119 | 119 | while (m_extraHandlers.TryDequeue(out handler)) |
|
120 | 120 | SignalSuccess(handler); |
|
121 | 121 | } |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | void OnError() { |
|
125 | 125 | var hp = m_handlerPointer; |
|
126 | 126 | var slot = hp +1 ; |
|
127 | 127 | while (slot < m_handlersCommited) { |
|
128 | 128 | if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) == hp) { |
|
129 | 129 | SignalError(m_handlers[slot],m_error); |
|
130 | 130 | } |
|
131 | 131 | hp = m_handlerPointer; |
|
132 | 132 | slot = hp +1 ; |
|
133 | 133 | } |
|
134 | 134 | |
|
135 | 135 | if (m_extraHandlers != null) { |
|
136 | 136 | THandler handler; |
|
137 | 137 | while (m_extraHandlers.TryDequeue(out handler)) |
|
138 | 138 | SignalError(handler, m_error); |
|
139 | 139 | } |
|
140 | 140 | } |
|
141 | 141 | |
|
142 | 142 | void OnCancelled() { |
|
143 | 143 | var hp = m_handlerPointer; |
|
144 | 144 | var slot = hp +1 ; |
|
145 | 145 | while (slot < m_handlersCommited) { |
|
146 | 146 | if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) == hp) { |
|
147 | 147 | SignalCancelled(m_handlers[slot], m_error); |
|
148 | 148 | } |
|
149 | 149 | hp = m_handlerPointer; |
|
150 | 150 | slot = hp +1 ; |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | if (m_extraHandlers != null) { |
|
154 | 154 | THandler handler; |
|
155 | 155 | while (m_extraHandlers.TryDequeue(out handler)) |
|
156 | 156 | SignalCancelled(handler, m_error); |
|
157 | 157 | } |
|
158 | 158 | } |
|
159 | 159 | |
|
160 | 160 | #endregion |
|
161 | 161 | |
|
162 | 162 | protected abstract void Listen(PromiseEventType events, Action handler); |
|
163 | 163 | |
|
164 | 164 | #region synchronization traits |
|
165 | 165 | protected void WaitResult(int timeout) { |
|
166 | 166 | if (!IsResolved) { |
|
167 | 167 | var lk = new object(); |
|
168 | 168 | |
|
169 | 169 | Listen(PromiseEventType.All, () => { |
|
170 | 170 | lock(lk) { |
|
171 | 171 | Monitor.Pulse(lk); |
|
172 | 172 | } |
|
173 | 173 | }); |
|
174 | 174 | |
|
175 | 175 | lock (lk) { |
|
176 | 176 | while(!IsResolved) { |
|
177 | 177 | if(!Monitor.Wait(lk,timeout)) |
|
178 | 178 | throw new TimeoutException(); |
|
179 | 179 | } |
|
180 | 180 | } |
|
181 | 181 | |
|
182 | 182 | } |
|
183 | 183 | switch (m_state) { |
|
184 | 184 | case SUCCEEDED_STATE: |
|
185 | 185 | return; |
|
186 | 186 | case CANCELLED_STATE: |
|
187 | 187 | throw new OperationCanceledException(); |
|
188 | 188 | case REJECTED_STATE: |
|
189 | 189 | throw new TargetInvocationException(m_error); |
|
190 | 190 | default: |
|
191 | 191 | throw new ApplicationException(String.Format("Invalid promise state {0}", m_state)); |
|
192 | 192 | } |
|
193 | 193 | } |
|
194 | 194 | #endregion |
|
195 | 195 | |
|
196 | 196 | #region handlers managment |
|
197 | 197 | |
|
198 | 198 | protected void AddHandler(THandler handler) { |
|
199 | 199 | |
|
200 | 200 | if (m_state > 1) { |
|
201 | 201 | // the promise is in the resolved state, just invoke the handler |
|
202 | 202 | InvokeHandler(handler); |
|
203 | 203 | } else { |
|
204 | 204 | var slot = Interlocked.Increment(ref m_handlersCount) - 1; |
|
205 | 205 | |
|
206 | 206 | if (slot < RESERVED_HANDLERS_COUNT) { |
|
207 | 207 | m_handlers[slot] = handler; |
|
208 | 208 | |
|
209 | 209 | while (slot != Interlocked.CompareExchange(ref m_handlersCommited, slot + 1, slot)) { |
|
210 | 210 | } |
|
211 | 211 | |
|
212 | 212 | if (m_state > 1) { |
|
213 | 213 | do { |
|
214 | 214 | var hp = m_handlerPointer; |
|
215 | 215 | slot = hp + 1; |
|
216 | 216 | if (slot < m_handlersCommited) { |
|
217 | 217 | if (Interlocked.CompareExchange(ref m_handlerPointer, slot, hp) != hp) |
|
218 | 218 | continue; |
|
219 | 219 | InvokeHandler(m_handlers[slot]); |
|
220 | 220 | } |
|
221 | 221 | break; |
|
222 | 222 | } while(true); |
|
223 | 223 | } |
|
224 | 224 | } else { |
|
225 | 225 | if (slot == RESERVED_HANDLERS_COUNT) { |
|
226 | 226 | m_extraHandlers = new MTQueue<THandler>(); |
|
227 | 227 | } else { |
|
228 | 228 | while (m_extraHandlers == null) |
|
229 | 229 | Thread.MemoryBarrier(); |
|
230 | 230 | } |
|
231 | 231 | |
|
232 | 232 | m_extraHandlers.Enqueue(handler); |
|
233 | 233 | |
|
234 | 234 | if (m_state > 1 && m_extraHandlers.TryDequeue(out handler)) |
|
235 | 235 | // if the promise have been resolved while we was adding the handler to the queue |
|
236 | 236 | // we can't guarantee that someone is still processing it |
|
237 | 237 | // therefore we need to fetch a handler from the queue and execute it |
|
238 | 238 | // note that fetched handler may be not the one that we have added |
|
239 | 239 | // even we can fetch no handlers at all :) |
|
240 | 240 | InvokeHandler(handler); |
|
241 | 241 | } |
|
242 | 242 | } |
|
243 | 243 | } |
|
244 | 244 | |
|
245 | 245 | protected void InvokeHandler(THandler handler) { |
|
246 | 246 | switch (m_state) { |
|
247 | 247 | case SUCCEEDED_STATE: |
|
248 | 248 | SignalSuccess(handler); |
|
249 | 249 | break; |
|
250 | 250 | case CANCELLED_STATE: |
|
251 | 251 | SignalCancelled(handler, m_error); |
|
252 | 252 | break; |
|
253 | 253 | case REJECTED_STATE: |
|
254 | 254 | SignalError(handler, m_error); |
|
255 | 255 | break; |
|
256 | 256 | default: |
|
257 | 257 | throw new Exception(String.Format("Invalid promise state {0}", m_state)); |
|
258 | 258 | } |
|
259 | 259 | } |
|
260 | 260 | |
|
261 | 261 | #endregion |
|
262 | 262 | |
|
263 | 263 | #region IPromise implementation |
|
264 | 264 | |
|
265 | 265 | public void Join(int timeout) { |
|
266 | 266 | WaitResult(timeout); |
|
267 | 267 | } |
|
268 | 268 | |
|
269 | 269 | public void Join() { |
|
270 | 270 | WaitResult(-1); |
|
271 | 271 | } |
|
272 | 272 | |
|
273 | 273 | public bool IsResolved { |
|
274 | 274 | get { |
|
275 | 275 | Thread.MemoryBarrier(); |
|
276 | 276 | return m_state > 1; |
|
277 | 277 | } |
|
278 | 278 | } |
|
279 | 279 | |
|
280 | 280 | public bool IsCancelled { |
|
281 | 281 | get { |
|
282 | 282 | Thread.MemoryBarrier(); |
|
283 | 283 | return m_state == CANCELLED_STATE; |
|
284 | 284 | } |
|
285 | 285 | } |
|
286 | 286 | |
|
287 | 287 | #endregion |
|
288 | 288 | |
|
289 | #region ICancellable implementation | |
|
290 | ||
|
291 | public void Cancel() { | |
|
292 | SetCancelled(null); | |
|
293 | } | |
|
294 | ||
|
295 | public void Cancel(Exception reason) { | |
|
296 | SetCancelled(reason); | |
|
297 | } | |
|
298 | ||
|
299 | #endregion | |
|
300 | ||
|
301 | 289 | public Exception Error { |
|
302 | 290 | get { |
|
303 | 291 | return m_error; |
|
304 | 292 | } |
|
305 | 293 | } |
|
306 | 294 | } |
|
307 | 295 | } |
|
308 | 296 |
@@ -1,24 +1,24 | |||
|
1 | 1 | using System; |
|
2 | 2 | |
|
3 | 3 | namespace Implab { |
|
4 | 4 | /// <summary> |
|
5 | 5 | /// Deferred result, usually used by asynchronous services as the service part of the promise. |
|
6 | 6 | /// </summary> |
|
7 |
public interface IDeferred : ICancel |
|
|
7 | public interface IDeferred : ICancelationToken { | |
|
8 | 8 | |
|
9 | 9 | void Resolve(); |
|
10 | 10 | |
|
11 | 11 | /// <summary> |
|
12 | 12 | /// Reject the promise with the specified error. |
|
13 | 13 | /// </summary> |
|
14 | 14 | /// <param name="error">The reason why the promise is rejected.</param> |
|
15 | 15 | /// <remarks> |
|
16 | 16 | /// Some exceptions are treated in a special case: |
|
17 | 17 | /// <see cref="OperationCanceledException"/> is interpreted as call to <see cref="Cancel()"/> method, |
|
18 | 18 | /// and <see cref="PromiseTransientException"/> is always unwrapped and its |
|
19 | 19 | /// <see cref="PromiseTransientException.InnerException"> is used as the reason to reject promise. |
|
20 | 20 | /// </remarks> |
|
21 | 21 | void Reject(Exception error); |
|
22 | 22 | } |
|
23 | 23 | } |
|
24 | 24 |
@@ -1,10 +1,10 | |||
|
1 | 1 | using System; |
|
2 | 2 | |
|
3 | 3 | namespace Implab { |
|
4 |
public interface IDeferred<T> : ICancel |
|
|
4 | public interface IDeferred<T> : ICancelationToken { | |
|
5 | 5 | void Resolve(T value); |
|
6 | 6 | |
|
7 | 7 | void Reject(Exception error); |
|
8 | 8 | } |
|
9 | 9 | } |
|
10 | 10 |
@@ -1,231 +1,234 | |||
|
1 | 1 | ο»Ώ<?xml version="1.0" encoding="utf-8"?> |
|
2 | 2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 | 3 | <PropertyGroup> |
|
4 | 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
5 | 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
6 | 6 | <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid> |
|
7 | 7 | <OutputType>Library</OutputType> |
|
8 | 8 | <RootNamespace>Implab</RootNamespace> |
|
9 | 9 | <AssemblyName>Implab</AssemblyName> |
|
10 | <ProductVersion>8.0.30703</ProductVersion> | |
|
11 | <SchemaVersion>2.0</SchemaVersion> | |
|
10 | 12 | </PropertyGroup> |
|
11 | 13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
12 | 14 | <DebugSymbols>true</DebugSymbols> |
|
13 | 15 | <DebugType>full</DebugType> |
|
14 | 16 | <Optimize>false</Optimize> |
|
15 | 17 | <OutputPath>bin\Debug</OutputPath> |
|
16 | 18 | <DefineConstants>TRACE;DEBUG;</DefineConstants> |
|
17 | 19 | <ErrorReport>prompt</ErrorReport> |
|
18 | 20 | <WarningLevel>4</WarningLevel> |
|
19 | 21 | <ConsolePause>false</ConsolePause> |
|
20 | 22 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
21 | 23 | </PropertyGroup> |
|
22 | 24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
23 | 25 | <DebugType>full</DebugType> |
|
24 | 26 | <Optimize>true</Optimize> |
|
25 | 27 | <OutputPath>bin\Release</OutputPath> |
|
26 | 28 | <ErrorReport>prompt</ErrorReport> |
|
27 | 29 | <WarningLevel>4</WarningLevel> |
|
28 | 30 | <ConsolePause>false</ConsolePause> |
|
29 | 31 | </PropertyGroup> |
|
30 | 32 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' "> |
|
31 | 33 | <DebugSymbols>true</DebugSymbols> |
|
32 | 34 | <DebugType>full</DebugType> |
|
33 | 35 | <Optimize>false</Optimize> |
|
34 | 36 | <OutputPath>bin\Debug</OutputPath> |
|
35 | 37 | <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants> |
|
36 | 38 | <ErrorReport>prompt</ErrorReport> |
|
37 | 39 | <WarningLevel>4</WarningLevel> |
|
38 | 40 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
39 | 41 | <ConsolePause>false</ConsolePause> |
|
40 | 42 | </PropertyGroup> |
|
41 | 43 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' "> |
|
42 | 44 | <Optimize>true</Optimize> |
|
43 | 45 | <OutputPath>bin\Release</OutputPath> |
|
44 | 46 | <ErrorReport>prompt</ErrorReport> |
|
45 | 47 | <WarningLevel>4</WarningLevel> |
|
46 | 48 | <ConsolePause>false</ConsolePause> |
|
47 | 49 | <DefineConstants>NET_4_5</DefineConstants> |
|
48 | 50 | </PropertyGroup> |
|
49 | 51 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' "> |
|
50 | 52 | <DebugSymbols>true</DebugSymbols> |
|
51 | 53 | <DebugType>full</DebugType> |
|
52 | 54 | <Optimize>false</Optimize> |
|
53 | 55 | <OutputPath>bin\Debug</OutputPath> |
|
54 | 56 | <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants> |
|
55 | 57 | <ErrorReport>prompt</ErrorReport> |
|
56 | 58 | <WarningLevel>4</WarningLevel> |
|
57 | 59 | <RunCodeAnalysis>true</RunCodeAnalysis> |
|
58 | 60 | <ConsolePause>false</ConsolePause> |
|
59 | 61 | </PropertyGroup> |
|
60 | 62 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' "> |
|
61 | 63 | <Optimize>true</Optimize> |
|
62 | 64 | <OutputPath>bin\Release</OutputPath> |
|
63 | 65 | <DefineConstants>NET_4_5;MONO;</DefineConstants> |
|
64 | 66 | <ErrorReport>prompt</ErrorReport> |
|
65 | 67 | <WarningLevel>4</WarningLevel> |
|
66 | 68 | <ConsolePause>false</ConsolePause> |
|
67 | 69 | </PropertyGroup> |
|
68 | 70 | <ItemGroup> |
|
69 | 71 | <Reference Include="System" /> |
|
70 | 72 | <Reference Include="System.Xml" /> |
|
71 | 73 | </ItemGroup> |
|
72 | 74 | <ItemGroup> |
|
73 | 75 | <Compile Include="Component.cs" /> |
|
74 | 76 | <Compile Include="CustomEqualityComparer.cs" /> |
|
75 | 77 | <Compile Include="Diagnostics\ConsoleTraceListener.cs" /> |
|
76 | 78 | <Compile Include="Diagnostics\EventText.cs" /> |
|
77 | 79 | <Compile Include="Diagnostics\LogChannel.cs" /> |
|
78 | 80 | <Compile Include="Diagnostics\LogicalOperation.cs" /> |
|
79 | 81 | <Compile Include="Diagnostics\TextFileListener.cs" /> |
|
80 | 82 | <Compile Include="Diagnostics\TraceLog.cs" /> |
|
81 | 83 | <Compile Include="Diagnostics\TraceEvent.cs" /> |
|
82 | 84 | <Compile Include="Diagnostics\TraceEventType.cs" /> |
|
83 | 85 | <Compile Include="Disposable.cs" /> |
|
84 | 86 | <Compile Include="ICancellable.cs" /> |
|
85 | 87 | <Compile Include="IProgressHandler.cs" /> |
|
86 | 88 | <Compile Include="IProgressNotifier.cs" /> |
|
87 | 89 | <Compile Include="IPromiseT.cs" /> |
|
88 | 90 | <Compile Include="IPromise.cs" /> |
|
89 | 91 | <Compile Include="IServiceLocator.cs" /> |
|
90 | 92 | <Compile Include="ITaskController.cs" /> |
|
91 | 93 | <Compile Include="JSON\JSONElementContext.cs" /> |
|
92 | 94 | <Compile Include="JSON\JSONElementType.cs" /> |
|
93 | 95 | <Compile Include="JSON\JSONGrammar.cs" /> |
|
94 | 96 | <Compile Include="JSON\JSONParser.cs" /> |
|
95 | 97 | <Compile Include="JSON\JSONScanner.cs" /> |
|
96 | 98 | <Compile Include="JSON\JsonTokenType.cs" /> |
|
97 | 99 | <Compile Include="JSON\JSONWriter.cs" /> |
|
98 | 100 | <Compile Include="JSON\JSONXmlReader.cs" /> |
|
99 | 101 | <Compile Include="JSON\JSONXmlReaderOptions.cs" /> |
|
100 | 102 | <Compile Include="JSON\StringTranslator.cs" /> |
|
101 | 103 | <Compile Include="Parallels\DispatchPool.cs" /> |
|
102 | 104 | <Compile Include="Parallels\ArrayTraits.cs" /> |
|
103 | 105 | <Compile Include="Parallels\MTQueue.cs" /> |
|
104 | 106 | <Compile Include="Parallels\WorkerPool.cs" /> |
|
105 | 107 | <Compile Include="Parsing\Alphabet.cs" /> |
|
106 | 108 | <Compile Include="Parsing\AlphabetBase.cs" /> |
|
107 | 109 | <Compile Include="Parsing\AltToken.cs" /> |
|
108 | 110 | <Compile Include="Parsing\BinaryToken.cs" /> |
|
109 | 111 | <Compile Include="Parsing\CatToken.cs" /> |
|
110 | 112 | <Compile Include="Parsing\CDFADefinition.cs" /> |
|
111 | 113 | <Compile Include="Parsing\DFABuilder.cs" /> |
|
112 | 114 | <Compile Include="Parsing\DFADefinitionBase.cs" /> |
|
113 | 115 | <Compile Include="Parsing\DFAStateDescriptor.cs" /> |
|
114 | 116 | <Compile Include="Parsing\DFAutomaton.cs" /> |
|
115 | 117 | <Compile Include="Parsing\EDFADefinition.cs" /> |
|
116 | 118 | <Compile Include="Parsing\EmptyToken.cs" /> |
|
117 | 119 | <Compile Include="Parsing\EndToken.cs" /> |
|
118 | 120 | <Compile Include="Parsing\EnumAlphabet.cs" /> |
|
119 | 121 | <Compile Include="Parsing\Grammar.cs" /> |
|
120 | 122 | <Compile Include="Parsing\IAlphabet.cs" /> |
|
121 | 123 | <Compile Include="Parsing\IDFADefinition.cs" /> |
|
122 | 124 | <Compile Include="Parsing\IVisitor.cs" /> |
|
123 | 125 | <Compile Include="Parsing\ParserException.cs" /> |
|
124 | 126 | <Compile Include="Parsing\Scanner.cs" /> |
|
125 | 127 | <Compile Include="Parsing\StarToken.cs" /> |
|
126 | 128 | <Compile Include="Parsing\SymbolToken.cs" /> |
|
127 | 129 | <Compile Include="Parsing\Token.cs" /> |
|
128 | 130 | <Compile Include="ServiceLocator.cs" /> |
|
129 | 131 | <Compile Include="TaskController.cs" /> |
|
130 | 132 | <Compile Include="ProgressInitEventArgs.cs" /> |
|
131 | 133 | <Compile Include="Properties\AssemblyInfo.cs" /> |
|
132 | 134 | <Compile Include="Parallels\AsyncPool.cs" /> |
|
133 | 135 | <Compile Include="Safe.cs" /> |
|
134 | 136 | <Compile Include="ValueEventArgs.cs" /> |
|
135 | 137 | <Compile Include="PromiseExtensions.cs" /> |
|
136 | 138 | <Compile Include="SyncContextPromise.cs" /> |
|
137 | 139 | <Compile Include="Diagnostics\OperationContext.cs" /> |
|
138 | 140 | <Compile Include="Diagnostics\TraceContext.cs" /> |
|
139 | 141 | <Compile Include="Diagnostics\LogEventArgs.cs" /> |
|
140 | 142 | <Compile Include="Diagnostics\LogEventArgsT.cs" /> |
|
141 | 143 | <Compile Include="Diagnostics\Extensions.cs" /> |
|
142 | 144 | <Compile Include="IComponentContainer.cs" /> |
|
143 | 145 | <Compile Include="PromiseEventType.cs" /> |
|
144 | 146 | <Compile Include="ComponentContainer.cs" /> |
|
145 | 147 | <Compile Include="DisposablePool.cs" /> |
|
146 | 148 | <Compile Include="ObjectPool.cs" /> |
|
147 | 149 | <Compile Include="Parallels\AsyncQueue.cs" /> |
|
148 | 150 | <Compile Include="PromiseT.cs" /> |
|
149 | 151 | <Compile Include="IDeferred.cs" /> |
|
150 | 152 | <Compile Include="IDeferredT.cs" /> |
|
151 | 153 | <Compile Include="AbstractPromise.cs" /> |
|
152 | 154 | <Compile Include="Promise.cs" /> |
|
153 | 155 | <Compile Include="PromiseTransientException.cs" /> |
|
154 | 156 | <Compile Include="Parallels\Signal.cs" /> |
|
155 | 157 | <Compile Include="Parallels\SharedLock.cs" /> |
|
156 | 158 | <Compile Include="Diagnostics\ILogWriter.cs" /> |
|
157 | 159 | <Compile Include="Diagnostics\ListenerBase.cs" /> |
|
158 | 160 | <Compile Include="Parallels\BlockingQueue.cs" /> |
|
161 | <Compile Include="ICancelationToken.cs" /> | |
|
159 | 162 | </ItemGroup> |
|
160 | 163 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
|
161 | 164 | <ItemGroup /> |
|
162 | 165 | <ProjectExtensions> |
|
163 | 166 | <MonoDevelop> |
|
164 | 167 | <Properties> |
|
165 | 168 | <Policies> |
|
166 | 169 | <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" /> |
|
167 | 170 | <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" /> |
|
168 | 171 | <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" /> |
|
169 | 172 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" /> |
|
170 | 173 | <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" /> |
|
171 | 174 | <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" /> |
|
172 | 175 | <NameConventionPolicy> |
|
173 | 176 | <Rules> |
|
174 | 177 | <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
175 | 178 | <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
176 | 179 | <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
177 | 180 | <RequiredPrefixes> |
|
178 | 181 | <String>I</String> |
|
179 | 182 | </RequiredPrefixes> |
|
180 | 183 | </NamingRule> |
|
181 | 184 | <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
182 | 185 | <RequiredSuffixes> |
|
183 | 186 | <String>Attribute</String> |
|
184 | 187 | </RequiredSuffixes> |
|
185 | 188 | </NamingRule> |
|
186 | 189 | <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
187 | 190 | <RequiredSuffixes> |
|
188 | 191 | <String>EventArgs</String> |
|
189 | 192 | </RequiredSuffixes> |
|
190 | 193 | </NamingRule> |
|
191 | 194 | <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
192 | 195 | <RequiredSuffixes> |
|
193 | 196 | <String>Exception</String> |
|
194 | 197 | </RequiredSuffixes> |
|
195 | 198 | </NamingRule> |
|
196 | 199 | <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
197 | 200 | <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" /> |
|
198 | 201 | <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
199 | 202 | <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" /> |
|
200 | 203 | <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> |
|
201 | 204 | <RequiredPrefixes> |
|
202 | 205 | <String>m_</String> |
|
203 | 206 | </RequiredPrefixes> |
|
204 | 207 | </NamingRule> |
|
205 | 208 | <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True"> |
|
206 | 209 | <RequiredPrefixes> |
|
207 | 210 | <String>_</String> |
|
208 | 211 | </RequiredPrefixes> |
|
209 | 212 | </NamingRule> |
|
210 | 213 | <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False"> |
|
211 | 214 | <RequiredPrefixes> |
|
212 | 215 | <String>m_</String> |
|
213 | 216 | </RequiredPrefixes> |
|
214 | 217 | </NamingRule> |
|
215 | 218 | <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
216 | 219 | <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
217 | 220 | <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
218 | 221 | <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
219 | 222 | <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" /> |
|
220 | 223 | <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True"> |
|
221 | 224 | <RequiredPrefixes> |
|
222 | 225 | <String>T</String> |
|
223 | 226 | </RequiredPrefixes> |
|
224 | 227 | </NamingRule> |
|
225 | 228 | </Rules> |
|
226 | 229 | </NameConventionPolicy> |
|
227 | 230 | </Policies> |
|
228 | 231 | </Properties> |
|
229 | 232 | </MonoDevelop> |
|
230 | 233 | </ProjectExtensions> |
|
231 | 234 | </Project> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now