mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-11 15:59:08 +01:00
More enumerator usage
This commit is contained in:
parent
3417c08a87
commit
a9e7a3cb5b
@ -346,9 +346,12 @@ namespace DS4Windows
|
||||
DS4LightBar.defaultLight = false;
|
||||
//foreach (DS4Device device in devices)
|
||||
|
||||
for (int i = 0, devCount = devices.Count(); i < devCount; i++)
|
||||
//for (int i = 0, devCount = devices.Count(); i < devCount; i++)
|
||||
int i = 0;
|
||||
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext(); i++)
|
||||
{
|
||||
DS4Device device = devices.ElementAt(i);
|
||||
DS4Device device = devEnum.Current;
|
||||
//DS4Device device = devices.ElementAt(i);
|
||||
if (showlog)
|
||||
LogDebug(Properties.Resources.FoundController + device.getMacAddress() + " (" + device.getConnectionType() + ")");
|
||||
|
||||
@ -561,9 +564,11 @@ namespace DS4Windows
|
||||
DS4Devices.findControllers();
|
||||
IEnumerable<DS4Device> devices = DS4Devices.getDS4Controllers();
|
||||
//foreach (DS4Device device in devices)
|
||||
for (int i = 0, devlen = devices.Count(); i < devlen; i++)
|
||||
//for (int i = 0, devlen = devices.Count(); i < devlen; i++)
|
||||
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext();)
|
||||
{
|
||||
DS4Device device = devices.ElementAt(i);
|
||||
DS4Device device = devEnum.Current;
|
||||
//DS4Device device = devices.ElementAt(i);
|
||||
|
||||
if (device.isDisconnectingStatus())
|
||||
continue;
|
||||
|
@ -3507,9 +3507,11 @@ namespace DS4Windows
|
||||
linkedXdoc.AppendChild(Node);
|
||||
|
||||
Dictionary<string, string>.KeyCollection serials = linkedProfiles.Keys;
|
||||
for (int i = 0, itemCount = linkedProfiles.Count; i < itemCount; i++)
|
||||
//for (int i = 0, itemCount = linkedProfiles.Count; i < itemCount; i++)
|
||||
for (var serialEnum = serials.GetEnumerator(); serialEnum.MoveNext();)
|
||||
{
|
||||
string serial = serials.ElementAt(i);
|
||||
//string serial = serials.ElementAt(i);
|
||||
string serial = serialEnum.Current;
|
||||
string profile = linkedProfiles[serial];
|
||||
XmlElement link = linkedXdoc.CreateElement("MAC" + serial);
|
||||
link.InnerText = profile;
|
||||
|
@ -179,9 +179,11 @@ namespace DS4Windows
|
||||
{
|
||||
IEnumerable<DS4Device> devices = getDS4Controllers();
|
||||
//foreach (DS4Device device in devices)
|
||||
for (int i = 0, devCount = devices.Count(); i < devCount; i++)
|
||||
//for (int i = 0, devCount = devices.Count(); i < devCount; i++)
|
||||
for (var devEnum = devices.GetEnumerator(); devEnum.MoveNext();)
|
||||
{
|
||||
DS4Device device = devices.ElementAt(i);
|
||||
DS4Device device = devEnum.Current;
|
||||
//DS4Device device = devices.ElementAt(i);
|
||||
device.StopUpdate();
|
||||
//device.runRemoval();
|
||||
device.HidDevice.CloseDevice();
|
||||
|
Loading…
x
Reference in New Issue
Block a user