本文整理汇总了C#中IConfig.GetDouble方法的典型用法代码示例。如果您正苦于以下问题:C# IConfig.GetDouble方法的具体用法?C# IConfig.GetDouble怎么用?C# IConfig.GetDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfig
的用法示例。
在下文中一共展示了IConfig.GetDouble方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialise
public void Initialise(IConfigSource config)
{
m_config = config.Configs["VivoxVoice"];
if (null == m_config)
{
//m_log.Info("[VivoxVoice] no config found, plugin disabled");
return;
}
if (!m_config.GetBoolean("enabled", false))
{
//m_log.Info("[VivoxVoice] plugin disabled by configuration");
return;
}
try
{
// retrieve configuration variables
m_vivoxServer = m_config.GetString("vivox_server", String.Empty);
m_vivoxSipUri = m_config.GetString("vivox_sip_uri", String.Empty);
m_vivoxAdminUser = m_config.GetString("vivox_admin_user", String.Empty);
m_vivoxAdminPassword = m_config.GetString("vivox_admin_password", String.Empty);
m_vivoxChannelDistanceModel = m_config.GetInt("vivox_channel_distance_model", CHAN_DIST_DEFAULT);
m_vivoxChannelRollOff = m_config.GetDouble("vivox_channel_roll_off", CHAN_ROLL_OFF_DEFAULT);
m_vivoxChannelMaximumRange = m_config.GetInt("vivox_channel_max_range", CHAN_MAX_RANGE_DEFAULT);
m_vivoxChannelMode = m_config.GetString("vivox_channel_mode", CHAN_MODE_DEFAULT).ToLower();
m_vivoxChannelType = m_config.GetString("vivox_channel_type", CHAN_TYPE_DEFAULT).ToLower();
m_vivoxChannelClampingDistance = m_config.GetInt("vivox_channel_clamping_distance",
CHAN_CLAMPING_DISTANCE_DEFAULT);
m_dumpXml = m_config.GetBoolean("dump_xml", false);
// Validate against constraints and default if necessary
if (m_vivoxChannelRollOff < CHAN_ROLL_OFF_MIN || m_vivoxChannelRollOff > CHAN_ROLL_OFF_MAX)
{
m_log.WarnFormat("[VivoxVoice] Invalid value for roll off ({0}), reset to {1}.",
m_vivoxChannelRollOff, CHAN_ROLL_OFF_DEFAULT);
m_vivoxChannelRollOff = CHAN_ROLL_OFF_DEFAULT;
}
if (m_vivoxChannelMaximumRange < CHAN_MAX_RANGE_MIN || m_vivoxChannelMaximumRange > CHAN_MAX_RANGE_MAX)
{
m_log.WarnFormat("[VivoxVoice] Invalid value for maximum range ({0}), reset to {1}.",
m_vivoxChannelMaximumRange, CHAN_MAX_RANGE_DEFAULT);
m_vivoxChannelMaximumRange = CHAN_MAX_RANGE_DEFAULT;
}
if (m_vivoxChannelClampingDistance < CHAN_CLAMPING_DISTANCE_MIN ||
m_vivoxChannelClampingDistance > CHAN_CLAMPING_DISTANCE_MAX)
{
m_log.WarnFormat("[VivoxVoice] Invalid value for clamping distance ({0}), reset to {1}.",
m_vivoxChannelClampingDistance, CHAN_CLAMPING_DISTANCE_DEFAULT);
m_vivoxChannelClampingDistance = CHAN_CLAMPING_DISTANCE_DEFAULT;
}
switch (m_vivoxChannelMode)
{
case "open" : break;
case "lecture" : break;
case "presentation" : break;
case "auditorium" : break;
default :
m_log.WarnFormat("[VivoxVoice] Invalid value for channel mode ({0}), reset to {1}.",
m_vivoxChannelMode, CHAN_MODE_DEFAULT);
m_vivoxChannelMode = CHAN_MODE_DEFAULT;
break;
}
switch (m_vivoxChannelType)
{
case "positional" : break;
case "channel" : break;
default :
m_log.WarnFormat("[VivoxVoice] Invalid value for channel type ({0}), reset to {1}.",
m_vivoxChannelType, CHAN_TYPE_DEFAULT);
m_vivoxChannelType = CHAN_TYPE_DEFAULT;
break;
}
m_vivoxVoiceAccountApi = String.Format("http://{0}/api2", m_vivoxServer);
// Admin interface required values
if (String.IsNullOrEmpty(m_vivoxServer) ||
String.IsNullOrEmpty(m_vivoxSipUri) ||
String.IsNullOrEmpty(m_vivoxAdminUser) ||
String.IsNullOrEmpty(m_vivoxAdminPassword))
{
m_log.Error("[VivoxVoice] plugin mis-configured");
m_log.Info("[VivoxVoice] plugin disabled: incomplete configuration");
return;
}
m_log.InfoFormat("[VivoxVoice] using vivox server {0}", m_vivoxServer);
// Get admin rights and cleanup any residual channel definition
DoAdminLogin();
//.........这里部分代码省略.........
示例2: ReadConfigToDap
public static void ReadConfigToDap(IConfig config, DAuthorProperties dap)
{
dap.Fill = DColor.FromString(config.Get(FILL_OPT));
dap.Stroke = DColor.FromString(config.Get(STROKE_OPT));
dap.StrokeWidth = config.GetInt(STROKEWIDTH_OPT, 1);
dap.StrokeStyle = (DStrokeStyle)Enum.Parse(typeof(DStrokeStyle),
config.Get(STROKESTYLE_OPT, DStrokeStyle.Solid.ToString()), true);
dap.Alpha = config.GetDouble(ALPHA_OPT, 1);
dap.StartMarker = (DMarker)Enum.Parse(typeof(DMarker),
config.Get(STARTMARKER_OPT, DMarker.None.ToString()), true);
dap.EndMarker = (DMarker)Enum.Parse(typeof(DMarker),
config.Get(ENDMARKER_OPT, DMarker.None.ToString()), true);
dap.FontName = config.Get(FONTNAME_OPT, "Arial");
dap.Bold = config.GetBoolean(BOLD_OPT, false);
dap.Italics = config.GetBoolean(ITALICS_OPT, false);
dap.Underline = config.GetBoolean(UNDERLINE_OPT, false);
dap.Strikethrough = config.GetBoolean(STRIKETHROUGH_OPT, false);
}
示例3: ExtensionInit
public void ExtensionInit(IApplication application, int extensionID, IConfig config)
{
if (disposed)
throw new ObjectDisposedException(GetType().Name);
this.application = application;
this.config = config;
settings["in_port"].Value = config.GetString("GPS COM Port", (string)settings["in_port"].Value);
settings["log"].Value = config.GetBoolean("Log Input", (bool)settings["log"].Value);
settings["mirror"].Value = config.GetBoolean("Mirror GPS Input to Output Port", (bool)settings["mirror"].Value);
settings["out_port"].Value = config.GetString("Output COM Port", (string)settings["out_port"].Value);
settings["movement_threshold"].Value = config.GetDouble("Movement Threshold", (double)settings["movement_threshold"].Value);
settings["dop_multiplier"].Value = config.GetDouble("DOP to Accuracy Multiplier", (double)settings["dop_multiplier"].Value);
log_input = (bool)settings["log"].Value;
GPSFix.dopMultiplier = (double)settings["dop_multiplier"].Value;
}
示例4: ResolveDouble
/// <summary>
/// Helper function for ParseConfig.
/// </summary>
/// <param name="settingName"></param>
/// <param name="defaultValue"></param>
/// <param name="global"></param>
/// <param name="local"></param>
/// <returns></returns>
private double ResolveDouble(string settingName, double defaultValue, IConfig global, IConfig local)
{
if (local != null)
{
return local.GetDouble(settingName, global.GetDouble(settingName, defaultValue));
}
else
{
return global.GetDouble(settingName, defaultValue);
}
}
示例5: Get
public static double Get(IConfig cfg, string key, double defalt)
{
return cfg == null ? defalt : cfg.GetDouble(key, defalt);
}