Пример #1
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);
			}
		}
Пример #2
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);
			}
		}
Пример #3
0
        public override void InitDatabase(AuraDb db, BaseConf conf)
        {
            base.InitDatabase(db, conf);

            // If items end up with temp ids in the db we'd get entity ids
            // that exist twice, when creating new temps later on.
            if (ChannelServer.Instance.Database.TmpItemsExist())
            {
                Log.Warning("InitDatabase: Found items with temp entity ids.");
                // TODO: clean up dbs
            }
        }
Пример #4
0
		/// <summary>
		/// Loads system and user localization files.
		/// </summary>
		public void LoadLocalization(BaseConf conf)
		{
			Log.Info("Loading localization ({0})...", conf.Localization.Language);

			// System
			try
			{
				Localization.Parse("system/localization/" + conf.Localization.Language);
			}
			catch (FileNotFoundException ex)
			{
				Log.Warning("Unable to load localization: " + ex.Message);
			}

			// User
			try
			{
				Localization.Parse("user/localization/" + conf.Localization.Language);
			}
			catch (FileNotFoundException)
			{
			}
		}
Пример #5
0
		/// <summary>
		/// Loads system and user localization files.
		/// </summary>
		public void LoadLocalization(BaseConf conf)
		{
			var language = conf.Localization.Language;
			var path = Path.Combine("localization", language + ".po");

			Log.Info("Loading localization ({0})...", language);

			// Try user first
			try
			{
				Localization.Load(Path.Combine("user", path));
			}
			catch (FileNotFoundException)
			{
				// Try system second, if the file wasn't in user
				try
				{
					Localization.Load(Path.Combine("system", path));
				}
				catch (FileNotFoundException)
				{
					// Warn if language wasn't the default
					if (language != "en-US")
						Log.Warning("Localization file '{0}.po' not found.", language);
				}
			}
		}
Пример #6
0
        /// <summary>
        /// Loads system and user localization files.
        /// </summary>
        public void LoadLocalization(BaseConf conf)
        {
            var language = conf.Localization.Language;
            var path = Path.Combine("localization", language + ".po");

            Log.Info("Loading localization ({0})...", language);

            // Try user first
            try
            {
                Localization.Load(Path.Combine("user", path));
            }
            catch (FileNotFoundException)
            {
                // Try system second, if the file wasn't in user
                try
                {
                    Localization.Load(Path.Combine("system", path));
                }
                catch (FileNotFoundException)
                {
                    // Warn if language wasn't the default
                    if (language != "en-US")
                        Log.Warning("Localization file '{0}.po' not found.", language);
                }
            }

            ErinnTime.SetMonthNames(
                Localization.Get("Imbolic"),
                Localization.Get("Alban Eiler"),
                Localization.Get("Baltane"),
                Localization.Get("Alban Heruin"),
                Localization.Get("Lughnasadh"),
                Localization.Get("Alban Elved"),
                Localization.Get("Samhain")
            );
        }