diff --git a/StabilityMatrix/Models/ProgressReport.cs b/StabilityMatrix/Models/ProgressReport.cs index e56ff6cd..16ee5842 100644 --- a/StabilityMatrix/Models/ProgressReport.cs +++ b/StabilityMatrix/Models/ProgressReport.cs @@ -42,6 +42,19 @@ public record struct ProgressReport Type = type; } + public ProgressReport(int current, int total, string? title = null, string? message = null, bool isIndeterminate = false, ProgressType type = ProgressType.Generic) + { + if (current < 0) throw new ArgumentOutOfRangeException(nameof(current), "Current progress cannot negative."); + if (total < 0) throw new ArgumentOutOfRangeException(nameof(total), "Total progress cannot be negative."); + Current = (ulong) current; + Total = (ulong) total; + Progress = (double) current / total; + Title = title; + Message = message; + IsIndeterminate = isIndeterminate; + Type = type; + } + public ProgressReport(ulong current, string? title = null, string? message = null, ProgressType type = ProgressType.Generic) { Current = current;