#region 注册表操作
/// <summary>
/// 读注册表
/// </summary>
/// <param name="path">注册表目录</param>
/// <param name="paramName">名称</param>
/// <returns></returns>
public static string Reg_read(string path, string paramName)
{
string value = string.Empty;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(path);
if (rk != null)
{
value = (string)rk.GetValue(paramName, null);
}
return value;
}
/// <summary>
/// 注册表写入值
/// </summary>
/// <param name="path">注册表目录</param>
/// <param name="paramName">名称</param>
/// <param name="value">写入值</param>
public static void Reg_write(string path, string paramName, string value)
{
RegistryKey rsg = null; //声明一个变量
Registry.LocalMachine.CreateSubKey(path);
rsg = Registry.LocalMachine.OpenSubKey(path, true); //true表可以修改
rsg.SetValue(paramName, value); //写入
rsg.Close();
}
#endregion