mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
reorder method
This commit is contained in:
parent
cfda317883
commit
7444899106
1 changed files with 11 additions and 11 deletions
|
@ -90,17 +90,6 @@ void OnCancelEvent(object sender, int timeout)
|
||||||
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
|
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)
|
public async Task<bool> ProcessAsynchronously(bool throwOnError = true)
|
||||||
{
|
{
|
||||||
using var instance = PrepareInstance(out var cancellationTokenSource);
|
using var instance = PrepareInstance(out var cancellationTokenSource);
|
||||||
|
@ -140,6 +129,17 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
|
||||||
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
|
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)
|
private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSource)
|
||||||
{
|
{
|
||||||
FFMpegHelper.RootExceptionCheck();
|
FFMpegHelper.RootExceptionCheck();
|
||||||
|
|
Loading…
Reference in a new issue