예제 #1
0
        /// <summary>
        /// Finds a native device by UDN.
        /// </summary>
        /// <param name="udn">The UDN for the device.</param>
        /// <param name="addressFamily">The address family to search in. (Vista or above only).</param>
        /// <returns>The device if one is found or null if not found.</returns>
        internal static IUPnPDevice FindNativeDeviceByUDN(
            string udn, AddressFamilyFlags addressFamily = AddressFamilyFlags.IPvBoth)
        {
            UPnPDeviceFinder lfFinder = new UPnPDeviceFinder();

            if (lfFinder is IUPnPAddressFamilyControl)
            {
                ((IUPnPAddressFamilyControl)lfFinder).SetAddressFamily((int)addressFamily);
            }

            return(lfFinder.FindByUDN(udn));
        }
예제 #2
0
        private static UPnPDevice FindByUDN(string uniqueDeviceName)
        {
            for (int i = 0; i < 3; ++i)
            {
                UPnPDevice device = _finder.FindByUDN(uniqueDeviceName);
                if (device != null)
                {
                    return(device);
                }
            }

            return(null);
        }
예제 #3
0
        /// <summary>
        /// Finds a native device by UDN.
        /// </summary>
        /// <param name="udn">The UDN for the device.</param>
        /// <param name="addressFamily">The address family to search in. (Vista or above only).</param>
        /// <returns>The device if one is found or null if not found.</returns>
        internal static IUPnPDevice FindNativeDeviceByUDN(
            string udn, AddressFamilyFlags addressFamily = AddressFamilyFlags.IPvBoth)
        {
            UPnPDeviceFinder lfFinder = new UPnPDeviceFinder();

            if (lfFinder is IUPnPAddressFamilyControl)
                ((IUPnPAddressFamilyControl)lfFinder).SetAddressFamily((int)addressFamily);

            return lfFinder.FindByUDN(udn);
        }