private static void CompleteTask <T>(TaskCompletionSource <T> tcs, FfiResult result, Func <T> argFunc)
 {
     if (result.ErrorCode != 0)
     {
         tcs.SetException(result.ToException());
     }
     else
     {
         tcs.SetResult(argFunc());
     }
 }
 public static void CompleteTask(IntPtr userData, FfiResult result)
 {
     CompleteTask(userData, result, () => true);
 }
        public static void CompleteTask <T>(IntPtr userData, FfiResult result, Func <T> argFunc)
        {
            var tcs = FromHandlePtr <TaskCompletionSource <T> >(userData);

            CompleteTask(tcs, result, argFunc);
        }
Beispiel #4
0
 public static Exception ToException(this FfiResult result)
 {
     return(new Exception($"Error Code: {result.ErrorCode}. Description: {result.Description}"));
 }