68 lines
975 B
C#
68 lines
975 B
C#
using System;
|
|
using Microsoft.Win32;
|
|
|
|
namespace Payroll.BO
|
|
{
|
|
public class EaseReg
|
|
{
|
|
private string _sVal;
|
|
private string _sKeyName;
|
|
private string _sSubKeyName;
|
|
|
|
public EaseReg(string sRegKeyName,string sRegSubKeyName)
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
_sKeyName=sRegKeyName;
|
|
_sSubKeyName=sRegSubKeyName;
|
|
this.GetSetting();
|
|
}
|
|
|
|
~EaseReg()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
this.SaveSetting();
|
|
}
|
|
|
|
public string Val
|
|
{
|
|
get
|
|
{
|
|
return _sVal;
|
|
}
|
|
|
|
set
|
|
{
|
|
_sVal=value;
|
|
}
|
|
|
|
}
|
|
|
|
public void SaveSetting()
|
|
{
|
|
RegistryKey oKey=Registry.CurrentUser.CreateSubKey(_sKeyName);
|
|
oKey.SetValue(_sSubKeyName,_sVal);
|
|
}
|
|
|
|
public void GetSetting()
|
|
{
|
|
RegistryKey oRegKey=Registry.CurrentUser;
|
|
|
|
try
|
|
{
|
|
oRegKey=oRegKey.OpenSubKey(_sKeyName);
|
|
object oValue=oRegKey.GetValue(_sSubKeyName);
|
|
_sVal=Convert.ToString(oValue);
|
|
}
|
|
catch
|
|
{
|
|
_sVal="";
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} |