3
3
using System . Net ;
4
4
using NetJoy . Core . Config ;
5
5
using NetJoy . Core . Utils ;
6
+ using NetJoy . Core . Utils . General ;
6
7
using Newtonsoft . Json . Linq ;
7
8
8
9
namespace NetJoy . Core . NetJoy . Server
@@ -20,31 +21,31 @@ public void Start()
20
21
{
21
22
22
23
23
- //get the address string for ngrock
24
+ //get the address string for Ngrock
24
25
var address = GetNgrok ( ) ;
25
26
26
27
//if we already have an instance skip the spawning process
27
28
if ( address != null )
28
29
{
29
- Logger . Debug ( "Found existing ngrock instance @" + address ) ;
30
+ Logger . Debug ( "Found existing Ngrock instance @" + address ) ;
30
31
return ;
31
32
}
32
33
33
34
//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." ) ;
35
36
36
37
//spawn a new ngrok instance
37
- SpawnNgrock ( _port ) ;
38
+ SpawnNgrock ( ) ;
38
39
39
40
//log that we created a new ngrock instance
40
- Logger . Debug ( "Spawned ngrock instance @" + GetNgrok ( ) ) ;
41
+ Logger . Debug ( "Spawned Ngrock instance @" + GetNgrok ( ) ) ;
41
42
}
42
43
43
44
/// <summary>
44
45
/// Get data about the Ngrok instance from the local webserver
45
46
/// </summary>
46
47
/// <returns></returns>
47
- public string GetNgrok ( )
48
+ private string GetNgrok ( )
48
49
{
49
50
var wr = WebRequest . Create ( "http://127.0.0.1:4040/api/tunnels" ) ;
50
51
@@ -82,21 +83,8 @@ public string GetNgrok()
82
83
83
84
}
84
85
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
-
98
86
//Process for creating new ngrok instances
99
- private void SpawnNgrock ( int port )
87
+ private void SpawnNgrock ( )
100
88
{
101
89
new Process
102
90
{
0 commit comments