using System.Security.Principal; using Explorer.Application; namespace Explorer.Windows; public sealed class WindowsElevatedScanService : IElevatedScanService { public bool IsElevated { get { try { using var identity = WindowsIdentity.GetCurrent(); return new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator); } catch { return false; } } } // Queue, index writer, and watchers stay in the user session. Elevation is never requested. public bool CanRequestElevation => false; public string ProtectedContentHint => "Protected content requires administrator privileges."; }