private void ConfigureItem_Click(object sender, EventArgs e) { var previous = ClientState; ClientState = EClientState.Changing; using (var setup = new SetupForm(_client.ClientConfig)) { if (setup.ShowDialog() == DialogResult.OK) { ClientState = previous; WaitThenStopClientIfNeeded(); try { _client.ClientConfig.SaveToFile(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + _client.ConfigFile); _client.UnLoadConfiguration(); _client.LoadConfiguration(); StartItem_Click(sender, e); } catch (Exception ex) { _client.Log(ex.Message, ESeverity.ERROR); _client.Log(ex.ToString(), ESeverity.DEBUG); } } else { ClientState = previous; } } }
public Client(IPEndPoint _remoteEndPoint, DateTime _connectedAt, EClientState _clientState) { remoteEndPoint = _remoteEndPoint; connectedAt = _connectedAt; clientState = _clientState; commandIssued = String.Empty; }
public CClientInfo(Guid clientInfoId, string computerName, string ipAddress, DateTime lastEventDateTime, EClientState state) { ClientInfoId = clientInfoId; ComputerName = computerName; IpAddress = ipAddress; LastEventDateTimeUtc = lastEventDateTime; State = state; }
public ClientRow(IPEndPoint ipPoint, long time, EClientState state = EClientState.Idle) { Index = 0; IpPoint = ipPoint; ScanTime = time; State = state; ConnectedTime = DateTime.Now; BeginTime = 0; }
public Client(IPEndPoint _remoteEndPoint, DateTime _connectedAt, EClientState _clientState) { remoteEndPoint = _remoteEndPoint; connectedAt = _connectedAt; clientState = _clientState; commandIssued = String.Empty; BirthMark = LiveCache.GetUniqueIdentifier(String.Format(cacheKeyFormat, remoteEndPoint.Port)); Birthdate = DateTime.Now; }
private void AdminItem_Click(object sender, EventArgs e) { var previous = ClientState; ClientState = EClientState.Changing; using (var admin = new AdminForm(_client.Tunnel, _client.Sid)) admin.ShowDialog(); ClientState = previous; }
public void SetClientState(EClientState state) { lock (client.Udp) { packet.Clear(); packet.Command = EClientCommand.SetClientState; packet.IArg1 = (int)state; client.Udp.Send(packet.Bytes, packet.Bytes.Length, client.IpPoint); Log(ESenderLogItem.Send, "Send a Command({0}) - IArg1 : {1}", packet.Command.ToString(), packet.IArg1); } client.Listener.WaitForAck(); }
private void StopClient(object state) { try { _client.StopClient(); ClientState = EClientState.Stopped; NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), Strings.MAINFORM_CLIENT_STOPPED, false); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Arrêt effectif du client /// </summary> /// <param name="state">les parametres</param> /// ----------------------------------------------------------------------------- private void StopClient(Object state) { try { _client.StopClient(); ClientState = EClientState.Stopped; // On utilise un Invoke car le thread courant est différent du thread créateur du contrôle (modèle STA) NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), new object[] { Strings.MAINFORM_CLIENT_STOPPED, false }); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); } }
private void StartClient(Object state) { try { _client.StartClient(); ClientState = EClientState.Started; NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), Strings.MAINFORM_CLIENT_STARTED, true); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); StopClient(null); } NotifyContextMenu_Opened(this, EventArgs.Empty); }
/// ----------------------------------------------------------------------------- /// <summary> /// Configuration du client /// </summary> /// <param name="sender">l'appelant</param> /// <param name="e">les parametres</param> /// ----------------------------------------------------------------------------- private void ConfigureItem_Click(object sender, EventArgs e) { var previous = ClientState; ClientState = EClientState.Changing; using (var setup = new SetupForm(_client.ClientConfig)) { if (setup.ShowDialog() == DialogResult.OK) { /* * Petite subtilite: a ce moment la configuration m_client contient de faux loggers * utiles uniquement pour sauvegarder le parametrage dans le fichier de configuration. * * Par contre les vrais instances des loggers sont conserves dans l'ancetre BdtClient. * UnLoadConfiguration va fermer ces loggers. LoadConfiguration va recharger le fichier * de configuration prealablement sauvegarde pour remettre a jour les instances -> * rechargement de la section logs uniquement * */ ClientState = previous; WaitThenStopClientIfNeeded(); try { _client.ClientConfig.SaveToFile(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + _client.ConfigFile); _client.UnLoadConfiguration(); _client.LoadConfiguration(); StartItem_Click(sender, e); } catch (Exception ex) { _client.Log(ex.Message, ESeverity.ERROR); _client.Log(ex.ToString(), ESeverity.DEBUG); } } else { ClientState = previous; } } }
private void SetClientState(IPEndPoint ipPoint) { lock (server.Clients) { if (server.Clients.ContainsKey(ipPoint.ToString()) == false) { logger.Log((int)EListenerLogItem.Note, "Can't find a client({0}) in Client Dictionary", ipPoint.ToString()); return; } ClientRow client = server.Clients[ipPoint.ToString()]; EClientState state = (EClientState)packet.IArg1; client.State = state; logger.Log((int)EListenerLogItem.Note, "Changed client({0}) to {1}", ipPoint.ToString(), state.ToString()); } OnChangedClients(this, null); }
/// ----------------------------------------------------------------------------- /// <summary> /// Administration du serveur /// </summary> /// <param name="sender">l'appelant</param> /// <param name="e">les parametres</param> /// ----------------------------------------------------------------------------- private void AdminItem_Click(object sender, EventArgs e) { var previous = ClientState; ClientState = EClientState.Changing; using (var admin = new AdminForm(_client.Tunnel, _client.Sid)) admin.ShowDialog(); ClientState = previous; }
/// ----------------------------------------------------------------------------- /// <summary> /// Arrêt du client /// </summary> /// <param name="sender">l'appelant</param> /// <param name="e">les parametres</param> /// ----------------------------------------------------------------------------- private void StopItem_Click(object sender, EventArgs e) { ClientState = EClientState.Changing; UpdateNotifyIcon(Strings.MAINFORM_CLIENT_STOPPING, false); System.Threading.ThreadPool.QueueUserWorkItem(StopClient); }
private void StopItem_Click(object sender, EventArgs e) { ClientState = EClientState.Changing; UpdateNotifyIcon(Strings.MAINFORM_CLIENT_STOPPING, false); System.Threading.ThreadPool.QueueUserWorkItem(StopClient); }
public Client(IPEndPoint _remoteEndPoint, DateTime _connectedAt, EClientState _clientState) { remoteEndPoint = _remoteEndPoint; connectedAt = _connectedAt; clientState = _clientState; }
public TelnetClient(IPEndPoint _remoteEndPoint, DateTime _connectedAt, EClientState _clientState) { this.remoteEndPoint = _remoteEndPoint; this.connectedAt = _connectedAt; this.clientState = _clientState; }