Exemplo n.º 1
0
        // GET: Mobile
        public ActionResult Index()
        {
            User user = (User)Session[WebUtils.Current_User];

            if (!(user != null && user.IsInRole(WebUtils.Admin)))
            {
                return(RedirectToAction("Login", "Users", new { ctl = "Mobile", act = "AllMobiles" }));
            }
            List <Mobile> mobiles = new MobileHandler().GetAllMobiles();

            return(View(mobiles));
        }
Exemplo n.º 2
0
        public ActionResult UpdateMobile(int id)
        {
            User user = (User)Session[WebUtils.Current_User];

            if (!(user != null && user.IsInRole(WebUtils.Admin)))
            {
                return(RedirectToAction("Login", "Users", new { ctl = "Slider", act = "AddImages" }));
            }
            Mobile mobile = new MobileHandler().GetMobilesById(id);

            return(View(mobile));
        }
Exemplo n.º 3
0
 /// <summary>
 /// constructor.
 /// </summary>
 /// <param name="controller">controller</param>
 /// <param name="logging">logger</param>
 public ImageServer(IImageController controller, ILoggingService logging, ICurrentRunLog currentLog)
 {
     handlersList = new List <string>();
     m_controller = controller;
     m_logging    = logging;
     m_currentLog = currentLog;
     m_ch         = new ClientHandler(m_controller, m_logging);
     m_mobileCh   = new MobileHandler(this, m_logging);
     //  m_tcpserver = new TCPServer(port, m_ch, m_logging);
     m_mobileserver = new MobileServer(port, m_mobileCh, m_logging);
     // read from App config and put handlers in array of string.
     // string[] directories = ConfigurationManager.AppSettings.Get("Handler").Split(';');
     foreach (string directoryPath in ConfigInfomation.Instance.handlerPaths)
     {
         // create handler for each path.
         CreateHandler(directoryPath);
     }
     m_controller.SpecialCommanndAppeared += SendCommand;
     // m_controller.SpecialCommanndAppeared += PassLog;
     // m_logging.MessageRecieved += m_ch.UpdateClientsNewLog;
 }
Exemplo n.º 4
0
        public ActionResult MobileDetails(int id)
        {
            List <Mobile> mobiles = new MobileHandler().GetMobilebyId(id);

            return(View(mobiles));
        }
Exemplo n.º 5
0
        public void Initialize()
        {
            Essential.consoleWriter = new ConsoleWriter(Console.Out);
            Console.SetOut(Essential.consoleWriter);
            try
            {
                Console.WindowWidth  = 130;
                Console.WindowHeight = 36;
            }
            catch { }
            Essential.ServerStarted = DateTime.Now;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine();
            Console.WriteLine(@"                                          ______                    _   _       _ ");
            Console.WriteLine(@"                                         |  ____|                  | | (_)     | |");
            Console.WriteLine(@"                                         | |__   ___ ___  ___ _ __ | |_ _  __ _| |");
            Console.WriteLine(@"                                         |  __| / __/ __|/ _ \ '_ \| __| |/ _` | |");
            Console.WriteLine(@"                                         | |____\__ \__ \  __/ | | | |_| | (_| | |");
            Console.WriteLine(@"                                         |______|___/___/\___|_| |_|\__|_|\__,_|_|");
            Console.WriteLine();
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("                                         Essential Emulator Build " + Build + " by " + Creator);
            Console.WriteLine();
            Console.WriteLine("                         Credits to: Meth0d (Uber), Sojobo (Phoenix), Juniori (GTE) & Rootkit (Essential)");
            Console.WriteLine();
            Console.ResetColor();
            try
            {
                Essential.Configuration = new ConfigurationData("config.conf");
                DateTime now = DateTime.Now;
                try
                {
                    Essential.SWFDirectory = Essential.GetConfig().data["web.api.furni.hof_furni"];
                }
                catch { }
                if (!Directory.Exists("API"))
                {
                    Directory.CreateDirectory("API");
                }

                DatabaseServer dbServer = new DatabaseServer(Essential.GetConfig().data["db.hostname"], uint.Parse(Essential.GetConfig().data["db.port"]), Essential.GetConfig().data["db.username"], Essential.GetConfig().data["db.password"]);
                Database       database = new Database(Essential.GetConfig().data["db.name"], uint.Parse(Essential.GetConfig().data["db.pool.minsize"]), uint.Parse(Essential.GetConfig().data["db.pool.maxsize"]));
                Essential.DatabaseManager = new DatabaseManager(dbServer, database);
                GroupsPartsData.InitGroups();
                try
                {
                    using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                    {
                        dbClient.ExecuteQuery("SET @@global.sql_mode= '';");
                        dbClient.ExecuteQuery("UPDATE users SET online = '0'");
                        dbClient.ExecuteQuery("UPDATE rooms SET users_now = '0'");
                    }
                    Essential.Internal_Game.ContinueLoading();
                }
                catch { }

                Essential.Internal_Game = new Game(int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]));

                Essential.PacketManager = new PacketManager();
                Essential.PacketManager.Load();
                Essential.mhandler = new MobileHandler();
                Essential.mhandler.Load();
                Console.WriteLine(Essential.PacketManager.Count + " Packets loaded!");
                Essential.antiAdSystem   = new AntiAd();
                Essential.MusListener    = new MusListener(Essential.GetConfig().data["mus.tcp.bindip"], int.Parse(Essential.GetConfig().data["mus.tcp.port"]), Essential.GetConfig().data["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20);
                Essential.SocketsManager = new SocketsManager(Essential.GetConfig().data["game.tcp.bindip"], int.Parse(Essential.GetConfig().data["game.tcp.port"]), int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]));
                //ConnectionManage = new ConnectionHandeling(Essential.GetConfig().data["game.tcp.port"], int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]), int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]), true);
                Essential.HeadImagerURL = Essential.GetConfig().data["eventstream.imager.url"];
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE server_status SET bannerdata='" + EssentialEnvironment.globalCrypto.Prime + ":" + EssentialEnvironment.globalCrypto.Generator + "';");
                }
                Essential.SocketsManager.method_3().method_0();
                webSocketServerManager = new WebSocketServerManager(Essential.GetConfig().data["websocket.url"]);
                Console.WriteLine("Server started at " + Essential.GetConfig().data["websocket.url"]);
                webManager = new WebManager();
                TimeSpan timeSpan = DateTime.Now - now;
                Logging.WriteLine(string.Concat(new object[]
                {
                    "Server -> READY! (",
                    timeSpan.Seconds,
                    " s, ",
                    timeSpan.Milliseconds,
                    " ms)"
                }));
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE server_status SET server_started='" + Convert.ToInt32(GetUnixTimestamp()) + "'");
                }
                Console.Beep();
            }
            catch (KeyNotFoundException KeyNotFoundException)
            {
                Logging.WriteLine("Failed to boot, key not found: " + KeyNotFoundException);
                Logging.WriteLine("Press any key to shut down ...");
                Console.ReadKey(true);
                Essential.Destroy();
            }
            catch (InvalidOperationException ex)
            {
                Logging.WriteLine("Failed to initialize EssentialEmulator: " + ex.Message);
                Logging.WriteLine("Press any key to shut down ...");
                Console.ReadKey(true);
                Essential.Destroy();
            }
        }