using System;
using System.Linq;
public class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
string currentProfile = BFS.DisplayFusion.GetCurrentWallpaperProfile();
string[] profiles = BFS.DisplayFusion.GetWallpaperProfiles();
if (profiles == null || profiles.Length == 0)
return;
// Find current profile index
int currentIndex = Array.FindIndex(
profiles,
p => string.Equals(p, currentProfile, StringComparison.OrdinalIgnoreCase)
);
// If not found, just load the first profile
if (currentIndex < 0)
{
BFS.DisplayFusion.LoadWallpaperProfile(profiles[0]);
return;
}
// Move to next profile, wrapping around
int nextIndex = (currentIndex + 1) % profiles.Length;
// If next is the same as current (only one profile exists), do nothing
if (nextIndex == currentIndex)
return;
BFS.DisplayFusion.LoadWallpaperProfile(profiles[nextIndex]);
}
}