private bool TryParseNotification(IPEndPoint remotEndPoint, string package, out Notification notification) { if (string.IsNullOrEmpty(package) || !package.StartsWith("CK.HA/1.0")) { notification = null; return false; } Match match = _parser.Match(package); string type = match.Groups["type"].Value; string message = match.Groups["message"].Value; int typeID = int.Parse(type); NotificationType typeValue = (NotificationType)typeID; notification = new Notification(DateTime.Now, remotEndPoint.Address, typeValue, message); return true; }
public ControllerNotificationReceivedEventArguments(Notification notification) { if (notification == null) throw new ArgumentNullException(nameof(notification)); Notification = notification; }