示例#1
0
文件: Program.cs 项目: Ch0wW/XBSlink
        static void Main(string[] args)
        {
            xbs_settings settings = new xbs_settings();

            if (args.Length > 0)
            {
                console_app = new xbs_console_app();
                console_app.run(settings, args);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                try
                {
                    main_form = new FormMain();
                }
                catch (ApplicationException)
                {
                    main_form = null;
                }

                if (main_form != null)
                    Application.Run(main_form);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            xbs_settings settings = new xbs_settings();

            if (args.Length > 0)
            {
                console_app = new xbs_console_app();
                console_app.run(settings, args);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                try
                {
                    main_form = new FormMain();
                }
                catch (ApplicationException)
                {
                    main_form = null;
                }

                if (main_form != null)
                {
                    Application.Run(main_form);
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }