Пример #1
0
        public void Run()
        {
            do
            {
                Console.WriteLine("This program is free software: you can redistribute it and/or modify");
                Console.WriteLine("it under the terms of the GNU General Public License as published by");
                Console.WriteLine("the Free Software Foundation, either version 3 of the License, or");
                Console.WriteLine("(at your option) any later version.");
                Console.WriteLine("");
                Console.WriteLine("This program is distributed in the hope that it will be useful,");
                Console.WriteLine("but WITHOUT ANY WARRANTY; without even the implied warranty of");
                Console.WriteLine("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the");
                Console.WriteLine("GNU General Public License for more details.");
                Console.WriteLine("");
                Console.WriteLine("You should have received a copy of the GNU General Public License");
                Console.WriteLine("along with this program.  If not, see <http://www.gnu.org/licenses/>.");

                if (GetInput("Accept the license of use?", "n", "y/N") == "y")
                {
                    licence = true;
                }
            }while (licence == false);

            do
            {
                port = Convert.ToInt32(GetInput("Insert the port on which the server will run", Convert.ToString(DEFAULT_PORT)));
            }while (port == -1);

            do
            {
                players = Convert.ToInt32(GetInput("Insert the maximum number of players", Convert.ToString(DEFAULT_PLAYERS)));
            }while (players == -1);

            do
            {
                motd = GetInput("Insert the server name", DEFAULT_MOTD);
            }while (motd == "null");

            YamlConfig config = new YamlConfig(route + "server.yml");

            config.Set("motd", motd);
            config.Set("ip", "0.0.0.0");
            config.Set("port", port);
            config.Set("max-players", players);

            config.Save();

            Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine("Configuration finished! Starting server, one moment please...");

            Console.ResetColor();
        }
Пример #2
0
        public static CrashReport ExportReport(string title, Exception cause, bool debugReport = false)
        {
            DateTime time = DateTime.Now;
            string   path = Server.ExecutePath + "/reports/crash";
            string   file = path + "/report-" + time.ToString("yyyy_M_d H_mm_ss") + ".report";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            YamlConfig  report = YamlConfig.Load(file);
            CrashReport data   = null;

            if (debugReport)
            {
                data = new CrashReport(title, cause, time);
            }
            else
            {
                data = new CrashReport(title, cause.ToString(), time);
            }

            report.Set("reportData", data);
            report.Save();

            return(data);
        }