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.

66 lines
1.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
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; } = new List<ITaskAction>();
  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 List<string> Tasks
  24. {
  25. set => Features = value;
  26. get => Features;
  27. }
  28. public void Update()
  29. {
  30. /*
  31. var statusList = Actions.Select(entry => entry.GetStatus()).ToList();
  32. if (statusList.Any(entry => entry == UninstallTaskStatus.InProgress))
  33. {
  34. Status = UninstallTaskStatus.InProgress;
  35. }
  36. else if (statusList.All(entry => entry == UninstallTaskStatus.Completed))
  37. {
  38. Status = UninstallTaskStatus.Completed;
  39. }
  40. else
  41. {
  42. Status = UninstallTaskStatus.ToDo;
  43. }
  44. */
  45. }
  46. public override string ToString()
  47. {
  48. var sb = new StringBuilder();
  49. var sw = new StringWriter(sb);
  50. var parser = new ConfigParser();
  51. parser.SerializeItem(sw, this);
  52. return sb.ToString();
  53. }
  54. }
  55. }