Browse Source

Remove Windows.winmd requirement, fix ServiceAction detecting deleted services as not stopped

master
Styris 1 year ago
parent
commit
bb9b32e6d3
4 changed files with 8 additions and 6 deletions
  1. +3
    -0
      TrustedUninstaller.CLI/TrustedUninstaller.CLI.csproj
  2. +2
    -3
      TrustedUninstaller.Shared/Actions/AppxAction.cs
  3. +3
    -0
      TrustedUninstaller.Shared/Actions/ServiceAction.cs
  4. +0
    -3
      TrustedUninstaller.Shared/Actions/SystemPackageAction.cs

+ 3
- 0
TrustedUninstaller.CLI/TrustedUninstaller.CLI.csproj View File

@ -102,6 +102,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Windows">
<HintPath>..\Windows.winmd</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CLI.cs" />


+ 2
- 3
TrustedUninstaller.Shared/Actions/AppxAction.cs View File

@ -1,8 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Management.Deployment;
using TrustedUninstaller.Shared.Exceptions;
using TrustedUninstaller.Shared.Tasks;
using YamlDotNet.Serialization;
@ -13,7 +11,6 @@ using System.Threading;
namespace TrustedUninstaller.Shared.Actions
{
// Integrate ame-assassin later
internal class AppxAction : ITaskAction
{
public enum AppxOperation
@ -48,12 +45,14 @@ namespace TrustedUninstaller.Shared.Actions
public string ErrorString() => $"AppxAction failed to remove '{Name}'.";
/*
private Package GetPackage()
{
var packageManager = new PackageManager();
return packageManager.FindPackages().FirstOrDefault(package => package.Id.Name == Name);
}
*/
public UninstallTaskStatus GetStatus()
{
if (InProgress) return UninstallTaskStatus.InProgress;


+ 3
- 0
TrustedUninstaller.Shared/Actions/ServiceAction.cs View File

@ -110,10 +110,12 @@ namespace TrustedUninstaller.Shared.Actions
return Operation switch
{
ServiceOperation.Stop =>
serviceController == null ||
serviceController?.Status == ServiceControllerStatus.Stopped
|| serviceController?.Status == ServiceControllerStatus.StopPending ?
UninstallTaskStatus.Completed : UninstallTaskStatus.ToDo,
ServiceOperation.Continue =>
serviceController == null ||
serviceController?.Status == ServiceControllerStatus.Running
|| serviceController?.Status == ServiceControllerStatus.ContinuePending ?
UninstallTaskStatus.Completed : UninstallTaskStatus.ToDo,
@ -122,6 +124,7 @@ namespace TrustedUninstaller.Shared.Actions
|| serviceController?.Status == ServiceControllerStatus.Running ?
UninstallTaskStatus.Completed : UninstallTaskStatus.ToDo,
ServiceOperation.Pause =>
serviceController == null ||
serviceController?.Status == ServiceControllerStatus.Paused
|| serviceController?.Status == ServiceControllerStatus.PausePending ?
UninstallTaskStatus.Completed : UninstallTaskStatus.ToDo,


+ 0
- 3
TrustedUninstaller.Shared/Actions/SystemPackageAction.cs View File

@ -1,8 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Management.Deployment;
using TrustedUninstaller.Shared.Exceptions;
using TrustedUninstaller.Shared.Tasks;
using YamlDotNet.Serialization;
@ -13,7 +11,6 @@ using System.Threading;
namespace TrustedUninstaller.Shared.Actions
{
// Integrate ame-assassin later
internal class SystemPackageAction : ITaskAction
{
public enum Architecture


Loading…
Cancel
Save