public static uint GetUInt(KeyValuePair <string, string> kvp) { uint uValue; string str; if (m_cfgCurrent.TryGetValue(kvp.Key, out str)) { if (StrUtil.TryParseUInt(str, out uValue)) { return(uValue); } else { Debug.Assert(false); } } if (StrUtil.TryParseUInt(kvp.Value, out uValue)) { return(uValue); } else { Debug.Assert(false); } return(0); }
/// <summary> /// Get an unsigned integer value from the current configuration. /// </summary> /// <param name="strField">Name of the configuration item.</param> /// <param name="uDefaultIfNotFound">Default value that is returned if /// the specified item cannot be found.</param> /// <returns>An unsigned integer.</returns> /// <exception cref="System.ArgumentNullException">Thrown if <paramref name="strField" /> /// is <c>null</c>.</exception> public static uint GetUInt(string strField, uint uDefaultIfNotFound) { Debug.Assert(strField != null); if (strField == null) { throw new ArgumentNullException("strField"); } string str; if (m_cfgCurrent.TryGetValue(strField, out str)) { uint uValue; if (StrUtil.TryParseUInt(str, out uValue)) { return(uValue); } } return(uDefaultIfNotFound); }
internal static void SetEnabled(string strIDs, bool bEnabled) { if (string.IsNullOrEmpty(strIDs)) { return; } string[] vIDs = strIDs.Split(new char[] { ',' }); foreach (string strID in vIDs) { if (string.IsNullOrEmpty(strID)) { continue; } uint uID; if (StrUtil.TryParseUInt(strID.Trim(), out uID)) { SetEnabled(uID, bEnabled); } } }