This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding functionality for scheduled tasks, fixing some UI issues, coup…
…le other minor tweaks, moving config file to json
- Loading branch information
Showing
37 changed files
with
921 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
WereDev.Utils.Wu10Man.Core/Interfaces/IWindowsTaskManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using WereDev.Utils.Wu10Man.Core.Models; | ||
|
||
namespace WereDev.Utils.Wu10Man.Core.Interfaces | ||
{ | ||
public interface IWindowsTaskManager | ||
{ | ||
WindowsTask[] GetTasks(); | ||
|
||
WindowsTask GetTask(string path); | ||
|
||
WindowsTask[] DisableTasks(); | ||
|
||
WindowsTask DisableTask(string path); | ||
|
||
WindowsTask[] EnableTasks(); | ||
|
||
WindowsTask EnableTask(string path); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
WereDev.Utils.Wu10Man.Core/Interfaces/Providers/IConfigurationReader.cs
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
WereDev.Utils.Wu10Man.Core/Interfaces/Providers/IWindowsTaskProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using WereDev.Utils.Wu10Man.Core.Models; | ||
|
||
namespace WereDev.Utils.Wu10Man.Core.Interfaces.Providers | ||
{ | ||
public interface IWindowsTaskProvider | ||
{ | ||
WindowsTask GetTask(string fullPath); | ||
|
||
void EnableTask(string fullPath); | ||
|
||
void DisableTask(string fullPath); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace WereDev.Utils.Wu10Man.Core.Models | ||
{ | ||
public class DeclutterConfig | ||
{ | ||
public AppInfo[] Microsoft { get; set; } | ||
|
||
public AppInfo[] ThirdParty { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace WereDev.Utils.Wu10Man.Core.Models | ||
{ | ||
public class WindowsTask | ||
{ | ||
public string Name { get; set; } | ||
|
||
public string FullPath { get; set; } | ||
|
||
public bool Enabled { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace WereDev.Utils.Wu10Man.Core.Models | ||
{ | ||
public class WindowsTaskConfig | ||
{ | ||
public string TaskName { get; set; } | ||
|
||
public string TaskPath { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Linq; | ||
using WereDev.Utils.Wu10Man.Core.Interfaces; | ||
using WereDev.Utils.Wu10Man.Core.Interfaces.Providers; | ||
using WereDev.Utils.Wu10Man.Core.Models; | ||
|
||
namespace WereDev.Utils.Wu10Man.Core.Services | ||
{ | ||
public class WindowsTaskManager : IWindowsTaskManager | ||
{ | ||
private readonly IWindowsTaskProvider _taskProvider; | ||
private readonly WindowsTaskConfig[] _windowsTaskConfigs; | ||
|
||
public WindowsTaskManager(IWindowsTaskProvider taskProvider, WindowsTaskConfig[] windowsTaskConfigs) | ||
{ | ||
_taskProvider = taskProvider ?? throw new ArgumentNullException(nameof(taskProvider)); | ||
_windowsTaskConfigs = windowsTaskConfigs ?? new WindowsTaskConfig[0]; | ||
var distinct = _windowsTaskConfigs.GroupBy(x => x.TaskPath) | ||
.Select(x => x.First()) | ||
.ToArray(); | ||
_windowsTaskConfigs = distinct; | ||
} | ||
|
||
public WindowsTask[] DisableTasks() | ||
{ | ||
foreach (var config in _windowsTaskConfigs) | ||
{ | ||
_taskProvider.DisableTask(config.TaskPath); | ||
} | ||
|
||
return GetTasks(); | ||
} | ||
|
||
public WindowsTask DisableTask(string path) | ||
{ | ||
_taskProvider.DisableTask(path); | ||
return _taskProvider.GetTask(path); | ||
} | ||
|
||
public WindowsTask[] EnableTasks() | ||
{ | ||
foreach (var config in _windowsTaskConfigs) | ||
{ | ||
_taskProvider.EnableTask(config.TaskPath); | ||
} | ||
|
||
return GetTasks(); | ||
} | ||
|
||
public WindowsTask EnableTask(string path) | ||
{ | ||
_taskProvider.EnableTask(path); | ||
return _taskProvider.GetTask(path); | ||
} | ||
|
||
public WindowsTask[] GetTasks() | ||
{ | ||
var tasks = new WindowsTask[_windowsTaskConfigs.Length]; | ||
for (int i = 0; i < tasks.Length; i++) | ||
{ | ||
var windowsTaskConfig = _windowsTaskConfigs[i]; | ||
var task = _taskProvider.GetTask(windowsTaskConfig.TaskPath); | ||
task.Name = windowsTaskConfig.TaskName; | ||
tasks[i] = task; | ||
} | ||
|
||
return tasks; | ||
} | ||
|
||
public WindowsTask GetTask(string path) | ||
{ | ||
var task = _taskProvider.GetTask(path); | ||
var taskFromCollection = _windowsTaskConfigs.FirstOrDefault(x => x.TaskPath.Equals(path, StringComparison.OrdinalIgnoreCase)); | ||
task.Name = taskFromCollection?.TaskName ?? task.Name; | ||
return task; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.