diff --git a/HandheldCompanion/ADLX/ADLXBackend.cs b/HandheldCompanion/ADLX/ADLXBackend.cs index 08536312f..b0353e79e 100644 --- a/HandheldCompanion/ADLX/ADLXBackend.cs +++ b/HandheldCompanion/ADLX/ADLXBackend.cs @@ -74,7 +74,7 @@ public enum ADLX_RESULT [DllImport(ADLX_Wrapper, CallingConvention = CallingConvention.Cdecl)] public static extern bool CloseAdlx(); [DllImport(ADLX_Wrapper, CallingConvention = CallingConvention.Cdecl)] public static extern ADLX_RESULT GetNumberOfDisplays(ref int displayNum); - + [DllImport(ADLX_Wrapper, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] public static extern ADLX_RESULT GetDisplayName(int idx, StringBuilder dispName, int nameLength); diff --git a/HandheldCompanion/App.xaml.cs b/HandheldCompanion/App.xaml.cs index dc30aafab..53a794076 100644 --- a/HandheldCompanion/App.xaml.cs +++ b/HandheldCompanion/App.xaml.cs @@ -110,7 +110,7 @@ private void Application_ThreadException(object sender, ThreadExceptionEventArgs { var ex = default(Exception); ex = (Exception)e.Exception; - if(ex.InnerException != null) + if (ex.InnerException != null) { LogManager.LogCritical(ex.InnerException.Message + "\t" + ex.InnerException.StackTrace); } diff --git a/HandheldCompanion/Controllers/DS4Controller.cs b/HandheldCompanion/Controllers/DS4Controller.cs index bfa1eaea9..cb307cc08 100644 --- a/HandheldCompanion/Controllers/DS4Controller.cs +++ b/HandheldCompanion/Controllers/DS4Controller.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using System.Windows; using System.Windows.Media; using static JSL; diff --git a/HandheldCompanion/Controllers/DualSenseController.cs b/HandheldCompanion/Controllers/DualSenseController.cs index 6e8e57b1e..8599b4362 100644 --- a/HandheldCompanion/Controllers/DualSenseController.cs +++ b/HandheldCompanion/Controllers/DualSenseController.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using System.Windows; using System.Windows.Media; using static JSL; diff --git a/HandheldCompanion/Controllers/GordonController.cs b/HandheldCompanion/Controllers/GordonController.cs index c1eb672a6..1d2ef137e 100644 --- a/HandheldCompanion/Controllers/GordonController.cs +++ b/HandheldCompanion/Controllers/GordonController.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Media; -using static JSL; namespace HandheldCompanion.Controllers { diff --git a/HandheldCompanion/Controllers/IController.xaml.cs b/HandheldCompanion/Controllers/IController.xaml.cs index 6c4ac4844..7bcf82b5b 100644 --- a/HandheldCompanion/Controllers/IController.xaml.cs +++ b/HandheldCompanion/Controllers/IController.xaml.cs @@ -3,7 +3,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Misc; -using HandheldCompanion.Sensors; using HandheldCompanion.Utils; using iNKORE.UI.WPF.Modern.Controls; using System; diff --git a/HandheldCompanion/Controllers/JSController.cs b/HandheldCompanion/Controllers/JSController.cs index 64cf63420..2ee80bb21 100644 --- a/HandheldCompanion/Controllers/JSController.cs +++ b/HandheldCompanion/Controllers/JSController.cs @@ -1,12 +1,9 @@ -using HandheldCompanion.Helpers; -using HandheldCompanion.Inputs; +using HandheldCompanion.Inputs; using HandheldCompanion.Utils; using Nefarius.Utilities.DeviceManagement.PnP; using System; using System.Threading.Tasks; -using System.Windows; using static JSL; -using Timer = System.Timers.Timer; namespace HandheldCompanion.Controllers; @@ -121,7 +118,7 @@ public virtual void UpdateState(float delta) // store motion Inputs.GyroState.SetGyroscope(iMU_STATE.gyroX, iMU_STATE.gyroY, iMU_STATE.gyroZ); Inputs.GyroState.SetAccelerometer(iMU_STATE.accelX, iMU_STATE.accelY, iMU_STATE.accelZ); - + // process motion gamepadMotion.ProcessMotion(iMU_STATE.gyroX, iMU_STATE.gyroY, iMU_STATE.gyroZ, iMU_STATE.accelX, iMU_STATE.accelY, iMU_STATE.accelZ, delta); } diff --git a/HandheldCompanion/Controllers/LegionController.cs b/HandheldCompanion/Controllers/LegionController.cs index a814534ee..961b97c8c 100644 --- a/HandheldCompanion/Controllers/LegionController.cs +++ b/HandheldCompanion/Controllers/LegionController.cs @@ -4,7 +4,6 @@ using HandheldCompanion.Managers; using HandheldCompanion.Utils; using HidLibrary; -using SharpDX.XInput; using System; using System.Collections.Generic; using System.Numerics; @@ -13,15 +12,14 @@ using System.Windows; using System.Windows.Forms; using static HandheldCompanion.Devices.Lenovo.SapientiaUsb; -using static JSL; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; namespace HandheldCompanion.Controllers { public class LegionController : XInputController { // Import the user32.dll library - [DllImport("user32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)] + [DllImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref uint pvParam, uint fWinIni); [Flags] @@ -58,7 +56,7 @@ private enum ControllerState private const byte LCONTROLLER_STATE_IDX = 11; private const byte RCONTROLLER_STATE_IDX = 12; - private HashSet READY_STATES = new HashSet() {25, 60}; + private HashSet READY_STATES = new HashSet() { 25, 60 }; private Thread dataThread; private bool dataThreadRunning; @@ -84,7 +82,7 @@ public override bool IsWireless } private bool IsPassthrough = false; - private int GyroIndex = LegionGo.RightJoyconIndex; + private int GyroIndex = LegionGo.RightJoyconIndex; private uint LongPressTime = 1000; // The minimum time in milliseconds for a long press private const int MaxDistance = 40; // Maximum distance tolerance between touch and untouch in pixels @@ -384,7 +382,7 @@ public override string GetGlyph(ButtonFlags button) case ButtonFlags.B8: return "\u27F1"; // Scroll down } - + return base.GetGlyph(button); } diff --git a/HandheldCompanion/Controllers/NeptuneController.cs b/HandheldCompanion/Controllers/NeptuneController.cs index c1b1b6dc4..1d31439da 100644 --- a/HandheldCompanion/Controllers/NeptuneController.cs +++ b/HandheldCompanion/Controllers/NeptuneController.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using static JSL; namespace HandheldCompanion.Controllers; @@ -277,7 +276,7 @@ private void Close() // remove handler Controller.OnControllerInputReceived = null; - + Controller.Close(); isConnected = false; } diff --git a/HandheldCompanion/Controllers/ProController.cs b/HandheldCompanion/Controllers/ProController.cs index fee6a90a3..4838655e9 100644 --- a/HandheldCompanion/Controllers/ProController.cs +++ b/HandheldCompanion/Controllers/ProController.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using System.Collections.Generic; using static JSL; namespace HandheldCompanion.Controllers; diff --git a/HandheldCompanion/Controllers/SteamController.cs b/HandheldCompanion/Controllers/SteamController.cs index bb198ef9d..a79d773ff 100644 --- a/HandheldCompanion/Controllers/SteamController.cs +++ b/HandheldCompanion/Controllers/SteamController.cs @@ -1,6 +1,5 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; -using SharpDX.XInput; using steam_hidapi.net.Hid; using System; diff --git a/HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs b/HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs index cc3988931..6d1fb83d3 100644 --- a/HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs +++ b/HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs @@ -1,6 +1,5 @@ using HandheldCompanion.Devices; using HandheldCompanion.Utils; -using HandheldCompanion.Views; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs b/HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs index b39030c88..24e8b462e 100644 --- a/HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs +++ b/HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs @@ -1,17 +1,11 @@ using HandheldCompanion.Devices; -using HandheldCompanion.Utils; -using HandheldCompanion.Views; using Microsoft.Win32.TaskScheduler; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.ServiceProcess; -using System.Threading.Tasks; using System.Timers; using System.Windows; -using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System; -using Task = System.Threading.Tasks.Task; using TaskScheduled = Microsoft.Win32.TaskScheduler.Task; namespace HandheldCompanion.Controls.Hints @@ -63,7 +57,7 @@ private bool HasTask() TaskScheduled task = GetTask(); if (task is null) return false; - + return task.Enabled; } diff --git a/HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs b/HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs index c2a1c0cb1..c0a1a22ae 100644 --- a/HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs +++ b/HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs @@ -1,6 +1,5 @@ using HandheldCompanion.Devices; using HandheldCompanion.Utils; -using HandheldCompanion.Views; using System; using System.Collections.Generic; using System.Linq; @@ -60,7 +59,7 @@ public Hint_RogAllyServiceCheck() : base() private void ServiceTimer_Elapsed(object? sender, ElapsedEventArgs e) { - if(!serviceControllers.Any()) + if (!serviceControllers.Any()) return; // Check if any of the services in the list exist and are running diff --git a/HandheldCompanion/Devices/AYANEO/AYANEO2.cs b/HandheldCompanion/Devices/AYANEO/AYANEO2.cs index c5a253d62..eda197f9a 100644 --- a/HandheldCompanion/Devices/AYANEO/AYANEO2.cs +++ b/HandheldCompanion/Devices/AYANEO/AYANEO2.cs @@ -1,6 +1,3 @@ -using HandheldCompanion.Inputs; -using System.Collections.Generic; -using WindowsInput.Events; namespace HandheldCompanion.Devices; public class AYANEO2 : AYANEO.AYANEODeviceCEc diff --git a/HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs b/HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs index a9fc22e49..aabac800c 100644 --- a/HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs +++ b/HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs @@ -36,7 +36,7 @@ public AYANEOKUN() protected override byte[] MapColorValues(int zone, Color color) { - switch(zone) + switch (zone) { case 1: return [color.G, color.R, color.B]; diff --git a/HandheldCompanion/Devices/IDevice.cs b/HandheldCompanion/Devices/IDevice.cs index 43200f721..ddd6934cb 100644 --- a/HandheldCompanion/Devices/IDevice.cs +++ b/HandheldCompanion/Devices/IDevice.cs @@ -13,11 +13,9 @@ using System.Collections.Specialized; using System.Linq; using System.Numerics; -using System.Threading; using System.Windows.Media; using Windows.Devices.Sensors; using WindowsInput.Events; -using static HandheldCompanion.OneEuroFilter; using static HandheldCompanion.OpenLibSys; using static HandheldCompanion.Utils.DeviceUtils; @@ -757,7 +755,7 @@ protected virtual void SendECData(byte data) protected bool IsECReady() { DateTime timeout = DateTime.Now.AddMilliseconds(250); - while(DateTime.Now < timeout) + while (DateTime.Now < timeout) { if ((ECRamReadByte(EC_SC) & EC_IBF) == 0x0) { diff --git a/HandheldCompanion/Devices/Lenovo/LegionGo.cs b/HandheldCompanion/Devices/Lenovo/LegionGo.cs index 298f4eae3..508df4eb1 100644 --- a/HandheldCompanion/Devices/Lenovo/LegionGo.cs +++ b/HandheldCompanion/Devices/Lenovo/LegionGo.cs @@ -153,13 +153,13 @@ public LegionGo() DynamicLightingCapabilities |= LEDLevel.Wheel; // Legion Go - Quiet - DevicePowerProfiles.Add(new(Properties.Resources.PowerProfileLegionGoBetterBattery, Properties.Resources.PowerProfileLegionGoBetterBatteryDesc) + DevicePowerProfiles.Add(new(Properties.Resources.PowerProfileLegionGoBetterBattery, Properties.Resources.PowerProfileLegionGoBetterBatteryDesc) { Default = true, DeviceDefault = true, OSPowerMode = OSPowerMode.BetterBattery, CPUBoostLevel = CPUBoostLevel.Disabled, - OEMPowerMode = (int) LegionMode.Quiet, + OEMPowerMode = (int)LegionMode.Quiet, Guid = new("961cc777-2547-4f9d-8174-7d86181b8a7a"), TDPOverrideEnabled = true, TDPOverrideValues = new[] { 8.0d, 8.0d, 8.0d } @@ -202,7 +202,7 @@ public LegionGo() )); // device specific layout - DefaultLayout.AxisLayout[AxisLayoutFlags.RightPad] = new MouseActions {MouseType = MouseActionsType.Move, Filtering = true, Sensivity = 15 }; + DefaultLayout.AxisLayout[AxisLayoutFlags.RightPad] = new MouseActions { MouseType = MouseActionsType.Move, Filtering = true, Sensivity = 15 }; DefaultLayout.ButtonLayout[ButtonFlags.RightPadClick] = new List() { new MouseActions { MouseType = MouseActionsType.LeftButton, HapticMode = HapticMode.Down, HapticStrength = HapticStrength.Low } }; DefaultLayout.ButtonLayout[ButtonFlags.RightPadClickDown] = new List() { new MouseActions { MouseType = MouseActionsType.RightButton, HapticMode = HapticMode.Down, HapticStrength = HapticStrength.High } }; diff --git a/HandheldCompanion/Devices/MSI/ClawA1M.cs b/HandheldCompanion/Devices/MSI/ClawA1M.cs index 940b29b65..f6504282f 100644 --- a/HandheldCompanion/Devices/MSI/ClawA1M.cs +++ b/HandheldCompanion/Devices/MSI/ClawA1M.cs @@ -1,8 +1,8 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using System; using HidLibrary; +using System; using System.Collections.Generic; using System.Management; using System.Numerics; diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerOneXFly.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerOneXFly.cs index 9f9f4d5d4..5a2c91b1e 100644 --- a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerOneXFly.cs +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerOneXFly.cs @@ -168,7 +168,7 @@ public override bool SetLedBrightness(int brightness) // Define the HID message for setting brightness. byte[] msg = { 0x00, 0x07, 0xFF, 0xFD, 0x01, 0x05, (byte)brightness }; - + // Write the HID message to set the LED brightness. hidDevice.Write(msg); diff --git a/HandheldCompanion/Extensions/GlyphExtensions.cs b/HandheldCompanion/Extensions/GlyphExtensions.cs index 90dd3099f..4e3ab864c 100644 --- a/HandheldCompanion/Extensions/GlyphExtensions.cs +++ b/HandheldCompanion/Extensions/GlyphExtensions.cs @@ -15,10 +15,10 @@ public static string ToGlyph(this MotionInput motionInput) return "\uF119"; case MotionInput.WorldSpace: return "\uE714"; - /* - case MotionInput.AutoRollYawSwap: - return "\uE7F8"; - */ + /* + case MotionInput.AutoRollYawSwap: + return "\uE7F8"; + */ case MotionInput.JoystickSteering: return "\uEC47"; } diff --git a/HandheldCompanion/GraphicsProcessingUnit/AMDGPU.cs b/HandheldCompanion/GraphicsProcessingUnit/AMDGPU.cs index ec480a9d5..aa5fa1025 100644 --- a/HandheldCompanion/GraphicsProcessingUnit/AMDGPU.cs +++ b/HandheldCompanion/GraphicsProcessingUnit/AMDGPU.cs @@ -3,7 +3,6 @@ using SharpDX.Direct3D9; using System; using System.Text; -using System.Threading; using System.Threading.Tasks; using System.Timers; using static HandheldCompanion.ADLX.ADLXBackend; @@ -29,7 +28,7 @@ public bool HasRSRSupport() return Execute(ADLXBackend.HasRSRSupport, false); } - + public override bool HasIntegerScalingSupport() { if (!IsInitialized) diff --git a/HandheldCompanion/GraphicsProcessingUnit/GPU.cs b/HandheldCompanion/GraphicsProcessingUnit/GPU.cs index e4460dedf..0169bfd6d 100644 --- a/HandheldCompanion/GraphicsProcessingUnit/GPU.cs +++ b/HandheldCompanion/GraphicsProcessingUnit/GPU.cs @@ -2,7 +2,6 @@ using SharpDX.Direct3D9; using System; using System.Management; -using System.Threading; using System.Threading.Tasks; using Task = System.Threading.Tasks.Task; using Timer = System.Timers.Timer; diff --git a/HandheldCompanion/IGCL/IGCLBackend.cs b/HandheldCompanion/IGCL/IGCLBackend.cs index 5b91bec82..2fcc95d51 100644 --- a/HandheldCompanion/IGCL/IGCLBackend.cs +++ b/HandheldCompanion/IGCL/IGCLBackend.cs @@ -579,7 +579,7 @@ internal static bool GetGPUScaling(nint deviceIdx, uint displayIdx) { handle = device }; - + Result = GetScalingSettings(hDevice, displayIdx, ref ScalingSettings); if (Result != ctl_result_t.CTL_RESULT_SUCCESS) return false; @@ -600,7 +600,7 @@ internal static bool SetGPUScaling(nint deviceIdx, uint displayIdx, bool enabled { handle = device }; - + Result = GetScalingSettings(hDevice, displayIdx, ref ScalingSettings); if (Result != ctl_result_t.CTL_RESULT_SUCCESS) return false; @@ -686,7 +686,7 @@ internal static bool SetScalingMode(nint deviceIdx, uint displayIdx, int mode) { handle = device }; - + Result = GetScalingSettings(hDevice, displayIdx, ref ScalingSettings); if (Result != ctl_result_t.CTL_RESULT_SUCCESS) return false; @@ -875,7 +875,7 @@ internal static bool SetIntegerScaling(nint deviceIdx, bool enabled, byte type) // fill custom scaling details RetroScalingSettings.Enable = enabled; RetroScalingSettings.RetroScalingType = RetroScalingType; - + Result = SetRetroScalingSettings(hDevice, RetroScalingSettings); if (Result != ctl_result_t.CTL_RESULT_SUCCESS) return false; diff --git a/HandheldCompanion/Inputs/GyroState.cs b/HandheldCompanion/Inputs/GyroState.cs index 2c46c011c..d8fa5e530 100644 --- a/HandheldCompanion/Inputs/GyroState.cs +++ b/HandheldCompanion/Inputs/GyroState.cs @@ -1,5 +1,4 @@ -using HandheldCompanion.Devices; -using System; +using System; using System.Collections.Generic; using System.Numerics; diff --git a/HandheldCompanion/Managers/ControllerManager.cs b/HandheldCompanion/Managers/ControllerManager.cs index 8f329f860..e9c175517 100644 --- a/HandheldCompanion/Managers/ControllerManager.cs +++ b/HandheldCompanion/Managers/ControllerManager.cs @@ -608,7 +608,7 @@ private static async void HidDeviceRemoved(PnPDetails details, DeviceEventArgs o private static void watchdogThreadLoop(object? obj) { - while(watchdogThreadRunning) + while (watchdogThreadRunning) { // monitoring unexpected slot changes HashSet UserIndexes = new(); @@ -739,7 +739,7 @@ private static void watchdogThreadLoop(object? obj) } } - Exit: + Exit: Thread.Sleep(2000); } } @@ -983,7 +983,7 @@ public static bool SuspendController(string baseContainerDeviceInstanceId) if (pnPDriver is not null) { pnPDevice.InstallNullDriver(out bool rebootRequired); - usbPnPDevice.CyclePort(); + usbPnPDevice.CyclePort(); } if (!deviceInstanceIds.Contains(baseContainerDeviceInstanceId)) @@ -1079,7 +1079,7 @@ public static List GetControllers() { return Controllers.Values.ToList(); } - + private static ControllerState mutedState = new ControllerState(); private static void UpdateInputs(ControllerState controllerState, GamepadMotion gamepadMotion, float delta) { diff --git a/HandheldCompanion/Managers/Desktop/DesktopScreen.cs b/HandheldCompanion/Managers/Desktop/DesktopScreen.cs index 31bbfb0c7..877a08e23 100644 --- a/HandheldCompanion/Managers/Desktop/DesktopScreen.cs +++ b/HandheldCompanion/Managers/Desktop/DesktopScreen.cs @@ -165,7 +165,7 @@ public int GetCurrentFrequency() public List GetFramelimits() { // A list to store the quotients - List Limits = [new(0,0)]; // (Comparer.Create((x, y) => y.CompareTo(x))); + List Limits = [new(0, 0)]; // (Comparer.Create((x, y) => y.CompareTo(x))); // A variable to store the divider value, rounded to nearest even number int divider = 1; @@ -209,7 +209,7 @@ public List GetFramelimits() for (int i = 0; i < orderedFpsLimits.Count(); i++) { - Limits.Add(new(i+1, orderedFpsLimits.ElementAt(i))); + Limits.Add(new(i + 1, orderedFpsLimits.ElementAt(i))); } _cachedFrameLimits.Add(dmDisplayFrequency, Limits); diff --git a/HandheldCompanion/Managers/DeviceManager.cs b/HandheldCompanion/Managers/DeviceManager.cs index de17f9186..8589ae3e4 100644 --- a/HandheldCompanion/Managers/DeviceManager.cs +++ b/HandheldCompanion/Managers/DeviceManager.cs @@ -1,5 +1,4 @@ -using HandheldCompanion.Controllers; -using HandheldCompanion.Managers.Hid; +using HandheldCompanion.Managers.Hid; using HandheldCompanion.Sensors; using HandheldCompanion.Utils; using Microsoft.Win32.SafeHandles; diff --git a/HandheldCompanion/Managers/DynamicLightingManager.cs b/HandheldCompanion/Managers/DynamicLightingManager.cs index db813f1cb..e0d1708d2 100644 --- a/HandheldCompanion/Managers/DynamicLightingManager.cs +++ b/HandheldCompanion/Managers/DynamicLightingManager.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Devices; using HandheldCompanion.Managers.Desktop; using HandheldCompanion.Misc; -using HandheldCompanion.Views; using SharpDX; using SharpDX.Direct3D9; using System; @@ -77,7 +76,7 @@ public static void Stop() return; StopAmbilight(); - + ReleaseDirect3DDevice(); IsInitialized = false; @@ -344,7 +343,7 @@ private static Color CalculateColorAverage(int x, int y) } } - foreach(Color color in colorList) + foreach (Color color in colorList) { squareRedSum += color.R; squareGreenSum += color.G; diff --git a/HandheldCompanion/Managers/GPUManager.cs b/HandheldCompanion/Managers/GPUManager.cs index ded013690..98060d4ea 100644 --- a/HandheldCompanion/Managers/GPUManager.cs +++ b/HandheldCompanion/Managers/GPUManager.cs @@ -5,7 +5,6 @@ using HandheldCompanion.Managers.Desktop; using SharpDX.Direct3D9; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -30,7 +29,7 @@ public static class GPUManager private static GPU currentGPU = null; private static ConcurrentDictionary DisplayGPU = new(); - + static GPUManager() { // manage events diff --git a/HandheldCompanion/Managers/Hotkeys/Hotkey.cs b/HandheldCompanion/Managers/Hotkeys/Hotkey.cs index 2ae384cf0..a7b403367 100644 --- a/HandheldCompanion/Managers/Hotkeys/Hotkey.cs +++ b/HandheldCompanion/Managers/Hotkeys/Hotkey.cs @@ -2,7 +2,6 @@ using HandheldCompanion.Controls; using HandheldCompanion.Devices; using HandheldCompanion.Properties; -using HandheldCompanion.Views; using iNKORE.UI.WPF.Modern.Controls; using Newtonsoft.Json; using System; @@ -307,7 +306,7 @@ public void DrawInput() var fontIcon = new FontIcon(); switch (button) - { + { case Inputs.ButtonFlags.OEM1: case Inputs.ButtonFlags.OEM2: case Inputs.ButtonFlags.OEM3: @@ -329,8 +328,8 @@ public void DrawInput() } break; } - - // display only one label, default one is not enough + + // display only one label, default one is not enough if (fontIcon.Glyph != IController.defaultGlyph) { if (fontIcon.Foreground is null) diff --git a/HandheldCompanion/Managers/HotkeysManager.cs b/HandheldCompanion/Managers/HotkeysManager.cs index 860fe89e5..be0f4f64f 100644 --- a/HandheldCompanion/Managers/HotkeysManager.cs +++ b/HandheldCompanion/Managers/HotkeysManager.cs @@ -6,12 +6,10 @@ using HandheldCompanion.Simulators; using HandheldCompanion.Utils; using HandheldCompanion.Views; -using iNKORE.UI.WPF.Modern.Controls; using Newtonsoft.Json; using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Runtime.InteropServices; diff --git a/HandheldCompanion/Managers/InputsManager.cs b/HandheldCompanion/Managers/InputsManager.cs index 7f402ba6c..adb602754 100644 --- a/HandheldCompanion/Managers/InputsManager.cs +++ b/HandheldCompanion/Managers/InputsManager.cs @@ -4,7 +4,6 @@ using HandheldCompanion.Devices; using HandheldCompanion.Inputs; using HandheldCompanion.Simulators; -using HandheldCompanion.Views; using PrecisionTiming; using System; using System.Collections.Generic; @@ -12,9 +11,9 @@ using System.Windows.Forms; using WindowsInput.Events; using static HandheldCompanion.Managers.InputsHotkey; +using Application = System.Windows.Application; using ButtonState = HandheldCompanion.Inputs.ButtonState; using Timer = System.Timers.Timer; -using Application = System.Windows.Application; namespace HandheldCompanion.Managers; @@ -200,7 +199,7 @@ private static bool CheckForSequence(bool IsKeyDown, bool IsKeyUp) { if (IsKeyUp) { - switch(hotkey.hotkeyType) + switch (hotkey.hotkeyType) { // we should always allow custom hotkeys (keyboard keys) to be released case InputsHotkeyType.Custom: @@ -691,7 +690,7 @@ private static void StopListening(InputsChord inputsChord = null) // the below logic is here to make sure every KeyDown has an equivalent KeyUp List missingOutputs = new List(); - foreach(OutputKey key in inputsChord.OutputKeys.Where(k => k.IsKeyDown)) + foreach (OutputKey key in inputsChord.OutputKeys.Where(k => k.IsKeyDown)) { bool hasUp = inputsChord.OutputKeys.Any(k => k.KeyValue == key.KeyValue && k.IsKeyUp); if (!hasUp) diff --git a/HandheldCompanion/Managers/MotionManager.cs b/HandheldCompanion/Managers/MotionManager.cs index 5d9614b01..ade9eb858 100644 --- a/HandheldCompanion/Managers/MotionManager.cs +++ b/HandheldCompanion/Managers/MotionManager.cs @@ -1,21 +1,15 @@ using HandheldCompanion.Actions; using HandheldCompanion.Controllers; -using HandheldCompanion.Devices; using HandheldCompanion.Helpers; using HandheldCompanion.Inputs; using HandheldCompanion.Misc; -using HandheldCompanion.Sensors; using HandheldCompanion.Utils; using HandheldCompanion.Views; -using Microsoft.WindowsAPICodePack.Sensors; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Numerics; -using System.Windows; using static HandheldCompanion.Utils.DeviceUtils; -using static JSL; using SensorState = HandheldCompanion.Inputs.GyroState.SensorState; namespace HandheldCompanion.Managers @@ -58,7 +52,7 @@ public static void UpdateReport(ControllerState controllerState, GamepadMotion g { SetupMotion(controllerState, gamepadMotion, delta); ProcessMotion(controllerState, gamepadMotion, delta); - + if (controllerState.ButtonState.Buttons.Intersect(resetFlags).Count() == 4) gamepadMotion.ResetMotion(); } @@ -85,7 +79,7 @@ private static void SetupMotion(ControllerState controllerState, GamepadMotion g if (steeringAxis == SteeringAxis.Auto) { SensorFamily sensorSelection = (SensorFamily)SettingsManager.GetInt("SensorSelection"); - switch(sensorSelection) + switch (sensorSelection) { case SensorFamily.Windows: case SensorFamily.SerialUSBIMU: diff --git a/HandheldCompanion/Managers/OSDManager.cs b/HandheldCompanion/Managers/OSDManager.cs index 909803dc6..53ff5e5ba 100644 --- a/HandheldCompanion/Managers/OSDManager.cs +++ b/HandheldCompanion/Managers/OSDManager.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Windows; namespace HandheldCompanion.Managers; @@ -271,7 +270,7 @@ public static string Draw(int processId) break; } - Exit: + Exit: return string.Join("\n", Content); } diff --git a/HandheldCompanion/Managers/PerformanceManager.cs b/HandheldCompanion/Managers/PerformanceManager.cs index 60c927d6a..ac855009f 100644 --- a/HandheldCompanion/Managers/PerformanceManager.cs +++ b/HandheldCompanion/Managers/PerformanceManager.cs @@ -3,12 +3,10 @@ using HandheldCompanion.Misc; using HandheldCompanion.Processors; using HandheldCompanion.Utils; -using HandheldCompanion.Views; using RTSSSharedMemoryNET; using System; using System.Linq; using System.Runtime.InteropServices; -using System.Threading; using System.Threading.Tasks; using System.Timers; using Timer = System.Timers.Timer; diff --git a/HandheldCompanion/Managers/PlatformManager.cs b/HandheldCompanion/Managers/PlatformManager.cs index 6674009d9..d780f3d60 100644 --- a/HandheldCompanion/Managers/PlatformManager.cs +++ b/HandheldCompanion/Managers/PlatformManager.cs @@ -1,6 +1,5 @@ using HandheldCompanion.Misc; using HandheldCompanion.Platforms; -using HandheldCompanion.Views; using System; using System.Diagnostics; using System.Timers; diff --git a/HandheldCompanion/Managers/PowerProfileManager.cs b/HandheldCompanion/Managers/PowerProfileManager.cs index 4b8533649..05b38810e 100644 --- a/HandheldCompanion/Managers/PowerProfileManager.cs +++ b/HandheldCompanion/Managers/PowerProfileManager.cs @@ -43,7 +43,7 @@ public static void Start() foreach (PowerProfile devicePowerProfile in IDevice.GetCurrent().DevicePowerProfiles) { - if(!profiles.ContainsKey(devicePowerProfile.Guid)) + if (!profiles.ContainsKey(devicePowerProfile.Guid)) UpdateOrCreateProfile(devicePowerProfile, UpdateSource.Serializer); } diff --git a/HandheldCompanion/Managers/ProfileManager.cs b/HandheldCompanion/Managers/ProfileManager.cs index d29a4fd89..0b20d3d4b 100644 --- a/HandheldCompanion/Managers/ProfileManager.cs +++ b/HandheldCompanion/Managers/ProfileManager.cs @@ -217,7 +217,7 @@ public static void CycleSubProfiles(bool previous = false) return; // get index of currently applied profile - int currentIndex = subProfilesList.IndexOf(currentProfile); + int currentIndex = subProfilesList.IndexOf(currentProfile); int newIndex = currentIndex; // previous? decrement, next? increment diff --git a/HandheldCompanion/Managers/SensorsManager.cs b/HandheldCompanion/Managers/SensorsManager.cs index 736c80449..006a0a331 100644 --- a/HandheldCompanion/Managers/SensorsManager.cs +++ b/HandheldCompanion/Managers/SensorsManager.cs @@ -69,7 +69,7 @@ private static void DeviceManager_UsbDeviceRemoved(PnPDevice device, DeviceEvent // pick next available sensor PickNextSensor(); } - + private static void PickNextSensor() { // get current controller @@ -119,7 +119,7 @@ private static void SettingsManager_SettingValueChanged(string name, object valu if (sensorFamily == sensorSelection) return; - switch(sensorFamily) + switch (sensorFamily) { case SensorFamily.Windows: StopListening(); @@ -133,7 +133,7 @@ private static void SettingsManager_SettingValueChanged(string name, object valu // update current sensorFamily sensorFamily = sensorSelection; - switch(sensorFamily) + switch (sensorFamily) { case SensorFamily.SerialUSBIMU: { @@ -330,7 +330,7 @@ public static async void Calibrate(GamepadMotion gamepadMotion) // display message dialog.UpdateContent($"Calibration succeeded: stationary sensor noise recorded. Drift correction found. Confidence: {confidence * 100.0f}%"); - + Close: await Task.Delay(2000); dialog.Hide(); diff --git a/HandheldCompanion/Managers/SettingsManager.cs b/HandheldCompanion/Managers/SettingsManager.cs index ac8cc5f7d..66a784392 100644 --- a/HandheldCompanion/Managers/SettingsManager.cs +++ b/HandheldCompanion/Managers/SettingsManager.cs @@ -1,6 +1,5 @@ using HandheldCompanion.Devices; using HandheldCompanion.Processors; -using HandheldCompanion.Views; using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/HandheldCompanion/Managers/UpdateManager.cs b/HandheldCompanion/Managers/UpdateManager.cs index 2f4e0e648..b5efd53b0 100644 --- a/HandheldCompanion/Managers/UpdateManager.cs +++ b/HandheldCompanion/Managers/UpdateManager.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Misc; using HandheldCompanion.Properties; using HandheldCompanion.Views; -using iNKORE.UI.WPF.Modern.Controls; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/HandheldCompanion/Misc/Dialog.cs b/HandheldCompanion/Misc/Dialog.cs index 365becccf..b3fe511e0 100644 --- a/HandheldCompanion/Misc/Dialog.cs +++ b/HandheldCompanion/Misc/Dialog.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Views; using HandheldCompanion.Views.Windows; using iNKORE.UI.WPF.Modern.Controls; -using System; using System.Threading.Tasks; using System.Windows; namespace HandheldCompanion.Misc; @@ -12,7 +11,7 @@ public class Dialog private ContentDialog dialog; public string Title; - public string Content; + public string Content; public ContentDialogButton DefaultButton = ContentDialogButton.Primary; public string PrimaryButtonText = string.Empty; public string SecondaryButtonText = string.Empty; diff --git a/HandheldCompanion/Misc/FanProfile.cs b/HandheldCompanion/Misc/FanProfile.cs index f8ea26b95..74c17c77f 100644 --- a/HandheldCompanion/Misc/FanProfile.cs +++ b/HandheldCompanion/Misc/FanProfile.cs @@ -1,5 +1,4 @@ using HandheldCompanion.Devices; -using HandheldCompanion.Views; using System; using System.Linq; diff --git a/HandheldCompanion/Misc/HidHide.cs b/HandheldCompanion/Misc/HidHide.cs index 4d438c44e..db9b8429e 100644 --- a/HandheldCompanion/Misc/HidHide.cs +++ b/HandheldCompanion/Misc/HidHide.cs @@ -160,7 +160,7 @@ public static bool SetCloaking(bool status) if (process is null) return false; - switch(status) + switch (status) { case true: process.StartInfo.Arguments = $"--cloak-on"; diff --git a/HandheldCompanion/Misc/Layout.cs b/HandheldCompanion/Misc/Layout.cs index 11b353793..12aeb01da 100644 --- a/HandheldCompanion/Misc/Layout.cs +++ b/HandheldCompanion/Misc/Layout.cs @@ -82,7 +82,7 @@ public object Clone() new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); deserialized.IsDefaultLayout = false; // Clone shouldn't be default layout in case it is true - + return deserialized; } @@ -106,7 +106,7 @@ public void UpdateLayout(ButtonFlags button, List actions) public void UpdateLayout(AxisLayoutFlags axis, IActions action) { - switch(axis) + switch (axis) { default: AxisLayout[axis] = action; diff --git a/HandheldCompanion/Misc/MotherboardInfo.cs b/HandheldCompanion/Misc/MotherboardInfo.cs index 49f0c8abb..dee54fb98 100644 --- a/HandheldCompanion/Misc/MotherboardInfo.cs +++ b/HandheldCompanion/Misc/MotherboardInfo.cs @@ -1,6 +1,4 @@ using HandheldCompanion.Devices; -using HandheldCompanion.Views; -using SharpDX.Direct3D9; using System.Collections.Generic; using System.Management; diff --git a/HandheldCompanion/Misc/PnPDetails.cs b/HandheldCompanion/Misc/PnPDetails.cs index d54184883..2d117382f 100644 --- a/HandheldCompanion/Misc/PnPDetails.cs +++ b/HandheldCompanion/Misc/PnPDetails.cs @@ -148,8 +148,8 @@ public bool InstallNullDrivers(bool basedevice = true) public bool InstallCustomDriver(string driverName, bool basedevice = true) { PnPDevice device; - - switch(basedevice) + + switch (basedevice) { case true: device = GetBasePnPDevice(); diff --git a/HandheldCompanion/Misc/PowerProfile.cs b/HandheldCompanion/Misc/PowerProfile.cs index be84ac5f9..c3f862253 100644 --- a/HandheldCompanion/Misc/PowerProfile.cs +++ b/HandheldCompanion/Misc/PowerProfile.cs @@ -55,7 +55,7 @@ public string Description } public string FileName { get; set; } - public bool Default { get; set; } + public bool Default { get; set; } public bool DeviceDefault { get; set; } public Version Version { get; set; } = new(); diff --git a/HandheldCompanion/Misc/Profile.cs b/HandheldCompanion/Misc/Profile.cs index 5584163d7..73ef3d527 100644 --- a/HandheldCompanion/Misc/Profile.cs +++ b/HandheldCompanion/Misc/Profile.cs @@ -94,7 +94,7 @@ public partial class Profile : ICloneable, IComparable // power & graphics public Guid PowerProfile { get; set; } = new(); public int FramerateValue { get; set; } = 0; // default RTSS value - public bool GPUScaling { get; set;} = false; + public bool GPUScaling { get; set; } = false; public int ScalingMode { get; set; } = 0; // default AMD value public bool RSREnabled { get; set; } = false; public int RSRSharpness { get; set; } = 20; // default AMD value @@ -172,7 +172,7 @@ public string GetFileName() if (!Default) name = System.IO.Path.GetFileNameWithoutExtension(Executable); - + // sub profile files will be of form "executable - #guid" if (IsSubProfile) name = $"{name} - {Guid}"; diff --git a/HandheldCompanion/Platforms/LibreHardwareMonitor.cs b/HandheldCompanion/Platforms/LibreHardwareMonitor.cs index 7ab9dacea..0b69b4348 100644 --- a/HandheldCompanion/Platforms/LibreHardwareMonitor.cs +++ b/HandheldCompanion/Platforms/LibreHardwareMonitor.cs @@ -136,7 +136,7 @@ private float HandleCPU_Clock(ISensor sensor, float currentHighest) private void HandleCPU_Power(ISensor sensor) { - switch(sensor.Name) + switch (sensor.Name) { case "Package": case "CPU Package": diff --git a/HandheldCompanion/Platforms/RTSS.cs b/HandheldCompanion/Platforms/RTSS.cs index e2eba00aa..7ad726f3d 100644 --- a/HandheldCompanion/Platforms/RTSS.cs +++ b/HandheldCompanion/Platforms/RTSS.cs @@ -225,7 +225,7 @@ private void Watchdog_Elapsed(object? sender, ElapsedEventArgs e) // force "Show On-Screen Display" to On SetFlags(~RTSSHOOKSFLAG_OSD_VISIBLE, RTSSHOOKSFLAG_OSD_VISIBLE); } - catch(DllNotFoundException) + catch (DllNotFoundException) { } // force "On-Screen Display Support" to On diff --git a/HandheldCompanion/Platforms/Steam.cs b/HandheldCompanion/Platforms/Steam.cs index 027fce983..6a8e26636 100644 --- a/HandheldCompanion/Platforms/Steam.cs +++ b/HandheldCompanion/Platforms/Steam.cs @@ -80,7 +80,7 @@ public override bool Stop(bool kill = false) // restore files even if Steam is still running RestoreFiles(); - + return base.Stop(); } diff --git a/HandheldCompanion/Processors/AMDProcessor.cs b/HandheldCompanion/Processors/AMDProcessor.cs index ace8b616f..e39126e12 100644 --- a/HandheldCompanion/Processors/AMDProcessor.cs +++ b/HandheldCompanion/Processors/AMDProcessor.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Devices; using HandheldCompanion.Helpers; using HandheldCompanion.Processors.AMD; -using HandheldCompanion.Views; using System; using System.Threading; using System.Timers; @@ -174,7 +173,7 @@ public override void SetGPUClock(double clock, int result) { if (Monitor.TryEnter(IsBusy)) { - switch(family) + switch (family) { case RyzenFamily.FAM_VANGOGH: { @@ -207,7 +206,7 @@ public override void SetGPUClock(double clock, int result) // you can't restore default frequency on AMD GPUs if (clock == 12750) return; - + int error = RyzenAdj.set_gfx_clk(ry, (uint)clock); /* diff --git a/HandheldCompanion/Sensors/IMUCalibration.cs b/HandheldCompanion/Sensors/IMUCalibration.cs index 29182a3eb..68b72d26e 100644 --- a/HandheldCompanion/Sensors/IMUCalibration.cs +++ b/HandheldCompanion/Sensors/IMUCalibration.cs @@ -20,7 +20,7 @@ public class IMUCalibration public IMUCalibration() { } - + static IMUCalibration() { // initialiaze path diff --git a/HandheldCompanion/Targets/DualShock4Target.cs b/HandheldCompanion/Targets/DualShock4Target.cs index d0c030b18..a5e70abd6 100644 --- a/HandheldCompanion/Targets/DualShock4Target.cs +++ b/HandheldCompanion/Targets/DualShock4Target.cs @@ -4,7 +4,6 @@ using HandheldCompanion.Managers; using HandheldCompanion.Sensors; using HandheldCompanion.Utils; -using Nefarius.ViGEm.Client; using Nefarius.ViGEm.Client.Exceptions; using Nefarius.ViGEm.Client.Targets; using Nefarius.ViGEm.Client.Targets.DualShock4; diff --git a/HandheldCompanion/Targets/Xbox360Target.cs b/HandheldCompanion/Targets/Xbox360Target.cs index 6e01ecc1a..6879a73f5 100644 --- a/HandheldCompanion/Targets/Xbox360Target.cs +++ b/HandheldCompanion/Targets/Xbox360Target.cs @@ -3,7 +3,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using Nefarius.ViGEm.Client; using Nefarius.ViGEm.Client.Exceptions; using Nefarius.ViGEm.Client.Targets; using Nefarius.ViGEm.Client.Targets.Xbox360; diff --git a/HandheldCompanion/UI/UIGamepad.cs b/HandheldCompanion/UI/UIGamepad.cs index 32902f3d9..4545db55d 100644 --- a/HandheldCompanion/UI/UIGamepad.cs +++ b/HandheldCompanion/UI/UIGamepad.cs @@ -182,7 +182,7 @@ private void _gamepadFrame_PageRendered(object? sender, System.Timers.ElapsedEve case "SettingsMode0": case "SettingsMode1": - // quicktools + // quicktools case "quickhome": case "quicksettings": case "quickdevice": @@ -343,7 +343,7 @@ public Control FocusedElement(GamepadWindow window) return null; } - + // declare a DateTime variable to store the last time the function was called private DateTime lastCallTime; diff --git a/HandheldCompanion/ViewModels/Layout/Mappings/ButtonMappingViewModel.cs b/HandheldCompanion/ViewModels/Layout/Mappings/ButtonMappingViewModel.cs index 40a82a44d..c73d49482 100644 --- a/HandheldCompanion/ViewModels/Layout/Mappings/ButtonMappingViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Mappings/ButtonMappingViewModel.cs @@ -6,7 +6,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using HandheldCompanion.Views; using System; using System.Collections.Generic; using System.Linq; @@ -75,10 +74,10 @@ public int ModifierIndex if (Action is not null && value != ModifierIndex) { if (Action is KeyboardActions keyboardAction) - keyboardAction.Modifiers = (ModifierSet) value; + keyboardAction.Modifiers = (ModifierSet)value; else if (Action is MouseActions mouseAction) - mouseAction.Modifiers = (ModifierSet) value; + mouseAction.Modifiers = (ModifierSet)value; OnPropertyChanged(nameof(ModifierIndex)); } @@ -131,7 +130,7 @@ public int HapticModeIndex { if (Action is not null && value != HapticModeIndex) { - Action.HapticMode = (HapticMode) value; + Action.HapticMode = (HapticMode)value; OnPropertyChanged(nameof(HapticModeIndex)); } } @@ -144,7 +143,7 @@ public int HapticStrengthIndex { if (Action is not null && value != HapticStrengthIndex) { - Action.HapticStrength = (HapticStrength) value; + Action.HapticStrength = (HapticStrength)value; OnPropertyChanged(nameof(HapticStrengthIndex)); } } @@ -176,7 +175,8 @@ public ButtonMappingViewModel(ButtonStackViewModel parentStack, ButtonFlags butt _parentStack = parentStack; IsInitialMapping = isInitialMapping; - ButtonCommand = new DelegateCommand(() => { + ButtonCommand = new DelegateCommand(() => + { if (IsInitialMapping) _parentStack.AddMapping(); else @@ -193,7 +193,7 @@ public ButtonMappingViewModel(ButtonStackViewModel parentStack, ButtonFlags butt { _keyboardKeysTargets.Add(new MappingTargetViewModel { - Tag = (VirtualKeyCode) key, + Tag = (VirtualKeyCode)key, Content = EnumUtils.GetDescriptionFromEnumValue(key) }); } @@ -222,7 +222,7 @@ protected override void UpdateController(IController controller) protected override void ActionTypeChanged(ActionType? newActionType = null) { - var actionType = newActionType ?? (ActionType) ActionTypeIndex; + var actionType = newActionType ?? (ActionType)ActionTypeIndex; if (actionType == ActionType.Disabled) { if (Action is not null) Delete(); @@ -231,7 +231,7 @@ protected override void ActionTypeChanged(ActionType? newActionType = null) return; } - var fallbackPressType = (PressType) _pressTypeFallbackIndex; + var fallbackPressType = (PressType)_pressTypeFallbackIndex; if (actionType == ActionType.Button) { @@ -245,7 +245,7 @@ protected override void ActionTypeChanged(ActionType? newActionType = null) var targets = new List(); MappingTargetViewModel? matchingTargetVm = null; - foreach(var button in controller.GetTargetButtons()) + foreach (var button in controller.GetTargetButtons()) { var mappingTargetVm = new MappingTargetViewModel { @@ -254,7 +254,7 @@ protected override void ActionTypeChanged(ActionType? newActionType = null) }; targets.Add(mappingTargetVm); - if(button == ((ButtonActions)Action).Button) + if (button == ((ButtonActions)Action).Button) { matchingTargetVm = mappingTargetVm; } diff --git a/HandheldCompanion/ViewModels/Layout/Mappings/ButtonStackViewModel.cs b/HandheldCompanion/ViewModels/Layout/Mappings/ButtonStackViewModel.cs index 37d68d846..ec0c7813a 100644 --- a/HandheldCompanion/ViewModels/Layout/Mappings/ButtonStackViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Mappings/ButtonStackViewModel.cs @@ -55,7 +55,7 @@ public override void Dispose() } ButtonMappings.Clear(); - + base.Dispose(); } @@ -105,7 +105,7 @@ private void UpdateMapping(Layout layout) // Model update should not go through as on update the entire stack is being recreated // If updateToModel is true, ButtonMappings will end up empty // => UpdateFromMapping() => UpdateMapping(layout) => UpdateFromMapping() - newMapping.SetAction(action, false); + newMapping.SetAction(action, false); } ButtonMappings.ReplaceWith(newMappings); diff --git a/HandheldCompanion/ViewModels/Layout/Mappings/GyroMappingViewModel.cs b/HandheldCompanion/ViewModels/Layout/Mappings/GyroMappingViewModel.cs index 6f9b50dc0..1119c07e9 100644 --- a/HandheldCompanion/ViewModels/Layout/Mappings/GyroMappingViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Mappings/GyroMappingViewModel.cs @@ -14,7 +14,7 @@ namespace HandheldCompanion.ViewModels { public class GyroMappingViewModel : MappingViewModel { - private static readonly HashSet _unsupportedMouseActionTypes = + private static readonly HashSet _unsupportedMouseActionTypes = [ MouseActionsType.LeftButton, MouseActionsType.RightButton, @@ -212,7 +212,7 @@ public int MotionModeIndex { if (Action is GyroActions gyroAction && value != MotionModeIndex) { - gyroAction.MotionMode = (MotionMode) value; + gyroAction.MotionMode = (MotionMode)value; OnPropertyChanged(nameof(MotionModeIndex)); } } @@ -261,7 +261,7 @@ private void InputsManager_TriggerUpdated(string listener, InputsChord inputs, I { if (Action is not GyroActions gyroAction) return; - + switch (listener) { case "shortcutProfilesPage@": @@ -271,7 +271,7 @@ private void InputsManager_TriggerUpdated(string listener, InputsChord inputs, I // update hotkey UI _gyroHotkey.inputsChord.State = gyroAction.MotionTrigger.Clone() as ButtonState; _gyroHotkey.DrawInput(); - } + } break; } @@ -292,7 +292,7 @@ protected override void UpdateController(IController controller) protected override void ActionTypeChanged(ActionType? newActionType = null) { - var actionType = newActionType ?? (ActionType) ActionTypeIndex; + var actionType = newActionType ?? (ActionType)ActionTypeIndex; if (actionType == ActionType.Disabled) { if (Action is not null) Delete(); @@ -318,7 +318,7 @@ protected override void ActionTypeChanged(ActionType? newActionType = null) // Build Targets var targets = new List(); - + MappingTargetViewModel? matchingTargetVm = null; foreach (var axis in controller.GetTargetAxis()) { @@ -410,7 +410,7 @@ protected override void Delete() protected override void UpdateMapping(Layout layout) { - if (layout.GyroLayout.TryGetValue((AxisLayoutFlags) Value, out var newAction)) + if (layout.GyroLayout.TryGetValue((AxisLayoutFlags)Value, out var newAction)) { _gyroHotkey.inputsChord.State = ((GyroActions)newAction).MotionTrigger.Clone() as ButtonState; _gyroHotkey.DrawInput(); diff --git a/HandheldCompanion/ViewModels/Layout/Mappings/MappingViewModel.cs b/HandheldCompanion/ViewModels/Layout/Mappings/MappingViewModel.cs index 8caf27116..f659d8ddb 100644 --- a/HandheldCompanion/ViewModels/Layout/Mappings/MappingViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Mappings/MappingViewModel.cs @@ -28,15 +28,15 @@ public abstract class MappingViewModel : BaseViewModel public int ActionTypeIndex { - get => Action is not null ? (int) Action.actionType : 0; + get => Action is not null ? (int)Action.actionType : 0; set { if (value != ActionTypeIndex) { if (Action is not null) - Action.actionType = (ActionType) value; + Action.actionType = (ActionType)value; - ActionTypeChanged((ActionType) value); + ActionTypeChanged((ActionType)value); } } } @@ -145,7 +145,7 @@ public bool IsSupported // Purely UI related properties, they should NOT update the Layout // Avoid unnecessary save/update calls - protected HashSet ExcludedUpdateProperties = + protected HashSet ExcludedUpdateProperties = [ nameof(Name), nameof(Glyph), @@ -221,7 +221,7 @@ public virtual void SetAction(IActions newAction, bool updateToModel = true) Action = newAction; _updateToModel = updateToModel; - + ActionTypeChanged(); // Includes full UI update // Reset update to model diff --git a/HandheldCompanion/ViewModels/Layout/Pages/ButtonsPageViewModel.cs b/HandheldCompanion/ViewModels/Layout/Pages/ButtonsPageViewModel.cs index 1ded11c6a..cdb089f26 100644 --- a/HandheldCompanion/ViewModels/Layout/Pages/ButtonsPageViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Pages/ButtonsPageViewModel.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Controllers; using HandheldCompanion.Devices; using HandheldCompanion.Inputs; -using HandheldCompanion.Views; using System.Collections.Generic; using System.Linq; @@ -13,7 +12,7 @@ public class ButtonsPageViewModel : ILayoutPageViewModel private static readonly List _BUMPERS = [ButtonFlags.L1, ButtonFlags.R1]; private static readonly List _MENU = [ButtonFlags.Back, ButtonFlags.Start, ButtonFlags.Special, ButtonFlags.Special2]; private static readonly List _BACKGRIPS = [ButtonFlags.L4, ButtonFlags.L5, ButtonFlags.R4, ButtonFlags.R5]; - + private bool _isABXYEnabled; public bool IsABXYEnabled { diff --git a/HandheldCompanion/ViewModels/Layout/Pages/GyroPageViewModel.cs b/HandheldCompanion/ViewModels/Layout/Pages/GyroPageViewModel.cs index 5aa437db6..a56bb3b37 100644 --- a/HandheldCompanion/ViewModels/Layout/Pages/GyroPageViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Pages/GyroPageViewModel.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Controllers; using HandheldCompanion.Devices; using HandheldCompanion.Inputs; -using HandheldCompanion.Views; using System.Collections.Generic; namespace HandheldCompanion.ViewModels @@ -14,7 +13,7 @@ public class GyroPageViewModel : ILayoutPageViewModel public GyroPageViewModel() { - foreach(var layoutFlag in _pageLayoutFlags) + foreach (var layoutFlag in _pageLayoutFlags) { GyroMappings.Add(new GyroMappingViewModel(layoutFlag)); } diff --git a/HandheldCompanion/ViewModels/Layout/Pages/TriggersPageViewModel.cs b/HandheldCompanion/ViewModels/Layout/Pages/TriggersPageViewModel.cs index 312f42edb..e45a2c2c1 100644 --- a/HandheldCompanion/ViewModels/Layout/Pages/TriggersPageViewModel.cs +++ b/HandheldCompanion/ViewModels/Layout/Pages/TriggersPageViewModel.cs @@ -46,8 +46,8 @@ public bool IsRightTriggerEnabled public TriggersPageViewModel() { - foreach (var flag in _leftTrigger) - { + foreach (var flag in _leftTrigger) + { LeftTriggerMappings.Add(new ButtonStackViewModel(flag)); } diff --git a/HandheldCompanion/ViewModels/Pages/PerformancePageViewModel.cs b/HandheldCompanion/ViewModels/Pages/PerformancePageViewModel.cs index 58acc7b52..3828b7f04 100644 --- a/HandheldCompanion/ViewModels/Pages/PerformancePageViewModel.cs +++ b/HandheldCompanion/ViewModels/Pages/PerformancePageViewModel.cs @@ -57,7 +57,7 @@ public PowerProfile SelectedPreset { _selectedPreset = value; if (!IsQuickTools) - { + { _selectedPresetIndex = ProfilePickerItems.IndexOf(ProfilePickerItems.First(p => p.LinkedPresetId == _selectedPreset.Guid)); } OnPropertyChanged(string.Empty); // Refresh all properties @@ -405,7 +405,7 @@ public int SelectedPresetIndex // Ensure the index is within the bounds of the collection if (value != _selectedPresetIndex && value >= 0 && value < ProfilePickerItems.Count) { - _selectedPresetIndex = value; + _selectedPresetIndex = value; _selectedPreset = PowerProfileManager.GetProfile(ProfilePickerItems[_selectedPresetIndex].LinkedPresetId.Value); OnPropertyChanged(string.Empty); @@ -489,14 +489,14 @@ public PerformancePageViewModel(bool isQuickTools) PowerProfileManager.Updated += PowerProfileManager_Updated; PowerProfileManager.Deleted += PowerProfileManager_Deleted; - PropertyChanged += - (sender, e) => + PropertyChanged += + (sender, e) => { if (SelectedPreset is null) return; // TODO: Get rid of UI update here of fan graph UI dependency - if(!IsQuickTools) + if (!IsQuickTools) { Application.Current.Dispatcher.Invoke(() => { @@ -541,7 +541,7 @@ public PerformancePageViewModel(bool isQuickTools) PowerProfileManager.UpdateOrCreateProfile(powerProfile, UpdateSource.Creation); }); - DeletePresetCommand = new DelegateCommand(async () => + DeletePresetCommand = new DelegateCommand(async () => { Task dialogTask = new Dialog(isQuickTools ? OverlayQuickTools.GetCurrent() : MainWindow.GetCurrent()) { @@ -595,7 +595,7 @@ public PerformancePageViewModel(bool isQuickTools) // Update the corresponding item in ProfilePickerItems var selectedItem = ProfilePickerItems.FirstOrDefault(item => item.LinkedPresetId == SelectedPreset.Guid); if (selectedItem != null) - { + { PresetName = ModifyPresetName; PresetDescription = ModifyPresetDescription; @@ -644,9 +644,9 @@ public PerformancePageViewModel(bool isQuickTools) } #endregion - } - - + } + + public override void Dispose() { SettingsManager.SettingValueChanged -= SettingsManager_SettingsValueChanged; @@ -673,7 +673,7 @@ public override void Dispose() private void SettingsManager_SettingsValueChanged(string name, object value) { - switch(name) + switch (name) { case "ConfigurableTDPOverride": case "ConfigurableTDPOverrideDown": @@ -769,8 +769,8 @@ private void ActualValues_CollectionChanged(object? sender, NotifyCollectionChan for (int idx = 0; idx < _fanGraphLineSeries.ActualValues.Count; idx++) SelectedPreset.FanProfile.fanSpeeds[idx] = (double)_fanGraphLineSeries.ActualValues[idx]; - } - + } + private void ChartMovePoint(Point point) { if (_storedChartPoint is not null) diff --git a/HandheldCompanion/ViewModels/Pages/QuickSuspenderPageViewModel.cs b/HandheldCompanion/ViewModels/Pages/QuickSuspenderPageViewModel.cs index 2310ec90f..84f409be9 100644 --- a/HandheldCompanion/ViewModels/Pages/QuickSuspenderPageViewModel.cs +++ b/HandheldCompanion/ViewModels/Pages/QuickSuspenderPageViewModel.cs @@ -3,7 +3,6 @@ using HandheldCompanion.Managers; using System.Collections.ObjectModel; using System.Linq; -using System.Windows; namespace HandheldCompanion.ViewModels { diff --git a/HandheldCompanion/ViewModels/ProcessExViewModel.cs b/HandheldCompanion/ViewModels/ProcessExViewModel.cs index 0291b9043..3c120ce00 100644 --- a/HandheldCompanion/ViewModels/ProcessExViewModel.cs +++ b/HandheldCompanion/ViewModels/ProcessExViewModel.cs @@ -42,12 +42,12 @@ public bool IsSuspended public bool FullScreenOptimization { get => !Process.FullScreenOptimization; - set {} // empty set to allow binding to ToggleSwitch.IsOn + set { } // empty set to allow binding to ToggleSwitch.IsOn } public bool HighDPIAware { get => !Process.HighDPIAware; - set {} // empty set to allow binding to ToggleSwitch.IsOn + set { } // empty set to allow binding to ToggleSwitch.IsOn } public ICommand KillProcessCommand { get; private set; } @@ -84,7 +84,7 @@ private void ProcessRefreshed(object? sender, EventArgs e) public override void Dispose() { - if (_process is not null) + if (_process is not null) _process.Refreshed -= ProcessRefreshed; base.Dispose(); diff --git a/HandheldCompanion/Views/Pages/AboutPage.xaml.cs b/HandheldCompanion/Views/Pages/AboutPage.xaml.cs index 97f3b8a4e..6b66f7c00 100644 --- a/HandheldCompanion/Views/Pages/AboutPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/AboutPage.xaml.cs @@ -1,11 +1,6 @@ -using HandheldCompanion.Devices; using HandheldCompanion.ViewModels; -using Nefarius.Utilities.DeviceManagement.PnP; -using System; using System.Diagnostics; -using System.Windows; using System.Windows.Controls; -using System.Windows.Media.Imaging; using System.Windows.Navigation; namespace HandheldCompanion.Views.Pages; diff --git a/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs b/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs index bee5154c9..535243bfa 100644 --- a/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs @@ -3,7 +3,6 @@ using HandheldCompanion.Managers; using HandheldCompanion.Misc; using HandheldCompanion.Utils; -using HandheldCompanion.Views.Windows; using iNKORE.UI.WPF.Modern.Controls; using System; using System.Threading.Tasks; @@ -206,10 +205,10 @@ private void ControllerManager_Working(int status) { default: case ContentDialogResult.Primary: - Toggle_ControllerManagement.IsOn = false; + Toggle_ControllerManagement.IsOn = false; break; case ContentDialogResult.None: - Toggle_ControllerManagement.IsOn = true; + Toggle_ControllerManagement.IsOn = true; break; } } @@ -287,7 +286,7 @@ private void ControllerRefresh() bool notmuted = !isHidden && hasVirtual && (!isSteam || (isSteam && !isMuted)); HintsNotMuted.Visibility = notmuted ? Visibility.Visible : Visibility.Collapsed; - Hints.Visibility = (HintsNoPhysicalConnected.Visibility == Visibility.Visible || + Hints.Visibility = (HintsNoPhysicalConnected.Visibility == Visibility.Visible || HintsHIDManagedByProfile.Visibility == Visibility.Visible || HintsNeptuneHidden.Visibility == Visibility.Visible || HintsNotMuted.Visibility == Visibility.Visible) ? Visibility.Visible : Visibility.Collapsed; diff --git a/HandheldCompanion/Views/Pages/DevicePage.xaml.cs b/HandheldCompanion/Views/Pages/DevicePage.xaml.cs index 73d934c8a..6a44d31cd 100644 --- a/HandheldCompanion/Views/Pages/DevicePage.xaml.cs +++ b/HandheldCompanion/Views/Pages/DevicePage.xaml.cs @@ -45,7 +45,7 @@ public DevicePage() SetControlEnabledAndVisible(LEDWheel, LEDLevel.Wheel); SetControlEnabledAndVisible(LEDGradient, LEDLevel.Gradient); SetControlEnabledAndVisible(LEDAmbilight, LEDLevel.Ambilight); - + } public DevicePage(string? Tag) : this() @@ -349,10 +349,10 @@ private void MainColorPicker_ColorChanged(object sender, RoutedEventArgs e) if (!IsLoaded) return; - + SettingsManager.SetProperty("LEDMainColor", prevMainColor.ToString()); } - + private void SecondColorPicker_ColorChanged(object sender, RoutedEventArgs e) { // workaround: NotifyableColor is raising ColorChanged event infinitely @@ -452,7 +452,7 @@ private void ui_button_calibrate_Click(object sender, RoutedEventArgs e) // update dependencies SensorFamily sensorFamily = (SensorFamily)cB_SensorSelection.SelectedIndex; - switch(sensorFamily) + switch (sensorFamily) { case SensorFamily.Windows: case SensorFamily.SerialUSBIMU: @@ -522,7 +522,7 @@ private void SliderLeftJoystickDeadzone_ValueChanged(object sender, RoutedProper if (!IsLoaded) return; - SapientiaUsb.SetStickCustomDeadzone(LegionGo.LeftJoyconIndex, (int) value - 1); + SapientiaUsb.SetStickCustomDeadzone(LegionGo.LeftJoyconIndex, (int)value - 1); } private void SliderLeftAutoSleepTime_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) diff --git a/HandheldCompanion/Views/Pages/LayoutPage.xaml.cs b/HandheldCompanion/Views/Pages/LayoutPage.xaml.cs index ab1b577b9..31cf7eee9 100644 --- a/HandheldCompanion/Views/Pages/LayoutPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/LayoutPage.xaml.cs @@ -1,7 +1,5 @@ -using HandheldCompanion.Actions; using HandheldCompanion.Controllers; using HandheldCompanion.Controls; -using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Misc; using HandheldCompanion.Utils; @@ -82,7 +80,7 @@ public void Initialize() }; // TODO: Temporary until conversion to MVVM - foreach(var template in LayoutManager.Templates) + foreach (var template in LayoutManager.Templates) { LayoutManager_Updated(template); } diff --git a/HandheldCompanion/Views/Pages/NotificationsPage.xaml.cs b/HandheldCompanion/Views/Pages/NotificationsPage.xaml.cs index a0fdadb86..c4d736afb 100644 --- a/HandheldCompanion/Views/Pages/NotificationsPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/NotificationsPage.xaml.cs @@ -59,7 +59,7 @@ public void Page_Closed() Application.Current.Dispatcher.Invoke(() => { IEnumerable notifications = Notifications.Children.OfType(); - foreach(IHint hint in notifications) + foreach (IHint hint in notifications) hint?.Stop(); }); } diff --git a/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs b/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs index 243798961..b408ae32b 100644 --- a/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs @@ -290,7 +290,7 @@ private void Toggle_FaceCamera_Toggled(object sender, RoutedEventArgs e) private void Slider_RestingPitch_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { - MainWindow.overlayModel.DesiredAngleDeg.X = -1* Slider_RestingPitch.Value; + MainWindow.overlayModel.DesiredAngleDeg.X = -1 * Slider_RestingPitch.Value; if (!IsLoaded) return; diff --git a/HandheldCompanion/Views/Pages/Profiles/SettingsMode0.xaml.cs b/HandheldCompanion/Views/Pages/Profiles/SettingsMode0.xaml.cs index eda3b3fc7..7ff4a1736 100644 --- a/HandheldCompanion/Views/Pages/Profiles/SettingsMode0.xaml.cs +++ b/HandheldCompanion/Views/Pages/Profiles/SettingsMode0.xaml.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Devices; using HandheldCompanion.Inputs; using HandheldCompanion.Managers; -using HandheldCompanion.Sensors; using HandheldCompanion.Utils; using System; using System.Collections.Generic; diff --git a/HandheldCompanion/Views/Pages/ProfilesPage.xaml.cs b/HandheldCompanion/Views/Pages/ProfilesPage.xaml.cs index ec0ea930c..bac4941bd 100644 --- a/HandheldCompanion/Views/Pages/ProfilesPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/ProfilesPage.xaml.cs @@ -51,7 +51,7 @@ public ProfilesPage(string Tag) : this() public ProfilesPage() { InitializeComponent(); - + // manage events ProfileManager.Deleted += ProfileDeleted; ProfileManager.Updated += ProfileUpdated; @@ -1020,7 +1020,7 @@ public void SubmitProfile(UpdateSource source = UpdateSource.ProfilesPage) { if (selectedProfile is null) return; - + LogManager.LogInformation($"Submitting profile in ProfilesPage: {selectedProfile} - is Sub Profile? {selectedProfile.IsSubProfile}"); switch (source) @@ -1144,7 +1144,7 @@ private void GPUScalingComboBox_SelectionChanged(object sender, SelectionChanged { selectedProfile.ScalingMode = GPUScalingComboBox.SelectedIndex; } - + UpdateProfile(); } diff --git a/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs b/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs index a481b6a24..be807d4a2 100644 --- a/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs @@ -1,24 +1,17 @@ -using HandheldCompanion.Controllers; -using HandheldCompanion.Devices; using HandheldCompanion.Managers; using HandheldCompanion.Managers.Desktop; using HandheldCompanion.Misc; using HandheldCompanion.Platforms; using iNKORE.UI.WPF.Modern; -using iNKORE.UI.WPF.Modern.Controls; using iNKORE.UI.WPF.Modern.Controls.Helpers; using iNKORE.UI.WPF.Modern.Helpers.Styles; -using Nefarius.Utilities.DeviceManagement.PnP; using System; using System.Collections.Generic; using System.Globalization; using System.Threading; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Media; using static HandheldCompanion.Managers.UpdateManager; -using static HandheldCompanion.Utils.DeviceUtils; using Page = System.Windows.Controls.Page; namespace HandheldCompanion.Views.Pages; @@ -349,7 +342,7 @@ private void cB_Language_SelectionChanged(object? sender, SelectionChangedEventA if (culture.Name == CultureInfo.CurrentCulture.Name) return; - _= new Dialog(MainWindow.GetCurrent()) + _ = new Dialog(MainWindow.GetCurrent()) { Title = Properties.Resources.SettingsPage_AppLanguageWarning, Content = Properties.Resources.SettingsPage_AppLanguageWarningDesc, diff --git a/HandheldCompanion/Views/QuickPages/QuickHomePage.xaml.cs b/HandheldCompanion/Views/QuickPages/QuickHomePage.xaml.cs index ac6592e32..81f9a4b80 100644 --- a/HandheldCompanion/Views/QuickPages/QuickHomePage.xaml.cs +++ b/HandheldCompanion/Views/QuickPages/QuickHomePage.xaml.cs @@ -128,7 +128,7 @@ private void SliderBrightness_ValueChanged(object sender, RoutedPropertyChangedE if (brightnessLock) return; - MultimediaManager.SetBrightness(SliderBrightness.Value); + MultimediaManager.SetBrightness(SliderBrightness.Value); } private void SliderVolume_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) @@ -169,11 +169,11 @@ private void SettingsManager_SettingValueChanged(string name, object value) switch (name) { case "OnScreenDisplayLevel": - { - var overlayLevel = Convert.ToInt16(value); - t_CurrentOverlayLevel.Text = onScreenDisplayLevels[overlayLevel]; - } - break; + { + var overlayLevel = Convert.ToInt16(value); + t_CurrentOverlayLevel.Text = onScreenDisplayLevels[overlayLevel]; + } + break; } }); } diff --git a/HandheldCompanion/Views/QuickPages/QuickProfilesPage.xaml.cs b/HandheldCompanion/Views/QuickPages/QuickProfilesPage.xaml.cs index 36ac46b76..4ab633bee 100644 --- a/HandheldCompanion/Views/QuickPages/QuickProfilesPage.xaml.cs +++ b/HandheldCompanion/Views/QuickPages/QuickProfilesPage.xaml.cs @@ -108,7 +108,7 @@ public QuickProfilesPage() }; // create icon - var icon = new FontIcon() { Glyph = mode.ToGlyph() }; + var icon = new FontIcon() { Glyph = mode.ToGlyph() }; if (!string.IsNullOrEmpty(icon.Glyph)) simpleStackPanel.Children.Add(icon); @@ -941,11 +941,11 @@ private void cb_SubProfiles_SelectionChanged(object sender, SelectionChangedEven // wait until lock is released if (updateLock) return; - + // return if combobox selected item is null if (cb_SubProfiles.SelectedIndex == -1) return; - + LogManager.LogInformation($"Subprofile changed in Quick Settings - ind: {cb_SubProfiles.SelectedIndex} - subprofile: {cb_SubProfiles.SelectedItem}"); selectedProfile = (Profile)cb_SubProfiles.SelectedItem; UpdateProfile(); diff --git a/HandheldCompanion/Views/Windows/MainWindow.xaml.cs b/HandheldCompanion/Views/Windows/MainWindow.xaml.cs index d16ab15dc..63adca0cf 100644 --- a/HandheldCompanion/Views/Windows/MainWindow.xaml.cs +++ b/HandheldCompanion/Views/Windows/MainWindow.xaml.cs @@ -139,8 +139,8 @@ public MainWindow(FileVersionInfo _fileVersionInfo, Assembly CurrentAssembly) notifyIcon.DoubleClick += (sender, e) => { SwapWindowState(); }; AddNotifyIconItem(Properties.Resources.MainWindow_MainWindow); - AddNotifyIconItem(Properties.Resources.MainWindow_QuickTools); - + AddNotifyIconItem(Properties.Resources.MainWindow_QuickTools); + AddNotifyIconSeparator(); AddNotifyIconItem(Properties.Resources.MainWindow_Exit); @@ -159,34 +159,34 @@ public MainWindow(FileVersionInfo _fileVersionInfo, Assembly CurrentAssembly) // initialize device SplashScreen.LoadingSequence.Text = "Initializing device..."; CurrentDevice = IDevice.GetCurrent(); - CurrentDevice.PullSensors(); - + CurrentDevice.PullSensors(); + string currentDeviceType = CurrentDevice.GetType().Name; switch (currentDeviceType) - { - /* - * workaround for Bosch BMI320/BMI323 (as of 06/20/2023) - * todo: check if still needed with Bosch G-sensor Driver V1.0.1.7 - * https://dlcdnets.asus.com/pub/ASUS/IOTHMD/Image/Driver/Chipset/34644/BoschG-sensor_ROG_Bosch_Z_V1.0.1.7_34644.exe?model=ROG%20Ally%20(2023) - - case "AYANEOAIRPlus": - case "ROGAlly": - { - LogManager.LogInformation("Restarting: {0}", CurrentDevice.InternalSensorName); - - if (CurrentDevice.RestartSensor()) - { - // give the device some breathing space once restarted - Thread.Sleep(500); - - LogManager.LogInformation("Successfully restarted: {0}", CurrentDevice.InternalSensorName); - } - else - LogManager.LogError("Failed to restart: {0}", CurrentDevice.InternalSensorName); - } - break; - */ - + { + /* + * workaround for Bosch BMI320/BMI323 (as of 06/20/2023) + * todo: check if still needed with Bosch G-sensor Driver V1.0.1.7 + * https://dlcdnets.asus.com/pub/ASUS/IOTHMD/Image/Driver/Chipset/34644/BoschG-sensor_ROG_Bosch_Z_V1.0.1.7_34644.exe?model=ROG%20Ally%20(2023) + + case "AYANEOAIRPlus": + case "ROGAlly": + { + LogManager.LogInformation("Restarting: {0}", CurrentDevice.InternalSensorName); + + if (CurrentDevice.RestartSensor()) + { + // give the device some breathing space once restarted + Thread.Sleep(500); + + LogManager.LogInformation("Successfully restarted: {0}", CurrentDevice.InternalSensorName); + } + else + LogManager.LogError("Failed to restart: {0}", CurrentDevice.InternalSensorName); + } + break; + */ + case "SteamDeck": { // prevent Steam Deck controller from being hidden by default @@ -272,7 +272,7 @@ public MainWindow(FileVersionInfo _fileVersionInfo, Assembly CurrentAssembly) private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { - switch(msg) + switch (msg) { case WM_DISPLAYCHANGE: case WM_DEVICECHANGE: @@ -424,24 +424,24 @@ private void loadPages() devicePage = new DevicePage("device"); profilesPage = new ProfilesPage("profiles"); - settingsPage = new SettingsPage("settings"); - + settingsPage = new SettingsPage("settings"); + overlayPage = new OverlayPage("overlay"); - hotkeysPage = new HotkeysPage("hotkeys"); - + hotkeysPage = new HotkeysPage("hotkeys"); + notificationsPage = new NotificationsPage("notifications"); notificationsPage.StatusChanged += NotificationsPage_LayoutUpdated; // store pages _pages.Add("ControllerPage", controllerPage); - _pages.Add("DevicePage", devicePage); - - _pages.Add("ProfilesPage", profilesPage); - + _pages.Add("DevicePage", devicePage); + + _pages.Add("ProfilesPage", profilesPage); + _pages.Add("OverlayPage", overlayPage); _pages.Add("SettingsPage", settingsPage); - _pages.Add("HotkeysPage", hotkeysPage); - + _pages.Add("HotkeysPage", hotkeysPage); + _pages.Add("NotificationsPage", notificationsPage); } diff --git a/HandheldCompanion/Views/Windows/OverlayModel.xaml.cs b/HandheldCompanion/Views/Windows/OverlayModel.xaml.cs index 4dc0aecfe..85f564351 100644 --- a/HandheldCompanion/Views/Windows/OverlayModel.xaml.cs +++ b/HandheldCompanion/Views/Windows/OverlayModel.xaml.cs @@ -1,5 +1,4 @@ using HandheldCompanion.Controllers; -using HandheldCompanion.Devices; using HandheldCompanion.Helpers; using HandheldCompanion.Inputs; using HandheldCompanion.Managers; @@ -10,12 +9,10 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Threading.Tasks; using System.Timers; using System.Windows; using System.Windows.Media; using System.Windows.Media.Media3D; -using NumQuaternion = System.Numerics.Quaternion; using NumVector3 = System.Numerics.Vector3; namespace HandheldCompanion.Views.Windows; @@ -76,10 +73,10 @@ private void SettingsManager_SettingValueChanged(string name, object value) { case "OverlayControllerMotion": MotionActivated = Convert.ToBoolean(value); - + // On change of motion activated, reset object alignment ResetModelPose(); - + break; } });