Skip to content

Commit 1654f50

Browse files
committed
v1.0 Release
1 parent a69f069 commit 1654f50

File tree

11 files changed

+23
-56
lines changed

11 files changed

+23
-56
lines changed

Core/Config/ConfigService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.IO;
33
using NetJoy.Core.Utils;
4+
using NetJoy.Core.Utils.General;
45
using Nett;
56

67
namespace NetJoy.Core.Config

Core/NetJoy/Client/Handling/JoyHandler.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
using Nefarius.ViGEm.Client.Targets;
55
using Nefarius.ViGEm.Client.Targets.Xbox360;
66
using NetJoy.Core.NetJoy.Packets;
7-
using NetJoy.Core.Utils;
87
using NetJoy.Core.Utils.Controller;
9-
using SharpDX.DirectInput;
10-
using vJoyInterfaceWrap;
8+
using NetJoy.Core.Utils.General;
119
using static System.Int16;
1210

1311
namespace NetJoy.Core.NetJoy.Client.Handling

Core/NetJoy/Client/NetJoyClient.cs

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
using System;
2-
using System.Diagnostics;
32
using System.Net;
43
using System.Net.Sockets;
54
using System.Threading;
65
using System.Threading.Tasks;
7-
using NetJoy.Core.Config;
86
using NetJoy.Core.NetJoy.Client.Handling;
97
using NetJoy.Core.NetJoy.Packets;
10-
using NetJoy.Core.Utils;
8+
using NetJoy.Core.Utils.General;
119
using Newtonsoft.Json;
1210
using Encoding = System.Text.Encoding;
1311

