Skip to content

Commit

Permalink
v1.4.1
Browse files Browse the repository at this point in the history
- Fixed #4
- Fixed Rust server Windows Firewall bug
- Fixed workshop map bug
  • Loading branch information
BattlefieldDuck committed Dec 13, 2019
1 parent 3655b7a commit dd6a6a3
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vs
WindowsGSM/bin/
WindowsGSM/obj/
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/CS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game cstrike";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/CSCZ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game czero";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/CSGO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game csgo";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers_override {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
40 changes: 0 additions & 40 deletions WindowsGSM/GameServer/Check/CrashDetection.cs

This file was deleted.

2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/GMOD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game garrysmod";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/HL2DM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game hl2mp";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/L4D2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game left4dead2";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
4 changes: 2 additions & 2 deletions WindowsGSM/GameServer/RUST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void SetParameter(string ip, string port, string map, string maxplayers)

if (!File.Exists(rustPath))
{
return (null, "srcds.exe not found (" + rustPath + ")", "");
return (null, "RustDedicated.exe not found (" + rustPath + ")", "");
}

if (string.IsNullOrWhiteSpace(Param))
Expand All @@ -92,7 +92,7 @@ public void SetParameter(string ip, string port, string map, string maxplayers)
return (null, "", "server.cfg not found (" + serverConfigPath + ")");
}

WindowsFirewall firewall = new WindowsFirewall("srcds.exe", rustPath);
WindowsFirewall firewall = new WindowsFirewall("RustDedicated.exe", rustPath);
if (!firewall.IsRuleExist())
{
firewall.AddRule();
Expand Down
2 changes: 1 addition & 1 deletion WindowsGSM/GameServer/TF2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public void SetParameter(string ip, string port, string map, string maxplayers,
Param = "-console -game tf";
Param += String.Format("{0}", String.IsNullOrEmpty(ip) ? "" : $" -ip {ip}");
Param += String.Format("{0}", String.IsNullOrEmpty(port) ? "" : $" -port {port}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
Param += String.Format("{0}", String.IsNullOrEmpty(maxplayers) ? "" : $" -maxplayers {maxplayers}");
Param += String.Format("{0}", String.IsNullOrEmpty(gslt) ? "" : $" +sv_setsteamaccount {gslt}");
Param += String.Format("{0}", String.IsNullOrEmpty(additional) ? "" : $" {additional}");
Param += String.Format("{0}", String.IsNullOrEmpty(map) ? "" : $" +map {map}");
}

public (Process Process, string Error, string Notice) Start()
Expand Down
52 changes: 22 additions & 30 deletions WindowsGSM/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private enum ServerStatus
Restoring = 11
}

public static readonly string WGSM_VERSION = "v1.4.0";
public static readonly string WGSM_VERSION = "v1.4.1";
public static readonly int MAX_SERVER = 100;
public static readonly string WGSM_PATH = Process.GetCurrentProcess().MainModule.FileName.Replace(@"\WindowsGSM.exe", "");
//public static readonly string WGSM_PATH = @"D:\WindowsGSMtest2";
Expand Down Expand Up @@ -964,42 +964,34 @@ private async Task<bool> GameServer_Delete(Function.ServerTable server)

private async void StartServerCrashDetector(Function.ServerTable server)
{
GameServer.Check.CrashDetection detector = new GameServer.Check.CrashDetection();
Process p = g_Process[Int32.Parse(server.ID)];

if (await detector.IsServerCrashed(g_Process[Int32.Parse(server.ID)], server.Game))
while (g_iServerStatus[Int32.Parse(server.ID)] == ServerStatus.Started)
{
g_iServerStatus[Int32.Parse(server.ID)] = ServerStatus.Stopped;
Log(server.ID, "Server: Crashed");
//Log(server.ID, "[WARNING] Exit Code: " + g_Process[Int32.Parse(server.ID)].ExitCode.ToString());
SetServerStatus(server, "Stopped");

g_Process[Int32.Parse(server.ID)] = null;

if (g_bDiscordAlert[Int32.Parse(server.ID)])
if (p != null && p.HasExited)
{
Discord.Webhook webhook = new Discord.Webhook(g_DiscordWebhook[Int32.Parse(server.ID)]);
await webhook.Send(server.ID, server.Game, "Crashed", server.Name, server.IP, server.Port);
}
g_iServerStatus[Int32.Parse(server.ID)] = ServerStatus.Stopped;
Log(server.ID, "Server: Crashed");
//Log(server.ID, "[WARNING] Exit Code: " + g_Process[Int32.Parse(server.ID)].ExitCode.ToString());
SetServerStatus(server, "Stopped");

if (g_bAutoRestart[Int32.Parse(server.ID)])
{
GameServer_Start(server);
}
}
else if (g_iServerStatus[Int32.Parse(server.ID)] == ServerStatus.Started && g_Process[Int32.Parse(server.ID)].HasExited)
{
g_iServerStatus[Int32.Parse(server.ID)] = ServerStatus.Stopped;
Log(server.ID, "Server: Stopped");
Log(server.ID, "[Notice] Server stopped externally");
SetServerStatus(server, "Stopped");
g_Process[Int32.Parse(server.ID)] = null;

g_Process[Int32.Parse(server.ID)] = null;
if (g_bDiscordAlert[Int32.Parse(server.ID)])
{
Discord.Webhook webhook = new Discord.Webhook(g_DiscordWebhook[Int32.Parse(server.ID)]);
await webhook.Send(server.ID, server.Game, "Crashed", server.Name, server.IP, server.Port);
}

if (g_bDiscordAlert[Int32.Parse(server.ID)])
{
Discord.Webhook webhook = new Discord.Webhook(g_DiscordWebhook[Int32.Parse(server.ID)]);
await webhook.Send(server.ID, server.Game, "Stopped", server.Name, server.IP, server.Port);
if (g_bAutoRestart[Int32.Parse(server.ID)])
{
GameServer_Start(server);
}

break;
}

await Task.Delay(1000);
}
}

Expand Down
4 changes: 2 additions & 2 deletions WindowsGSM/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.4.1.0")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: NeutralResourcesLanguage("en")]

1 change: 0 additions & 1 deletion WindowsGSM/WindowsGSM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
</Compile>
<Compile Include="Function\Path.cs" />
<Compile Include="Discord\Webhook.cs" />
<Compile Include="GameServer\Check\CrashDetection.cs" />
<Compile Include="GameServer\GMOD.cs" />
<Compile Include="GameServer\MCPE.cs" />
<Compile Include="GameServer\RUST.cs" />
Expand Down

0 comments on commit dd6a6a3

Please sign in to comment.