Пример #1
0
        /**
         *
         *
         */
        public static void Main(string[] args)
        {
            // defaults, either bei config file or hard coded defaults... (see Config class below)
            int    port     = Config.Port;
            String logFile  = Config.LogFilename;
            String ip       = Config.IP;
            String host     = Config.Host;
            String token    = Config.Usertoken;
            String username = Config.Username;

            // lame parsing of command line parameters
            if (args.Length >= 1)
            {
                try
                {
                    port = Convert.ToInt32(args[0]);
                }
                catch (System.FormatException e)
                {
                    port = 3306;
                    Console.WriteLine("Info: Supplied port number was not valid. Defaulting to 3306");
                }

                if (args.Length >= 2)
                {
                    logFile = args[1];

                    if (args.Length >= 3)
                    {
                        ip = args[2];
                    }

                    if (args.Length >= 4)
                    {
                        username = args[3];
                    }

                    if (args.Length >= 5)
                    {
                        token = args[4];
                    }

                    if (args.Length >= 6)
                    {
                        host = args[5];
                    }
                }
            }

            Console.WriteLine("Starting mysql pot with port " + port + " and logfile " + logFile + " and IP " + ip + " and username " + username + " and password " + token);
            Console.WriteLine("Command line parameters: port logfile ip username password host");
            MySqlServer mysqlServer = new MySqlServer(port, logFile, ip);

            mysqlServer.start(username, token, host);
        }       // main function
Пример #2
0
        /**
         *
         *
         */
        public static void Main(string[] args)
        {
            // defaults, either bei config file or hard coded defaults... (see Config class below)
            int port = Config.Port;
            String logFile = Config.LogFilename;
            String ip = Config.IP;
            String host = Config.Host;
            String token = Config.Usertoken;
            String username = Config.Username;

            // lame parsing of command line parameters
            if (args.Length >= 1)
            {
                try
                {
                    port = Convert.ToInt32(args[0]);
                }
                catch (System.FormatException e)
                {
                    port = 3306;
                    Console.WriteLine("Info: Supplied port number was not valid. Defaulting to 3306");
                }

                if (args.Length >= 2)
                {
                    logFile = args[1];

                    if (args.Length >= 3)
                    {
                        ip = args[2];
                    }

                    if (args.Length >= 4)
                    {
                        username = args[3];
                    }

                    if (args.Length >= 5)
                    {
                        token = args[4];
                    }

                    if (args.Length >= 6)
                    {
                        host = args[5];
                    }

                }

            }

            Console.WriteLine ("Starting mysql pot with port " + port + " and logfile " + logFile + " and IP " + ip + " and username " + username + " and password " + token);
            Console.WriteLine ("Command line parameters: port logfile ip username password host");
            MySqlServer mysqlServer = new MySqlServer(port, logFile, ip);
            mysqlServer.start(username, token, host);
        }