示例#1
0
 public UPnPControlPoint()
 {
     this.CreateTable         = Hashtable.Synchronized(new Hashtable());
     this.SSDPTable           = Hashtable.Synchronized(new Hashtable());
     this.NetInfo             = new NetworkInfo(new NetworkInfo.InterfaceHandler(this.NewInterface));
     this.SyncData            = ArrayList.Synchronized(new ArrayList());
     this.SSDPSessions        = Hashtable.Synchronized(new Hashtable());
     this.Lifetime            = new LifeTimeMonitor();
     this.Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.HandleExpired);
 }
 public UPnPInternalSmartControlPoint()
 {
     this.deviceFactory.OnDevice        += new UPnPDeviceFactory.UPnPDeviceHandler(this.DeviceFactoryCreationSink);
     this.deviceLifeTimeClock.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.DeviceLifeTimeClockSink);
     this.deviceUpdateClock.OnExpired   += new LifeTimeMonitor.LifeTimeHandler(this.DeviceUpdateClockSink);
     this.hostNetworkInfo = new NetworkInfo(new NetworkInfo.InterfaceHandler(this.NetworkInfoNewInterfaceSink));
     this.hostNetworkInfo.OnInterfaceDisabled += new NetworkInfo.InterfaceHandler(this.NetworkInfoOldInterfaceSink);
     this.genericControlPoint           = new UPnPControlPoint(this.hostNetworkInfo);
     this.genericControlPoint.OnSearch += new UPnPControlPoint.SearchHandler(this.UPnPControlPointSearchSink);
     this.genericControlPoint.OnNotify += new SSDP.NotifyHandler(this.SSDPNotifySink);
     this.genericControlPoint.FindDeviceAsync("upnp:rootdevice");
 }
示例#3
0
 private void NewInterface(NetworkInfo sender, IPAddress Intfce)
 {
     try
     {
         SSDP ssdp = new SSDP(new IPEndPoint(Intfce, 0x76c), 0xffff);
         ssdp.OnNotify += new SSDP.NotifyHandler(this.HandleNotify);
         this.SSDPTable[Intfce.ToString()] = ssdp;
     }
     catch (Exception)
     {
     }
 }
示例#4
0
 public UPnPControlPoint(NetworkInfo ni)
 {
     this.CreateTable = Hashtable.Synchronized(new Hashtable());
     this.SSDPTable   = Hashtable.Synchronized(new Hashtable());
     this.NetInfo     = ni;
     foreach (IPAddress address in this.NetInfo.GetLocalAddresses())
     {
         this.NewInterface(this.NetInfo, address);
     }
     this.NetInfo.OnNewInterface += new NetworkInfo.InterfaceHandler(this.NewInterface);
     this.SyncData            = ArrayList.Synchronized(new ArrayList());
     this.SSDPSessions        = Hashtable.Synchronized(new Hashtable());
     this.Lifetime            = new LifeTimeMonitor();
     this.Lifetime.OnExpired += new LifeTimeMonitor.LifeTimeHandler(this.HandleExpired);
 }
        private void NetworkInfoOldInterfaceSink(NetworkInfo sender, IPAddress Intfce)
        {
            ArrayList list = new ArrayList();

            lock (this.deviceTableLock)
            {
                foreach (UPnPDevice device in this.GetCurrentDevices())
                {
                    if (device.InterfaceToHost.Equals(Intfce))
                    {
                        list.Add(this.UnprotectedRemoveMe(device));
                    }
                }
            }
            foreach (UPnPDevice device2 in list)
            {
                device2.Removed();
                this.OnRemovedDeviceEvent.Fire(this, device2);
            }
            this.genericControlPoint.FindDeviceAsync("upnp:rootdevice");
        }