Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Apr 16, 2023
1 parent 060b714 commit 067a1ea
Show file tree
Hide file tree
Showing 23 changed files with 19 additions and 54 deletions.
1 change: 0 additions & 1 deletion ControllerCommon/Controllers/ControllerState.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ControllerCommon.Inputs;
using SharpDX.XInput;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
Expand Down
5 changes: 2 additions & 3 deletions ControllerCommon/Devices/GPD/GPDWin4.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ControllerCommon.Inputs;
using System.Collections.Generic;
using System.Net;
using System.Numerics;
using WindowsInput.Events;

Expand Down Expand Up @@ -66,8 +65,8 @@ public GPDWin4() : base()
));

OEMChords.Add(new DeviceChord("Bottom button right",
new List<KeyCode>() { KeyCode.F12, KeyCode.R},
new List<KeyCode>() { KeyCode.F12, KeyCode.R},
new List<KeyCode>() { KeyCode.F12, KeyCode.R },
new List<KeyCode>() { KeyCode.F12, KeyCode.R },
false, ButtonFlags.OEM3
));
}
Expand Down
6 changes: 1 addition & 5 deletions ControllerCommon/IniFile.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ControllerCommon
{
Expand Down
4 changes: 2 additions & 2 deletions ControllerCommon/Managers/PowerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Timers;
using System.Windows.Forms;
using Timer = System.Timers.Timer;
using SystemPowerManager = Windows.System.Power.PowerManager;
using System.Timers;
using Timer = System.Timers.Timer;

namespace ControllerCommon.Managers
{
Expand Down
6 changes: 1 addition & 5 deletions ControllerCommon/Utils/CommonUtils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using SharpDX.Multimedia;
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
Expand All @@ -9,8 +7,6 @@
using System.Security.Principal;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Documents;
using static System.Net.Mime.MediaTypeNames;

namespace ControllerCommon.Utils
{
Expand Down
2 changes: 1 addition & 1 deletion ControllerCommon/Utils/ProcessUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static string GetWindowTitle(IntPtr handle)

public static Dictionary<string, string> GetAppProperties(string filePath1)
{
Dictionary<string, string> AppProperties = new ();
Dictionary<string, string> AppProperties = new();

ShellObject shellFile = ShellObject.FromParsingName(filePath1);
foreach (var property in typeof(ShellProperties.PropertySystem).GetProperties(BindingFlags.Public | BindingFlags.Instance))
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Actions/MouseActions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ControllerCommon.Actions;
using ControllerCommon.Controllers;
using ControllerCommon.Inputs;
using HandheldCompanion.Simulators;
using System;
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Controllers/NeptuneController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using SharpDX.XInput;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace HandheldCompanion.Controllers
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Controllers/XInputController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;

Expand Down
6 changes: 3 additions & 3 deletions HandheldCompanion/Managers/HotkeysManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void Start()

if (!string.IsNullOrEmpty(hotkey.inputsHotkey.Settings))
hotkey.IsEnabled = SettingsManager.GetBoolean(hotkey.inputsHotkey.Settings);

HotkeyCreated?.Invoke(hotkey);
}

Expand All @@ -136,7 +136,7 @@ private static void SettingsManager_SettingValueChanged(string name, object valu
Application.Current.Dispatcher.BeginInvoke(() =>
{
// manage toggle type hotkeys
foreach(Hotkey hotkey in Hotkeys.Values.Where(item => item.inputsHotkey.Listener.Equals(name)))
foreach (Hotkey hotkey in Hotkeys.Values.Where(item => item.inputsHotkey.Listener.Equals(name)))
{
if (!hotkey.inputsHotkey.IsToggle)
continue;
Expand All @@ -146,7 +146,7 @@ private static void SettingsManager_SettingValueChanged(string name, object valu
}

// manage settings type hotkeys
foreach(Hotkey hotkey in Hotkeys.Values.Where(item => item.inputsHotkey.Settings.Contains(name)))
foreach (Hotkey hotkey in Hotkeys.Values.Where(item => item.inputsHotkey.Settings.Contains(name)))
{
bool enabled = SettingsManager.GetBoolean(hotkey.inputsHotkey.Settings);
hotkey.IsEnabled = enabled;
Expand Down
3 changes: 1 addition & 2 deletions HandheldCompanion/Managers/LayoutManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Collections.Generic;
using System.IO;
using System.Windows;
using static PInvoke.Kernel32;
using Layout = ControllerCommon.Layout;

namespace HandheldCompanion.Managers
Expand Down Expand Up @@ -226,7 +225,7 @@ public static void SerializeLayoutTemplate(LayoutTemplate layoutTemplate)
});

string fileName = string.Empty;

if (layoutTemplate.IsTemplate)
fileName = Path.Combine(TemplatesPath, $"{layoutTemplate.Name}.json");
else
Expand Down
6 changes: 2 additions & 4 deletions HandheldCompanion/Managers/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using ControllerCommon.Managers;
using ControllerCommon.Pipes;
using ControllerCommon.Utils;
using Force.Crc32;
using HandheldCompanion.Controllers;
using HandheldCompanion.Controls;
using HandheldCompanion.Views;
Expand All @@ -13,7 +12,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static ControllerCommon.Utils.ProcessUtils;

namespace HandheldCompanion.Managers
{
Expand Down Expand Up @@ -275,7 +273,7 @@ private static void ProcessProfile(string fileName)
if (jObject.ContainsKey("Version"))
version = new(jObject["Version"].ToString());

switch(version.ToString())
switch (version.ToString())
{
case "0.15.0.4":
outputraw = CommonUtils.RegexReplace(outputraw, "Generic.Dictionary(.*)System.Private.CoreLib\"", "Generic.SortedDictionary$1System.Collections\"");
Expand Down Expand Up @@ -479,7 +477,7 @@ private static void ControllerManager_ControllerSelected(IController Controller)
if (Controller.GetType() != typeof(XInputController))
return;

foreach(Profile profile in profiles.Values)
foreach (Profile profile in profiles.Values)
UpdateProfileWrapper(profile);
}
}
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Managers/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;

namespace HandheldCompanion.Managers
Expand Down
2 changes: 1 addition & 1 deletion HandheldCompanion/Models/ModelDS4.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ControllerCommon.Inputs;
using System;
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
Expand Down
7 changes: 1 addition & 6 deletions HandheldCompanion/Platforms/GOGGalaxy.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using ControllerCommon.Managers;
using ControllerCommon.Platforms;
using ControllerCommon.Platforms;
using ControllerCommon.Utils;
using HandheldCompanion.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace HandheldCompanion.Platforms
{
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Platforms/SteamPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using HandheldCompanion.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand Down
4 changes: 0 additions & 4 deletions HandheldCompanion/Platforms/UbisoftConnect.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using ControllerCommon.Platforms;
using ControllerCommon.Utils;
using HandheldCompanion.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace HandheldCompanion.Platforms
{
Expand Down
3 changes: 1 addition & 2 deletions HandheldCompanion/Views/Pages/LayoutPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ControllerCommon;
using ControllerCommon.Actions;
using ControllerCommon.Controllers;
using ControllerCommon.Devices;
Expand Down Expand Up @@ -441,7 +440,7 @@ private void LayoutExportButton_Click(object sender, RoutedEventArgs e)

if (ExportForCurrent.IsChecked == true)
newLayout.ControllerType = ControllerManager.GetTargetController().GetType();

LayoutManager.SerializeLayoutTemplate(newLayout);

// close flyout
Expand Down
1 change: 0 additions & 1 deletion HandheldCompanion/Views/Pages/ProfilesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Xml;
using System.Xml.Linq;
using Layout = ControllerCommon.Layout;
using Page = System.Windows.Controls.Page;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using static System.Runtime.InteropServices.JavaScript.JSType;
using Layout = ControllerCommon.Layout;
using Page = System.Windows.Controls.Page;
using Timer = System.Timers.Timer;
Expand Down
2 changes: 1 addition & 1 deletion HandheldCompanion/Views/Windows/OverlayQuickTools.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using System.Linq;
using System.Windows;
using System.Windows.Forms;
using Input = System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Navigation;
using Windows.System.Power;
using Application = System.Windows.Application;
using Input = System.Windows.Input;
using Page = System.Windows.Controls.Page;
using PowerManager = ControllerCommon.Managers.PowerManager;
using SystemPowerManager = Windows.System.Power.PowerManager;
Expand Down
7 changes: 1 addition & 6 deletions HandheldCompanion/XInputPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
using Force.Crc32;
using HandheldCompanion.Controllers;
using HandheldCompanion.Managers;
using HelixToolkit.Wpf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static ControllerCommon.Utils.ProcessUtils;
using static PInvoke.Kernel32;

namespace HandheldCompanion
{
Expand Down Expand Up @@ -44,7 +39,7 @@ public static void RegisterApplication(Profile profile)
{
XInputController XController = (XInputController)controller;
int idx = XController.GetUserIndex() + 1;

IniFile IniFile = new IniFile(IniPath);
IniFile.Write("Controller1", Convert.ToString(idx), "ControllerNumber");

Expand Down
2 changes: 1 addition & 1 deletion HandheldCompanion/models/ModelToyController.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ControllerCommon.Inputs;
using System;
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
Expand Down

0 comments on commit 067a1ea

Please sign in to comment.