public void StartWatcher()
 {
     Logger.Trace("StartWatcher called for {BasePath}", BasePath);
     RegistryDisableService.StartWatcher();
     if (monitor != null)
     {
         Logger.Trace("Watcher already started");
         return;
     }
     monitor = new FolderChangeMonitor()
     {
         BasePath = BasePath,
         Category = Category,
     };
     monitor.Add    += AddHandler;
     monitor.Remove += RemoveHandler;
     Logger.Trace("Watcher started");
 }
        /// <summary>
        /// Watches the assigned registry keys
        /// </summary>
        /// <remarks>
        /// Because of API limitations no all changes are monitored.
        /// See https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regnotifychangekeyvalue
        /// Not monitored are changes via RegRestoreKey https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regrestorekeya
        /// </remarks>
        public void StartWatcher()
        {
            Logger.Trace("StartWatcher called for {BasePath}", BasePath);
            RegistryDisableService?.StartWatcher();
            if (monitor != null)
            {
                Logger.Trace("Watcher already started");
                return;
            }
            var currentAutoStarts = (List <AutoStartEntry>)GetCurrentAutoStarts();

            lastAutostarts = new List <RegistryAutoStartEntry>();
            foreach (var currentAutoStart in currentAutoStarts)
            {
                lastAutostarts.Add((RegistryAutoStartEntry)currentAutoStart);
            }
            monitor          = new RegistryChangeMonitor(BasePath);
            monitor.Changed += ChangeHandler;
            monitor.Error   += ErrorHandler;
            monitor.Start();
            Logger.Trace("Watcher started");
        }