mirror of
				https://github.com/esiur/esiur-dotnet.git
				synced 2025-10-30 23:51:34 +00:00 
			
		
		
		
	.Net 6 Upgrade
This commit is contained in:
		| @@ -3,66 +3,65 @@ using System.Collections.Generic; | ||||
| using System.Runtime.CompilerServices; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Esiur.Core | ||||
| namespace Esiur.Core; | ||||
|  | ||||
| public class AsyncReplyBuilder | ||||
| { | ||||
|     public class AsyncReplyBuilder | ||||
|     AsyncReply reply; | ||||
|  | ||||
|     AsyncReplyBuilder(AsyncReply reply) | ||||
|     { | ||||
|         AsyncReply reply; | ||||
|  | ||||
|         AsyncReplyBuilder(AsyncReply reply) | ||||
|         { | ||||
|             this.reply = reply; | ||||
|         } | ||||
|  | ||||
|         public static AsyncReplyBuilder Create() | ||||
|         { | ||||
|             return new AsyncReplyBuilder(new AsyncReply()); | ||||
|         } | ||||
|  | ||||
|         public void Start<TStateMachine>(ref TStateMachine stateMachine) | ||||
|             where TStateMachine : IAsyncStateMachine | ||||
|         { | ||||
|             stateMachine.MoveNext(); | ||||
|         } | ||||
|  | ||||
|         public void SetStateMachine(IAsyncStateMachine stateMachine) | ||||
|         { | ||||
|             Console.WriteLine("SetStateMachine"); | ||||
|         } | ||||
|  | ||||
|         public void SetException(Exception exception) | ||||
|         { | ||||
|             reply.TriggerError(exception); | ||||
|         } | ||||
|  | ||||
|         public void SetResult() | ||||
|         { | ||||
|             reply.Trigger(null); | ||||
|         } | ||||
|  | ||||
|         public void AwaitOnCompleted<TAwaiter, TStateMachine>( | ||||
|             ref TAwaiter awaiter, ref TStateMachine stateMachine) | ||||
|             where TAwaiter : INotifyCompletion | ||||
|             where TStateMachine : IAsyncStateMachine | ||||
|         { | ||||
|             awaiter.OnCompleted(stateMachine.MoveNext); | ||||
|         } | ||||
|  | ||||
|         public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>( | ||||
|             ref TAwaiter awaiter, ref TStateMachine stateMachine) | ||||
|             where TAwaiter : ICriticalNotifyCompletion | ||||
|             where TStateMachine : IAsyncStateMachine | ||||
|         { | ||||
|             awaiter.UnsafeOnCompleted(stateMachine.MoveNext);             | ||||
|         } | ||||
|  | ||||
|         public AsyncReply Task | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 return reply; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         this.reply = reply; | ||||
|     } | ||||
|  | ||||
|     public static AsyncReplyBuilder Create() | ||||
|     { | ||||
|         return new AsyncReplyBuilder(new AsyncReply()); | ||||
|     } | ||||
|  | ||||
|     public void Start<TStateMachine>(ref TStateMachine stateMachine) | ||||
|         where TStateMachine : IAsyncStateMachine | ||||
|     { | ||||
|         stateMachine.MoveNext(); | ||||
|     } | ||||
|  | ||||
|     public void SetStateMachine(IAsyncStateMachine stateMachine) | ||||
|     { | ||||
|         Console.WriteLine("SetStateMachine"); | ||||
|     } | ||||
|  | ||||
|     public void SetException(Exception exception) | ||||
|     { | ||||
|         reply.TriggerError(exception); | ||||
|     } | ||||
|  | ||||
|     public void SetResult() | ||||
|     { | ||||
|         reply.Trigger(null); | ||||
|     } | ||||
|  | ||||
|     public void AwaitOnCompleted<TAwaiter, TStateMachine>( | ||||
|         ref TAwaiter awaiter, ref TStateMachine stateMachine) | ||||
|         where TAwaiter : INotifyCompletion | ||||
|         where TStateMachine : IAsyncStateMachine | ||||
|     { | ||||
|         awaiter.OnCompleted(stateMachine.MoveNext); | ||||
|     } | ||||
|  | ||||
|     public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>( | ||||
|         ref TAwaiter awaiter, ref TStateMachine stateMachine) | ||||
|         where TAwaiter : ICriticalNotifyCompletion | ||||
|         where TStateMachine : IAsyncStateMachine | ||||
|     { | ||||
|         awaiter.UnsafeOnCompleted(stateMachine.MoveNext); | ||||
|     } | ||||
|  | ||||
|     public AsyncReply Task | ||||
|     { | ||||
|         get | ||||
|         { | ||||
|             return reply; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user