Skip to content

Commit 7a6babd

Browse files
committed
chore: reformat
1 parent 2c82434 commit 7a6babd

File tree

9 files changed

+166
-159
lines changed

9 files changed

+166
-159
lines changed

SindenCompanion/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public void InjectionNotification()
4444
{
4545
_server.SendMessage(MessageBuilder.Build("serverready", null).AsMessage());
4646
}
47+
4748
private Mem GetMemoryReader(uint processId)
4849
{
4950
Mem memlib;
@@ -73,6 +74,7 @@ public void WindowEventHandler(IntPtr hWinEventHook, uint eventType, IntPtr hwnd
7374
_logger.Information("Client not ready, ignoring window change");
7475
return;
7576
}
77+
7678
_conf = Config.GetInstance();
7779
var fp = new ForegroundProcess();
7880
var matchedGp = _conf.GameProfiles.FirstOrDefault(x => x.Matches(fp));
@@ -112,7 +114,7 @@ public void WindowEventHandler(IntPtr hWinEventHook, uint eventType, IntPtr hwnd
112114
value = memlib.ReadByte(matchedGp.Memscan.Code);
113115
matchedGp.Memscan.Match.TryGetValue(value, out profName);
114116
break;
115-
case "short":
117+
case "short":
116118
value = memlib.Read2Byte(matchedGp.Memscan.Code);
117119
matchedGp.Memscan.Match.TryGetValue(value, out profName);
118120
break;
@@ -185,7 +187,7 @@ public void MessageHandler(List<string> messages)
185187
select MessageBuilder.FromMessage(msg))
186188
switch (e.Type)
187189
{
188-
case "ready":
190+
case "ready":
189191
_logger.Information("Client signaled it's ready.");
190192
_clientReady = true;
191193
break;
Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,84 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net472</TargetFramework>
6-
<PlatformTarget>x64</PlatformTarget>
7-
<Platforms>AnyCPU;x64</Platforms>
8-
<IsPublishable>False</IsPublishable>
9-
<SignAssembly>False</SignAssembly>
10-
</PropertyGroup>
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net472</TargetFramework>
6+
<PlatformTarget>x64</PlatformTarget>
7+
<Platforms>AnyCPU;x64</Platforms>
8+
<IsPublishable>False</IsPublishable>
9+
<SignAssembly>False</SignAssembly>
10+
</PropertyGroup>
1111

12-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
13-
<DebugType>full</DebugType>
14-
</PropertyGroup>
12+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
13+
<DebugType>full</DebugType>
14+
</PropertyGroup>
1515

16-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
17-
<DebugType>full</DebugType>
18-
</PropertyGroup>
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
17+
<DebugType>full</DebugType>
18+
</PropertyGroup>
1919

20-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
21-
<DebugType>full</DebugType>
22-
</PropertyGroup>
20+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
21+
<DebugType>full</DebugType>
22+
</PropertyGroup>
2323

24-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
25-
<DebugType>full</DebugType>
26-
</PropertyGroup>
27-
28-
<ItemGroup>
29-
<None Remove="config.yaml" />
30-
</ItemGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
25+
<DebugType>full</DebugType>
26+
</PropertyGroup>
3127

32-
<ItemGroup>
33-
<Content Include="config.yaml">
34-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
35-
</Content>
36-
</ItemGroup>
28+
<ItemGroup>
29+
<None Remove="config.yaml" />
30+
</ItemGroup>
3731

38-
<ItemGroup>
39-
<PackageReference Include="Costura.Fody" Version="5.7.0">
40-
<PrivateAssets>all</PrivateAssets>
41-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
42-
</PackageReference>
43-
<PackageReference Include="FluentValidation" Version="11.8.1" />
44-
<PackageReference Include="Memory.dll.x64" Version="1.2.24" />
45-
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
46-
<PackageReference Include="Serilog.Sinks.RichTextBox.Wpf" Version="1.1.0" />
47-
<PackageReference Include="YamlDotNet" Version="13.7.1" />
48-
</ItemGroup>
32+
<ItemGroup>
33+
<Content Include="config.yaml">
34+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
35+
</Content>
36+
</ItemGroup>
4937

50-
<ItemGroup>
51-
<ProjectReference Include="..\ManagedInjector.Lib\ManagedInjector.Lib.csproj" />
52-
<ProjectReference Include="..\SindenCompanionShared\SindenCompanionShared.csproj" />
53-
<ProjectReference Include="..\SindenHook\SindenHook.csproj" />
54-
</ItemGroup>
38+
<ItemGroup>
39+
<PackageReference Include="Costura.Fody" Version="5.7.0">
40+
<PrivateAssets>all</PrivateAssets>
41+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
42+
</PackageReference>
43+
<PackageReference Include="FluentValidation" Version="11.8.1" />
44+
<PackageReference Include="Memory.dll.x64" Version="1.2.24" />
45+
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.456101" />
46+
<PackageReference Include="Serilog.Sinks.RichTextBox.Wpf" Version="1.1.0" />
47+
<PackageReference Include="YamlDotNet" Version="13.7.1" />
48+
</ItemGroup>
5549

56-
<ItemGroup>
57-
<Reference Include="System.Windows.Forms" />
58-
<Reference Include="WindowsFormsIntegration" />
59-
</ItemGroup>
50+
<ItemGroup>
51+
<ProjectReference Include="..\ManagedInjector.Lib\ManagedInjector.Lib.csproj" />
52+
<ProjectReference Include="..\SindenCompanionShared\SindenCompanionShared.csproj" />
53+
<ProjectReference Include="..\SindenHook\SindenHook.csproj" />
54+
</ItemGroup>
6055

61-
<ItemGroup>
62-
<Compile Update="AppForm.cs">
63-
<SubType>Form</SubType>
64-
</Compile>
65-
<Compile Update="Properties\Settings.Designer.cs">
66-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
67-
<AutoGen>True</AutoGen>
68-
<DependentUpon>Settings.settings</DependentUpon>
69-
</Compile>
70-
</ItemGroup>
56+
<ItemGroup>
57+
<Reference Include="System.Windows.Forms" />
58+
<Reference Include="WindowsFormsIntegration" />
59+
</ItemGroup>
7160

72-
<ItemGroup>
73-
<None Update="Properties\Settings.settings">
74-
<Generator>SettingsSingleFileGenerator</Generator>
75-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
76-
</None>
77-
</ItemGroup>
61+
<ItemGroup>
62+
<Compile Update="AppForm.cs">
63+
<SubType>Form</SubType>
64+
</Compile>
65+
<Compile Update="Properties\Settings.Designer.cs">
66+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
67+
<AutoGen>True</AutoGen>
68+
<DependentUpon>Settings.settings</DependentUpon>
69+
</Compile>
70+
</ItemGroup>
7871

79-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
80-
<Exec Command="copy &quot;$(TargetDir)\SindenCompanion.exe&quot; ..\build\&#xD;&#xA;copy &quot;$(TargetDir)\config.yaml&quot; ..\build\&#xD;&#xA;copy &quot;$(TargetDir)\SindenHook.dll&quot; ..\build\" />
81-
</Target>
72+
<ItemGroup>
73+
<None Update="Properties\Settings.settings">
74+
<Generator>SettingsSingleFileGenerator</Generator>
75+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
76+
</None>
77+
</ItemGroup>
8278

83-
</Project>
79+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
80+
<Exec
81+
Command="copy &quot;$(TargetDir)\SindenCompanion.exe&quot; ..\build\&#xD;&#xA;copy &quot;$(TargetDir)\config.yaml&quot; ..\build\&#xD;&#xA;copy &quot;$(TargetDir)\SindenHook.dll&quot; ..\build\" />
82+
</Target>
83+
84+
</Project>

SindenCompanion/SindenInjector.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ public bool IsAlive()
116116

117117
private string SHA256CheckSum()
118118
{
119-
using (SHA256 sha256 = SHA256.Create())
119+
using (var sha256 = SHA256.Create())
120120
{
121-
using (FileStream fileStream = File.OpenRead(_process.MainModule.FileName))
121+
using (var fileStream = File.OpenRead(_process.MainModule.FileName))
122122
{
123123
return BitConverter.ToString(sha256.ComputeHash(fileStream)).Replace("-", "");
124124
}
@@ -130,9 +130,9 @@ public void Inject()
130130
var checksum = SHA256CheckSum();
131131

132132
if (checksum != "EE421F10B9CFAE3E7D9F32F1184CD643E683205B72FEDEA6A865E84E197E3538")
133-
{
134-
_logger.Warning("Remote process checksum did not match. This version of Sinden Lightgun may not be supported.");
135-
}
133+
_logger.Warning(
134+
"Remote process checksum did not match. This version of Sinden Lightgun may not be supported.");
135+
136136
var dt = DataTarget.AttachToProcess(_process.Id, false);
137137
var dllAlreadyLoaded = dt
138138
.ClrVersions

SindenCompanionShared/RecoilProfile.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public List<byte[]> AsConfigurationPayload()
3232
{
3333
var ret = new List<byte[]>()
3434
{
35-
new byte[] { 170, 162, (byte)PulseLength, (byte)DelayAfterFirstPulse, (byte)PulseLength, (byte)DelayBetweenPulses, 187 },
35+
new byte[]
36+
{
37+
170, 162, (byte)PulseLength, (byte)DelayAfterFirstPulse, (byte)PulseLength,
38+
(byte)DelayBetweenPulses, 187
39+
},
3640
new byte[] { 170, 161, 1, 0, 0, 0, 187 },
3741
new byte[] { 170, 167, (byte)Strength, 0, 0, 0, 187 },
3842
new byte[] { 170, 163, Convert.ToByte(Automatic), 0, 0, 0, 187 },

SindenCompanionShared/ServerInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ namespace SindenCompanionShared
1414
public class ServerInterface : IDisposable
1515
{
1616
private readonly RecvCallback _callback;
17-
private ILogger _logger;
1817
private readonly NetMQPoller _poller;
1918
private readonly PullSocket _puller;
2019
private readonly PushSocket _pusher;
20+
private ILogger _logger;
2121

2222
public ServerInterface(bool isServer, int ipcPort, ILogger logger, RecvCallback callback)
2323
{
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net452</TargetFramework>
5-
<PlatformTarget>x64</PlatformTarget>
6-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net452</TargetFramework>
5+
<PlatformTarget>x64</PlatformTarget>
6+
</PropertyGroup>
77

8-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
9-
<DebugType>full</DebugType>
10-
</PropertyGroup>
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
9+
<DebugType>full</DebugType>
10+
</PropertyGroup>
1111

12-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
13-
<DebugType>full</DebugType>
14-
</PropertyGroup>
12+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
13+
<DebugType>full</DebugType>
14+
</PropertyGroup>
1515

16-
<ItemGroup>
17-
<PackageReference Include="NetMQ" Version="4.0.1.13" />
18-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
19-
<PackageReference Include="Serilog" Version="2.12.0" />
20-
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
21-
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
22-
</ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="NetMQ" Version="4.0.1.13" />
18+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
19+
<PackageReference Include="Serilog" Version="2.12.0" />
20+
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
21+
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
22+
</ItemGroup>
2323

24-
</Project>
24+
</Project>

SindenHook/FodyWeavers.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2-
<Costura />
2+
<Costura />
33
</Weavers>

SindenHook/InjectionEntryPoint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class EntryPoint
1414
{
1515
private readonly ServerInterface _client;
1616
private readonly ILogger _logger;
17-
private RecoilProfile _lastProfile;
1817
private bool _isReady;
18+
private RecoilProfile _lastProfile;
1919

2020
private List<SindenLightgun> _lightguns;
2121

@@ -46,7 +46,6 @@ public void Execute()
4646
_logger.Information("Found main app form");
4747

4848

49-
5049
while (!_isReady)
5150
{
5251
Thread.Sleep(200);
@@ -99,6 +98,7 @@ public void MessageHandler(List<string> messages)
9998
ev = MessageBuilder.Build("ready", _lightguns);
10099
_client.SendMessage(ev.AsMessage());
101100
}
101+
102102
break;
103103
case "ping":
104104
ev = MessageBuilder.Build("pong", null);

0 commit comments

Comments
 (0)