Exemple #1
0
        static void Main()
        {
            db            = new PangyaEntities();
            Console.Title = string.Format("Pangya Fresh Up! AuthServer - LOGIN: {0}, GAMES: {1}, MESSENGER: {2}", 0, 0, 0);

            AuthKey = "3493ef7ca4d69f54de682bee58be4f93"; //Unogames em MD5

            //Inicia servidor
            Server = new AuthServer();
            Server.Start();
            Server.OnPacketReceived += TcpServer_OnPacketReceived;

            var servers = db.Pangya_Server.Where(c => c.Active == true && c.Port != 7997).ToList();

            foreach (var _server in servers)
            {
                db.Database.SqlQuery <PangyaEntities>($"UPDATE [dbo].[Pangya_Server] Set Active = '{0}' where ServerID = '{_server.ServerID}'").FirstOrDefault();
            }
            for (; ;)
            {
                var comando = Console.ReadLine().Split(new char[] { ' ' }, 2);
                switch (comando[0].ToLower())
                {
                case "": break;

                case "notice":
                {
                    var message = comando[1];

                    Server.Send(AuthClientTypeEnum.GameServer, new AuthPacket()
                        {
                            ID = AuthPacketEnum.SERVER_RELEASE_NOTICE, Message = new { mensagem = message }
                        });
                }
                break;

                case "ticket":
                {
                    var message = comando[1];

                    Server.Send(AuthClientTypeEnum.GameServer, new AuthPacket()
                        {
                            ID = AuthPacketEnum.SERVER_RELEASE_TICKET, Message = new { GetNickName = "ADMIN", GetMessage = message }
                        });
                }
                break;

                case "quit":
                    Console.WriteLine("The server was stopped!");
                    Environment.Exit(1);
                    break;

                case "limpar":
                case "cls":
                case "clear":
                    Console.Clear();
                    break;

                default:
                    Console.WriteLine("Comando inexistente");
                    break;
                }
            }
        }