You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
638 B
23 lines
638 B
using System.Diagnostics.CodeAnalysis; |
|
using StabilityMatrix.Core.Models.Progress; |
|
using StabilityMatrix.Core.Processes; |
|
|
|
namespace StabilityMatrix.Core.Extensions; |
|
|
|
public static class ProgressExtensions |
|
{ |
|
[return: NotNullIfNotNull(nameof(progress))] |
|
public static Action<ProcessOutput>? AsProcessOutputHandler( |
|
this IProgress<ProgressReport>? progress |
|
) |
|
{ |
|
return progress == null |
|
? null |
|
: output => |
|
{ |
|
progress.Report( |
|
new ProgressReport { IsIndeterminate = true, Message = output.Text } |
|
); |
|
}; |
|
} |
|
}
|
|
|