public UPnPRelayDevice(UPnPDevice device, CpGateKeeper _CP)
        {
            OpenSource.Utilities.InstanceTracker.Add(this);
            ILCB = new InvokeResponseHandler(InvokeResponseSink);
            CP = _CP;
            ProxyDevice = UPnPDevice.CreateRootDevice(750, double.Parse(device.Version), "");
            ProxyDevice.UniqueDeviceName = Guid.NewGuid().ToString();

            ProxyDevice.HasPresentation = false;
            ProxyDevice.FriendlyName = "*" + device.FriendlyName;
            ProxyDevice.Manufacturer = device.Manufacturer;
            ProxyDevice.ManufacturerURL = device.ManufacturerURL;
            ProxyDevice.ModelName = device.ModelName;
            ProxyDevice.DeviceURN = device.DeviceURN;

            foreach (UPnPService S in device.Services)
            {
                UPnPService S2 = (UPnPService)S.Clone();
                foreach (UPnPAction A in S2.Actions)
                {
                    A.ParentService = S2;
                    A.SpecialCase += new UPnPAction.SpecialInvokeCase(InvokeSink);
                }

                UPnPDebugObject dbg = new UPnPDebugObject(S2);

                dbg.SetField("SCPDURL", "_" + S2.ServiceID + "_scpd.xml");
                dbg.SetProperty("ControlURL", "_" + S2.ServiceID + "_control");
                dbg.SetProperty("EventURL", "_" + S2.ServiceID + "_event");
                ProxyDevice.AddService(S2);
            }

            UDNTable[device.UniqueDeviceName] = ProxyDevice;
            ReverseUDNTable[ProxyDevice.UniqueDeviceName] = device.UniqueDeviceName;
            foreach (UPnPDevice _ed in device.EmbeddedDevices)
            {
                ProcessDevice(_ed);
            }
        }
 private void serviceTypeTextBox_TextChanged(object sender, System.EventArgs e)
 {
     if (selectedItem.GetType() != typeof(UPnPService)) return;
     UPnPDebugObject dobj = new UPnPDebugObject(selectedItem);
     dobj.SetProperty("ServiceURN", serviceTypeTextBox.Text);
     serviceTypeTextBox.Text = ((UPnPService)selectedItem).ServiceURN;
 }
        private void ProcessDevice(UPnPDevice device)
        {
            UPnPDevice d = UPnPDevice.CreateEmbeddedDevice(double.Parse(device.Version), Guid.NewGuid().ToString());
            d.FriendlyName = "*" + device.FriendlyName;
            d.Manufacturer = device.Manufacturer;
            d.ManufacturerURL = device.ManufacturerURL;
            d.ModelDescription = device.ModelDescription;
            d.ModelURL = device.ModelURL;
            d.DeviceURN = device.DeviceURN;
            UDNTable[device.UniqueDeviceName] = d;
            ReverseUDNTable[d.UniqueDeviceName] = device.UniqueDeviceName;

            foreach (UPnPService S in device.Services)
            {
                UPnPService S2 = (UPnPService)S.Clone();
                foreach (UPnPAction A in S2.Actions)
                {
                    A.ParentService = S2;
                    A.SpecialCase += new UPnPAction.SpecialInvokeCase(InvokeSink);
                }

                UPnPDebugObject dbg = new UPnPDebugObject(S2);

                dbg.SetField("SCPDURL", "_" + S2.ServiceID + "_scpd.xml");
                dbg.SetProperty("ControlURL", "_" + S2.ServiceID + "_control");
                dbg.SetProperty("EventURL", "_" + S2.ServiceID + "_event");
                d.AddService(S2);
            }
            ((UPnPDevice)UDNTable[device.ParentDevice.UniqueDeviceName]).AddDevice(d);

            foreach (UPnPDevice _ed in device.EmbeddedDevices)
            {
                ProcessDevice(_ed);
            }
        }