123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Win32;
- namespace Aitex.Core.RT.Key
- {
- public class RegistryManager
- {
- /*
- *
- *
- *
- *
- *
- */
- public static string PathMachineCode = "Software\\MyTech\\MachineCode";
- public static string PathRegisterCode = "Software\\MyTech\\RegisterCode";
- public static string ValueRegisterCode = "Code";
- public static string Read(string path, string keyname)
- {
- RegistryKey registryKey = Registry.LocalMachine.CreateSubKey(path);
- if (registryKey == null)
- {
- return string.Empty;
- }
- object value = registryKey.GetValue(keyname);
- if (value != null)
- {
- return value.ToString();
- }
- return string.Empty;
- }
- public static void Write(string path, string keyname, string keyvalue)
- {
- RegistryKey registryKey = Registry.LocalMachine.CreateSubKey(path);
- if (registryKey == null)
- {
- return;
- }
- registryKey.SetValue(keyname, keyvalue);
- }
- }
- }
|