/// <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); } } } }
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 } }
/// <summary> /// Load config file from the path stated in BaseConf /// </summary> /// <param name="conf">Config File containing the path of every file that need to be loaded</param> private static void LoadConf(BaseConf conf) { Log.Info("Reading configuration..."); try { conf.Load(); } catch (Exception ex) { Log.Exception(ex, "Unable to read configuration. ({0})", ex.Message); } }
/// <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); } }
/// <summary> /// Initialize the Database using parameters retrieved from BaseConf /// </summary> /// <param name="db">Database Connection</param> /// <param name="conf">Config File</param> protected static void InitDatabase(GameDatabase db, BaseConf conf) { Log.Info("Initializing database..."); try { db.Init(conf.Database.Host, conf.Database.Port, conf.Database.User, conf.Database.Pass, conf.Database.Db); } catch (Exception ex) { db = null; Log.Error("Unable to open database connection. ({0})", ex.Message); } }
/// <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); } }
/// <summary> /// Tries to call conf's load method, exits on error. /// </summary> protected static void LoadConf(BaseConf conf) { Log.Info("Reading configuration..."); try { conf.Load(); } catch (Exception ex) { Log.Exception(ex, "Unable to read configuration. ({0})", ex.Message); ConsoleUtil.Exit(1); } }
static CommConf() { const string configName = "CommConf"; FormText = BaseConf.ConfigStrR("conf/ui/form_text", configName); TrayText = BaseConf.ConfigStrR("conf/ui/tray_text", configName); BallonTitle = BaseConf.ConfigStrR("conf/ui/ballon_title", configName); BallonText = BaseConf.ConfigStrR("conf/ui/ballon_text", configName); HideOnLoad = BaseConf.ConfigBoolR("conf/ui/hide_on_load", configName); DllFileName = BaseConf.ConfigStrR("conf/model/dll_file_name", configName); NameSpace = BaseConf.ConfigStrR("conf/model/name_space", configName); ClassName = BaseConf.ConfigStrR("conf/model/class_name", configName); }
/// <summary> /// Tries to call conf's load method, exits on error. /// </summary> public void LoadConf(BaseConf conf) { using (var t = new ChangingOutput("Reading Configuration...")) { try { Log.ToFile("Reading Configuration...", LogLevel.Info); conf.Load(); t.PrintResult(true); } catch (Exception ex) { t.PrintResult(false); Log.Exception(ex, "Unable to read configuration. ({0})", ex.Message); CliUtil.Exit(1); } } }
/// <summary> /// Tries to initialize database with the information from conf, /// exits on error. /// </summary> public virtual void InitDatabase(PastorsDeskDb db, BaseConf conf) { using (var t = new ChangingOutput("Initializing database...")) { try { Log.ToFile("Initializing database...", LogLevel.Info); db.Init(conf.Database.Host, conf.Database.User, conf.Database.Pass, conf.Database.Db); t.PrintResult(true); } catch (Exception ex) { t.PrintResult(false); Log.Error("Unable to open database connection. ({0})", ex.Message); CliUtil.Exit(1); } } }
/// <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") ); }
/// <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) { } }