private void Server_ConnetionClosed(object sender, UCBServerConnection e) { if (IdentifiedServers.ContainsKey(e)) { ServerDisconnected?.Invoke(this, IdentifiedServers[e]); IdentifiedServers.Remove(e); } }
private void Server_ConnectionIdentified(object sender, UCBServerConnection e) { foreach (U3Server server in AvailableServers) { if (server.LastPID == e.PID) { if (!IdentifiedServers.ContainsKey(e)) { IdentifiedServers.Add(e, server); ServerIdentified?.Invoke(this, server); return; } } } }
public bool SendPackage(U3Server server, OPackage package) { if (IsIdentifed(server)) { try { UCBServerConnection con = GetConnection(server); if (con != null) { con.send(package); return(true); } return(false); } catch (Exception) { return(false); } } else { return(false); } }