| | |
| | | [System.Serializable] |
| | | public class UserInfo |
| | | { |
| | | public static readonly string ConfigFile = "UserInfo_File"; |
| | | /// <summary> |
| | | /// 通用方法 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(ConfigFile))); |
| | | UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadUserInfo())); |
| | | if (temp == null) |
| | | { |
| | | m_Current = new UserInfo() { }; |
| | |
| | | /// 用户住宅列表 |
| | | /// </summary> |
| | | public List<RegionInfoRes> regionList = new List<RegionInfoRes>(); |
| | | /// <summary> |
| | | /// 当前选择的住宅索引 |
| | | /// </summary> |
| | | public string CurReginID = ""; |
| | | |
| | | #endregion |
| | | |
| | | public void SaveUserInfo() |
| | | { |
| | | FileUtils.WriteFileByBytes(ConfigFile, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); |
| | | Common.FileUtlis.Files.WirteUserinfo( Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | headImagePagePath = "LoginIcon/2.png";//重置用户头像 |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | public string SetLanguage = ""; |
| | | |
| | | /// <summary> |
| | | /// 软件解锁界面 |
| | | /// 1:启动时 |
| | | /// 2:布防撤防时 |
| | | /// 3:远程开锁时 |
| | | /// </summary> |
| | | public List<string> appUnlockPage = new List<string>(); |
| | | /// <summary> |
| | | /// 软件解锁方式 |
| | | /// 1:数字密码 |
| | | /// 2:手势密码 |
| | | /// 3:指纹密码 |
| | | /// 4:面容ID |
| | | /// </summary> |
| | | public List<string> appUnlockType = new List<string>(); |
| | | /// <summary> |
| | | /// 软件解锁密码 |
| | | /// </summary> |
| | | public string appUnlockPasswrod = ""; |
| | | /// <summary> |
| | | /// 解锁时间 |
| | | /// </summary> |
| | | public DateTime unlockTime = DateTime.MinValue; |
| | | } |
| | | } |