Skip to content

Commit

Permalink
misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Nov 26, 2021
1 parent b866e44 commit 02a59ed
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 33 deletions.
4 changes: 0 additions & 4 deletions ControllerHelper/Controller.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ControllerHelper
{
Expand Down
4 changes: 0 additions & 4 deletions ControllerHelper/ControllerHelper.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using ControllerService;
using Microsoft.Extensions.Logging;
using Microsoft.Win32;
using Serilog;
using Serilog.Core;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
Expand Down
4 changes: 3 additions & 1 deletion ControllerHelper/ControllerHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.1" />
<PackageReference Include="MouseKeyHook" Version="5.6.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion ControllerHelper/MouseHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Serilog.Core;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
Expand Down
1 change: 0 additions & 1 deletion ControllerHelper/PipeClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using ControllerService;
using NamedPipeWrapper;
using Serilog.Core;
using SharpDX.XInput;
using System;
using System.Collections.Concurrent;
using System.Timers;
Expand Down
1 change: 0 additions & 1 deletion ControllerHelper/ProfileManager.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.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using static ControllerService.Utils;
Expand Down
10 changes: 2 additions & 8 deletions ControllerHelper/ServiceManager.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using Serilog.Core;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using Timer = System.Timers.Timer;

namespace ControllerHelper
Expand Down Expand Up @@ -71,7 +65,7 @@ private void MonitorHelper(object sender, ElapsedEventArgs e)
controller.Refresh();
status = controller.Status;
}
catch(Exception)
catch (Exception)
{
status = 0;
}
Expand All @@ -82,7 +76,7 @@ private void MonitorHelper(object sender, ElapsedEventArgs e)
{
controller.WaitForStatus(nextStatus, TimeSpan.FromSeconds(5));
}
catch(Exception ex)
catch (Exception ex)
{
nextStatus = status;
logger.Error("{0} set to {1}", name, ex.Message);
Expand Down
6 changes: 1 addition & 5 deletions ControllerHelper/Utils.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using Microsoft.Toolkit.Uwp.Notifications;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ControllerHelper
{
Expand Down Expand Up @@ -67,7 +63,7 @@ public static string GetPathToApp(Process process)

return "";
}

public static bool IsTextAValidIPAddress(string text)
{
IPAddress test;
Expand Down
9 changes: 5 additions & 4 deletions ControllerService/ControllerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ internal void UpdateProfile(Dictionary<string, string> args)

public void UpdateSettings(Dictionary<string, string> args)
{
foreach(KeyValuePair<string, string> pair in args)
foreach (KeyValuePair<string, string> pair in args)
{
string name = pair.Key;
string property = pair.Value;
Expand Down Expand Up @@ -241,7 +241,7 @@ private void ApplySetting(string name, object prev_value, object value)
PhysicalController.SetVibrationStrength((int)value);
break;
case "DSUEnabled":
switch((bool)value)
switch ((bool)value)
{
case true: DSUServer.Start(); break;
case false: DSUServer.Stop(); break;
Expand Down Expand Up @@ -279,7 +279,8 @@ public Task StartAsync(CancellationToken cancellationToken)
PipeServer.Start();

// send notification
PipeServer.SendMessage(new PipeMessage {
PipeServer.SendMessage(new PipeMessage
{
Code = PipeCode.SERVER_TOAST,
args = new Dictionary<string, string>
{
Expand Down Expand Up @@ -330,7 +331,7 @@ public Dictionary<string, string> GetSettings()
{
Dictionary<string, string> settings = new Dictionary<string, string>();

foreach(SettingsProperty s in Properties.Settings.Default.Properties)
foreach (SettingsProperty s in Properties.Settings.Default.Properties)
settings.Add(s.Name, Properties.Settings.Default[s.Name].ToString());

settings.Add("gyrometer", $"{PhysicalController.gyrometer.sensor != null}");
Expand Down
8 changes: 6 additions & 2 deletions ControllerService/ControllerService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@
<PackageReference Include="NetCoreNamedPipeWrapper" Version="1.0.4" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="SharpDX" Version="4.2.0" />
<PackageReference Include="SharpDX.DirectInput" Version="4.2.0" />
<PackageReference Include="SharpDX.XInput" Version="4.2.0" />
Expand Down
2 changes: 1 addition & 1 deletion ControllerService/PipeServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void OnClientDisconnected(NamedPipeConnection<PipeMessage, PipeMessage>
{
connected = false;
logger.LogInformation("Client {0} disconnected", connection.Id);

service.PhysicalController.touch.OnMouseUp(-1, -1, 1048576 /* MouseButtons.Left */);
}

Expand Down
2 changes: 1 addition & 1 deletion ControllerService/XInputController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void SetVirtualController(IVirtualGamepad _controller)
vcontroller = _controller;
vcontroller.AutoSubmitReport = false;

switch(vcontroller.GetType().FullName)
switch (vcontroller.GetType().FullName)
{
case "Nefarius.ViGEm.Client.Targets.DualShock4Controller":
UpdateTimer.Elapsed += DS4_UpdateReport;
Expand Down

0 comments on commit 02a59ed

Please sign in to comment.