diff --git a/ControllerCommon/Devices/AYANEO2021.cs b/ControllerCommon/Devices/AYANEO2021.cs index 1d3adb975..d7d0beb17 100644 --- a/ControllerCommon/Devices/AYANEO2021.cs +++ b/ControllerCommon/Devices/AYANEO2021.cs @@ -1,5 +1,4 @@ -using static ControllerCommon.OneEuroFilter; -using WindowsInput.Events; +using WindowsInput.Events; namespace ControllerCommon.Devices { diff --git a/ControllerCommon/Devices/AYANEONEXT.cs b/ControllerCommon/Devices/AYANEONEXT.cs index 423337918..23bcd8b02 100644 --- a/ControllerCommon/Devices/AYANEONEXT.cs +++ b/ControllerCommon/Devices/AYANEONEXT.cs @@ -1,5 +1,4 @@ using WindowsInput.Events; -using static ControllerCommon.OneEuroFilter; namespace ControllerCommon.Devices { diff --git a/ControllerCommon/Devices/Device.cs b/ControllerCommon/Devices/Device.cs index 52d13d085..87eec3635 100644 --- a/ControllerCommon/Devices/Device.cs +++ b/ControllerCommon/Devices/Device.cs @@ -5,7 +5,6 @@ using System.Numerics; using Windows.Devices.Sensors; using WindowsInput.Events; -using WindowsInput.Events.Sources; using static ControllerCommon.OneEuroFilter; using static ControllerCommon.Utils.DeviceUtils; @@ -66,45 +65,45 @@ public static Device GetDefault() switch (ManufacturerName) { case "AYANEO": - { - switch (ProductName) { - case "AYANEO 2021": - case "AYANEO 2021 Pro": - case "AYANEO 2021 Pro Retro Power": - device = new AYANEO2021(); - break; - case "NEXT Pro": - case "NEXT Advance": - case "NEXT": - device = new AYANEONEXT(); - break; + switch (ProductName) + { + case "AYANEO 2021": + case "AYANEO 2021 Pro": + case "AYANEO 2021 Pro Retro Power": + device = new AYANEO2021(); + break; + case "NEXT Pro": + case "NEXT Advance": + case "NEXT": + device = new AYANEONEXT(); + break; + } } - } - break; + break; case "ONE-NETBOOK TECHNOLOGY CO., LTD.": - { - switch (ProductName) { - case "ONE XPLAYER": - { - switch (Version) + switch (ProductName) + { + case "ONE XPLAYER": { - default: - case "V01": - device = new OneXPlayerMiniAMD(); - break; - case "1002-C": - device = new OneXPlayerMiniIntel(); - break; + switch (Version) + { + default: + case "V01": + device = new OneXPlayerMiniAMD(); + break; + case "1002-C": + device = new OneXPlayerMiniIntel(); + break; + } + break; } break; - } - break; + } } - } - break; + break; } if (device is null) diff --git a/ControllerCommon/Devices/OneXPlayerMiniAMD.cs b/ControllerCommon/Devices/OneXPlayerMiniAMD.cs index 76c4b53b5..09fd8eb0a 100644 --- a/ControllerCommon/Devices/OneXPlayerMiniAMD.cs +++ b/ControllerCommon/Devices/OneXPlayerMiniAMD.cs @@ -1,6 +1,5 @@ using System.Numerics; using WindowsInput.Events; -using static ControllerCommon.OneEuroFilter; namespace ControllerCommon.Devices { diff --git a/ControllerCommon/Devices/OneXPlayerMiniIntel.cs b/ControllerCommon/Devices/OneXPlayerMiniIntel.cs index a70c99d6e..c901db82b 100644 --- a/ControllerCommon/Devices/OneXPlayerMiniIntel.cs +++ b/ControllerCommon/Devices/OneXPlayerMiniIntel.cs @@ -1,6 +1,5 @@ using System.Numerics; using WindowsInput.Events; -using static ControllerCommon.OneEuroFilter; namespace ControllerCommon.Devices { diff --git a/ControllerCommon/Managers/ServiceManager.cs b/ControllerCommon/Managers/ServiceManager.cs index 44c8381f6..484e337f1 100644 --- a/ControllerCommon/Managers/ServiceManager.cs +++ b/ControllerCommon/Managers/ServiceManager.cs @@ -96,7 +96,7 @@ public bool Exists() string output = process.StandardOutput.ReadToEnd(); string error = CommonUtils.Between(output, "FAILED ", ":"); - switch(error) + switch (error) { case "1060": return false; diff --git a/ControllerCommon/Managers/SystemManager.cs b/ControllerCommon/Managers/SystemManager.cs index 76d8cee59..04231565c 100644 --- a/ControllerCommon/Managers/SystemManager.cs +++ b/ControllerCommon/Managers/SystemManager.cs @@ -135,7 +135,7 @@ private PnPDeviceEx GetDeviceEx(PnPDevice owner) return deviceEx; } - + public List GetDeviceExs() { devices.Clear(); diff --git a/ControllerCommon/TriggerInputs.cs b/ControllerCommon/TriggerInputs.cs index d0be89b73..683b68016 100644 --- a/ControllerCommon/TriggerInputs.cs +++ b/ControllerCommon/TriggerInputs.cs @@ -1,11 +1,5 @@ using SharpDX.XInput; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WindowsInput.Events; -using WindowsInput.Events.Sources; namespace ControllerCommon { @@ -28,7 +22,7 @@ public TriggerInputs(TriggerInputsType type, string value) this.type = type; this.raw = value; - switch(type) + switch (type) { default: case TriggerInputsType.Gamepad: @@ -52,7 +46,7 @@ public TriggerInputs(TriggerInputsType type, string value, string name) : this(t public string GetValue() { - switch(type) + switch (type) { default: case TriggerInputsType.Gamepad: diff --git a/ControllerService/ControllerService.cs b/ControllerService/ControllerService.cs index 71446d5b9..8e4b39da5 100644 --- a/ControllerService/ControllerService.cs +++ b/ControllerService/ControllerService.cs @@ -1,5 +1,4 @@ using ControllerCommon; -using ControllerCommon.Devices; using ControllerCommon.Managers; using ControllerCommon.Sensors; using ControllerCommon.Utils; diff --git a/ControllerService/Sensors/XInputAccelerometer.cs b/ControllerService/Sensors/XInputAccelerometer.cs index 622b5e922..88ca85616 100644 --- a/ControllerService/Sensors/XInputAccelerometer.cs +++ b/ControllerService/Sensors/XInputAccelerometer.cs @@ -1,7 +1,6 @@ using ControllerCommon.Managers; using ControllerCommon.Sensors; using ControllerCommon.Utils; -using System.Collections.Generic; using System.Numerics; using Windows.Devices.Sensors; using static ControllerCommon.Utils.DeviceUtils; diff --git a/ControllerService/Sensors/XInputGirometer.cs b/ControllerService/Sensors/XInputGirometer.cs index 8ca9c15cc..3edad304e 100644 --- a/ControllerService/Sensors/XInputGirometer.cs +++ b/ControllerService/Sensors/XInputGirometer.cs @@ -1,7 +1,6 @@ using ControllerCommon.Managers; using ControllerCommon.Sensors; using ControllerCommon.Utils; -using System.Collections.Generic; using System.Numerics; using Windows.Devices.Sensors; using static ControllerCommon.Utils.DeviceUtils; diff --git a/ControllerService/Sensors/XInputInclinometer.cs b/ControllerService/Sensors/XInputInclinometer.cs index 2d64b51f1..8531e5981 100644 --- a/ControllerService/Sensors/XInputInclinometer.cs +++ b/ControllerService/Sensors/XInputInclinometer.cs @@ -1,7 +1,6 @@ using ControllerCommon.Managers; using ControllerCommon.Sensors; using System; -using System.Collections.Generic; using System.Numerics; using Windows.Devices.Sensors; using static ControllerCommon.Utils.DeviceUtils; diff --git a/ControllerService/Targets/ViGEmTarget.cs b/ControllerService/Targets/ViGEmTarget.cs index 8fb5e1c34..b4ad91739 100644 --- a/ControllerService/Targets/ViGEmTarget.cs +++ b/ControllerService/Targets/ViGEmTarget.cs @@ -1,5 +1,4 @@ using ControllerCommon; -using ControllerCommon.Devices; using ControllerCommon.Managers; using ControllerCommon.Utils; using ControllerService.Sensors; diff --git a/HandheldCompanion/Managers/ControllerManager.cs b/HandheldCompanion/Managers/ControllerManager.cs index 9811c17a6..fa98292ed 100644 --- a/HandheldCompanion/Managers/ControllerManager.cs +++ b/HandheldCompanion/Managers/ControllerManager.cs @@ -1,5 +1,4 @@ using ControllerCommon; -using ControllerCommon.Managers; using HandheldCompanion.Views; using SharpDX.XInput; using System.Collections.Generic; diff --git a/HandheldCompanion/Managers/InputsManager.cs b/HandheldCompanion/Managers/InputsManager.cs index 0856df7b1..59e3c222c 100644 --- a/HandheldCompanion/Managers/InputsManager.cs +++ b/HandheldCompanion/Managers/InputsManager.cs @@ -6,19 +6,10 @@ using HandheldCompanion.Views; using SharpDX.XInput; using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; -using WindowsInput; using WindowsInput.Events; -using WindowsInput.Events.Sources; -using static ControllerCommon.TriggerInputs; -using Timer = System.Timers.Timer; namespace HandheldCompanion.Managers { @@ -158,7 +149,8 @@ private void M_GlobalHook_KeyEvent(object? sender, KeyEventArgs e) { TriggerBuffer.AddRange(Intercepted); break; - }else if (args.IsKeyUp) + } + else if (args.IsKeyUp) TriggerRaised?.Invoke(trigger, Triggers[trigger]); } else diff --git a/HandheldCompanion/Managers/ProcessManager.cs b/HandheldCompanion/Managers/ProcessManager.cs index fcc889880..c410f595a 100644 --- a/HandheldCompanion/Managers/ProcessManager.cs +++ b/HandheldCompanion/Managers/ProcessManager.cs @@ -1,5 +1,4 @@ -using ControllerCommon; -using ControllerCommon.Managers; +using ControllerCommon.Managers; using ControllerCommon.Utils; using ModernWpf.Controls; using System; @@ -11,11 +10,8 @@ using System.Management; using System.Runtime.InteropServices; using System.Threading; -using System.Threading.Tasks; -using System.Timers; using System.Windows; using System.Windows.Controls; -using System.Windows.Media; using System.Windows.Threading; using Windows.System.Diagnostics; using Brush = System.Windows.Media.Brush; @@ -252,7 +248,7 @@ private void ProcessResume_Click(object sender, RoutedEventArgs e) { processResume.IsEnabled = false; })); - + NtResumeProcess(Process.Handle); Thread.Sleep(500); // breathing ShowWindow(Process.MainWindowHandle, 9); @@ -322,7 +318,7 @@ public void Stop() if (!isRunning) return; - foreach(ProcessEx processEx in CurrentProcesses.Values) + foreach (ProcessEx processEx in CurrentProcesses.Values) processEx.Stop(); // stop processes monitor @@ -408,7 +404,7 @@ void ProcessCreated(object sender, EventArrivedEventArgs e) Process proc = Process.GetProcessById((int)processId); ProcessCreated(proc); } - catch(Exception) { } + catch (Exception) { } } void ProcessCreated(Process proc) diff --git a/HandheldCompanion/Views/Pages/AboutPage.xaml.cs b/HandheldCompanion/Views/Pages/AboutPage.xaml.cs index 522418bd0..9c9d73595 100644 --- a/HandheldCompanion/Views/Pages/AboutPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/AboutPage.xaml.cs @@ -1,6 +1,3 @@ -using ControllerCommon; -using ControllerCommon.Devices; -using ControllerCommon.Managers; using Nefarius.Utilities.DeviceManagement.PnP; using System; using System.Windows; diff --git a/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs b/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs index b57fc18a3..a3644c4ef 100644 --- a/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/ControllerPage.xaml.cs @@ -1,5 +1,4 @@ using ControllerCommon; -using ControllerCommon.Managers; using ControllerCommon.Utils; using HandheldCompanion.Managers; using System; diff --git a/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs b/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs index e5f933458..614aafedd 100644 --- a/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/OverlayPage.xaml.cs @@ -1,13 +1,9 @@ using ControllerCommon; using ControllerCommon.Utils; -using HandheldCompanion.Managers; -using HandheldCompanion.Models; -using HandheldCompanion.Views.Windows; using ModernWpf.Controls; using System.Windows; using System.Windows.Controls; using System.Windows.Media; -using GamepadButtonFlags = SharpDX.XInput.GamepadButtonFlags; using Page = System.Windows.Controls.Page; namespace HandheldCompanion.Views.Pages @@ -304,8 +300,8 @@ private void TriggerUpdated(string listener, TriggerInputs input) Properties.Settings.Default.OverlayTrackpadsTriggerType = (int)input.type; break; } - }); - + }); + Properties.Settings.Default.Save(); } diff --git a/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs b/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs index bf6c0b304..1b30d4f8f 100644 --- a/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs +++ b/HandheldCompanion/Views/Pages/SettingsPage.xaml.cs @@ -1,5 +1,4 @@ using ControllerCommon; -using ControllerCommon.Managers; using ControllerCommon.Utils; using HandheldCompanion.Managers; using ModernWpf; diff --git a/HandheldCompanion/Views/Windows/MainWindow.xaml.cs b/HandheldCompanion/Views/Windows/MainWindow.xaml.cs index 637bf940c..08bb04b8f 100644 --- a/HandheldCompanion/Views/Windows/MainWindow.xaml.cs +++ b/HandheldCompanion/Views/Windows/MainWindow.xaml.cs @@ -3,12 +3,10 @@ using ControllerCommon.Managers; using ControllerCommon.Utils; using HandheldCompanion.Managers; -using HandheldCompanion.Models; using HandheldCompanion.Views.Pages; using HandheldCompanion.Views.Windows; using ModernWpf.Controls; using Nefarius.Utilities.DeviceManagement.PnP; -using SharpDX.XInput; using System; using System.Collections.Generic; using System.ComponentModel; @@ -296,13 +294,13 @@ private void InputsManager_TriggerRaised(string listener, TriggerInputs input) switch (listener) { case "suspender": - suspender.UpdateVisibility(); + suspender.UpdateVisibility(); break; case "overlayGamepad": - overlay.UpdateControllerVisibility(); + overlay.UpdateControllerVisibility(); break; case "overlayTrackpads": - overlay.UpdateTrackpadsVisibility(); + overlay.UpdateTrackpadsVisibility(); break; } }); diff --git a/HandheldCompanion/Views/Windows/Overlay.xaml.cs b/HandheldCompanion/Views/Windows/Overlay.xaml.cs index d147beb74..3b6268000 100644 --- a/HandheldCompanion/Views/Windows/Overlay.xaml.cs +++ b/HandheldCompanion/Views/Windows/Overlay.xaml.cs @@ -1,12 +1,9 @@ using ControllerCommon; -using ControllerCommon.Devices; using ControllerCommon.Utils; using HandheldCompanion.Managers; using HandheldCompanion.Models; using SharpDX.XInput; using System; -using System.ComponentModel; -using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Windows; @@ -164,7 +161,7 @@ public void UpdateModel() break; case OverlayModelMode.Virtual: { - switch(HIDmode) + switch (HIDmode) { default: case HIDmode.DualShock4Controller: @@ -317,7 +314,7 @@ public void UpdateTrackpadsVisibility() visibility = Visibility.Collapsed; break; case Visibility.Collapsed: - case Visibility.Hidden: + case Visibility.Hidden: visibility = Visibility.Visible; break; } @@ -668,7 +665,7 @@ private void UpdateModelVisual3D() // Correction amount for camera, increase slowly FaceCameraObjectAlignment += DiffAngle * 0.0006; // 0.0015 = ~90 degrees in 30 seconds - + // Devices rotates (slowly) towards a default position facing the camara // Calculation above is done to: // - "quickly" move to the correct pose when enabled as it's calculated in the background diff --git a/HandheldCompanion/Views/Windows/Suspender.xaml.cs b/HandheldCompanion/Views/Windows/Suspender.xaml.cs index 942a2b2ca..c6a7e133a 100644 --- a/HandheldCompanion/Views/Windows/Suspender.xaml.cs +++ b/HandheldCompanion/Views/Windows/Suspender.xaml.cs @@ -1,22 +1,5 @@ -using ControllerCommon; -using HandheldCompanion.Managers; -using Microsoft.Extensions.Logging; -using SharpDX.XInput; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; +using HandheldCompanion.Managers; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace HandheldCompanion.Views.Windows { diff --git a/HandheldCompanion/models/ModelOneXPlayerMini.cs b/HandheldCompanion/models/ModelOneXPlayerMini.cs index 2760a2204..7ae482425 100644 --- a/HandheldCompanion/models/ModelOneXPlayerMini.cs +++ b/HandheldCompanion/models/ModelOneXPlayerMini.cs @@ -1,4 +1,3 @@ -using System.Windows; using System.Windows.Media; using System.Windows.Media.Media3D; @@ -63,7 +62,7 @@ public ModelOneXPlayerMini() : base("OneXPlayerMini") BLetter = modelImporter.Load($"models/{ModelName}/BLetter.obj"); BLetterInside1 = modelImporter.Load($"models/{ModelName}/BLetterInside1.obj"); BLetterInside2 = modelImporter.Load($"models/{ModelName}/BLetterInside2.obj"); - Screen= modelImporter.Load($"models/{ModelName}/Screen.obj"); + Screen = modelImporter.Load($"models/{ModelName}/Screen.obj"); Home = modelImporter.Load($"models/{ModelName}/Home.obj"); LED = modelImporter.Load($"models/{ModelName}/LED.obj"); LeftBaseRing = modelImporter.Load($"models/{ModelName}/LeftBaseRing.obj"); @@ -77,9 +76,9 @@ public ModelOneXPlayerMini() : base("OneXPlayerMini") Turbo = modelImporter.Load($"models/{ModelName}/Turbo.obj"); TurboIcon = modelImporter.Load($"models/{ModelName}/TurboIcon.obj"); XLetter = modelImporter.Load($"models/{ModelName}/XLetter.obj"); - YLetter = modelImporter.Load($"models/{ModelName}/YLetter.obj"); - // pull model(s) - + YLetter = modelImporter.Load($"models/{ModelName}/YLetter.obj"); + // pull model(s) + model3DGroup.Children.Add(ALetter); model3DGroup.Children.Add(ALetterInside); model3DGroup.Children.Add(BackGrillShadow);