Exemple #1
0
        /// <summary>
        ///     Applies one or more path information configurations
        /// </summary>
        /// <param name="pathInfos">An array of path information configuration</param>
        /// <param name="flags">DisplayConfigFlags flags</param>
        public static void SetDisplaysConfig(PathInfo[] pathInfos, DisplayConfigFlags flags)
        {
            try
            {
                var configsV2 = pathInfos.Select(config => config.GetPathInfoV2()).Cast <IPathInfo>().ToArray();
                DisplayApi.SetDisplayConfig(configsV2, flags);
                configsV2.DisposeAll();
            }
            catch (NVIDIAApiException ex)
            {
                if (ex.Status != Status.IncompatibleStructureVersion)
                {
                    throw;
                }
            }
            catch (NVIDIANotSupportedException)
            {
                // ignore
            }

            var configsV1 = pathInfos.Select(config => config.GetPathInfoV1()).Cast <IPathInfo>().ToArray();

            DisplayApi.SetDisplayConfig(configsV1, flags);
            configsV1.DisposeAll();
        }
Exemple #2
0
        /// <summary>
        ///     Creates and fills a PathInfo object
        /// </summary>
        /// <returns>The newly created PathInfo object</returns>
        public static PathInfo[] GetDisplaysConfig()
        {
            var configs         = DisplayApi.GetDisplayConfig();
            var logicalDisplays = configs.Select(info => new PathInfo(info)).ToArray();

            configs.DisposeAll();
            return(logicalDisplays);
        }
Exemple #3
0
 /// <summary>
 ///     Creates a new Display
 /// </summary>
 /// <param name="displayName">Name of the display device</param>
 public Display(string displayName)
 {
     Handle = DisplayApi.GetAssociatedNvidiaDisplayHandle(displayName);
 }
Exemple #4
0
 void Start()
 {
     api = DisplayApi.instance;
 }
Exemple #5
0
 /// <summary>
 ///     This function returns all NVIDIA displays
 ///     Note: Display handles can get invalidated on a modeset.
 /// </summary>
 /// <returns>An array of Display objects</returns>
 public static Display[] GetDisplays()
 {
     return(DisplayApi.EnumNvidiaDisplayHandle().Select(handle => new Display(handle)).ToArray());
 }
Exemple #6
0
 /// <summary>
 ///     Gets all the supported NVIDIA display views (nView and Dualview modes) for this display.
 /// </summary>
 /// <returns></returns>
 public TargetViewMode[] GetSupportedViews()
 {
     return(DisplayApi.GetSupportedViews(Handle));
 }
Exemple #7
0
 void Start()
 {
     api    = DisplayApi.instance;
     volume = 18;
 }
 /// <summary>
 ///     This function returns all unattached NVIDIA displays
 ///     Note: Display handles can get invalidated on a modeset.
 /// </summary>
 /// <returns>An array of Display objects</returns>
 public static UnAttachedDisplay[] GetUnAttachedDisplays()
 {
     return
         (DisplayApi.EnumNvidiaUnAttachedDisplayHandle().Select(handle => new UnAttachedDisplay(handle)).ToArray());
 }
 /// <summary>
 ///     Creates a new active attached display from this unattached display
 ///     At least one GPU must be present in the system and running an NVIDIA display driver.
 /// </summary>
 /// <returns>An active attached display</returns>
 public Display CreateDisplay()
 {
     return(new Display(DisplayApi.CreateDisplayFromUnAttachedDisplay(Handle)));
 }
Exemple #10
0
 /// <summary>
 ///     Creates a new DisplayDevice
 /// </summary>
 /// <param name="displayName">Display name of the display device</param>
 public DisplayDevice(string displayName) : this(DisplayApi.GetDisplayIdByDisplayName(displayName))
 {
 }