Пример #1
0
 /// <summary>
 /// Disconnects the Client from the remote host if connected. NOTE: Currently run asynchronously due to design flaws (to be fixed).
 /// Use this code after calling this method to wait for completion:
 /// while (client.Connected) { System.Threading.Thread.Sleep(100); }
 /// </summary>
 /// <param name="sendDisconnect">Indicates whether the remote host should be notified about the disconnect.</param>
 protected void Disconnect(bool sendDisconnect)
 {
     Connecting = false;
     Active     = false;
     if (sendDisconnect && ClientInterface != null && ClientInterface.Connections.ContainsKey("Main") && ClientInterface.Connections["Main"] != null)
     {
         ClientInterface.Connections["Main"].Write(Password, new Command(null, ClientInterface.Information, CommandType.Close, CommandOption.Broadcast));
     }
     Connected = false;
     Clients.Clear();
     ClientInterface?.Dispose();
     ClientInterface = null;
 }
Пример #2
0
 public void Dispose()
 {
     PluginInterface.UiBuilder.OnOpenConfigUi -= OnOpenConfigUi;
     PluginInterface.UiBuilder.OnBuildUi      -= this.BuildUI;
     PluginInterface.Framework.OnUpdateEvent  -= FrameworkUpdate;
     ActionManager?.Dispose();
     IconManager?.Dispose();
     generalStopwatch.Stop();
     OutOfCombatTimer.Stop();
     cacheTimer.Stop();
     RemoveCommands();
     updateRetainerListHook?.Disable();
     updateRetainerListHook?.Dispose();
     Client.Dispose();
     PluginInterface.Dispose();
 }
Пример #3
0
        public void Dispose()
        {
            PluginInterface.UiBuilder.OnBuildUi     -= this.BuildUI;
            PluginInterface.Framework.OnUpdateEvent -= FrameworkOnUpdate;

            RemoveCommands();
            Client.Dispose();

            foreach (var hook in Common.HookList.Where(hook => !hook.IsDisposed))
            {
                if (hook.IsEnabled)
                {
                    hook.Disable();
                }
                hook.Dispose();
            }
            Common.HookList.Clear();
        }