예제 #1
0
        private void close_app(int exit_code)
        {
            if (cloudlist != null)
            {
                if (cloudlist.part_of_cloud)
                {
                    cloudlist.LeaveCloud();
                }
            }
            if (sniffer != null)
            {
                sniffer.close();
                sniffer = null;
            }
            if (udp_listener != null)
            {
                node_list.sendLogOff();
                udp_listener.shutdown();
                udp_listener = null;
            }
            if (upnp != null)
            {
                if (upnp.isUPnPavailable())
                {
                    upnp.upnp_deleteAllPortMappings();
                }
            }

            stop_threads();
#if DEBUG
            xbs_messages.addDebugMessage("exiting program.", xbs_message_sender.GENERAL);
#endif
            output_queued_messages();
#if DEBUG
            Console.ReadLine();
#endif
            exit_code = 0;
            if (windows_console_attached)
            {
                FreeConsole();
            }
            if (System.Windows.Forms.Application.MessageLoop)
            {
                System.Windows.Forms.Application.Exit();
            }
            else
            {
                System.Environment.Exit(exit_code);
            }
        }
예제 #2
0
        private void discover_upnp()
        {
            upnp = new xbs_upnp();
            upnp.upnp_startDiscovery();
            int count = 0;

            while (!upnp.isUPnPavailable() && count < (80))
            {
                Thread.Sleep(250);
                count++;
            }
            if (upnp.isUPnPavailable())
            {
                external_ip = upnp.upnp_getPublicIP();
            }
        }
예제 #3
0
 private void discover_upnp()
 {
     upnp = new xbs_upnp();
     upnp.upnp_startDiscovery();
     int count = 0;
     while (!upnp.isUPnPavailable() && count < (80))
     {
         Thread.Sleep(250);
         count++;
     }
     if (upnp.isUPnPavailable())
         external_ip = upnp.upnp_getPublicIP();
 }