added error message if multiple presets are used

fixes #26
This commit is contained in:
alterNERDtive 2021-07-04 20:59:18 +02:00
parent 69f3a43590
commit 65534330d9
2 changed files with 10 additions and 1 deletions

View file

@ -10,6 +10,7 @@
troubleshooting.
* `bindED-diagnostics` profile: runs the `diagnostics` plugin context on load.
Should be the first troubleshooting step.
* Error message if multiple control presets are in use (Odyssey only).
# 4.1 (2021-05-22)

View file

@ -299,7 +299,15 @@ namespace bindEDplugin
{
throw new FileNotFoundException("No 'StartPreset.start' file found. Please run Elite: Dangerous at least once, then restart VoiceAttack.");
}
return File.ReadAllLines(startFile).First();
IEnumerable<string> presets = File.ReadAllLines(startFile).Distinct();
if (presets.Count() > 1)
{
LogError($"You have selected multiple control presets ('{ String.Join("', '", presets) }'). "
+ $"Only binds from '{ presets.First() }' will be used. Please refer to the documentation for more information.");
}
return presets.First();
}
private static string DetectBindsFile(string? preset)