gxc
2019-10-29 081ea8d273048fd03756718ac6fb48a3c09218e9
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs
@@ -891,17 +891,21 @@
    public class MemberShardInfoData
    {
        /// <summary>
        /// 成员的全部分享数据,里面包含所有的文件(keys:房间文件名  value:文件名)
        /// </summary>
        public Dictionary<string, HashSet<string>> dicAllMemberShard = new Dictionary<string, HashSet<string>>();
        /// <summary>
        /// 全部的分享文件的主键(keys:文件名  value:主键)
        /// </summary>
        public Dictionary<string, string> dicAllShardKeys = new Dictionary<string, string>();
        /// <summary>
        /// 分享房间的对象(它是从云端来的)
        /// 分享房间的对象(它是从云端来的,keys:文件名)
        /// </summary>
        public Dictionary<string, Common.Room> dicShardRoom = new Dictionary<string, Common.Room>();
        public Dictionary<string, Room> dicShardRoom = new Dictionary<string, Common.Room>();
        /// <summary>
        /// 分享的楼层
        /// </summary>
        public Dictionary<string, string> dicShardFloor = new Dictionary<string, string>();
        /// <summary>
        /// 临时变量(这个东西为null,即不是新分享的房间,否则是新分享的房间。用完记得置空)
        /// </summary>
        public Room TempRoom = null;
        /// <summary>
        /// 是否需要刷新
        /// </summary>
@@ -983,77 +987,6 @@
        /// 应该叫远程连接的名字吧
        /// </summary>
        public string ConnectZigbeeMqttBrokerName = string.Empty;
    }
    #endregion
    #region ■ 账号设置类__________________________
    /// <summary>
    /// 账号设置信息
    /// </summary>
    public class AccountOption
    {
        /// <summary>
        /// 是否使用指纹验证
        /// </summary>
        public bool FingerprintAuthentication = false;
        /// <summary>
        /// 密码验证
        /// </summary>
        public string PswAuthentication = string.Empty;
        /// <summary>
        /// 手势验证
        /// </summary>
        public string GestureAuthentication = string.Empty;
        /// <summary>
        /// 是否使用远程开锁
        /// </summary>
        public bool DoorUnLockByRemote = false;
        /// <summary>
        /// 保存
        /// </summary>
        public void Save()
        {
            //加密密码
            string hdlKey = "hD1(La3o";
            string oldPswAuthentication = PswAuthentication;
            PswAuthentication = UserCenterLogic.EncryptPassword(hdlKey, oldPswAuthentication);
            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;
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <returns></returns>
        public AccountOption 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();
            }
            var varByte = Shared.IO.FileUtils.ReadFile(fileName);
            string strValue = System.Text.Encoding.UTF8.GetString(varByte);
            var info = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountOption>(strValue);
            //解密密码
            string hdlKey = "hD1(La3o";
            info.PswAuthentication = UserCenterLogic.DecryptPassword(hdlKey, info.PswAuthentication);
            info.GestureAuthentication = UserCenterLogic.DecryptPassword(hdlKey, info.GestureAuthentication);
            return info;
        }
    }
    #endregion