예제 #1
0
        public static void Assert(this MpReturnCode code)
        {
            switch (code)
            {
            case MpReturnCode.Success: return;

            case MpReturnCode.Aborted:
            {
                throw new MediaPipeException("MediaPipe Aborted, refer glog files for more details");
            }

            case MpReturnCode.StandardError:
            {
                throw new MediaPipePluginException($"Exception is thrown in Unmanaged Code");
            }

            case MpReturnCode.UnknownError:
            {
                throw new MediaPipePluginException($"Unknown exception is thrown in Unmanaged Code");
            }

            case MpReturnCode.Unset:
            {
                // Bug
                throw new MediaPipePluginException($"Failed to call a native function, but the reason is unknown");
            }

            default:
            {
                throw new MediaPipePluginException($"Failed to call a native function, but the reason is undefined");
            }
            }
        }
예제 #2
0
 private T ValueOrFormatException <T>(MpReturnCode code, T value)
 {
     try {
         code.Assert();
         return(value);
     } catch (MediaPipeException) {
         throw new FormatException($"Invalid image format: {Format()}");
     }
 }
예제 #3
0
        public static void Assert(this MpReturnCode code)
        {
            switch (code)
            {
            case MpReturnCode.Success: return;

            case MpReturnCode.Aborted: {
                throw new MediaPipeException("MediaPipe Aborted, refer glog files for more details");
            }

            default: {
                throw new MediaPipePluginException($"Failed to call a native function (code={code}");
            }
            }
        }