Use enumeartor for KeyCollection as well

This commit is contained in:
Travis Nickles 2019-02-16 02:25:54 -06:00
parent cd6742cf56
commit 61a5ab07ea

View File

@ -290,9 +290,11 @@ namespace DS4Windows
// TODO what about the rest? e.g. repeat keys really ought to be on some set schedule // TODO what about the rest? e.g. repeat keys really ought to be on some set schedule
Dictionary<UInt16, SyntheticState.KeyPresses>.KeyCollection kvpKeys = state.keyPresses.Keys; Dictionary<UInt16, SyntheticState.KeyPresses>.KeyCollection kvpKeys = state.keyPresses.Keys;
//foreach (KeyValuePair<UInt16, SyntheticState.KeyPresses> kvp in state.keyPresses) //foreach (KeyValuePair<UInt16, SyntheticState.KeyPresses> kvp in state.keyPresses)
for (int i = 0, keyCount = kvpKeys.Count; i < keyCount; i++) //for (int i = 0, keyCount = kvpKeys.Count; i < keyCount; i++)
for (var keyEnum = kvpKeys.GetEnumerator(); keyEnum.MoveNext();)
{ {
UInt16 kvpKey = kvpKeys.ElementAt(i); //UInt16 kvpKey = kvpKeys.ElementAt(i);
UInt16 kvpKey = keyEnum.Current;
SyntheticState.KeyPresses kvpValue = state.keyPresses[kvpKey]; SyntheticState.KeyPresses kvpValue = state.keyPresses[kvpKey];
SyntheticState.KeyPresses gkp; SyntheticState.KeyPresses gkp;