/// <summary> /// Creates a new EasyTouchUnit if the message contains valid unit information and null otherwise. /// </summary> /// <param name="data">The message received from a remote connection request</param> /// <returns>The EasyTouchUnit if the message is valid</returns> public static EasyTouchUnit?Create(Messages.GetGatewayData data) { EasyTouchUnit unit = new(data); if (unit.IsValid) { return(unit); } return(null); }
public EasyTouchUnit(Messages.GetGatewayData data) { try { GatewayName = data.GatewayName; IPAddress = IPAddress.Parse(data.IPAddr !); Port = data.Port; IsValid = data.GatewayFound && data.PortOpen; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); } }