CLI tool for running Playbooks
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.

58 lines
1.7 KiB

1 year ago
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Text;
  5. using TrustedUninstaller.Shared.Parser;
  6. using YamlDotNet.Serialization;
  7. namespace TrustedUninstaller.Shared.Tasks
  8. {
  9. public class UninstallTask
  10. {
  11. public string Title { get; set; }
  12. #nullable enable
  13. public string? Description { get; set; }
  14. public string[]? SupportedBuilds { get; set; }
  15. public int? MinVersion { get; set; }
  16. public int? MaxVersion { get; set; }
  17. #nullable disable
  18. public UninstallTaskStatus Status { get; set; } = UninstallTaskStatus.ToDo;
  19. public List<ITaskAction> Actions { get; set; }
  20. public int Priority { get; set; } = 1;
  21. public UninstallTaskPrivilege Privilege { get; set; } = UninstallTaskPrivilege.Admin;
  22. public List<string> Features { get; set; } = new List<string>();
  23. public void Update()
  24. {
  25. /*
  26. var statusList = Actions.Select(entry => entry.GetStatus()).ToList();
  27. if (statusList.Any(entry => entry == UninstallTaskStatus.InProgress))
  28. {
  29. Status = UninstallTaskStatus.InProgress;
  30. }
  31. else if (statusList.All(entry => entry == UninstallTaskStatus.Completed))
  32. {
  33. Status = UninstallTaskStatus.Completed;
  34. }
  35. else
  36. {
  37. Status = UninstallTaskStatus.ToDo;
  38. }
  39. */
  40. }
  41. public override string ToString()
  42. {
  43. var sb = new StringBuilder();
  44. var sw = new StringWriter(sb);
  45. var parser = new ConfigParser();
  46. parser.SerializeItem(sw, this);
  47. return sb.ToString();
  48. }
  49. }
  50. }