本文整理汇总了C#中Configuration.ReadArguments方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.ReadArguments方法的具体用法?C# Configuration.ReadArguments怎么用?C# Configuration.ReadArguments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.ReadArguments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public static void Load(string[] args)
{
_conf = new Configuration();
_conf.ReadFile("../../conf/msgr.conf");
if (args != null)
_conf.ReadArguments(args, "../../");
MsgrConf.ConsoleFilter = (LogLevel)_conf.GetInt("msgr.consolefilter", 0);
#if DEBUG
// Enable debug regardless of configuration in debug builds.
MsgrConf.ConsoleFilter &= ~LogLevel.Debug;
#endif
MsgrConf.DatabaseHost = _conf.GetString("database.host", "localhost");
MsgrConf.DatabaseUser = _conf.GetString("database.user", "root");
MsgrConf.DatabasePass = _conf.GetString("database.pass", "");
MsgrConf.DatabaseDb = _conf.GetString("database.db", "aura");
}
示例2: Load
public static void Load(string[] args)
{
_conf = new Configuration();
_conf.ReadFile("../../conf/login.conf");
if (args != null)
_conf.ReadArguments(args, "../../");
LoginConf.ConsoleFilter = (LogLevel)_conf.GetInt("login.consolefilter", 0);
#if DEBUG
// Enable debug regardless of configuration in debug builds.
LoginConf.ConsoleFilter &= ~LogLevel.Debug;
#endif
LoginConf.Password = _conf.GetString("inter.password", "aura");
LoginConf.DataPath = _conf.GetString("data.path", "../../data");
LoginConf.Localization = _conf.GetString("data.localization", "us");
LoginConf.DatabaseHost = _conf.GetString("database.host", "localhost");
LoginConf.DatabaseUser = _conf.GetString("database.user", "root");
LoginConf.DatabasePass = _conf.GetString("database.pass", "");
LoginConf.DatabaseDb = _conf.GetString("database.db", "aura");
LoginConf.Port = _conf.Get<ushort>("login.port", 11000);
LoginConf.ConsumeCards = _conf.GetBool("login.consumecards", true);
LoginConf.NewAccounts = _conf.GetBool("login.newaccounts", true);
LoginConf.DeletionWait = _conf.Get<int>("login.deletewait", 107);
if (LoginConf.DeletionWait < 0 || (LoginConf.DeletionWait > 23 && LoginConf.DeletionWait < 100) || LoginConf.DeletionWait > 123)
{
Logger.Warning("Invalid format for 'login.deletewait', setting to 0.");
LoginConf.DeletionWait = 0;
}
LoginConf.EnableSecondaryPassword = _conf.GetBool("login.enable_sec", true);
}
示例3: Load
public static void Load(string[] args)
{
_conf = new Configuration();
_conf.ReadFile("../../conf/world.conf");
if (args != null)
_conf.ReadArguments(args, "../../");
WorldConf.ConsoleFilter = (LogLevel)_conf.GetInt("world.consolefilter", 0);
#if DEBUG
// Enable debug regardless of configuration in debug builds.
WorldConf.ConsoleFilter &= ~LogLevel.Debug;
#endif
WorldConf.Password = _conf.GetString("inter.password", "aura");
WorldConf.DataPath = _conf.GetString("data.path", "../../data");
WorldConf.Localization = _conf.GetString("data.localization", "us");
WorldConf.DatabaseHost = _conf.GetString("database.host", "localhost");
WorldConf.DatabaseUser = _conf.GetString("database.user", "root");
WorldConf.DatabasePass = _conf.GetString("database.pass", "");
WorldConf.DatabaseDb = _conf.GetString("database.db", "aura");
WorldConf.ServerName = _conf.GetString("world.servername", "Dummy");
WorldConf.ChannelName = _conf.GetString("world.channelname", "Ch1");
WorldConf.ChannelHost = _conf.GetString("world.channelhost", "127.0.0.1");
WorldConf.ChannelPort = (ushort)_conf.GetInt("world.channelport", 11020);
WorldConf.CachePath = _conf.GetString("world.cache", "../../cache");
WorldConf.LoginHost = _conf.GetString("world.loginhost", "127.0.0.1");
WorldConf.LoginPort = (ushort)_conf.GetInt("world.loginport", 11000);
WorldConf.CommandPrefix = _conf.GetString("commands.prefix", ">")[0];
WorldConf.ScriptPath = _conf.GetString("script.path", "../../scripts");
WorldConf.DisableScriptCaching = _conf.GetBool("script.disable_cache", false);
WorldConf.ScriptStrictMode = _conf.GetBool("script.strict_mode", false);
WorldConf.SightRange = _conf.Get<uint>("world.sightrange", 3000);
WorldConf.AutoSendGMCP = _conf.GetBool("world.auto_gmcp", false);
WorldConf.MinimumGMCP = _conf.Get<byte>("world.minimum_gmcp", 50);
WorldConf.MinimumGMCPSummon = _conf.Get<byte>("world.minimum_gmcp_summon", 50);
WorldConf.MinimumGMCPCharWarp = _conf.Get<byte>("world.minimum_gmcp_char_warp", 50);
WorldConf.MinimumGMCPMove = _conf.Get<byte>("world.minimum_gmcp_move", 50);
WorldConf.MinimumGMCPRevive = _conf.Get<byte>("world.minimum_gmcp_revive", 50);
WorldConf.MinimumGMCPInvisible = _conf.Get<byte>("world.minimum_gmcp_invisible", 50);
WorldConf.MinimumGMCPExpel = _conf.Get<byte>("world.minimum_gmcp_expel", 50);
WorldConf.MinimumGMCPBan = _conf.Get<byte>("world.minimum_gmcp_ban", 50);
WorldConf.ExpRate = _conf.Get<float>("world.exp_rate", 100f) / 100.0f;
WorldConf.DropRate = _conf.Get<float>("world.drop_rate", 100f) / 100.0f;
WorldConf.GoldDropRate = _conf.Get<float>("world.gold_drop_rate", 30f) / 100.0f;
WorldConf.PropDropRate = _conf.Get<float>("world.prop_drop_rate", 30f) / 100.0f;
WorldConf.EnableItemShop = _conf.GetBool("world.enable_itemshop", false);
WorldConf.MailExpires = _conf.GetInt("world.mail_expires", 30);
WorldConf.EnableVisual = _conf.GetBool("world.enable_visual", true);
WorldConf.SafeDye = _conf.GetBool("world.safe_dye", false);
WorldConf.BunshinSouls = _conf.GetBool("world.bunshinsouls", true);
WorldConf.PerfectPlay = _conf.GetBool("world.perfectplay", false);
WorldConf.DkSoundFix = _conf.GetBool("world.dk_sound_fix", true);
WorldConf.ColorChange = _conf.GetBool("world.colorchange", true);
WorldConf.DynamicCombat = _conf.GetBool("world.dynamic_combat", true);
WorldConf.TimeBeforeAncient = _conf.GetInt("world.time_before_ancient", 300);
WorldConf.AncientRate = _conf.Get<float>("world.ancient_rate", .33f);
WorldConf.NpcIntroOnce = _conf.GetBool("world.npc_intro_once", true);
try
{
WorldConf.Motd = File.ReadAllText("../../conf/motd.txt");
}
catch (FileNotFoundException)
{
Logger.Warning("'motd.txt' not found.");
WorldConf.Motd = string.Empty;
}
}