using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
namespace HDL_ON
{
[System.Serializable]
public class UserInfo
{
///
/// 用户名称
///
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 int 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 = "C";
///
/// 用户住宅列表
///
public List regionList = new List();
public void SaveUserInfo()
{
FileUtils.WriteFileByBytes("UserInfo_File", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
}
private byte[] convertByte(Image img)
{
MemoryStream ms = new MemoryStream();
img.Save(ms, img.RawFormat);
//byte[] bytes = new byte[ms.Length];
//ms.Read(bytes, 0, Convert.ToInt32(ms.Length));
//以上两句改成下面两句
byte[] bytes = ms.ToArray();
ms.Close();
return bytes;
}
private Image convertImg(byte[] datas)
{
MemoryStream ms = new MemoryStream(datas);
Image img = Image.FromStream(ms, true);//在这里出错
//流用完要及时关闭
ms.Close();
return img;
}
}
}