Exemplo n.º 1
0
        public void RunServer(IList <string> args)
        {
            string port      = null;
            string user      = null;
            string assembly  = null;
            string ipaddress = null;

            var p = new OptionSet()
            {
                { "p|port=", v => port = v },
                { "u|user="******"a|assembly=", v => assembly = v },
                { "l|listen=", v => ipaddress = v }
            };

            args = p.Parse(args);

            ServerCommand cmd = new ServerCommand(Environment, args);

            if (assembly != null)
            {
                cmd.ApplicationAssembly = assembly;
            }

            if (port != null)
            {
                int pt;
                if (!Int32.TryParse(port, out pt))
                {
                    throw new ArgumentException("Port value is not an integer.");
                }
                if (pt <= 0)
                {
                    throw new ArgumentOutOfRangeException("port", "Port must be a positive integer.");
                }
                cmd.Port = pt;
            }

            if (user != null)
            {
                cmd.User = user;
            }

            if (ipaddress != null)
            {
                cmd.IPAddress = ipaddress;
            }

            cmd.Run();
        }
Exemplo n.º 2
0
        public void RunServer(IList<string> args)
        {
            string port = null;
            string user = null;
            string assembly = null;
            string ipaddress = null;

            var p = new OptionSet () {
                { "p|port=", v => port = v },
                { "u|user="******"a|assembly=", v=> assembly = v},
                { "l|listen=", v => ipaddress = v }
            };
            args = p.Parse(args);

            ServerCommand cmd = new ServerCommand (Environment, args);

            if(assembly != null)
            {
                cmd.ApplicationAssembly = assembly;
            }

            if (port != null) {
                int pt;
                if (!Int32.TryParse (port, out pt))
                    throw new ArgumentException ("Port value is not an integer.");
                if (pt <= 0)
                    throw new ArgumentOutOfRangeException ("port", "Port must be a positive integer.");
                cmd.Port = pt;
            }

            if (user != null)
                cmd.User = user;

            if (ipaddress != null)
                cmd.IPAddress = ipaddress;

            cmd.Run ();
        }
Exemplo n.º 3
0
        public void RunServer(IList<string> args)
        {
            string port = null;
            string securePort = null;
            string certFile = null;
            string keyFile = null;
            string user = null;
            string assembly = null;
            string ipaddress = null;

            var p = new OptionSet () {
                { "p|port=", v => port = v },
                { "P|secureport=", v => securePort = v },
                { "c|certfile=", v => certFile = v },
                { "k|keyfile=", v => keyFile = v },
                { "u|user="******"a|assembly=", v=> assembly = v},
                { "l|listen=", v => ipaddress = v }
            };
            args = p.Parse(args);

            ServerCommand cmd = new ServerCommand (Environment, args);

            if(assembly != null)
            {
                cmd.ApplicationAssembly = assembly;
            }

            if (port != null) {
                int pt;
                if (!Int32.TryParse (port, out pt))
                    throw new ArgumentException ("Port value is not an integer.");
                if (pt <= 0)
                    throw new ArgumentOutOfRangeException ("port", "Port must be a positive integer.");
                cmd.Port = pt;
            }

            if (securePort != null) {
                if (certFile == null)
                    throw new ArgumentException ("Certificate file required for TLS.");
                if (keyFile == null)
                    throw new ArgumentException ("Certificate private key required for TLS.");
                int pt;
                if (!Int32.TryParse (securePort, out pt))
                    throw new ArgumentException ("Secure port value is not an integer.");
                if (pt <= 0)
                    throw new ArgumentOutOfRangeException ("secureport", "Secure port must be a positive integer.");
                cmd.SecurePort = pt;
                cmd.CertificateFile = certFile;
                cmd.KeyFile = keyFile;
            }

            if (user != null)
                cmd.User = user;

            if (ipaddress != null)
                cmd.IPAddress = ipaddress;

            cmd.Run ();
        }
Exemplo n.º 4
0
        public void RunServer(IList<string> args)
        {
            string port = null;
            string user = null;

            var p = new OptionSet () {
                { "p|port=", v => port = v },
                { "u|user="******"Port value is not an integer.");
                if (pt <= 0)
                    throw new ArgumentOutOfRangeException ("port", "Port must be a positive integer.");
                cmd.Port = pt;
            }

            if (user != null)
                cmd.User = user;

            cmd.Run ();
        }
Exemplo n.º 5
0
        public void RunServer(IList<string> args)
        {
            ServerCommand cmd = new ServerCommand (Environment, args);

            cmd.Run ();
        }
Exemplo n.º 6
0
        public void RunServer(IList <string> args)
        {
            string port       = null;
            string securePort = null;
            string certFile   = null;
            string keyFile    = null;
            string user       = null;
            string assembly   = null;
            string ipaddress  = null;

            var p = new OptionSet()
            {
                { "p|port=", v => port = v },
                { "P|secureport=", v => securePort = v },
                { "c|certfile=", v => certFile = v },
                { "k|keyfile=", v => keyFile = v },
                { "u|user="******"a|assembly=", v => assembly = v },
                { "l|listen=", v => ipaddress = v }
            };

            args = p.Parse(args);

            ServerCommand cmd = new ServerCommand(Environment, args);

            if (assembly != null)
            {
                cmd.ApplicationAssembly = assembly;
            }

            if (port != null)
            {
                int pt;
                if (!Int32.TryParse(port, out pt))
                {
                    throw new ArgumentException("Port value is not an integer.");
                }
                if (pt <= 0)
                {
                    throw new ArgumentOutOfRangeException("port", "Port must be a positive integer.");
                }
                cmd.Port = pt;
            }

            if (securePort != null)
            {
                if (certFile == null)
                {
                    throw new ArgumentException("Certificate file required for TLS.");
                }
                if (keyFile == null)
                {
                    throw new ArgumentException("Certificate private key required for TLS.");
                }
                int pt;
                if (!Int32.TryParse(securePort, out pt))
                {
                    throw new ArgumentException("Secure port value is not an integer.");
                }
                if (pt <= 0)
                {
                    throw new ArgumentOutOfRangeException("secureport", "Secure port must be a positive integer.");
                }
                cmd.SecurePort      = pt;
                cmd.CertificateFile = certFile;
                cmd.KeyFile         = keyFile;
            }

            if (user != null)
            {
                cmd.User = user;
            }

            if (ipaddress != null)
            {
                cmd.IPAddress = ipaddress;
            }

            cmd.Run();
        }