📄 framesystem.cs
字号:
namespace FrameCountry.FrameBuild
{
using FrameCountry;
using Microsoft.Win32;
using System;
public class FrameSystem
{
private string ClassAlias = "SY";
private FrameCity frameCity = new FrameCity();
public bool DeleteRegeditInfo(string regeditKey, string regeditPath, string regeditParam, ref string ErrorInfo)
{
string functionAlias = "02";
try
{
RegistryKey classesRoot;
switch (regeditKey.ToLower())
{
case "root":
classesRoot = Registry.ClassesRoot;
break;
case "user":
classesRoot = Registry.CurrentUser;
break;
case "machine":
classesRoot = Registry.LocalMachine;
break;
case "users":
classesRoot = Registry.Users;
break;
case "config":
classesRoot = Registry.CurrentConfig;
break;
default:
throw new Exception("请求的注册表根目录 " + regeditKey + " 不存在!");
}
if (regeditParam == "")
{
classesRoot.DeleteSubKey(regeditPath);
}
else
{
classesRoot.OpenSubKey(regeditPath, true).DeleteValue(regeditParam);
}
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
public bool GetRegeditInfo(string regeditKey, string regeditPath, string regeditParam, ref string regeditValue, ref string ErrorInfo)
{
string functionAlias = "00";
try
{
RegistryKey classesRoot;
switch (regeditKey.ToLower())
{
case "root":
classesRoot = Registry.ClassesRoot;
break;
case "user":
classesRoot = Registry.CurrentUser;
break;
case "machine":
classesRoot = Registry.LocalMachine;
break;
case "users":
classesRoot = Registry.Users;
break;
case "config":
classesRoot = Registry.CurrentConfig;
break;
default:
throw new Exception("请求的注册表根目录 " + regeditKey + " 不存在!");
}
classesRoot = classesRoot.OpenSubKey(regeditPath);
regeditValue = classesRoot.GetValue(regeditParam).ToString();
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
public bool SetRegeditInfo(string regeditKey, string regeditPath, string regeditParam, string regeditValue, ref string ErrorInfo)
{
string functionAlias = "01";
try
{
RegistryKey classesRoot;
switch (regeditKey.ToLower())
{
case "root":
classesRoot = Registry.ClassesRoot;
break;
case "user":
classesRoot = Registry.CurrentUser;
break;
case "machine":
classesRoot = Registry.LocalMachine;
break;
case "users":
classesRoot = Registry.Users;
break;
case "config":
classesRoot = Registry.CurrentConfig;
break;
default:
throw new Exception("请求的注册表根目录 " + regeditKey + " 不存在!");
}
classesRoot.CreateSubKey(regeditPath).SetValue(regeditParam, regeditValue);
}
catch (Exception exception)
{
ErrorInfo = this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, exception.Message);
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -