mirror of
https://github.com/CommonLoon102/NBloodServerSupervisor.git
synced 2024-12-23 03:02:51 +01:00
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace Common
|
|
{
|
|
public static class NBloodServerStartInfo
|
|
{
|
|
private static readonly string workingDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "blood");
|
|
|
|
public static ProcessStartInfo Get(int maxPlayers, int port)
|
|
{
|
|
var psi = new ProcessStartInfo(GetExecutable(), $"-server {maxPlayers} -port {port} -pname Server")
|
|
{
|
|
UseShellExecute = true,
|
|
WorkingDirectory = workingDir
|
|
};
|
|
|
|
return psi;
|
|
}
|
|
|
|
private static string GetExecutable()
|
|
{
|
|
string nbloodServer = Constants.NBloodExecutable;
|
|
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
|
if (isWindows)
|
|
nbloodServer += ".exe";
|
|
|
|
return nbloodServer;
|
|
}
|
|
}
|
|
}
|