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); } }
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(); } }
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(); }