Radeon Reset Bug fix service
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.
RadeonResetBugFix/RadeonResetBugFixService/Tasks/BasicTasks/DisableBasicDisplayStartupT...

45 lines
1.5 KiB

namespace RadeonResetBugFixService.Tasks.BasicTasks
{
using System;
using Contracts;
using Devices;
class DisableBasicDisplayStartupTask : ITask
{
string ITask.TaskName => "Disabling basic display automatic start";
private DevicesStatus StartupDevicesStatus { get; }
public DisableBasicDisplayStartupTask(DevicesStatus startupDevicesStatus)
{
if (startupDevicesStatus == null)
{
throw new ArgumentNullException(nameof(startupDevicesStatus));
}
this.StartupDevicesStatus = startupDevicesStatus;
}
void ITask.Run(ILogger logger)
{
foreach (var device in this.StartupDevicesStatus.DisabledDevices)
{
logger.Log($"Processing {device.Description}; should be enabled");
var disabledStatus = DeviceHelper.IsDeviceCurrentlyDisabled(device);
if (disabledStatus.HasValue && !disabledStatus.Value)
{
logger.Log($"Device is enabled; disabling BasicDisplay service");
5 years ago
var originalValue = RegistryHelper.GetBasicDisplayStartType();
logger.Log($"Original start value {originalValue}");
5 years ago
RegistryHelper.SetBasicDisplayStartType(4);
}
5 years ago
else
{
logger.Log($"Device is not enabled");
}
}
}
}
}