/// <summary>
        ///     Toggles whether we should show only pol.exe processes or
        ///     all processes.
        /// </summary>
        private void ChangeFilter()
        {
            // Toggle the process name. The process watcher knows that
            // the empty string means locate all processes.
            if (ProcessName.Equals(ClientName))
            {
                ProcessName        = string.Empty;
                ToggleButtonHeader = "POL Only";
            }
            else
            {
                ProcessName        = ClientName;
                ToggleButtonHeader = "Show All";
            }

            // Dispose of the old watcher.
            _processWatcher.Stop();

            // Clear all previously found processes.
            Sessions.Clear();

            // Start up the new watcher.
            _processWatcher        = new ProcessWatcher(ProcessName);
            _processWatcher.Entry += SessionEntry;
            _processWatcher.Exit  += SessionExit;
            _processWatcher.Start();
        }
示例#2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (pWatcher != null)
     {
         pWatcher.Stop();
     }
 }
示例#3
0
 public void Config(BeSafeConfig config, PipeServer pipeServer, bool stoppingService)
 {
     bool stateResult =
         (((config?.ComponentsState.ProcessWatcher == true) && (stoppingService == false))
         ? _processWatcher.Start()
         : _processWatcher.Stop());
 }
示例#4
0
        /// <summary>
        /// Stops the Hearthstone log and process monitoring.
        /// </summary>
        public async Task Stop()
        {
            await _procWatcher.Stop();

            await LogReader.Stop();

            Game.Reset();
            _running = false;
        }
示例#5
0
        private void MetroWindow_Closed(object sender, EventArgs e)
        {
            Keymapper.Stop();
            ProcessWatcher.Stop();
            HapticManager.Stop();

            var aC = ControllerManager.GetActiveController();

            aC?.SetLightbar(0, 0, 0);
            aC?.Stop();
            ControllerManager.Stop();

            _notifyIcon.Visible = false;
            _notifyIcon.Dispose();
            WindowClosing?.Invoke();
        }
示例#6
0
        public void Stop_DoesNotThrow()
        {
            Utils.MethodStart();

            foreach (var name in EnumValues.GetString())
            {
                foreach (var affinity in EnumValues.GetLong())
                {
                    foreach (var user in EnumValues.GetString())
                    {
                        Assert.DoesNotThrow(() =>
                        {
                            var procConfig     = new ProcessConfig(name, affinity, user);
                            var processWatcher = new ProcessWatcher(new List <ProcessConfig>()
                            {
                                procConfig
                            });
                            processWatcher.Start();
                            processWatcher.Stop();
                        });
                        TestContext.WriteLine($@"Assert.DoesNotThrow(() => new ProcConfig({name}, {affinity}, {user}))");
                        Assert.DoesNotThrowAsync(async() => await Task.Run(() =>
                        {
                            var procConfig     = new ProcessConfig(name, affinity, user);
                            var processWatcher = new ProcessWatcher(new List <ProcessConfig>()
                            {
                                procConfig
                            });
                            processWatcher.Start();
                            processWatcher.Stop();
                        }));
                        TestContext.WriteLine($@"Assert.DoesNotThrowAsync(async () => new ProcConfig({name}, {affinity}, {user}))");
                    }
                }
            }

            Utils.MethodComplete();
        }
示例#7
0
 /// <inheritdoc />
 protected override bool OnStopRuntimeWatching()
 {
     _runtimeWatcher.ProcessCreated -= OnRuntimeProcessCreated;
     _runtimeWatcher.ProcessDeleted -= OnRuntimeProcessDeleted;
     return(_runtimeWatcher.Stop());
 }
 public void StopRemovesRegisterEvent()
 {
     _processWatcher.Stop();
     _mockProcess.ReceivedWithAnyArgs().RemoveRegisteredEvent(TestEvent);
 }
示例#9
0
 public void Stop()
 {
     _tracking = false;
     _watcher.Stop();
 }