using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
using HDL_ON.DAL;
using HDL_ON.DAL.Server;
namespace HDL_ON
{
[System.Serializable]
public class UserInfo
{
///
/// 通用方法
///
private static UserInfo m_Current = null;
///
/// 通用方法
///
public static UserInfo Current
{
get
{
if (m_Current == null)
{
try
{
UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadUserInfo()));
if (temp == null)
{
m_Current = new UserInfo() { };
Utlis.WriteLine("UserInfo null");
}
else
{
m_Current = temp;
Utlis.WriteLine("UserInfo Current");
}
}
catch
{
m_Current = new UserInfo() { };
Utlis.WriteLine("UserInfo null");
}
}
return m_Current;
}
}
///
/// 清除缓存数据
///
public void ClearUserInfo()
{
m_Current = null;
}
#region 新增保存参数
///
/// 账号注册服务器信息
///
public string RequestHttpsHost = "https://china.hdlcontrol.com";
///
///
///
public GlobalRegionListRes GlobalRegion;
///
/// 是否同意协议
///
public bool isAgreePrivacyPolicy;
///
/// 忽略更新的版本号
///
public string IgnoreUpdateVersion = string.Empty;
///
/// 信息推送标记
///
public string PushDeviceToken;
///
/// phoneName
///
public string PhoneName;
///
/// 添加推送Token成功时返回的Id
///
public string PushId;
#endregion
#region 用户数据
///
/// 用户名称
///
public string userName = "";
///
/// 用户
///
public string AccountString = "";
/////
///// 用户密码
/////
//public string password = "";
//string aesPassword = "";
/////
///// 用户密码
/////
//public string password
//{
// get
// {
// return Shared.Securitys.EncryptionService.AesDecryptTopic(aesPassword, "85521566HDLONPRO");
// }
// set
// {
// aesPassword = Shared.Securitys.EncryptionService.AesEncryptTopic(value, "85521566HDLONPRO");
// }
//}
///
/// 用户手机号码
///
public string userMobileInfo = "";
///
/// 用户邮箱信息
///
public string userEmailInfo = "";
///
/// 用户ID
///
public string ID;
///
/// 用户选择显示的语言
///
public string language = "Chinese";
///
/// 用户区域
///
public string areaCode = "86";
///
/// 用户头像图片
///
public string headImagePagePath = "LoginIcon/2.png";
/////
///// 用户头像byte数据
/////
//public byte[] headImagePageBytes = null;
///
/// 上一次登录时间
///
public DateTime LastTime = DateTime.MinValue;
///
/// 是否是登录状态
///
public bool IsLogin
{
get
{
return (DateTime.Now - LastTime).TotalDays < 7;
}
}
///
///
///
public string LoginTokenString;
///
///
///
public string RefreshToken;
///
/// UserType B端账号 C端账号
///
public string userType = "USER_C";
///
/// 用户住宅列表
///
public List regionList = new List();
///
/// 当前选择的住宅索引
///
public string CurReginID = "";
#endregion
public void SaveUserInfo()
{
Common.FileUtlis.Files.WirteUserinfo(Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
}
///
/// 退出登录重置参数
///
public void LogoutReset()
{
userName = "";
ID = "";
LoginTokenString = "";
RefreshToken = "";
userType = "USER_C";
LastTime = DateTime.MinValue;
headImagePagePath = "LoginIcon/2.png";//重置用户头像
}
public string SetLanguage = "";
///
/// 软件解锁界面
/// 1:启动时
/// 2:布防撤防时
/// 3:远程开锁时
///
public List appUnlockPage = new List();
///
/// 软件解锁方式
/// 1:数字密码
/// 2:手势密码
/// 3:指纹密码
/// 4:面容ID
///
public List appUnlockType = new List();
///
/// 软件解锁密码
///
public string appUnlockPasswrod = "";
///
/// 解锁时间
///
public DateTime unlockTime = DateTime.MinValue;
}
}