?? 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 + -