Example #1
0
 private static void PrintDisconnectedDisplays()
 {
     ConsoleWriter.Default.PrintCaption("UnAttachedDisplay.GetUnAttachedDisplays()");
     ConsoleNavigation.Default.PrintNavigation(UnAttachedDisplay.GetUnAttachedDisplays(),
                                               (i, unAttachedDisplay) => ConsoleWriter.Default.WriteObject(unAttachedDisplay, 0),
                                               "Select a display to show additional information");
 }
Example #2
0
        private static void DeviceContext()
        {
            var navigation = new Dictionary <object, Action>
            {
                {
                    "DeviceContext: Display Adapters",
                    () =>
                    ConsoleNavigation.PrintObject(DisplayAdapter.GetDisplayAdapters().ToArray(),
                                                  display =>
                                                  ConsoleNavigation.PrintObject(display.GetDisplayDevices(),
                                                                                "Display.GetDisplayDevices()"),
                                                  "DisplayAdapter.GetDisplayAdapters()", "Select an adapter to show connected devices.")
                },
                {
                    "DeviceContext: Connected Displays",
                    () =>
                    ConsoleNavigation.PrintObject(Display.GetDisplays().ToArray(),
                                                  display => ConsoleNavigation.PrintObject(display.CurrentSetting, () =>
                    {
                        ConsoleNavigation.PrintObject(
                            display.GetPossibleSettings()
                            .OrderByDescending(
                                setting =>
                                (ulong)setting.Resolution.Height * (ulong)setting.Resolution.Width)
                            .Take(10)
                            .ToArray(),
                            setting => { display.SetSettings(new DisplaySetting(setting), true); },
                            "Display.GetValidSettings()", "Select a display setting to apply and enable.");
                    }, "Display.CurrentSetting", ""),
                                                  "Display.GetDisplays()", "Select a display to show current settings.")
                },
                {
                    "DeviceContext: Disconnected Displays",
                    () =>
                    ConsoleNavigation.PrintObject(UnAttachedDisplay.GetUnAttachedDisplays().ToArray(), display =>
                    {
                        ConsoleNavigation.PrintObject(
                            display.GetPossibleSettings()
                            .OrderByDescending(
                                setting =>
                                (ulong)setting.Resolution.Height * (ulong)setting.Resolution.Width)
                            .Take(10)
                            .ToArray(), setting =>
                        {
                            display.Enable(new DisplaySetting(setting));
                            DisplaySetting.ApplySavedSettings();
                        }, "Display.GetValidSettings()", "Select a display setting to apply and enable.");
                    }, "UnAttachedDisplay.GetUnAttachedDisplays()",
                                                  "Select an unattached display to show possible display settings to activate.")
                },
                {
                    "DeviceContext: Disable All Except Primary",
                    () =>
                    {
                        var displays = Display.GetDisplays().ToArray();
                        foreach (var display in displays.Where(display => !display.IsGDIPrimary))
                        {
                            display.Disable(false);
                        }
                        DisplaySetting.ApplySavedSettings();
                    }
                },
                {
                    "DeviceContext: Enable All",
                    () =>
                    {
                        var displays = UnAttachedDisplay.GetUnAttachedDisplays().ToArray();
                        foreach (var display in displays)
                        {
                            display.Enable(new DisplaySetting(display.GetPreferedSetting()));
                        }
                        DisplaySetting.ApplySavedSettings();
                    }
                }
            };

            ConsoleNavigation.PrintNavigation(navigation, "DeviceContext functions",
                                              "Select a DeviceContext sample.");
        }
