public void Dispose() { Logger.LogMessage -= Logger_LogMessage; Server?.Dispose(); if (UpdateToken?.IsCancellationRequested == false) { UpdateToken.Cancel(); UpdateLock.Wait(); } UpdateLock?.Dispose(); UpdateToken?.Dispose(); }
public override bool Stop() { Logger.Log(LogType.Debug, "Stopping UpdateThread..."); if (UpdateToken?.IsCancellationRequested == false) { UpdateToken.Cancel(); UpdateLock.Wait(); } Logger.Log(LogType.Debug, "Stopped UpdateThread."); Logger.Log(LogType.Debug, "Stopping Modules..."); foreach (var module in Modules) { module.Stop(); } Logger.Log(LogType.Debug, "Stopped Modules."); return(true); }
protected override void Dispose(bool disposing) { if (!IsDisposed) { if (disposing) { AppDomain.CurrentDomain.AssemblyResolve -= AppDomain_AssemblyResolve; ClientJoined?.Dispose(); ClientLeaved?.Dispose(); if (UpdateToken?.IsCancellationRequested == false) { UpdateToken.Cancel(); UpdateLock.Wait(); } } IsDisposed = true; } base.Dispose(disposing); }