Пример #1
0
        public void Dispose()
        {
            Logger.LogMessage -= Logger_LogMessage;

            Server?.Dispose();

            if (UpdateToken?.IsCancellationRequested == false)
            {
                UpdateToken.Cancel();
                UpdateLock.Wait();
            }

            UpdateLock?.Dispose();
            UpdateToken?.Dispose();
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }