Ejemplo n.º 1
0
 /// <summary>
 /// Throws an <see cref="AzureKinectOpenDeviceException"/> if the result of the function
 /// is not a success.
 /// </summary>
 /// <param name="tracer">The tracer is that is capturing logging messages.</param>
 /// <param name="result">The result native function to call.</param>
 /// <typeparam name="T">The type of result to expect from the function call.</typeparam>
 internal static new void ThrowIfNotSuccess <T>(LoggingTracer tracer, T result)
     where T : System.Enum
 {
     if (!AzureKinectException.IsSuccess(result))
     {
         throw new AzureKinectOpenDeviceException($"result = {result}", tracer.LogMessages);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Throws an <see cref="AzureKinectOpenDeviceException"/> if the result of the function
 /// is not a success.
 /// </summary>
 /// <param name="function">The native function to call.</param>
 /// <typeparam name="T">The type of result to expect from the function call.</typeparam>
 internal static new void ThrowIfNotSuccess <T>(Func <T> function)
     where T : System.Enum
 {
     using (LoggingTracer tracer = new LoggingTracer())
     {
         T result = function();
         if (!AzureKinectException.IsSuccess(result))
         {
             throw new AzureKinectOpenDeviceException($"result = {result}", tracer.LogMessages);
         }
     }
 }