Exemple #1
0
        /// <summary>
        ///     Returns an enumerable collection of telemetry tasks.
        /// </summary>
        public static IEnumerable <NvidiaControllerResult <TelemetryTask> > EnumerateTelemetryTasks()
        {
            var taskFilters = new[]
            {
                new Regex("NvTmMon_*", RegexOptions.Compiled),
                new Regex("NvTmRep*", RegexOptions.Compiled),
                new Regex("NvTmRepOnLogon_*", RegexOptions.Compiled)
            };

            foreach (var filter in taskFilters)
            {
                var tasks = TaskService.Instance.FindAllTasks(filter);

                if (tasks.Length == 0)
                {
                    yield return new NvidiaControllerResult <TelemetryTask>(null, new TaskNotFoundException($"Failed to find task: {filter}"))
                           {
                               Name = filter.ToString()
                           }
                }
                ;

                foreach (var task in tasks)
                {
                    var telemetryTask = new TelemetryTask(task);

                    yield return(new NvidiaControllerResult <TelemetryTask>(telemetryTask)
                    {
                        Name = filter.ToString()
                    });
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///     Enables the provided task.
        /// </summary>
        /// <param name="telemetryTask">The task to enable.</param>
        public static NvidiaControllerResult <TelemetryTask> EnableTelemetryTask(TelemetryTask telemetryTask)
        {
            try
            {
                var modified = false;

                if (telemetryTask.Task != null && !telemetryTask.Task.Enabled)
                {
                    telemetryTask.Task.Enabled = true;
                    modified = true;
                }


                return(new NvidiaControllerResult <TelemetryTask>(telemetryTask)
                {
                    Modified = modified
                });
            }

            catch (Exception ex)
            {
                return(new NvidiaControllerResult <TelemetryTask>(telemetryTask, ex));
            }
        }