示例#1
0
        public void Disconnect(bool dispose = true)
        {
            lock (_disconnectLock)
            {
                if (_serverS == null)
                {
                    return;
                }

                _serverS.Shutdown(SocketShutdown.Both);
                _serverS.Dispose();
                _serverS = null;

                _receiveData = false;
                _serverB     = _serverC = null;
                _toClientS   = _toServerS = 0;

                if (Disconnected != null && !dispose)
                {
                    var disconnectedEventArgs = new DisconnectedEventArgs();
                    Disconnected(this, disconnectedEventArgs);
                    dispose = disconnectedEventArgs.UnsubscribeFromEvents;
                }

                if (dispose)
                {
                    SKore.Unsubscribe(ref Connected);
                    SKore.Unsubscribe(ref DataToClient);
                    SKore.Unsubscribe(ref DataToServer);
                    SKore.Unsubscribe(ref Disconnected);
                }
            }
        }
示例#2
0
        public void Disconnect(bool Dispose = true)
        {
            lock (DisconnectLock)
            {
                if (ServerS == null)
                {
                    return;
                }

                ServerS.Shutdown(SocketShutdown.Both);
                ServerS.Dispose();
                ServerS = null;

                if (Dispose)
                {
                    SKore.Unsubscribe(ref OnConnected);
                    SKore.Unsubscribe(ref DataToClient);
                    SKore.Unsubscribe(ref DataToServer);
                    SKore.Unsubscribe(ref OnDisconnected);
                }

                _ReceiveData = false;
                ServerB      = ServerC = null;
                ToClientS    = ToServerS = 0;

                if (OnDisconnected != null)
                {
                    OnDisconnected(this, EventArgs.Empty);
                }
            }
        }
示例#3
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                CaptureEvents = LockEvents = false;

                if (_previousOutgoing != null)
                {
                    _previousOutgoing.Clear();
                }

                if (_previousIncoming != null)
                {
                    _previousIncoming.Clear();
                }

                if (_lockedOut != null)
                {
                    _lockedOut.Clear();
                }

                if (_lockedIn != null)
                {
                    _lockedIn.Clear();
                }


                SKore.Unsubscribe(ref HostBanPlayer);
                SKore.Unsubscribe(ref HostChangeClothes);
                SKore.Unsubscribe(ref HostChangeMotto);
                SKore.Unsubscribe(ref HostChangeStance);
                SKore.Unsubscribe(ref HostClickPlayer);
                SKore.Unsubscribe(ref HostDance);
                SKore.Unsubscribe(ref HostGesture);
                SKore.Unsubscribe(ref HostKickPlayer);
                SKore.Unsubscribe(ref HostMoveFurniture);
                SKore.Unsubscribe(ref HostMutePlayer);
                SKore.Unsubscribe(ref HostRaiseSign);
                SKore.Unsubscribe(ref HostRoomExit);
                SKore.Unsubscribe(ref HostRoomNavigate);
                SKore.Unsubscribe(ref HostSay);
                SKore.Unsubscribe(ref HostShout);
                SKore.Unsubscribe(ref HostTradePlayer);
                SKore.Unsubscribe(ref HostWalk);

                SKore.Unsubscribe(ref FurnitureDataLoaded);
                SKore.Unsubscribe(ref PlayerChangeData);
                SKore.Unsubscribe(ref PlayerChangeStance);
                SKore.Unsubscribe(ref PlayerDance);
                SKore.Unsubscribe(ref PlayerDataLoaded);
                SKore.Unsubscribe(ref PlayerDropFurniture);
                SKore.Unsubscribe(ref PlayerGesture);
                SKore.Unsubscribe(ref PlayerKickHost);
                SKore.Unsubscribe(ref PlayerMoveFurniture);
            }
        }
示例#4
0
        protected virtual void Dispose(bool disposing)
        {
            SKore.Unsubscribe(ref ScheduleTick);

            if (disposing)
            {
                Stop();
                _ticker.Dispose();
            }
        }
示例#5
0
        protected virtual void Dispose(bool disposing)
        {
            SKore.Unsubscribe(ref Connected);
            SKore.Unsubscribe(ref Disconnected);
            SKore.Unsubscribe(ref DataToClient);
            SKore.Unsubscribe(ref DataToServer);

            if (disposing)
            {
                // Managed
            }
        }
