| | |
| | | /// <summary>
|
| | | /// 账号设置信息
|
| | | /// </summary>
|
| | | public class AccountOption
|
| | | public class AccountOptionClass
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 是否使用指纹验证
|
| | | /// </summary>
|
| | |
| | | /// 是否使用远程开锁
|
| | | /// </summary>
|
| | | public bool DoorUnLockByRemote = false;
|
| | | /// <summary>
|
| | | /// 是否使用安防快捷方式
|
| | | /// </summary>
|
| | | public bool SafetyShortcut = false;
|
| | | /// <summary>
|
| | | /// 密码剩余可输入次数
|
| | | /// </summary>
|
| | |
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public string UserPictruePath = string.Empty;
|
| | | /// <summary>
|
| | | /// 安防报警信息记录一天内最大的报警数
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public int SafetyOnedayMaxAlarmMsgCount = 50;
|
| | | /// <summary>
|
| | | /// 安防报警信息记录最大天数
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public int SafetyMaxAlarmMsgDay = 5;
|
| | | /// <summary>
|
| | | /// 门锁报警信息记录一天内最大的报警数
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public int DoorLockOnedayMaxAlarmMsgCount = 200;
|
| | | /// <summary>
|
| | | /// 门锁报警信息记录最大天数
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public int DoorLockMaxAlarmMsgDay = 5;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | |
| | | /// </summary>
|
| | | public void Save()
|
| | | {
|
| | | //加密密码
|
| | | string hdlKey = "hD1(La3o";
|
| | | string oldPswAuthentication = PswAuthentication;
|
| | | PswAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldPswAuthentication);
|
| | | try
|
| | | {
|
| | | //加密密码
|
| | | string hdlKey = "hD1(La3o";
|
| | | string oldPswAuthentication = PswAuthentication;
|
| | | PswAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldPswAuthentication);
|
| | |
|
| | | string oldGestureAuthentication = GestureAuthentication;
|
| | | GestureAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldGestureAuthentication);
|
| | | string oldGestureAuthentication = GestureAuthentication;
|
| | | GestureAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldGestureAuthentication);
|
| | |
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | string fullName = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.AccountOptionFile);
|
| | | //写入内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
|
| | | //还原明码
|
| | | PswAuthentication = oldPswAuthentication;
|
| | | GestureAuthentication = oldGestureAuthentication;
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | string fullName = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.AccountOptionFile);
|
| | | //写入内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
|
| | | //还原明码
|
| | | PswAuthentication = oldPswAuthentication;
|
| | | GestureAuthentication = oldGestureAuthentication;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | HdlLogLogic.Current.WriteLog(ex);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 加载数据
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public AccountOption Load()
|
| | | public AccountOptionClass Load()
|
| | | {
|
| | | string fileName = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.AccountOptionFile);
|
| | | if (System.IO.File.Exists(fileName) == false)
|
| | | {
|
| | | return new AccountOption();
|
| | | return new AccountOptionClass();
|
| | | }
|
| | | try
|
| | | {
|
| | | var varByte = Shared.IO.FileUtils.ReadFile(fileName);
|
| | | string strValue = System.Text.Encoding.UTF8.GetString(varByte);
|
| | | var info = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountOption>(strValue);
|
| | | var info = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountOptionClass>(strValue);
|
| | | //解密密码
|
| | | string hdlKey = "hD1(La3o";
|
| | | info.PswAuthentication = UserCenterLogic.DecryptPassword(hdlKey, info.PswAuthentication);
|
| | |
| | | catch (Exception ex)
|
| | | {
|
| | | HdlLogLogic.Current.WriteLog(ex);
|
| | | return new AccountOption();
|
| | | return new AccountOptionClass();
|
| | | }
|
| | | }
|
| | |
|