Added unchecked block

This commit is contained in:
Travis Nickles 2018-08-04 01:39:46 -05:00
parent c3b4190b02
commit f3c64143e2

View File

@ -597,44 +597,48 @@ namespace DS4Windows
if (clientsList.Count <= 0) if (clientsList.Count <= 0)
return; return;
byte[] outputData = new byte[100]; unchecked
int outIdx = BeginPacket(outputData, 1001);
Array.Copy(BitConverter.GetBytes((uint)MessageType.DSUS_PadDataRsp), 0, outputData, outIdx, 4);
outIdx += 4;
outputData[outIdx++] = (byte)padMeta.PadId;
outputData[outIdx++] = (byte)padMeta.PadState;
outputData[outIdx++] = (byte)padMeta.Model;
outputData[outIdx++] = (byte)padMeta.ConnectionType;
{ {
byte[] padMac = padMeta.PadMacAddress.GetAddressBytes(); byte[] outputData = new byte[100];
outputData[outIdx++] = padMac[0]; int outIdx = BeginPacket(outputData, 1001);
outputData[outIdx++] = padMac[1]; Array.Copy(BitConverter.GetBytes((uint)MessageType.DSUS_PadDataRsp), 0, outputData, outIdx, 4);
outputData[outIdx++] = padMac[2]; outIdx += 4;
outputData[outIdx++] = padMac[3];
outputData[outIdx++] = padMac[4]; outputData[outIdx++] = (byte)padMeta.PadId;
outputData[outIdx++] = padMac[5]; outputData[outIdx++] = (byte)padMeta.PadState;
outputData[outIdx++] = (byte)padMeta.Model;
outputData[outIdx++] = (byte)padMeta.ConnectionType;
{
byte[] padMac = padMeta.PadMacAddress.GetAddressBytes();
outputData[outIdx++] = padMac[0];
outputData[outIdx++] = padMac[1];
outputData[outIdx++] = padMac[2];
outputData[outIdx++] = padMac[3];
outputData[outIdx++] = padMac[4];
outputData[outIdx++] = padMac[5];
}
outputData[outIdx++] = (byte)padMeta.BatteryStatus;
outputData[outIdx++] = padMeta.IsActive ? (byte)1 : (byte)0;
Array.Copy(BitConverter.GetBytes((uint)hidReport.PacketCounter), 0, outputData, outIdx, 4);
outIdx += 4;
if (!ReportToBuffer(hidReport, outputData, ref outIdx))
return;
else
FinishPacket(outputData);
foreach (var cl in clientsList)
{
//try { udpSock.SendTo(outputData, cl); }
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.RemoteEndPoint = cl;
args.SetBuffer(outputData, 0, outputData.Length);
try { udpSock.SendToAsync(args); }
catch (SocketException ex) { }
}
} }
outputData[outIdx++] = (byte)padMeta.BatteryStatus;
outputData[outIdx++] = padMeta.IsActive ? (byte)1 : (byte)0;
Array.Copy(BitConverter.GetBytes((uint)hidReport.PacketCounter), 0, outputData, outIdx, 4);
outIdx += 4;
if (!ReportToBuffer(hidReport, outputData, ref outIdx))
return;
else
FinishPacket(outputData);
foreach (var cl in clientsList)
{
//try { udpSock.SendTo(outputData, cl); }
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.RemoteEndPoint = cl;
args.SetBuffer(outputData, 0, outputData.Length);
try { udpSock.SendToAsync(args); }
catch (SocketException ex) { }
}
clientsList.Clear(); clientsList.Clear();
clientsList = null; clientsList = null;
} }