예제 #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;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Called when a character logs in
        /// </summary>
        private void Initialize()
        {
            lock (this._classLock)
            {
                // Some how initialize was called multiple times.  Ignore it
                if (this._initializeComplete)
                {
                    WrapperDebugWriter.WriteToStaticLog("RT", "Skipping Initialize.  Already Complete");
                    return;
                }

                try
                {
                    // Cache ourself with the F# layer so that the library code can access decal
                    // singletons
                    PluginProvider.Set(this);

                    this._settings = RTSettings.Resume(this.CharacterFilter.Name);

                    this._errorLogger = new ErrorLogger(this, "RT");
                    this._debugWriter = new DebugWriter(this, "RT", "RT");
                    this._chatWriter = new ChatWriter(this, "RT");

                    // If not using wrapper, we have to hook up the logic to support the plugin base events
                    if (this._realPluginBaseEvents == null)
                    {
                        this._pluginBaseEventsHelper = new PluginBaseEventsHelper();
                        this.ClientDispatch += RTPlugin_ClientDispatch;
                        this.ServerDispatch += RTPlugin_ServerDispatch;
                    }

                    //this.TryInitializeExternalPluginDependencies();

                    this._eventsManager = new EventsManager();

                    this._dispatchManager = new DispatchManager(this.Events.Decal);

                    this._monitorManager = new MonitorManager((IREEventsFireCallbacks)this.Events.RE);

                    this._commandListenerManager = new CommandListenerManager(this.Events.Decal);

                    this.Chat.WriteLine("***Initialization Complete****");
                }
                finally
                {
                    this._initializeComplete = true;

                    // Reset close down flag
                    this._closeDownComplete = false;
                }
            }
        }