Пример #1
0
        private void ApplicationProcess_Exited(object sender, EventArgs e)
        {
            var unexpectedStop = (this.State != ApplicationState.Stopping && this.State != ApplicationState.Restarting);
            var needsRestart   = (this.State == ApplicationState.Restarting);

            this.State = ApplicationState.Stopped;

            if (unexpectedStop)
            {
                this.module.log.Warning("The application stopped unexpectedly.");
                UnexpectedStop.InvokeSafe(this, new ServerStoppedEventArgs(DateTime.Now));
            }
            else
            {
                NormalStop.InvokeSafe(this, new ServerStoppedEventArgs(DateTime.Now));
            }

            this.Users.Clear();

            if (needsRestart)
            {
                Start();
            }
        }
 internal void OnUnexpectedStop()
 {
     Log.Success($"Server {this.ID:00} Unexpectedly Stopped.");
     UnexpectedStop.Invoke(this, null);
 }