using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { string[] hdrOnProfiles = { "HDR Gaming", "HDR Movie", "HDR Work" }; string[] hdrOffProfiles = { "Standard", "Night Mode", "Reading" }; string hdrCmdPath = @"C:\Path\To\HDRCmd.exe"; string currentProfile = BFS.DisplayFusion.GetCurrentMonitorProfile(); if (!File.Exists(hdrCmdPath)) { BFS.Dialog.ShowMessageError("HDRCmd utility not found at: " + hdrCmdPath); return; } bool shouldTurnOnHDR = Array.Exists(hdrOnProfiles, profile => profile.Equals(currentProfile, StringComparison.OrdinalIgnoreCase)); bool shouldTurnOffHDR = Array.Exists(hdrOffProfiles, profile => profile.Equals(currentProfile, StringComparison.OrdinalIgnoreCase)); if (shouldTurnOnHDR) { ExecuteHDRCommand("on"); } else if (shouldTurnOffHDR) { ExecuteHDRCommand("off"); } else { BFS.Dialog.ShowMessageInfo("Current profile '" + currentProfile + "' is not configured for HDR changes."); } } private static void ExecuteHDRCommand(string command) { string hdrCmdPath = @"C:\Path\To\HDRCmd.exe"; try { Process.Start(hdrCmdPath, command); } catch (Exception ex) { BFS.Dialog.ShowMessageError("Error executing HDRCmd: " + ex.Message); } } }