Added API.OnStop(). Added ConsoleCancelEvent
This commit is contained in:
@ -5,6 +5,7 @@ namespace CoopServer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static bool ReadyToStop = false;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
@ -16,6 +17,15 @@ namespace CoopServer
|
||||
File.WriteAllText("log.txt", string.Empty);
|
||||
}
|
||||
|
||||
Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
|
||||
{
|
||||
if (e.SpecialKey == ConsoleSpecialKey.ControlC)
|
||||
{
|
||||
e.Cancel = true;
|
||||
ReadyToStop = true;
|
||||
}
|
||||
};
|
||||
|
||||
_ = new Server();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Reference in New Issue
Block a user