/// <summary> /// Creates a new object. /// </summary> /// <param name="endPoint"></param> /// <param name="bytesSent"></param> /// <param name="port"></param> /// <param name="format"></param> public BroadcastEventArgs(IPEndPoint endPoint, int bytesSent, int port, RebroadcastFormat format) { EndPoint = endPoint; BytesSent = bytesSent; Port = port; Format = format; }
/// <summary> /// Returns the localised string for a <see cref="RebroadcastFormat"/>. /// </summary> /// <param name="format"></param> /// <returns></returns> private string ConvertFormatToString(RebroadcastFormat format) { switch (format) { case RebroadcastFormat.Passthrough: return(Strings.RebroadcastFormatPassthrough); case RebroadcastFormat.Port30003: return(Strings.RebroadcastFormatPort30003); case RebroadcastFormat.Avr: return(Strings.RebroadcastFormatAvr); default: throw new NotImplementedException(); } }
/// <summary> /// See interface docs. /// </summary> /// <param name="endPointAddress"></param> /// <param name="endPointPort"></param> /// <param name="connectedToPort"></param> /// <param name="portFormat"></param> /// <param name="bytesSent"></param> public void ShowRebroadcastClientServiced(string endPointAddress, int endPointPort, int connectedToPort, RebroadcastFormat portFormat, int bytesSent) { rebroadcastStatusControl.UpdateEntry(endPointAddress, endPointPort, connectedToPort, portFormat, bytesSent); }
/// <summary> /// Updates or adds a connection to the list. /// </summary> /// <param name="endPointAddress"></param> /// <param name="endPointPort"></param> /// <param name="connectedToPort"></param> /// <param name="portFormat"></param> /// <param name="bytesSent"></param> public void UpdateEntry(string endPointAddress, int endPointPort, int connectedToPort, RebroadcastFormat portFormat, int bytesSent) { lock (_SyncLock) { var connection = _Connections.Where(r => r.EndPointPort == endPointPort && r.EndPointAddress == endPointAddress).FirstOrDefault(); if (connection == null) { connection = new Connection() { EndPointAddress = endPointAddress, EndPointPort = endPointPort }; _Connections.Add(connection); } connection.BytesSent += bytesSent; connection.Format = portFormat; connection.ConnectedToPort = connectedToPort; connection.Changed = true; } }
/// <summary> /// Returns the localised string for a <see cref="RebroadcastFormat"/>. /// </summary> /// <param name="format"></param> /// <returns></returns> private string ConvertFormatToString(RebroadcastFormat format) { switch(format) { case RebroadcastFormat.Passthrough: return Strings.RebroadcastFormatPassthrough; case RebroadcastFormat.Port30003: return Strings.RebroadcastFormatPort30003; case RebroadcastFormat.Avr: return Strings.RebroadcastFormatAvr; default: throw new NotImplementedException(); } }
/// <summary> /// Updates or adds a connection to the list. /// </summary> /// <param name="endPointAddress"></param> /// <param name="endPointPort"></param> /// <param name="connectedToPort"></param> /// <param name="portFormat"></param> /// <param name="bytesSent"></param> public void UpdateEntry(string endPointAddress, int endPointPort, int connectedToPort, RebroadcastFormat portFormat, int bytesSent) { lock(_SyncLock) { var connection = _Connections.Where(r => r.EndPointPort == endPointPort && r.EndPointAddress == endPointAddress).FirstOrDefault(); if(connection == null) { connection = new Connection() { EndPointAddress = endPointAddress, EndPointPort = endPointPort }; _Connections.Add(connection); } connection.BytesSent += bytesSent; connection.Format = portFormat; connection.ConnectedToPort = connectedToPort; connection.Changed = true; } }