public void OnDisconnect(DisconnectEvent ev) { if (!plugin.allowUserChoice && !plugin.dropitems && !plugin.forceValue) { return; } List <Player> Players = PluginManager.Manager.Server.GetPlayers(); Player SpectatorPlayer = SearchSpectator(Players); Player DisconnectedPlayer = SearchDisconnectedPlayer(Players); //Cannot find disconnected player if (DisconnectedPlayer == null) { return; } if (SpectatorPlayer == null) { //Drop items if (plugin.dropitems) { DropItems(DisconnectedPlayer); } } else { //Replace player ReplaceSpectator(SpectatorPlayer, DisconnectedPlayer); } }
void IEventHandlerDisconnect.OnDisconnect(DisconnectEvent ev) { string keyrm = string.Empty; string connrm = string.Empty; foreach (var conn in conns) { bool hasfound = false; //plugin.Info(conn.Value); foreach (var item in plugin.Server.GetPlayers()) { if (item.SteamId == conn.Value) { hasfound = true; break; } } if (!hasfound) { keyrm = conn.Value; connrm = conn.Key; } } if (keyrm != string.Empty && connrm != string.Empty) { //plugin.Info(connrm + " has disconnected"); conns.Remove(connrm); keys.Remove(keyrm); } }
public void Stop() { cts?.Cancel(); cycleTask?.GetAwaiter().GetResult(); StateConnect = false; DisconnectEvent?.Invoke(this, new EventArgs()); }
public void OnDisconnect(DisconnectEvent ev) { /// <summary> /// This is the event handler for disconnection events. /// </summary> plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_ondisconnect"), plugin.MultiLanguage(13)); }
private void OnSocketDisconnecting(DisconnectEvent e) { if (SocketDisconnecting != null) { SocketDisconnecting(this, e); } }
public void Dispose() { try { if (QuikLua != null && QuikLua.Service.IsConnected().Result) { QuikLua.Service.QuikService.Stop(); } } catch (Exception error) { SendLogMessage(error.ToString(), LogMessageType.Error); } if (QuikLua != null) { QuikLua.Events.OnConnected -= EventsOnOnConnected; QuikLua.Events.OnDisconnected -= EventsOnOnDisconnected; QuikLua.Events.OnConnectedToQuik -= EventsOnOnConnectedToQuik; QuikLua.Events.OnDisconnectedFromQuik -= EventsOnOnDisconnectedFromQuik; QuikLua.Events.OnTrade -= EventsOnOnTrade; QuikLua.Events.OnOrder -= EventsOnOnOrder; QuikLua.Events.OnQuote -= EventsOnOnQuote; QuikLua.Events.OnFuturesClientHolding -= EventsOnOnFuturesClientHolding; QuikLua.Events.OnFuturesLimitChange -= EventsOnOnFuturesLimitChange; } ServerStatus = ServerConnectStatus.Disconnect; DisconnectEvent?.Invoke(); subscribedBook = new List <string>(); QuikLua = null; }
public void OnConnectorDisconnectHandler(object sender, object disconnectionState) { IConnector connector = sender as IConnector; if (connector == null) { return; } connector.DisconnectEvent -= OnConnectorDisconnectHandler; TeamPainterTCPClient client = null; lock (_cSync) { long clientID; _clientConnectionAssociation.TryGetAndRemove(connector.UniqueID, out clientID); _clients.TryGetAndRemove(clientID, out client); } if (client != null) { client.Connector.DisconnectEvent -= OnConnectorDisconnectHandler; client.Connector.ReceiveAction -= OnReceveDataHandler; client.Connector.ReceiveComAction -= OnReceiveCommandHandler; } NetLogger.Log(connector.UniqueID + " is disconnected"); DisconnectEvent?.Invoke(client, disconnectionState); }
private void OnDisconnect(int deviceId) { Debug.Log($"OnDisconnect({deviceId})"); PlayerManager.Instance.DisconnectPlayer(deviceId); DisconnectEvent?.Invoke(this, new DisconnectEventArgs(deviceId)); }
private void On(DisconnectEvent e) { if (!Room.Of(this.BotBits).JoinComplete) { new JoinFailureEvent(this._lastInfo?.Title ?? "Unknown", this._lastInfo?.Text ?? "No error message was received from server.") .RaiseIn(this.BotBits); } }
public override void Disconnect() { if (DisconnectEvent != null) { DisconnectEvent.Invoke(); } base.Disconnect(); }
public void OnDisconnectEvent(int hostId, int connectionId, NetworkError error) { DisconnectEvent?.Invoke(connectionId); print("|Disconnect event: " + "/n|HostId: " + hostId + "/n|ConnectionId : " + connectionId + "/n|Error: " + error.ToString()); }
public AnonymousPipes(String pipeName, String clientPath, String cmdLineArgs, CallBack callback, DisconnectEvent disconnectEvent) { String args; this.clientPath = clientPath; this.callback = callback; this.disconnectEvent = disconnectEvent; this.name = pipeName; this.running = true; serverMode = true; args = StartPipeServer() + " " + cmdLineArgs; try { pipeClient = new Process(); pipeClient.StartInfo.FileName = clientPath; pipeClient.StartInfo.Arguments = args; pipeClient.StartInfo.UseShellExecute = false; pipeClient.Start(); } catch (Exception ex) { ermsg = ex.Message; running = false; return; } outGoingServerPipe.DisposeLocalCopyOfClientHandle(); inComingServerPipe.DisposeLocalCopyOfClientHandle(); ssw = new StreamWriter(outGoingServerPipe); ssw.AutoFlush = true; ssw.WriteLine("SYNC"); outGoingServerPipe.WaitForPipeDrain(); new Thread(delegate() { using (StreamReader isr = new StreamReader(inComingServerPipe)) { String tmp; while (running && inComingServerPipe.IsConnected) { tmp = isr.ReadLine(); if (tmp != null) { callback(tmp); } } } running = false; disconnectEvent(); }).Start(); }
public void Disconnect() { if (currentSocket.Connected) { log.NormalLog(string.Format("Disconnect information,ID:{0} , IPAdderss:{1}", ID, CurrentSocket.RemoteEndPoint)); currentSocket.Disconnect(true); DisconnectEvent?.Invoke(this); } isUsed = false; }
public void Close() { if (StateConnect) { Socket.Close(); Socket.Dispose(); StateConnect = false; requestHandler.LostCustomerConnection(); DisconnectEvent?.Invoke(this, new EventArgs()); } }
private IEnumerator Deconnect() { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; yield return(new WaitForSeconds(5f)); var evnt = DisconnectEvent.Create(GlobalTargets.Everyone); evnt.Send(); yield break; }
public void OnDisconnect(DisconnectEvent ev) { /// <summary> /// This is the event handler for disconnection events. /// </summary> Dictionary <string, string> variables = new Dictionary <string, string> { { "ipaddress", ev.Connection.IpAddress.ToString() } }; plugin.SendMessageToBot(plugin.GetConfigString("discord_channel_ondisconnect"), "round.ondisconnect", variables); }
public void OnDisconnect(DisconnectEvent ev) { if (this.roundOver) { return; } this.plugin.Debug("Dropping player inventory."); Thread myThread = new Thread(new ThreadStart(RealDisconnectHandler)); myThread.Start(); }
public void OnDisconnect(DisconnectEvent ev) { /// <summary> /// This is the event handler for disconnection events. /// </summary> Dictionary <string, string> variables = new Dictionary <string, string> { { "ipaddress", ev.Connection.IpAddress } }; plugin.SendMessage(Config.GetArray("channels.ondisconnect"), "round.ondisconnect", variables); }
public void OnDisconnect(DisconnectEvent ev) { if (!isEnabled) { return; } if (instance.Server.GetPlayers().FirstOrDefault(x => x.PlayerId == scpPlayer?.PlayerId) == null) { KillScp035(false); } }
public override void OnEvent(DisconnectEvent evnt) { //Camera[] cam = FindObjectsOfType<Camera>(); //foreach (var VARIABLE in cam) //{ // BoltNetwork.Destroy(VARIABLE.gameObject); //} BoltNetwork.Shutdown(); SceneManager.LoadScene(0, LoadSceneMode.Single); }
public void Disconnect() { var s = ((AsyncUserToken)socketArg.UserToken).AcceptSocket; if (s.Connected) { s.Shutdown(SocketShutdown.Both); } log.NormalLog(string.Format("Disconnect information,ID:{0} , IPAdderss:{1}", ID, s.RemoteEndPoint)); s.Close(); DisconnectEvent?.Invoke(this); }
/// <summary> /// PLC心跳事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _hbTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { _hbTimer.Stop(); int result = 1; // 不为0的正整数 lock (syncObj) { result = _s7Client.DBRead(10, 0, 1, _hbbuf); // PLC CPU可达, 更新心跳时间 } if (result == 0) { _hbNow = DateTime.Now; } if (_hbNow.AddSeconds(3) < DateTime.Now) //连接时长超过10s表示心跳信号中断 { if (_isConnected) // 第一次连接中断 { DisconnectEvent?.Invoke(this, null); // 更新包括Mainform _isConnected = false; return; } //else // 试着重新连接 //{ // if (_reConnect) // 自动进行5s的重连 // { // Stopwatch sw = new Stopwatch(); // sw.Start(); // while (true) // { // if (sw.Elapsed > TimeSpan.FromSeconds(5)) // { // _reConnect = false; // break; // } // int connOk = _s7Client.Connect(); // // 连接成功 // if (connOk == 0) // { // ReconnectEvent?.Invoke(this, null); // _isConnected = true; // } // } // sw.Stop(); // } //} } if (_isConnected) { _hbTimer.Start(); } }
public void OnDisconnect(DisconnectEvent ev) { for (int i = eventQue.Count - 1; i > -1; i--) { if (eventQue[i].ev.Player.IpAddress == ev.Connection.IpAddress) { DeathSync d = eventQue[i]; d.skip = true; eventQue[i] = d; plugin.Info(ev.Connection.IpAddress + " escaped the resurection by disconnecting! Hopefully crash averted."); } } }
public void Disconnect() { if (ConnectState) { cts.Cancel(); if (taskCycleRead != null) { taskCycleRead.Wait(); } commands.Disconnect(); ConnectState = false; } DisconnectEvent?.Invoke(this, new EventArgs()); }
/// <summary> /// Disconnect from the current server. /// </summary> public void Disconnect() { UpdateManager.StopUdpUpdates(); _udpNetClient.Disconnect(); IsConnected = false; // Clear all client addon packet handlers, because their IDs become invalid _packetManager.ClearClientAddonPacketHandlers(); // Invoke callback if it exists DisconnectEvent?.Invoke(); }
public ProxyConnection(int serverID, byte[] connectMsg, DisconnectEvent disconFunc) { OnDisconnect = disconFunc; ServerID = serverID; syncRequestData = Queue.Synchronized(requestData); syncResponseData = Queue.Synchronized(responseData); Request r = ParseAddrSpec(connectMsg); IPAddress = r.DestAddr.IP.ToString(); if (!DispatchRequest(r)) { throw new SocksException("Unknown error has occurred.", SocksError.Disconnected); } }
public bool DisConnect() { if (IsConnect) { _socket?.Close(); } _socketArg?.Dispose(); _socket?.Dispose(); _socket = null; _socketArg = null; _isConnect = false; _subSocketArgFlag = false; DisconnectEvent?.Invoke(this); return(true); }
public void Stop() { try { if (_eventSourceClient != null) { _eventSourceClient.Disconnect(); _log.Debug($"SSE Handler stoped..."); } } catch (Exception ex) { _log.Debug($"SSE Handler Stop: {ex.Message}"); DisconnectEvent?.Invoke(this, new FeedbackEventArgs(false)); } }
private void OnDisconnectEventHandler(object sender, object disconnectState) { _TCP.DisconnectEvent -= OnDisconnectEventHandler; _TCP.ReceiveAction -= OnReceveDataHandler; _TCP.ReceiveComAction -= OnReceiveCommandHandler; _clientID = 0; _isActive = false; string s = "Disconnected "; if (disconnectState != null) { s += disconnectState.ToString(); } NetLogger.Log(s); DisconnectEvent?.Invoke(_TCP, disconnectState); _TCP = null; }
/// <summary> /// This is the event handler for disconnection events. /// </summary> public void OnDisconnect(DisconnectEvent ev) { Dictionary <string, string> variables = new Dictionary <string, string> { { "ipaddress", ev.Connection.IpAddress } }; if (ev.Connection.IsBanned) { this.plugin.SendMessage(Config.GetArray("channels.ondisconnect.banned"), "round.ondisconnect.banned", variables); } else { this.plugin.SendMessage(Config.GetArray("channels.ondisconnect.default"), "round.ondisconnect.default", variables); } }
private void OnDisconnect(DisconnectEvent e) { e.session.OnDisconnect(); server.sessionPool.Return(e.session); }