示例#6
0
        protected virtual void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }
            if (disposing)
            {
                _inPrevious.Clear();
                _outPrevious.Clear();

                InDetected.Clear();
                OutDetected.Clear();

                _inAttaches.Clear();
                _outAttaches.Clear();

                #region Unsubscribe Game Events
                SKore.Unsubscribe(ref HostBanPlayer);
                SKore.Unsubscribe(ref HostUpdateClothes);
                SKore.Unsubscribe(ref HostUpdateMotto);
                SKore.Unsubscribe(ref HostUpdateStance);
                SKore.Unsubscribe(ref HostClickPlayer);
                SKore.Unsubscribe(ref HostDance);
                SKore.Unsubscribe(ref HostGesture);
                SKore.Unsubscribe(ref HostKickPlayer);
                SKore.Unsubscribe(ref HostMoveFurniture);
                SKore.Unsubscribe(ref HostMutePlayer);
                SKore.Unsubscribe(ref HostRaiseSign);
                SKore.Unsubscribe(ref HostExitRoom);
                SKore.Unsubscribe(ref HostNavigateRoom);
                SKore.Unsubscribe(ref HostSay);
                SKore.Unsubscribe(ref HostShout);
                SKore.Unsubscribe(ref HostTradePlayer);
                SKore.Unsubscribe(ref HostWalk);

                SKore.Unsubscribe(ref FurnitureLoad);
                SKore.Unsubscribe(ref EntityAction);
                SKore.Unsubscribe(ref PlayerUpdate);
                SKore.Unsubscribe(ref PlayerDance);
                SKore.Unsubscribe(ref EntityLoad);
                SKore.Unsubscribe(ref FurnitureDrop);
                SKore.Unsubscribe(ref PlayerGesture);
                SKore.Unsubscribe(ref PlayerKickHost);
                SKore.Unsubscribe(ref FurnitureMove);
                #endregion
            }
            IsDisposed = true;
        }
示例#7
0
 private void Dispose(bool disposing)
 {
     if (IsDisposed)
     {
         return;
     }
     if (disposing)
     {
         IsRunning = false;
         _ticker.Dispose();
         _hotkey.Dispose();
     }
     SKore.Unsubscribe(ref ScheduleTick);
     IsDisposed = true;
 }
            protected virtual void Dispose(bool disposing)
            {
                if (IsDisposed)
                {
                    return;
                }
                if (disposing)
                {
                    IsRunning = false;
                    _ticker.Dispose();

                    SKore.Unsubscribe(ref ScheduleTick);
                }
                IsDisposed = true;
            }
示例#9
0
 protected virtual void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         if (disposing)
         {
             Triggers.Dispose();
             SKore.Unsubscribe(ref Connected);
             SKore.Unsubscribe(ref Disconnected);
             SKore.Unsubscribe(ref DataIncoming);
             Disconnect();
         }
         IsDisposed = true;
     }
 }
示例#10
0
        public void Disconnect()
        {
            if (!_disconnectAllowed)
            {
                return;
            }
            _disconnectAllowed = false;

            lock (_disconnectLock)
            {
                if (_clientS != null)
                {
                    _clientS.Shutdown(SocketShutdown.Both);
                    _clientS.Close();
                    _clientS = null;
                }
                if (_serverS != null)
                {
                    _serverS.Shutdown(SocketShutdown.Both);
                    _serverS.Close();
                    _serverS = null;
                }
                ResetHost();
                if (_htcpExt != null)
                {
                    _htcpExt.Stop();
                    _htcpExt = null;
                }
                Protocol           = HProtocol.Modern;
                _toClientS         = _toServerS = _socketCount = 0;
                _clientB           = _serverB = _clientC = _serverC = null;
                _hasOfficialSocket = RequestEncrypted = ResponseEncrypted = false;
                ClientEncrypt      = ClientDecrypt = ServerEncrypt = ServerDecrypt = null;
                if (Disconnected != null)
                {
                    var disconnectedEventArgs = new DisconnectedEventArgs();
                    Disconnected(this, disconnectedEventArgs);
                    if (disconnectedEventArgs.UnsubscribeFromEvents)
                    {
                        SKore.Unsubscribe(ref Connected);
                        SKore.Unsubscribe(ref DataToClient);
                        SKore.Unsubscribe(ref DataToServer);
                        SKore.Unsubscribe(ref Disconnected);
                        base.Dispose(false);
                    }
                }
            }
        }
