using System; using System.Collections.Generic; using System.Text; namespace Sonex.Library.WorkersCore { public static partial class Worker { public static string Name { get; set; } = string.Empty; public static string Title { get; set; } = string.Empty; public static string? Description { get; set; } public static WorkerWorkType WorkType { get; set; } = WorkerWorkType.Interval; public static WorkerStatus Status { get; set; } = WorkerStatus.Offline; public static int TotalTasks { get; set; } public static int CurrentTask { get; set; } public static string Activity { get; set; } = string.Empty; public static int ProgressPercent => TotalTasks <= 0 ? 0 : Math.Clamp((int)Math.Round((double)CurrentTask * 100 / TotalTasks), 0, 100); public static string Progress => $"{CurrentTask}/{TotalTasks} ({ProgressPercent}%)"; public static string ProgressInfo => string.IsNullOrWhiteSpace(Activity) ? Progress : $"{Progress} - {Activity}"; } }