/// <summary> /// Forward the OnRemovedDevice event to the user. /// </summary> /// <param name="sender">UPnPInternalSmartControlPoint that sent the event</param> /// <param name="device">The UPnPDevice object that was removed from the network</param> private void HandleRemovedDevice(UPnPInternalSmartControlPoint sender, UPnPDevice device) { if ((OnRemovedDevice != null) || (OnRemovedService != null)) { object[] r; ArrayList dList = new ArrayList(); ArrayList sList = new ArrayList(); Hashtable h = new Hashtable(); bool MatchAll = true; for (int filterIndex = 0; filterIndex < PartialMatchFilters.Length; ++filterIndex) { string filter = PartialMatchFilters[filterIndex]; double Version = MinimumVersion[filterIndex]; if (CheckDeviceAgainstFilter(filter, Version, device, out r) == false) { MatchAll = false; break; } foreach (object x in r) { if (x.GetType().FullName == "OSTL.UPnP.UPnPDevice") { dList.Add(x); if (PartialMatchFilters.Length == 1) { if (OnRemovedDevice != null) { OnRemovedDevice(this, (UPnPDevice)x); } } } else { sList.Add(x); if (PartialMatchFilters.Length == 1) { if (OnRemovedDevice != null) { OnRemovedDevice(this, (UPnPDevice)x); } } } } } if (MatchAll) { if (PartialMatchFilters.Length == 1) { if (OnRemovedService != null) { foreach (UPnPService S in sList) { OnRemovedService(this, S); } } return; } foreach (UPnPDevice dev in dList) { bool _OK_ = true; foreach (string filter in PartialMatchFilters) { if (dev.GetDevices(filter).Length == 0) { if (dev.GetServices(filter).Length == 0) { _OK_ = false; break; } } } if (_OK_) { h[dev] = dev; } } foreach (UPnPService serv in sList) { bool _OK_ = true; foreach (string filter in PartialMatchFilters) { if (serv.ParentDevice.GetServices(filter).Length == 0) { _OK_ = false; break; } } if (_OK_) { if (h.ContainsKey(serv.ParentDevice) == false) { h[serv.ParentDevice] = serv.ParentDevice; } } } } IDictionaryEnumerator ide = h.GetEnumerator(); while (ide.MoveNext()) { if (OnRemovedDevice != null) { OnRemovedDevice(this, (UPnPDevice)ide.Value); } } } }
/// <summary> /// Forward the HandleExpiredDevice event to the user as an OnRemovedDevice event. /// </summary> /// <param name="sender">UPnPInternalSmartControlPoint that sent the event</param> /// <param name="device">The UPnPDevice object that was removed from the network</param> private void HandleExpiredDevice(UPnPInternalSmartControlPoint sender, UPnPDevice device) { HandleRemovedDevice(sender, device); }
/// <summary> /// Forward the OnUpdatedDevice event to the user. /// </summary> /// <param name="sender">UPnPInternalSmartControlPoint that sent the event</param> /// <param name="device">The UPnPDevice object that was updated</param> private void HandleUpdatedDevice(UPnPInternalSmartControlPoint sender, UPnPDevice device) { }