Exemple #1
0
 public static void Initialization()
 {
     using (YobiWiContext context = new YobiWiContext())
     {
         context.Database.EnsureCreated();
     }
     Log.Info("Start server program.");
     Config.Initialization();
     MailF.Init();
 }
Exemple #2
0
        /// <summary>
        /// The entry point of the program, where the program control starts and keys functional.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

            Config.Initialization();

            Database.Initialization(false);
            MailF.Init();
            if (args.Length != 0)
            {
                if (args.Length >= 2)
                {
                    if (args[0] == "-a")
                    {
                        AddAdmin(args[1], args[2]);
                    }
                }
                switch (args[0])
                {
                case "-r":
                    Logger.ReadConsoleLogsDatabase();
                    break;

                case "-c":
                    Database.DropTables();
                    break;

                case "-d":
                    SetUpWordsContent();
                    break;

                case "-v":
                    Server server = new Server();
                    server.request_view = true;
                    server.port         = Config.Port;
                    server.ip           = Config.IP;
                    server.domen        = Config.Domen;
                    UsersController user  = new UsersController(Config.Domen);
                    GameController  game  = new GameController();
                    AdminController admin = new AdminController();
                    server.InitListenSocket();
                    break;

                case "-h":
                case "-help":
                    Helper();
                    break;

                default:
                    Console.WriteLine("Turn first parameter for initialize server. You can turned keys: -h or -help - to see instruction of start servers modes.");
                    break;
                }
            }
            else
            {
                Server server = new Server();
                server.port  = Config.Port;
                server.ip    = Config.IP;
                server.domen = Config.Domen;
                UsersController user  = new UsersController(Config.Domen);
                GameController  game  = new GameController();
                AdminController admin = new AdminController();
                server.InitListenSocket();
            }
        }