| | |
| | | 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 |
| | | { |
| | | public static readonly string ConfigFile = "UserInfo_File"; |
| | | /// <summary> |
| | | /// 通用方法 |
| | | /// </summary> |
| | | private static UserInfo m_Current = null; |
| | | /// <summary> |
| | | /// 通用方法 |
| | | /// </summary> |
| | | public static UserInfo Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | try |
| | | { |
| | | UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(ConfigFile))); |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | #region 账号注册服务器信息 |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string RequestHttpsHost = "https://china.hdlcontrol.com"; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public GlobalRegionListRes GlobalRegion; |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 是否同意协议 |
| | | /// </summary> |
| | | public bool isAgreePrivacyPolicy; |
| | | |
| | | /// <summary> |
| | | /// 用户名称 |
| | | /// </summary> |
| | |
| | | ///// <summary> |
| | | ///// 用户密码 |
| | | ///// </summary> |
| | | //public string Password = ""; |
| | | string aesPassword = ""; |
| | | /// <summary> |
| | | /// 用户密码 |
| | | /// </summary> |
| | | public string password |
| | | { |
| | | get |
| | | { |
| | | return Shared.Securitys.EncryptionService.AesDecryptTopic(aesPassword, "85521566HDLONPRO"); |
| | | } |
| | | set |
| | | { |
| | | aesPassword = Shared.Securitys.EncryptionService.AesEncryptTopic(value, "85521566HDLONPRO"); |
| | | } |
| | | } |
| | | //public string password = ""; |
| | | //string aesPassword = ""; |
| | | ///// <summary> |
| | | ///// 用户密码 |
| | | ///// </summary> |
| | | //public string password |
| | | //{ |
| | | // get |
| | | // { |
| | | // return Shared.Securitys.EncryptionService.AesDecryptTopic(aesPassword, "85521566HDLONPRO"); |
| | | // } |
| | | // set |
| | | // { |
| | | // aesPassword = Shared.Securitys.EncryptionService.AesEncryptTopic(value, "85521566HDLONPRO"); |
| | | // } |
| | | //} |
| | | /// <summary> |
| | | /// 用户手机号码 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 用户区域 |
| | | /// </summary> |
| | | public int areaCode = 86; |
| | | public string areaCode = "86"; |
| | | /// <summary> |
| | | /// 用户头像图片 |
| | | /// </summary> |
| | |
| | | |
| | | public void SaveUserInfo() |
| | | { |
| | | FileUtils.WriteFileByBytes("UserInfo_File", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); |
| | | FileUtils.WriteFileByBytes(ConfigFile, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); |
| | | } |
| | | |
| | | |