reorder method

This commit is contained in:
Malte Rosenbjerg 2021-03-06 23:33:48 +01:00
parent cfda317883
commit 7444899106

View file

@ -90,17 +90,6 @@ void OnCancelEvent(object sender, int timeout)
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
}
private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList<string> errorData)
{
if (throwOnError && exitCode != 0)
throw new FFMpegProcessException(exitCode, string.Join("\n", errorData));
_onPercentageProgress?.Invoke(100.0);
if (_totalTimespan.HasValue) _onTimeProgress?.Invoke(_totalTimespan.Value);
return exitCode == 0;
}
public async Task<bool> ProcessAsynchronously(bool throwOnError = true)
{
using var instance = PrepareInstance(out var cancellationTokenSource);
@ -140,6 +129,17 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
}
private bool HandleCompletion(bool throwOnError, int exitCode, IReadOnlyList<string> errorData)
{
if (throwOnError && exitCode != 0)
throw new FFMpegProcessException(exitCode, string.Join("\n", errorData));
_onPercentageProgress?.Invoke(100.0);
if (_totalTimespan.HasValue) _onTimeProgress?.Invoke(_totalTimespan.Value);
return exitCode == 0;
}
private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSource)
{
FFMpegHelper.RootExceptionCheck();