Example #3
0
        private static void Main(string[] args)
        {
            _writer = new StreamWriter(new FileStream(
                                           string.Format("HeliosDisplayManagement.Reporting.{0}.log", Process.GetCurrentProcess().Id),
                                           FileMode.CreateNew));

            try
            {
                Dump(DisplayAdapter.GetDisplayAdapters(), "WindowsDisplayAPI.DisplayAdapter.GetDisplayAdapters()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(Display.GetDisplays(), "WindowsDisplayAPI.Display.GetDisplays()", new[]
                {
                    new Tuple <Func <Display, object>, string>(display => display.GetPossibleSettings(),
                                                               "GetPossibleSettings()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(UnAttachedDisplay.GetUnAttachedDisplays(),
                     "WindowsDisplayAPI.UnAttachedDisplay.GetUnAttachedDisplays()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplayAdapter.GetAdapters(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplayAdapter.GetAdapters()",
                     new[]
                {
                    new Tuple <Func <PathDisplayAdapter, object>, string>(adapter => adapter.ToDisplayAdapter(),
                                                                          "ToDisplayAdapter()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplaySource.GetDisplaySources(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplaySource.GetDisplaySources()", new[]
                {
                    new Tuple <Func <PathDisplaySource, object>, string>(source => source.ToDisplayDevices(),
                                                                         "ToDisplayDevices()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplayTarget.GetDisplayTargets(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets()", new[]
                {
                    new Tuple <Func <PathDisplayTarget, object>, string>(target => target.ToDisplayDevice(),
                                                                         "ToDisplayDevice()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                if (PathInfo.IsSupported)
                {
                    Dump(PathInfo.GetActivePaths(), "WindowsDisplayAPI.DisplayConfig.PathInfo.GetActivePaths()", null,
                         2);
                }
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(LogicalGPU.GetLogicalGPUs(), "NvAPIWrapper.GPU.LogicalGPU.GetLogicalGPUs()", null, 1);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PhysicalGPU.GetPhysicalGPUs(), "NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.Display.GetDisplays(), "NvAPIWrapper.Display.Display.GetDisplays()", new[]
                {
                    new Tuple <Func <NvAPIWrapper.Display.Display, object>, string>(
                        display => display.GetSupportedViews(),
                        "GetSupportedViews()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.UnAttachedDisplay.GetUnAttachedDisplays(),
                     "NvAPIWrapper.Display.UnAttachedDisplay.GetUnAttachedDisplays()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.PathInfo.GetDisplaysConfig(),
                     "NvAPIWrapper.Display.PathInfo.GetDisplaysConfig()",
                     null, 3);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(GridTopology.GetGridTopologies(), "NvAPIWrapper.Mosaic.GridTopology.GetGridTopologies()", null, 3);
            }
            catch (Exception e)
            {
                WriteException(e);
            }


            try
            {
                Dump(Profile.GetAllProfiles(), "HeliosDisplayManagement.Shared.Profile.GetAllProfiles()", null, 99);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            _writer.Flush();
            _writer.Close();
            _writer.Dispose();

            Console.WriteLine(@"Done, press enter to exit.");
            Console.ReadLine();
        }
Example #4
0
        private static void Main()
        {
            NVIDIA.Initialize();
            var navigation = new Dictionary <object, Action>
            {
                {
                    "Connected Displays",
                    () =>
                    ConsoleNavigation.PrintObject(Display.GetDisplays(),
                                                  display => ConsoleNavigation.PrintObject(display.DisplayDevice, "Display.DisplayDevice"),
                                                  "Display.GetDisplays()", "Select a display to show device information")
                },
                {
                    "Disconnected Displays",
                    () =>
                    ConsoleNavigation.PrintObject(UnAttachedDisplay.GetUnAttachedDisplays(),
                                                  display =>
                                                  ConsoleNavigation.PrintObject(display.PhysicalGPU, "UnAttachedDisplay.PhysicalGPU"),
                                                  "UnAttachedDisplay.GetUnAttachedDisplays()", "Select a display to show GPU information")
                },
                {
                    "Display Configurations",
                    () =>
                    ConsoleNavigation.PrintObject(PathInfo.GetDisplaysConfig().ToArray(),
                                                  pathInfo =>
                                                  ConsoleNavigation.PrintObject(pathInfo.TargetsInfo,
                                                                                targetInfo =>
                                                                                ConsoleNavigation.PrintObject(targetInfo.DisplayDevice,
                                                                                                              "PathTargetInfo.DisplayDevice"), "PathInfo.TargetsInfo[]",
                                                                                "Select a path target info to show display device information"),
                                                  "PathInfo.GetDisplaysConfig()", "Select a path info to show target information")
                },
                {
                    "Physical GPUs", () =>
                    ConsoleNavigation.PrintObject(PhysicalGPU.GetPhysicalGPUs(),
                                                  gpu => ConsoleNavigation.PrintObject(gpu.ActiveOutputs, "PhysicalGPU.ActiveOutputs"),
                                                  "PhysicalGPU.GetPhysicalGPUs()", "Select a GPU to show active outputs")
                },
                {
                    "GPU Temperatures", () =>
                    ConsoleNavigation.PrintNavigation(
                        PhysicalGPU.GetPhysicalGPUs()
                        .ToDictionary(gpu => (object)gpu.ToString(), gpu => new Action(
                                          () =>
                    {
                        ConsoleNavigation.PrintObject(gpu.ThermalSensors, "PhysicalGPU.ThermalSensors");
                    })),
                        "PhysicalGPU.GetPhysicalGPUs()", "Select a GPU to show thermal sensor values")
                },
                {
                    "GPU Clock Frequencies", () =>
                    ConsoleNavigation.PrintNavigation(
                        PhysicalGPU.GetPhysicalGPUs()
                        .ToDictionary(gpu => (object)gpu.ToString(), gpu => new Action(
                                          () =>
                    {
                        ConsoleNavigation.PrintObject(gpu.ClockFrequencies, "gpu.ClockFrequencies");
                    })),
                        "PhysicalGPU.GetPhysicalGPUs()", "Select a GPU to show thermal sensor values")
                },
                {
                    "GPU Dynamic Performance States", () =>
                    ConsoleNavigation.PrintNavigation(
                        PhysicalGPU.GetPhysicalGPUs()
                        .ToDictionary(gpu => (object)gpu.ToString(), gpu => new Action(
                                          () =>
                    {
                        ConsoleNavigation.PrintObject(gpu.DynamicPerformanceStatesInfo,
                                                      "PhysicalGPU.DynamicPerformanceStatesInfo");
                    })),
                        "PhysicalGPU.GetPhysicalGPUs()", "Select a GPU to show dynamic performance state domains")
                },
                {
                    "TCC GPUs", () =>
                    ConsoleNavigation.PrintObject(PhysicalGPU.GetTCCPhysicalGPUs(),
                                                  "PhysicalGPU.GetTCCPhysicalGPUs()")
                },
                {
                    "Grid Topologies (Mosaic)",
                    () =>
                    ConsoleNavigation.PrintObject(GridTopology.GetGridTopologies(),
                                                  grid =>
                                                  ConsoleNavigation.PrintObject(grid.Displays,
                                                                                display =>
                                                                                ConsoleNavigation.PrintObject(display.DisplayDevice,
                                                                                                              "GridTopologyDisplay.DisplayDevice"), "GridTopology.Displays",
                                                                                "Select a grid topology display to show display device information"),
                                                  "GridTopology.GetGridTopologies()", "Select a grid topology to show display informations")
                },
                {
                    "NVIDIA Driver and API version", () => ConsoleNavigation.PrintObject(new object[]
                    {
                        "Driver Version: " + NVIDIA.DriverVersion,
                        "Driver Branch Version: " + NVIDIA.DriverBranchVersion,
                        "NvAPI Version: " + NVIDIA.InterfaceVersionString
                    }, "NVIDIA")
                },
                { "System Chipset Info", () => ConsoleNavigation.PrintObject(NVIDIA.ChipsetInfo, "NVIDIA.ChipsetInfo") },
                {
                    "Lid and Dock Information",
                    () => ConsoleNavigation.PrintObject(NVIDIA.LidAndDockParameters, "NVIDIA.LidAndDockParameters")
                }
            };

            ConsoleNavigation.PrintNavigation(navigation, "Execution Lines",
                                              "Select an execution line to browse NvAPIWrapper functionalities.");
        }