Example #1
0
        /// <summary>
        /// Called when a character logs off
        /// </summary>
        private void CloseDown()
        {
            lock (this._classLock)
            {
                try
                {
                    this.Chat.WriteLine("***Closing Down****");

                    //if (this._hackyDelayedRetryInitTimer != null)
                    //{
                    //    this._hackyDelayedRetryInitTimer.Dispose();
                    //    this._hackyDelayedRetryInitTimer = null;
                    //}

                    if (this._commandListenerManager != null)
                    {
                        this._commandListenerManager.Dispose();
                        this._commandListenerManager = null;
                    }

                    if (this._settings != null)
                    {
                        this._settings.Save();
                        this._settings = null;
                    }

                    if (this._monitorManager != null)
                    {
                        this._monitorManager.Dispose();
                        this._monitorManager = null;
                    }

                    if (this._dispatchManager != null)
                    {
                        this._dispatchManager.Dispose();
                        this._dispatchManager = null;
                    }

                    if (this._eventsManager != null)
                    {
                        this._eventsManager.Dispose();
                        this._eventsManager = null;
                    }

                    // If not using wrapper, we have to unhook the dispatch events we hooked up too
                    if (this._realPluginBaseEvents == null)
                    {
                        this.ClientDispatch -= RTPlugin_ClientDispatch;
                        this.ServerDispatch -= RTPlugin_ServerDispatch;
                        this._realPluginBaseEvents = null;
                    }

                    PluginProvider.Clear();

                    this._chatWriter = null;
                    this._debugWriter = null;
                    this._errorLogger = null;
                }
                finally
                {
                    this._closeDownComplete = true;

                    // Reset initialize flag
                    this._initializeComplete = false;
                }
            }
        }
Example #2
0
        public void WrappedStartup(IRealPluginBase realPlugin, IPluginBaseEvents realPluginBaseEvents)
        {
            this._realPlugin = realPlugin;
            this._realPluginBaseEvents = realPluginBaseEvents;
            this.Startup();

            if (this.CoreManager.CharacterFilter.LoginStatus == 3)
            {
                this.Initialize();

                this.TryInitializeExternalPluginDependencies();

                this.Chat.WriteLine("***Initialized After Reload****");
            }
        }