Files
PowerToys/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/DriveDetection/IndexerDriveDetection.cs
Alekhya 025f2507f4 Drive Detection Indexer warning refinement (#5221)
* show results always and conditionally show warning

* changed test logic to show warning when expected

* renamed unit test
2020-07-24 17:45:07 -07:00

36 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Plugin.Indexer.DriveDetection;
using Microsoft.Plugin.Indexer.Interface;
namespace Microsoft.Plugin.Indexer.DriveDetection
{
public class IndexerDriveDetection
{
private bool IsEnhancedModeEnabled { get; set; } = false;
private IRegistryWrapper _registryHelper;
public bool IsDriveDetectionWarningCheckBoxSelected { get; set; } = false;
public IndexerDriveDetection(IRegistryWrapper registryHelper)
{
_registryHelper = registryHelper;
GetEnhancedModeStatus();
}
// To display the warning when Enhanced mode is disabled and the Disable Drive detection check box in settings is unchecked
public bool DisplayWarning()
{
return !(IsDriveDetectionWarningCheckBoxSelected || IsEnhancedModeEnabled);
}
// To look up the registry entry for
private void GetEnhancedModeStatus()
{
string registryLocation = @"Software\Microsoft\Windows Search\Gather\Windows\SystemIndex";
string valueName = "EnableFindMyFiles";
IsEnhancedModeEnabled = _registryHelper.GetHKLMRegistryValue(registryLocation, valueName) == 0 ? false : true;
}
}
}