private void OnMasterConnectionClosedHandler(object sender, TcpConnectionEventArgs e) { ModbusMasterTcpConnection connection; if (!_masters.TryRemove(e.EndPoint, out connection)) { string msg = $"EndPoint {e.EndPoint} cannot be removed, it does not exist."; throw new ArgumentException(msg); } Debug.WriteLine($"Removed Master {e.EndPoint}"); }
private void OnMasterConnectionClosedHandler(object sender, TcpConnectionEventArgs e) { ModbusMasterTcpConnection connection; if (!_masters.TryRemove(e.EndPoint, out connection)) { var msg = string.Format( CultureInfo.InvariantCulture, "EndPoint {0} cannot be removed, it does not exist.", e.EndPoint); throw new ArgumentException(msg); } Debug.WriteLine("Removed Master {0}", e.EndPoint); }
public void TcpConnectionEventArgs() { var args = new TcpConnectionEventArgs("foo"); Assert.AreEqual("foo", args.EndPoint); }
private void OnMasterConnectionClosedHandler(object sender, TcpConnectionEventArgs e) { ModbusMasterTcpConnection connection; if (!_masters.TryRemove(e.EndPoint, out connection)) { var msg = string.Format( CultureInfo.InvariantCulture, "EndPoint {0} cannot be removed, it does not exist.", e.EndPoint); throw new ArgumentException(msg); } Debug.WriteLine("Removed Master {0}", e.EndPoint); }