1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix small exit exceptions

fix the live radar tab switching for .net core 3.0
change events to use "sequential" but still parallel
update the publish scripts
This commit is contained in:
RaidMax
2019-10-09 15:51:02 -05:00
parent 2ae4d031e5
commit 4623cc6e12
9 changed files with 59 additions and 15 deletions

View File

@ -1,6 +1,7 @@
using SharedLibraryCore;
using SharedLibraryCore.Events;
using SharedLibraryCore.Interfaces;
using System.Linq;
using System.Threading;
namespace IW4MAdmin.Application
@ -8,6 +9,14 @@ namespace IW4MAdmin.Application
class GameEventHandler : IEventHandler
{
readonly ApplicationManager Manager;
private static GameEvent.EventType[] overrideEvents = new[]
{
GameEvent.EventType.Connect,
GameEvent.EventType.Disconnect,
GameEvent.EventType.Quit,
GameEvent.EventType.Stop
};
public GameEventHandler(IManager mgr)
{
Manager = (ApplicationManager)mgr;
@ -19,8 +28,21 @@ namespace IW4MAdmin.Application
ThreadPool.GetMaxThreads(out int workerThreads, out int n);
ThreadPool.GetAvailableThreads(out int availableThreads, out int m);
gameEvent.Owner.Logger.WriteDebug($"There are {workerThreads - availableThreads} active threading tasks");
#endif
if (Manager.Running || overrideEvents.Contains(gameEvent.Type))
{
#if DEBUG
gameEvent.Owner.Logger.WriteDebug($"Adding event with id {gameEvent.Id}");
#endif
Manager.OnServerEvent?.Invoke(gameEvent.Owner, new GameEventArgs(null, false, gameEvent));
}
#if DEBUG
else
{
gameEvent.Owner.Logger.WriteDebug($"Skipping event as we're shutting down {gameEvent.Id}");
}
#endif
Manager.OnServerEvent?.Invoke(gameEvent.Owner, new GameEventArgs(null, false, gameEvent));
}
}
}