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

add game log server

This commit is contained in:
RaidMax
2018-09-06 13:25:58 -05:00
parent 85f910272a
commit 8a721bb53a
23 changed files with 362 additions and 71 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using SharedLibraryCore.Objects;
namespace SharedLibraryCore
@ -50,8 +51,7 @@ namespace SharedLibraryCore
public GameEvent()
{
OnProcessed = new SemaphoreSlim(0);
OnProcessed.Release();
OnProcessed = new ManualResetEventSlim();
Time = DateTime.UtcNow;
Id = GetNextEventId();
}
@ -64,10 +64,16 @@ namespace SharedLibraryCore
public Server Owner;
public Boolean Remote = false;
public object Extra { get; set; }
public SemaphoreSlim OnProcessed { get; set; }
public ManualResetEventSlim OnProcessed { get; set; }
public DateTime Time { get; set; }
public long Id { get; private set; }
/// <summary>
/// asynchronously wait for GameEvent to be processed
/// </summary>
/// <returns>waitable task </returns>
public Task<bool> WaitAsync(int timeOut = int.MaxValue) => Task.FromResult(OnProcessed.Wait(timeOut));
/// <summary>
/// determine whether an event should be delayed or not
/// applies only to the origin entity