コード例 #1
0
        private static void SilentlyDisableTelemetry()
        {
            Logging.GetFileLogger().Log(Level.Info, "Silently disabling telemetry services.");

            var services = NvidiaController.GetTelemetryServices(true);

            NvidiaController.DisableTelemetryServices(services.Select(s => s.Service).ToList(), true, true);

            Logging.GetFileLogger().Log(Level.Info, "Silently disabling telemetry tasks.");

            var tasks = NvidiaController.GetTelemetryTasks(true);

            NvidiaController.DisableTelemetryTasks(tasks.Select(t => t.Task).ToList(), true, true);
        }
コード例 #2
0
        private void RefreshTelemetryServices(bool logging)
        {
            var services       = new List <ServiceController>();
            var serviceQueries = NvidiaController.GetTelemetryServices();

            if (serviceQueries.Count > 0)
            {
                foreach (var query in serviceQueries)
                {
                    var serviceFound = false;
                    var running      = false;
                    try
                    {
                        running      = query.Result.Status == ServiceControllerStatus.Running;
                        serviceFound = true;
                    }

                    catch
                    {
                        if (logging)
                        {
                            AppendLog($"Failed to find service: {query.Query}");
                        }
                    }

                    if (serviceFound)
                    {
                        if (logging)
                        {
                            AppendLog($"Found Service: {query.Result.DisplayName} ({query.Result.ServiceName})");
                            AppendLog($"Service is: {(running ? "Enabled" : "Disabled")}");
                        }

                        if (!running)
                        {
                            _servicesControl.DisabledCount++;
                        }

                        _servicesControl.AddSubAction($"Service: {query.Result.DisplayName} ({query.Result.ServiceName})", running);

                        services.Add(query.Result);
                    }
                }
            }

            _servicesControl.Enabled = !_servicesControl.IsEmpty;

            _telemetryServices = services;
        }