protected override void OnSearchCompleted(networkInterface Interface, IList <Tuple <IPAddress, string> > Responses) { string serviceAddress; string MACAddress = ""; foreach (Tuple <IPAddress, string> s in Responses) { serviceAddress = Regex.Match(s.Item2, @"(?<=LOCATION:).*?(?=\r\n)", RegexOptions.Singleline).Value; Interface.add_DeviceInfo(new deviceNetworkInfo() { IPaddress = s.Item1, MACAddress = MACAddress, UPNPServiceAddress = serviceAddress }); } base.NotifyResultProcessingDone(); }
protected override void OnSearchCompleted(networkInterface Interface, IList <Tuple <IPAddress, string> > Responses) { //Process the result from socket for this Interface string[] Xaddresses; try { foreach (Tuple <IPAddress, string> s in Responses) { Xaddresses = Regex.Match(s.Item2, @"(?<=XAddrs>).*?(?=</)", RegexOptions.Singleline).Value.Split(char.Parse(" ")); for (int idx = 0; idx < Xaddresses.Length; idx++) { if (ExcludeLocalLinkAddesses) { string ipaddress = Regex.Match(Xaddresses[idx], "(?<=http://).*?(?=/)").Value; if (ipaddress.Substring(0, 7) != "169.254") { Interface.add_DeviceInfo(new deviceNetworkInfo() { IPaddress = s.Item1, ONVIFXAddress = Xaddresses[idx], Model = parse_model_from_service_response(s.Item2) }); } } else { Interface.add_DeviceInfo(new deviceNetworkInfo() { IPaddress = s.Item1, ONVIFXAddress = Xaddresses[idx], Model = parse_model_from_service_response(s.Item2) }); } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } base.NotifyResultProcessingDone(); }