1412
namespace NetJoy.Core.NetJoy.Client
1513
{
1614
public class NetJoyClient
1715
{
18-
private readonly Configuration _configuration; // the config file
19-
2016
private Socket _client; //the client socket
2117
private JoyHandler _joyHandler; // the joystick handler instance
2218

2319
// ManualResetEvent instances signal completion.
2420
private readonly ManualResetEvent _connectDone = new ManualResetEvent(false);
25-
26-
public NetJoyClient(Configuration configuration)
27-
{
28-
_configuration = configuration;
29-
}
30-
21+
3122
/// <summary>
3223
/// Start the net joy client
3324
/// </summary>

Core/NetJoy/NetJoyManager.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Threading;
3-
using System.Threading.Tasks;
4-
using NetJoy.Core.Config;
1+
using System.Threading.Tasks;
52
using NetJoy.Core.NetJoy.Client;
63
using NetJoy.Core.NetJoy.Server;
74
using NetJoy.Core.Utils;
@@ -10,14 +7,11 @@ namespace NetJoy.Core.NetJoy
107
{
118
public class NetJoyManager
129
{
13-
14-
private readonly Configuration _config;
1510
private readonly NetJoyServer _server;
1611
private readonly NetJoyClient _client;
1712

18-
public NetJoyManager(Configuration config, NetJoyServer server, NetJoyClient client)
13+
public NetJoyManager(NetJoyServer server, NetJoyClient client)
1914
{
20-
_config = config;
2115
_server = server;
2216
_client = client;
2317
}

Core/NetJoy/Server/NetJoyServer.cs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using NetJoy.Core.Config;
88
using NetJoy.Core.NetJoy.Packets;
99
using NetJoy.Core.Utils;
10+
using NetJoy.Core.Utils.General;
1011
using Newtonsoft.Json;
1112
using SharpDX.DirectInput;
1213

Core/NetJoy/Server/NgrokUtils.cs

+8-20
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Net;
44
using NetJoy.Core.Config;
55
using NetJoy.Core.Utils;
6+
using NetJoy.Core.Utils.General;
67
using Newtonsoft.Json.Linq;
78

89
namespace NetJoy.Core.NetJoy.Server
@@ -20,31 +21,31 @@ public void Start()
2021
{
2122

2223

23-
//get the address string for ngrock
24+
//get the address string for Ngrock
2425
var address = GetNgrok();
2526

2627
//if we already have an instance skip the spawning process
2728
if (address != null)
2829
{
29-
Logger.Debug("Found existing ngrock instance @" + address);
30+
Logger.Debug("Found existing Ngrock instance @" + address);
3031
return;
3132
}
3233

3334
//log that we couldn't find any instances
34-
Logger.Debug("No existing ngrock instances. Spawning new instance.");
35+
Logger.Debug("No existing Ngrock instances. Spawning new instance.");
3536

3637
//spawn a new ngrok instance
37-
SpawnNgrock(_port);
38+
SpawnNgrock();
3839

3940
//log that we created a new ngrock instance
40-
Logger.Debug("Spawned ngrock instance @" + GetNgrok());
41+
Logger.Debug("Spawned Ngrock instance @" + GetNgrok());
4142
}
4243

4344
/// <summary>
4445
/// Get data about the Ngrok instance from the local webserver
4546
/// </summary>
4647
/// <returns></returns>
47-
public string GetNgrok()
48+
private string GetNgrok()
4849
{
4950
var wr = WebRequest.Create("http://127.0.0.1:4040/api/tunnels");
5051

@@ -82,21 +83,8 @@ public string GetNgrok()
8283

8384
}
8485

85-
//process for killing ngrok instances
86-
private readonly Process _taskKill = new Process
87-
{
88-
StartInfo = new ProcessStartInfo()
89-
{
90-
UseShellExecute = false,
91-
CreateNoWindow = true,
92-
FileName = "taskkill.exe",
93-
RedirectStandardOutput = true,
94-
Arguments = "/f /im \"ngrok.exe\""
95-
}
96-
};
97-
9886
//Process for creating new ngrok instances
99-
private void SpawnNgrock(int port)
87+
private void SpawnNgrock()
10088
{
10189
new Process
10290
{

Core/Utils/Controller/ControllerUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace NetJoy.Core.Utils.Controller
55
{
6-
public class ControllerUtils
6+
public static class ControllerUtils
77
{
88
/// <summary>
99
/// Get the Xbox360Button for the given string

Core/Utils/General/Logger.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace NetJoy.Core.Utils
3+
namespace NetJoy.Core.Utils.General
44
{
55
public static class Logger
66
{

Core/Utils/General/Prompts.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using NetJoy.Core.Utils.General;
23

34
namespace NetJoy.Core.Utils
45
{

NetJoy.csproj

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
<LangVersion>9</LangVersion>
77
</PropertyGroup>
88

9-
<ItemGroup>
10-
<Reference Include="vJoyInterfaceWrap, Version=0.2.1.6, Culture=neutral, PublicKeyToken=null">
11-
<HintPath>..\..\..\..\..\Program Files\vJoy\x64\vJoyInterfaceWrap.dll</HintPath>
12-
</Reference>
13-
</ItemGroup>
14-
159
<ItemGroup>
1610
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
1711
<PackageReference Include="Nefarius.ViGEm.Client" Version="1.16.150" />

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ NetJoy is a bundled client/server application that can send joystick/controller
33
from one computer to another remotely over the network.
44

55
# Support
6-
Currently the only supported platform is windows but linux support
7-
is planned in the near future! This is due to using the windows binaries for "ngrok" and "taskkill".
8-
6+
Currently the only supported platform is Windows, Linux is planned in the future!
97

108
# Example Config
119
````toml
@@ -23,13 +21,14 @@ port = 6069
2321
> EXTRA STEP FOR SERVERS
2422
* Open config.toml and set isServer to true.
2523
* Change port to your desired port number.
26-
* configure ngrok to use your ngrok token [FROM HERE](https://ngrok.com/) by running
24+
* configure ngrok using your ngrok token [FROM HERE](https://ngrok.com/) by running the below code in the NeyJoy Directory
2725
```
26+
cd PATH_TO_NETJOY_FOLDER
2827
ngrok authtoken TOKEN_GOES_HERE
2928
```
3029

3130
> EXTRA STEP FOR CLIENTS
32-
* Install vJoy from [here](http://vjoystick.sourceforge.net/site/index.php/download-a-install/download)
31+
* Install ViGEm from [here](https://github.com/ViGEm/ViGEmBus)
3332
* Complete install & restart
3433
> Both Clients & Servers
35-
* Run NetJoy.exe & follow instructions.
34+
* Run NetJoy.exe & follow instructions in the application for setting up your server/client.

0 commit comments

Comments
 (0)