SteamController: Allow to EnableDS4Support=false

This commit is contained in:
Kamil Trzciński 2023-05-21 16:44:01 +02:00
parent af6cee0bff
commit eb774e11fa
7 changed files with 26 additions and 10 deletions

View file

@ -5,13 +5,16 @@ namespace SteamController.ProfilesSettings.Helpers
{
internal class ProfileStringConverter : TypeConverter
{
public static string[] Profiles = new string[0];
public static List<Profiles.Profile> Profiles = new List<Profiles.Profile>();
private volatile StandardValuesCollection? collection;
public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context)
{
return collection ??= new StandardValuesCollection(Profiles.ToArray());
return collection ??= new StandardValuesCollection(Profiles.
Where((profile) => profile.Visible).
Select((profile) => profile.Name).
ToArray());
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext? context)
@ -26,7 +29,7 @@ namespace SteamController.ProfilesSettings.Helpers
public override bool IsValid(ITypeDescriptorContext? context, object? value)
{
return Profiles.Contains(value?.ToString());
return Profiles.Find((profile) => profile.Name == value?.ToString()) is not null;
}
}
}