Esempio n. 1
0
        /// <summary>
        /// Sets up default controllers and starts web server
        /// </summary>
        public void StartWebServer()
        {
            Log.Info("Starting web server...");

            this.App = new WebApplication();

            this.App.Engine("htm", new HandlebarsEngine());

            this.App.Get("/favicon.ico", new StaticController(this.Conf.Web.Favicon));

            this.App.Static("user/save/");
            this.App.Static("user/resources/");
            this.App.Static("system/web/public/");
            this.App.Static("user/web/public/");

            this.App.Get("/", new MainController());
            this.App.Post("/ui", new UiStorageController());
            this.App.Post("/visual-chat", new VisualChatController());
            this.App.Post("/avatar-upload", new AvatarUploadController());

            try
            {
                this.App.Listen(this.Conf.Web.Port);

                Log.Status("Server ready, listening on 0.0.0.0:{0}.", this.Conf.Web.Port);
            }
            catch (NHttp.NHttpException)
            {
                Log.Error("Failed to start web server.");
                Log.Info("Port {0} might already be in use, make sure no other application, like other web servers or Skype, are using it or set a different port in web.conf.", this.Conf.Web.Port);
                CliUtil.Exit(1);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Executes SQL update file.
        /// </summary>
        /// <param name="updateFile"></param>
        public void RunUpdate(string updateFile)
        {
            try
            {
                using (var conn = this.GetConnection())
                {
                    // Run update
                    using (var cmd = new MySqlCommand(File.ReadAllText(Path.Combine("sql", updateFile)), conn))
                        cmd.ExecuteNonQuery();

                    // Log update
                    using (var cmd = new InsertCommand("INSERT INTO `updates` {0}", conn))
                    {
                        cmd.Set("path", updateFile);
                        cmd.Execute();
                    }

                    Log.Info("Successfully applied '{0}'.", updateFile);
                }
            }
            catch (Exception ex)
            {
                Log.Error("RunUpdate: Failed to run '{0}': {1}", updateFile, ex.Message);
                CliUtil.Exit(1);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Sets up default controllers and starts web server
        /// </summary>
        public void StartWebServer()
        {
            Log.Info("Starting web server...");

            this.App = new WebApplication();

            this.App.Engine("htm", new HandlebarsEngine());

            this.App.Get("/toslive/patch/serverlist.xml", new ServerListController());
            this.App.Get("/toslive/patch/static__Config.txt", new StaticConfigController());

            try
            {
                int port;
                Int32.TryParse(Settings.Default.WebPort, out port);
                this.App.Listen(port);

                Log.Info("ServerListURL: http://*:{0}/{1}", Settings.Default.WebPort, "toslive/patch/serverlist.xml");
                Log.Info("StaticConfigURL: http://*:{0}/{1}", Settings.Default.WebPort, "toslive/patch/");
                Log.Status("Server ready, listening on 0.0.0.0:{0}.", Settings.Default.WebPort);
            }
            catch (NHttp.NHttpException)
            {
                Log.Error("Failed to start web server.");
                Log.Info("The port might already be in use, make sure no other application, like other web servers or Skype, are using it, or set a different port in web.conf.");
                CliUtil.Exit(1);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Starts web server for API
        /// </summary>
        private void LoadWebApi()
        {
            Log.Info("Loading Web API...");

            // Trick compiler into referencing Mabi.dll, so Swebs references
            // it in the C# scripts as well.
            var x = Mabi.Const.GuildMemberRank.Applied;

            var conf = new Configuration();

            conf.Port = this.Conf.Login.WebPort;
            conf.SourcePaths.Add("user/api/");
            conf.SourcePaths.Add("system/api/");

            this.HttpServer = new HttpServer(conf);
            this.HttpServer.UnhandledException += (s, e) => Log.Exception(e.Exception);

            try
            {
                this.HttpServer.Start();

                Log.Info("Web API listening on 0.0.0.0:{0}.", this.Conf.Login.WebPort);
            }
            catch (NHttpException)
            {
                Log.Error("Failed to start web server.");
                Log.Info("Port {0} might already be in use, make sure no other application, like other web servers or Skype, are using it or set a different port in web.conf.", this.Conf.Login.WebPort);
                CliUtil.Exit(1);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Handler for unhandled exceptions.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                Log.Error("Oh no! Ferghus escaped his memory block and infected the rest of the server!");
                Log.Error("Aura has encountered an unexpected and unrecoverable error. We're going to try to save as much as we can.");
            }
            catch { }
            try
            {
                this.Server.Stop();
            }
            catch { }
            try
            {
                // save the world
            }
            catch { }
            try
            {
                Log.Exception((Exception)e.ExceptionObject);
                Log.Status("Closing server.");
            }
            catch { }

            CliUtil.Exit(1, false);
        }
Esempio n. 6
0
        /// <summary>
        /// Loads data from files.
        /// </summary>
        protected void LoadData(DataToLoad toLoad, bool reload)
        {
            Log.Info("Loading data...");

            try
            {
                if ((toLoad & DataToLoad.Items) != 0)
                {
                    this.LoadDb(this.Data.ItemDb, "db/items.txt", reload);
                }

                if ((toLoad & DataToLoad.Jobs) != 0)
                {
                    this.LoadDb(this.Data.JobDb, "db/jobs.txt", reload);
                }

                if ((toLoad & DataToLoad.Maps) != 0)
                {
                    this.LoadDb(this.Data.MapDb, "db/maps.txt", reload);
                }

                if ((toLoad & DataToLoad.Monsters) != 0)
                {
                    this.LoadDb(this.Data.MonsterDb, "db/monsters.txt", reload);
                }

                if ((toLoad & DataToLoad.Servers) != 0)
                {
                    this.LoadDb(this.Data.ServerDb, "db/servers.txt", reload);
                }

                if ((toLoad & DataToLoad.Barracks) != 0)
                {
                    this.LoadDb(this.Data.BarrackDb, "db/barracks.txt", reload);
                }

                if ((toLoad & DataToLoad.Skills) != 0)
                {
                    this.LoadDb(this.Data.SkillDb, "db/skills.txt", reload);
                }
            }
            catch (DatabaseErrorException ex)
            {
                Log.Error(ex.ToString());
                CliUtil.Exit(1);
            }
            catch (FileNotFoundException ex)
            {
                Log.Error(ex.Message);
                CliUtil.Exit(1);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Error while loading data.");
                CliUtil.Exit(1);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Executes SQL update file.
        /// </summary>
        /// <param name="updateFile"></param>
        public void RunUpdate(string updateFile)
        {
            string[] result = Regex.Split(File.ReadAllText(Path.Combine("sql", updateFile)), @"([^\\];)");
            try
            {
                using (var connection = MySQL.CreateConnection())
                {
                    //stop autocommit
                    using (var cmd = connection.CreateCommand())
                    {
                        cmd.CommandText = "SET AUTOCOMMIT = 0";
                        cmd.ExecuteNonQuery();
                    }
                    //Run update
                    using (var cmd = new MySqlCommand(File.ReadAllText(Path.Combine("sql", updateFile)), connection))
                    {
                        //_log.Info("GameServer need to connect only after loading all SQL! We are waiting for a long download of large SQL files!");
                        cmd.CommandTimeout = 120; //3600; //ждем долгой загрузки больших SQL файлов. Обычно, это значение - десятки секунд.
                        cmd.ExecuteNonQuery();
                    }

                    // Log update
                    using (var cmd = new InsertCommand("INSERT INTO `updates` {0}", connection))
                    {
                        cmd.Set("path", updateFile);
                        cmd.Execute();
                    }

                    // recovery autocommit
                    using (var cmd = connection.CreateCommand())
                    {
                        cmd.CommandText = "SET AUTOCOMMIT = 1";
                        cmd.ExecuteNonQuery();
                    }

                    _log.Info("Successfully applied '{0}'.", updateFile);
                }
            }
            catch (Exception ex)
            {
                using (var connection = MySQL.CreateConnection())
                {
                    MySqlTransaction transaction = connection.BeginTransaction();

                    // recovery autocommit
                    using (var cmd = connection.CreateCommand())
                    {
                        cmd.CommandText = "SET AUTOCOMMIT = 1";
                        cmd.ExecuteNonQuery();
                    }
                }

                _log.Error("RunUpdate: Failed to run '{0}': {1}", updateFile, ex.Message);
                CliUtil.Exit(1);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        public override void Run()
        {
            base.Run();

            CliUtil.WriteHeader("Channel", ConsoleColor.DarkGreen);
            CliUtil.LoadingTitle();

            // Conf
            this.LoadConf();

            // Database
            this.Database = new ChannelDb();
            this.InitDatabase(this.Database);

            // Data
            this.LoadData(DataToLoad.All, true);

            // GM Commands
            this.GmCommands = new GmCommands();

            // Packet handlers
            ChannelPacketHandler.Instance.RegisterMethods();

            // World
            Log.Info("Initializing world...");
            this.World.Initialize();
            Log.Info("  done loading {0} maps.", this.World.Count);

            // Script manager
            this.ScriptManager.Initialize();
            this.ScriptManager.Load();

            // Get channel data
            var serverId   = 1;
            var serverData = this.Data.ServerDb.FindChannel(serverId);

            if (serverData == null)
            {
                Log.Error("Server data not found. ({0})", serverId);
                CliUtil.Exit(1);
            }

            // Server
            this.ConnectionManager = new ConnectionManager <ChannelConnection>(serverData.Port);
            this.ConnectionManager.Start();

            // Ready
            CliUtil.RunningTitle();
            Log.Status("Server ready, listening on {0}.", this.ConnectionManager.Address);

            // Commands
            this.ConsoleCommands = new ConsoleCommands();
            this.ConsoleCommands.Wait();
        }
Esempio n. 9
0
 static void Main(string[] args)
 {
     try
     {
         LoginServer.Instance.Run();
     }
     catch (Exception ex)
     {
         Log.Error("Error on startup: {0}, {1}", ex.GetType().Name, ex.Message);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 10
0
        private void ShutdownTimerDone(object timer)
        {
            ((Timer)timer).Dispose();

            // Kill clients
            this.KillConnectedClients();

            // Save global variables
            this.Database.SaveVars("Aura System", 0, this.ScriptManager.GlobalVars.Perm);

            CliUtil.Exit(0, false);
        }
Esempio n. 11
0
 static void Main(string[] args)
 {
     try
     {
         LoginServer.Instance.Run();
     }
     catch (Exception ex)
     {
         Log.Error("Error on startup: {0}", ex);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 12
0
 static void Main(string[] args)
 {
     try
     {
         GateServer.Instance.Run();
     }
     catch (Exception ex)
     {
         Log.Exception(ex, "An exception occured while starting the server.");
         CliUtil.Exit(1);
     }
 }
Esempio n. 13
0
 static void Main(string[] args)
 {
     try
     {
         ChannelServer.Instance.Run();
     }
     catch (Exception ex)
     {
         Log.Error("Error on startup: {0}, {1}\r\n{2}\r\n{3}", ex.GetType().Name, ex.Message, ex.TargetSite, ex.StackTrace);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes database connection with data from Conf.
 /// </summary>
 protected void InitDatabase(MeliaDb db, Conf conf)
 {
     try
     {
         Log.Info("Initializing database...");
         db.Init(conf.Database.Host, conf.Database.User, conf.Database.Pass, conf.Database.Db);
     }
     catch (Exception ex)
     {
         Log.Error("Failed to initialize database: {0}", ex.Message);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 15
0
 /// <summary>
 /// Loads given conf class and stops start up when an error
 /// occurs.
 /// </summary>
 /// <param name="conf"></param>
 protected void LoadConf(Conf conf)
 {
     try
     {
         Log.Info("Loading configuration...");
         conf.LoadAll();
     }
     catch (Exception ex)
     {
         Log.Error("Failed to load configuration: {0}", ex.Message);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes ASD database connection with data from Conf.
 /// </summary>
 /// <param name="db"></param>
 /// <param name="conf"></param>
 protected void InitDatabase(Base db, Conf conf)
 {
     try
     {
         db.Init(conf.ASDDbHost, conf.ASDDbUserName, conf.ASDDbPassword, conf.ASDDbName);
         Log.Info("Initialized " + db.GetDbName() + " database connection");
     }
     catch (Exception ex)
     {
         Log.Error("Failed to initialize " + db.GetDbName() + " database: {0}", ex.Message);
         CliUtil.Exit(1, true);
     }
 }
Esempio n. 17
0
        /// <summary>
        /// Tries to call conf's load method, exits on error.
        /// </summary>
        public void LoadConf(BaseConf conf)
        {
            Log.Info("Reading configuration...");

            try
            {
                conf.Load();
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Unable to read configuration. ({0})", ex.Message);
                CliUtil.Exit(1);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Tries to initialize database with the information from conf,
        /// exits on error.
        /// </summary>
        public virtual void InitDatabase(AuraDb db, BaseConf conf)
        {
            Log.Info("Initializing database...");

            try
            {
                db.Init(conf.Database.Host, conf.Database.User, conf.Database.Pass, conf.Database.Db);
            }
            catch (Exception ex)
            {
                Log.Error("Unable to open database connection. ({0})", ex.Message);
                CliUtil.Exit(1);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 加载配置文件
        /// </summary>
        /// <param name="conf"></param>
        public void LoadConf(BaseConf conf)
        {
            Log.Info("读取配置...");

            try
            {
                conf.Load();
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "读取错误. ({0})", ex.Message);
                CliUtil.Exit(1);
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Tries to find aura root folder and changes the working directory to it.
        /// Exits if not successful.
        /// </summary>
        public void NavigateToRoot()
        {
            // Go back max 2 folders, the bins should be in [aura]/bin/(Debug|Release)
            for (int i = 0; i < 3; ++i)
            {
                if (Directory.Exists("system"))
                {
                    return;
                }

                Directory.SetCurrentDirectory("..");
            }

            Log.Error("Unable to find root directory.");
            CliUtil.Exit(1);
        }
Esempio n. 21
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        public override void Run()
        {
            base.Run();

            CliUtil.WriteHeader("Login", ConsoleColor.Magenta);
            CliUtil.LoadingTitle();

            // Conf
            this.LoadConf();

            // Database
            this.Database = new LoginDb();
            this.InitDatabase(this.Database);

            // Check if there are any updates
            this.CheckDatabaseUpdates();

            // Data
            this.LoadData(DataToLoad.Jobs | DataToLoad.Maps | DataToLoad.Barracks | DataToLoad.Servers | DataToLoad.StartingCities, true);

            // Packet handlers
            LoginPacketHandler.Instance.RegisterMethods();

            // Get server data
            var serverId   = 1;
            var serverData = this.Data.ServerDb.FindLogin(serverId);

            if (serverData == null)
            {
                Log.Error("Server data not found. ({0})", serverId);
                CliUtil.Exit(1);
            }

            // Server
            var mgr = new ConnectionManager <LoginConnection>(serverData.Port);

            mgr.Start();

            // Ready
            CliUtil.RunningTitle();
            Log.Status("Server ready, listening on {0}.", mgr.Address);

            // Commands
            this.ConsoleCommands = new LoginConsoleCommands();
            this.ConsoleCommands.Wait();
        }
Esempio n. 22
0
        /// <summary>
        /// Starts listener.
        /// </summary>
        /// <param name="endPoint"></param>
        private void Start(IPEndPoint endPoint)
        {
            try
            {
                _socket.Bind(endPoint);
                _socket.Listen(10);

                _socket.BeginAccept(this.OnAccept, _socket);

                Log.Status("Server ready, listening on {0}.", _socket.LocalEndPoint);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Unable to set up socket; perhaps you're already running a server?");
                CliUtil.Exit(1);
            }
        }
 /// <summary>
 /// Loads data from files.
 /// </summary>
 protected void LoadData()
 {
     try
     {
         this.LoadItemFiles();
         this.LoadMapFiles();
     }
     catch (FileNotFoundException ex)
     {
         Log.Error(ex.Message);
         CliUtil.Exit(1);
     }
     catch (Exception ex)
     {
         Log.Exception(ex, "Error while loading data.");
         CliUtil.Exit(1);
     }
 }
Esempio n. 24
0
        protected CommandResult HandleShutDown(string command, IList <string> args)
        {
            var players = ChannelServer.Instance.World.GetAllPlayers();

            foreach (var player in players)
            {
                var packet = new Packet(Op.RequestClientDisconnect, MabiId.Channel);
                packet.PutByte(1);
                player.Client.Send(packet);
            }

            Log.Status("Players logged out. Disconnecting from login server.");
            ChannelServer.Instance.LoginServer.Kill();

            CliUtil.Exit(0, true);

            return(CommandResult.Okay);
        }
Esempio n. 25
0
        /// <summary>
        /// Tries to find root folder and changes the working directory to it.
        /// Exits if not successful.
        /// </summary>
        public void NavigateToRoot()
        {
            // Go back max 2 folders, the bins should be in [root]/bin/(Debug|Release)
            for (var i = 0; i < 6; ++i)
            {
                if (Directory.Exists("system") && Directory.Exists("user"))
                {
                    //if (i != 0)
                    //	Log.Info("Switched workign directory to '{0}'.", Directory.GetCurrentDirectory());
                    return;
                }

                Directory.SetCurrentDirectory("..");
            }

            Log.Error("Unable to find root directory, that contains system and user folders.");
            CliUtil.Exit(1);
        }
Esempio n. 26
0
    static void Main(string[] args)
    {
        try
        {
            Log.LogFile   = string.Format("log/{0}.txt", DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss"));
            Console.Title = "测试服务器--" + DateTime.Now.ToString();
            TcpManager.GetInstance(5991);
            KcpManager.GetInstance(7566);
            game = new Game();
            game.Run();
            Process.GetCurrentProcess().WaitForExit();
        }
        catch (Exception ex)
        {
            Log.Exception(ex, "An exception occured while starting the server.");
            CliUtil.Exit(1);
        }

        //===========
        //test();
    }
Esempio n. 27
0
 /// <summary>
 /// Registers all methods of this class that have a packet handler attribute.
 /// </summary>
 public void RegisterMethods()
 {
     foreach (var method in this.GetType().GetMethods())
     {
         try
         {
             foreach (PacketHandlerAttribute attr in method.GetCustomAttributes(typeof(PacketHandlerAttribute), false))
             {
                 var func = (PacketHandlerFunc)Delegate.CreateDelegate(typeof(PacketHandlerFunc), this, method);
                 foreach (var op in attr.Ops)
                 {
                     this.Register(op, func);
                 }
             }
         }
         catch (Exception ex)
         {
             Log.Error("Failed to register packet handler '{0}': {1}", method.Name, ex);
             CliUtil.Exit(1);
         }
     }
 }
Esempio n. 28
0
        /// <summary>
        /// Sets up default controllers and starts web server
        /// </summary>
        public void StartWebServer()
        {
            Log.Info("Starting web server...");

            // Trick compiler into referencing DLLs, so Swebs references them
            // in the C# scripts as well.
            //_swebsReferences.Add(...);

            var conf = new Configuration();

            conf.Host = IPAddress.Parse(this.Conf.Web.Ip);
            conf.Port = this.Conf.Web.Port;
            conf.SourcePaths.Add("user/web/");
            conf.SourcePaths.Add("system/web/");

            this.HttpServer = new HttpServer(conf);
            this.HttpServer.RequestReceived += (s, e) =>
            {
                Log.Debug("[{0}] - {1}", e.Request.HttpMethod, e.Request.Path);
                //Log.Debug(e.Request.UserAgent); // Client: TEST_ARI
            };
            this.HttpServer.UnhandledException += (s, e) => Log.Exception(e.Exception);

            try
            {
                this.HttpServer.Start();

                Log.Info("ServerListURL: http://*:{0}/{1}", this.Conf.Web.Port, "toslive/patch/serverlist.cs");
                Log.Info("StaticConfigURL: http://*:{0}/{1}", this.Conf.Web.Port, "toslive/patch/");
                Log.Status("Server ready, listening on 0.0.0.0:{0}.", this.Conf.Web.Port);
            }
            catch (NHttpException)
            {
                Log.Error("Failed to start web server.");
                Log.Info("Port {0} might already be in use, make sure no other application, like other web servers or Skype, are using it or set a different port in web.conf.", this.Conf.Web.Port);
                CliUtil.Exit(1);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Sets up default controllers and starts web server
        /// </summary>
        public void StartWebServer()
        {
            Log.Info("Starting web server...");

            // Trick compiler into referencing Mabi.dll and Data.dll,
            // so Swebs references it in the C# scripts as well.
            _swebsReferences.Add(Mabi.Const.GuildMemberRank.Applied);
            _swebsReferences.Add(AuraData.FeaturesDb);
            _swebsReferences.Add(typeof(MySql.Data.MySqlClient.MySqlCommand));

            var conf = new Configuration();

            conf.Port = this.Conf.Web.Port;
            conf.SourcePaths.Add("user/web/");
            conf.SourcePaths.Add("system/web/");

            this.HttpServer = new HttpServer(conf);
            this.HttpServer.RequestReceived += (s, e) =>
            {
                Log.Debug("[{0}] - {1}", e.Request.HttpMethod, e.Request.Path);
                //Log.Debug(e.Request.UserAgent); // Client: TEST_ARI
            };
            this.HttpServer.UnhandledException += (s, e) => Log.Exception(e.Exception);

            try
            {
                this.HttpServer.Start();

                Log.Status("Server ready, listening on 0.0.0.0:{0}.", this.Conf.Web.Port);
            }
            catch (NHttpException)
            {
                Log.Error("Failed to start web server.");
                Log.Info("Port {0} might already be in use, make sure no other application, like other web servers or Skype, are using it or set a different port in web.conf.", this.Conf.Web.Port);
                CliUtil.Exit(1);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// (Re-)Loads data files (db), exits on error.
        /// </summary>
        /// <remarks>
        /// Called on server start and with some reload commands.
        /// Should only load required data, e.g. Msgr Server doesn't
        /// need race data.
        /// </remarks>
        public void LoadData(DataLoad toLoad, bool reload)
        {
            Log.Info("Loading data...");

            try
            {
                if ((toLoad & DataLoad.Features) != 0)
                {
                    this.LoadDb(AuraData.FeaturesDb, "db/features.txt", reload);
                }

                if ((toLoad & DataLoad.Races) != 0)
                {
                    this.LoadDb(AuraData.AncientDropDb, "db/ancient_drops.txt", reload);
                    this.LoadDb(AuraData.SpeedDb, "db/speed.txt", reload, false);
                    this.LoadDb(AuraData.RaceDb, "db/races.txt", reload);
                }

                if ((toLoad & DataLoad.StatsBase) != 0)
                {
                    this.LoadDb(AuraData.StatsBaseDb, "db/stats_base.txt", reload);
                }

                if ((toLoad & DataLoad.StatsLevel) != 0)
                {
                    this.LoadDb(AuraData.StatsLevelUpDb, "db/stats_levelup.txt", reload);
                }

                if ((toLoad & DataLoad.StatsAge) != 0)
                {
                    this.LoadDb(AuraData.StatsAgeUpDb, "db/stats_ageup.txt", reload);
                }

                if ((toLoad & DataLoad.Motions) != 0)
                {
                    this.LoadDb(AuraData.MotionDb, "db/motions.txt", reload);
                }

                if ((toLoad & DataLoad.Cards) != 0)
                {
                    this.LoadDb(AuraData.CharCardSetDb, "db/charcardsets.txt", reload, false);
                    this.LoadDb(AuraData.CharCardDb, "db/charcards.txt", reload);
                }

                if ((toLoad & DataLoad.Colors) != 0)
                {
                    this.LoadDb(AuraData.ColorMapDb, "db/colormap.dat", reload);
                }

                if ((toLoad & DataLoad.Items) != 0)
                {
                    this.LoadDb(AuraData.ItemDb, "db/items.txt", reload);
                    this.LoadDb(AuraData.ChairDb, "db/chairs.txt", reload);
                }

                if ((toLoad & DataLoad.Skills) != 0)
                {
                    this.LoadDb(AuraData.SkillDb, "db/skills.txt", reload);
                }

                if ((toLoad & DataLoad.Regions) != 0)
                {
                    this.LoadDb(AuraData.RegionDb, "db/regions.txt", reload);
                    this.LoadDb(AuraData.RegionInfoDb, "db/regioninfo.dat", reload);
                }

                if ((toLoad & DataLoad.Shamala) != 0)
                {
                    this.LoadDb(AuraData.ShamalaDb, "db/shamala.txt", reload);
                }

                if ((toLoad & DataLoad.PropDrops) != 0)
                {
                    this.LoadDb(AuraData.PropDropDb, "db/prop_drops.txt", reload);
                }

                if ((toLoad & DataLoad.Exp) != 0)
                {
                    this.LoadDb(AuraData.ExpDb, "db/exp.txt", reload);
                }

                if ((toLoad & DataLoad.Pets) != 0)
                {
                    this.LoadDb(AuraData.PetDb, "db/pets.txt", reload);
                }

                if ((toLoad & DataLoad.Weather) != 0)
                {
                    this.LoadDb(AuraData.WeatherTableDb, "db/weathertables.txt", reload);
                    this.LoadDb(AuraData.WeatherDb, "db/weather.txt", reload);
                }

                if ((toLoad & DataLoad.Keywords) != 0)
                {
                    this.LoadDb(AuraData.KeywordDb, "db/keywords.txt", reload);
                }

                if ((toLoad & DataLoad.Titles) != 0)
                {
                    this.LoadDb(AuraData.TitleDb, "db/titles.txt", reload);
                }

                if ((toLoad & DataLoad.ItemUpgrades) != 0)
                {
                    this.LoadDb(AuraData.ItemUpgradesDb, "db/itemupgrades.txt", reload);
                }

                if ((toLoad & DataLoad.Props) != 0)
                {
                    this.LoadDb(AuraData.PropsDb, "db/props.txt", reload);
                    this.LoadDb(AuraData.PropDefaultsDb, "db/prop_defaults.dat", reload);
                }

                if ((toLoad & DataLoad.Collecting) != 0)
                {
                    this.LoadDb(AuraData.CollectingDb, "db/collecting.txt", reload);
                }

                if ((toLoad & DataLoad.Fishing) != 0)
                {
                    this.LoadDb(AuraData.FishDb, "db/fish.txt", reload);
                    this.LoadDb(AuraData.FishingGroundsDb, "db/fishing_grounds.txt", reload);
                }

                if ((toLoad & DataLoad.Dungeons) != 0)
                {
                    this.LoadDb(AuraData.DungeonBlocksDb, "db/dungeon_blocks.txt", reload);
                    this.LoadDb(AuraData.DungeonDb, "db/dungeons.txt", reload);
                }

                if ((toLoad & DataLoad.Cutscenes) != 0)
                {
                    this.LoadDb(AuraData.CutscenesDb, "db/cutscenes.txt", reload);
                    this.LoadDb(AuraData.ActorDb, "db/actors.txt", reload);
                }
            }
            catch (DatabaseErrorException ex)
            {
                Log.Error("{0}", ex.ToString());
                CliUtil.Exit(1);
            }
            catch (FileNotFoundException ex)
            {
                Log.Error(ex.Message);
                CliUtil.Exit(1);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Error while loading data.");
                CliUtil.Exit(1);
            }
        }