源码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DouYin
{
public class IGK_Registry
{
public static string Read(String Key)
{
string value = string.Empty;
Microsoft.Win32.RegistryKey registryKey;
registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\IGK_DouYin");
if (registryKey != null)
{
value = (string)registryKey.GetValue(Key);
registryKey.Close();
}
return value;
}
public static void Write(String Key,String Value)
{
Microsoft.Win32.RegistryKey registryKey;
registryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\IGK_DouYin");
registryKey.SetValue(Key, Value);
registryKey.Close();
}
public class SystemVar
{
public static string SpeekerIP;
}
}
}
测试一下
textBoxSpeekerIP.Text = IGK_Registry.Read("语音播报器IP");
IGK_Registry.Write("语音播报器IP", textBoxSpeekerIP.Text);
注册表截图