コード例 #1
0
 public string GetNodeAttributValue(XmlNode node, string attributName)
 {
     if (node == null)
     {
         return(string.Empty);
     }
     try
     {
         return(node.Attributes[attributName].InnerText.Trim());
     }
     catch (Exception ex)
     {
         XErrorLogTool.WriteLog(ex.ToString());
         return(string.Empty);
     }
 }
コード例 #2
0
ファイル: XRegeditHelper.cs プロジェクト: TIWTESOFT/MMIS
        /// <summary>
        /// 设置注册表项值
        /// </summary>
        /// <param name="rootKeyType">注册表根节点项类型</param>
        /// <param name="keyPath">注册表路径</param>
        /// <param name="keyValueName">值名称</param>
        /// <param name="keyValue">值</param>
        /// <returns></returns>
        public static bool SetRegistryValue(WRegisterRootKeyType rootKeyType, string keyPath, string keyValueName, string keyValue)
        {
            RegistryKey key = GetRegistryKey(rootKeyType, keyPath);

            if (key == null)
            {
                key = CreateRegistryKey(rootKeyType, keyPath);
            }
            try
            {
                key.SetValue(keyValueName, keyValue);
            }
            catch (Exception ex)
            {
                XErrorLogTool.WriteLog(ex.ToString());
                return(false);
            }
            return(true);
        }