2020-01-27 13:23:00 +01:00
|
|
|
|
using Model;
|
|
|
|
|
using System;
|
2020-01-24 14:34:10 +01:00
|
|
|
|
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");
|
|
|
|
|
|
2020-01-27 13:23:00 +01:00
|
|
|
|
public static ProcessStartInfo Get(int maxPlayers, int port, Mod mod)
|
2020-01-24 14:34:10 +01:00
|
|
|
|
{
|
2020-01-27 13:23:00 +01:00
|
|
|
|
var psi = new ProcessStartInfo(GetExecutable(), $"-server {maxPlayers} -port {port} -pname Server {mod.CommandLine}")
|
2020-01-24 14:34:10 +01:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|