public void run(xbs_settings settings, String[] args) { int exit_code = 0; if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) { if (!AttachConsole(ATTACH_PARENT_PROCESS) && Marshal.GetLastWin32Error() == ERROR_ACCESS_DENIED) { // A console was not allocated, so we need to make one. if (!AllocConsole()) { throw new Exception("Console Allocation Failed"); } } windows_console_attached = true; } Console.CancelKeyPress += delegate { handleCancelKeyPress(); }; WebRequest.DefaultWebProxy = null; default_color_text = Console.ForegroundColor; default_color_background = Console.BackgroundColor; xbs_chat.notify_on_incoming_message = false; command_line_option_set = new OptionSet() { { "?|h|help", "show this help message", v => cmd_help = v != null }, { "l|list-devices", "list all available network packet capture devices", v => cmd_list_devices = v != null }, { "d|update-check", "check online for program update", v => option_check_for_update = v != null }, { "n|nickname=", "set the nickname", v => option_nickname = v }, { "s|cloudserver=", "set cloudserver URL", v => option_cloudserver = v }, { "j|list-clouds", "list available clouds on cloudserver", v => cmd_list_clouds = v != null }, { "c|cloudname=", "connect to this cloud", v => option_cloudname = v }, { "m|max-nodes=", "maximum clients in cloud. default is 10", (UInt16 v) => option_maxnodes = v }, { "w|password="******"set password for cloud", v => option_password = v }, { "u|upnp", "use UPnP to forward incoming port", v => option_upnp = v != null }, { "p|port=", "set the incoming port number. default is 31415", (UInt16 v) => option_local_port = v }, { "o|source-ip=", "bind to this local ip address.", (String v) => option_local_ip = IPAddress.Parse(v) }, { "i|capture-device=", "name of network device for capturing packets", v => option_capture_device = v }, }; xbs_settings = settings; cloudlist = new xbs_cloudlist(); exit_code = parse_command_line(args); close_app(exit_code); }
private void Form1_Load(object sender, EventArgs e) { // globally turn off Proxy auto detection WebRequest.DefaultWebProxy = null; node_list = new xbs_node_list(); cloudlist = new xbs_cloudlist(); upnp = new xbs_upnp(); NAT = new xbs_nat(); initializeCloudListView(); timer_messages.Start(); form1_width = this.Width; ShowVersionInfoMessages(); textBox_local_Port.Text = xbs_udp_listener.standard_port.ToString(); textBox_remote_port.Text = xbs_udp_listener.standard_port.ToString(); initializeLocalIPList(); initializeTrayIcon(); initWithRegistryValues(); initializeAboutWindow(); tabControl1.SelectedTab = tabPage_settings; autoswitch_on_chat_message = checkBox_chatAutoSwitch.Checked; if (checkBox_showNewsFeed.Checked) loadNewsFeed(textBox_newsFeedUri.Text); }
public void run(xbs_settings settings, String[] args) { int exit_code = 0; if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) { if (!AttachConsole(ATTACH_PARENT_PROCESS) && Marshal.GetLastWin32Error() == ERROR_ACCESS_DENIED) { // A console was not allocated, so we need to make one. if (!AllocConsole()) { throw new Exception("Console Allocation Failed"); } } windows_console_attached = true; } Console.CancelKeyPress += delegate { handleCancelKeyPress(); }; WebRequest.DefaultWebProxy = null; default_color_text = Console.ForegroundColor; default_color_background = Console.BackgroundColor; xbs_chat.notify_on_incoming_message = false; command_line_option_set = new OptionSet() { { "?|h|help", "show this help message", v => cmd_help = v!=null }, { "l|list-devices", "list all available network packet capture devices", v => cmd_list_devices = v != null }, { "d|update-check", "check online for program update", v => option_check_for_update = v!=null }, { "n|nickname=", "set the nickname", v => option_nickname=v }, { "s|cloudserver=", "set cloudserver URL", v => option_cloudserver=v }, { "j|list-clouds", "list available clouds on cloudserver", v => cmd_list_clouds = v!=null }, { "c|cloudname=", "connect to this cloud", v => option_cloudname=v }, { "m|max-nodes=", "maximum clients in cloud. default is 10", (UInt16 v) => option_maxnodes=v }, { "w|password="******"set password for cloud", v => option_password=v }, { "u|upnp", "use UPnP to forward incoming port", v => option_upnp = v!=null }, { "p|port=", "set the incoming port number. default is 31415", (UInt16 v) => option_local_port = v }, { "o|source-ip=", "bind to this local ip address.", (String v) => option_local_ip=IPAddress.Parse(v) }, { "i|capture-device=", "name of network device for capturing packets", v => option_capture_device = v }, }; xbs_settings = settings; cloudlist = new xbs_cloudlist(); exit_code = parse_command_line(args); close_app(exit_code); }