mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
* show results always and conditionally show warning * changed test logic to show warning when expected * renamed unit test
36 lines
1.3 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|