From 6098c91e2913e52348bbfc708522965892410580 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Tue, 12 Feb 2019 01:31:18 -0600 Subject: [PATCH] Use ref for more color struct routines --- DS4Windows/DS4Control/DS4LightBar.cs | 10 +++++----- DS4Windows/DS4Control/ScpUtil.cs | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DS4Windows/DS4Control/DS4LightBar.cs b/DS4Windows/DS4Control/DS4LightBar.cs index c81baf4..5e72314 100644 --- a/DS4Windows/DS4Control/DS4LightBar.cs +++ b/DS4Windows/DS4Control/DS4LightBar.cs @@ -47,8 +47,8 @@ namespace DS4Windows { if (getLedAsBatteryIndicator(deviceNum)) { - DS4Color fullColor = getCustomColor(deviceNum); - DS4Color lowColor = getLowColor(deviceNum); + ref DS4Color fullColor = ref getCustomColor(deviceNum); + ref DS4Color lowColor = ref getLowColor(deviceNum); color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery()); } else @@ -83,8 +83,8 @@ namespace DS4Windows } else if (getLedAsBatteryIndicator(deviceNum)) { - DS4Color fullColor = getMainColor(deviceNum); - DS4Color lowColor = getLowColor(deviceNum); + ref DS4Color fullColor = ref getMainColor(deviceNum); + ref DS4Color lowColor = ref getLowColor(deviceNum); color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery()); } else @@ -95,7 +95,7 @@ namespace DS4Windows if (device.getBattery() <= getFlashAt(deviceNum) && !defaultLight && !device.isCharging()) { - DS4Color flashColor = getFlashColor(deviceNum); + ref DS4Color flashColor = ref getFlashColor(deviceNum); if (!(flashColor.red == 0 && flashColor.green == 0 && flashColor.blue == 0)) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 9e707bc..9823864 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -794,27 +794,27 @@ namespace DS4Windows => m_Config.SetGyroMouseToggle(index, value, control); public static DS4Color[] MainColor => m_Config.m_Leds; - public static DS4Color getMainColor(int index) + public static ref DS4Color getMainColor(int index) { - return m_Config.m_Leds[index]; + return ref m_Config.m_Leds[index]; } public static DS4Color[] LowColor => m_Config.m_LowLeds; - public static DS4Color getLowColor(int index) + public static ref DS4Color getLowColor(int index) { - return m_Config.m_LowLeds[index]; + return ref m_Config.m_LowLeds[index]; } public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds; - public static DS4Color getChargingColor(int index) + public static ref DS4Color getChargingColor(int index) { - return m_Config.m_ChargingLeds[index]; + return ref m_Config.m_ChargingLeds[index]; } public static DS4Color[] CustomColor => m_Config.m_CustomLeds; - public static DS4Color getCustomColor(int index) + public static ref DS4Color getCustomColor(int index) { - return m_Config.m_CustomLeds[index]; + return ref m_Config.m_CustomLeds[index]; } public static bool[] UseCustomLed => m_Config.useCustomLeds; @@ -824,9 +824,9 @@ namespace DS4Windows } public static DS4Color[] FlashColor => m_Config.m_FlashLeds; - public static DS4Color getFlashColor(int index) + public static ref DS4Color getFlashColor(int index) { - return m_Config.m_FlashLeds[index]; + return ref m_Config.m_FlashLeds[index]; } public static byte[] TapSensitivity => m_Config.tapSensitivity;