示例#11
0
 /// <summary>
 /// Releases all resources used by the <see cref="HConnection"/>.
 /// </summary>
 /// <param name="disposing">The value that determines whether managed resources should be disposed.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (IsDisposed)
     {
         return;
     }
     if (disposing)
     {
         SKore.Unsubscribe(ref Connected);
         SKore.Unsubscribe(ref Disconnected);
         SKore.Unsubscribe(ref DataIncoming);
         SKore.Unsubscribe(ref DataOutgoing);
         Disconnect();
     }
     IsDisposed = true;
 }
示例#12
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                SKore.Unsubscribe(ref Connected);
                SKore.Unsubscribe(ref DataToClient);
                SKore.Unsubscribe(ref DataToServer);
                SKore.Unsubscribe(ref Disconnected);
                Disconnect();

                Host          = null;
                Addresses     = null;
                Port          = SocketSkip = 0;
                CaptureEvents = false;
            }
            base.Dispose(disposing);
        }
示例#13
0
        public void Dispose()
        {
            lock (DisposeLock)
            {
                #region Event Unsubscribing & Disconnecting
                SKore.Unsubscribe(ref OnConnected);
                SKore.Unsubscribe(ref DataToClient);
                SKore.Unsubscribe(ref DataToServer);
                SKore.Unsubscribe(ref OnDisconnected);
                Disconnect();
                #endregion

                Host          = null;
                Addresses     = null;
                Port          = SocketSkip = 0;
                CaptureEvents = false;
            }
        }
示例#14
0
        protected virtual void Dispose(bool disposing)
        {
            SKore.Unsubscribe(ref Connected);
            SKore.Unsubscribe(ref DataToClient);
            SKore.Unsubscribe(ref DataToServer);
            SKore.Unsubscribe(ref Disconnected);

            if (disposing)
            {
                Disconnect();

                Host      = null;
                Addresses = null;
                Port      = SocketSkip = 0;

                Triggers.Dispose();
            }
        }
示例#15
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                _inPrevious.Clear();
                _outPrevious.Clear();

                _inLocked.Clear();
                _outLocked.Clear();

                _inCallbacks.Clear();
                _outCallbacks.Clear();
            }

            SKore.Unsubscribe(ref HostBanPlayer);
            SKore.Unsubscribe(ref HostChangeClothes);
            SKore.Unsubscribe(ref HostChangeMotto);
            SKore.Unsubscribe(ref HostChangeStance);
            SKore.Unsubscribe(ref HostClickPlayer);
            SKore.Unsubscribe(ref HostDance);
            SKore.Unsubscribe(ref HostGesture);
            SKore.Unsubscribe(ref HostKickPlayer);
            SKore.Unsubscribe(ref HostMoveFurniture);
            SKore.Unsubscribe(ref HostMutePlayer);
            SKore.Unsubscribe(ref HostRaiseSign);
            SKore.Unsubscribe(ref HostRoomExit);
            SKore.Unsubscribe(ref HostRoomNavigate);
            SKore.Unsubscribe(ref HostSay);
            SKore.Unsubscribe(ref HostShout);
            SKore.Unsubscribe(ref HostTradePlayer);
            SKore.Unsubscribe(ref HostWalk);

            SKore.Unsubscribe(ref FurnitureDataLoaded);
            SKore.Unsubscribe(ref PlayerActionsDetected);
            SKore.Unsubscribe(ref PlayerChangeData);
            SKore.Unsubscribe(ref PlayerDance);
            SKore.Unsubscribe(ref PlayerDataLoaded);
            SKore.Unsubscribe(ref PlayerDropFurniture);
            SKore.Unsubscribe(ref PlayerGesture);
            SKore.Unsubscribe(ref PlayerKickHost);
            SKore.Unsubscribe(ref PlayerMoveFurniture);
        }
示例#16
0
 public void Dispose()
 {
     Stop();
     SKore.Unsubscribe(ref ScheduleTriggered);
     _ticker.Dispose();
 }