using System; using System.Collections.Generic; using System.Text; using HDL_ON.DAL; using HDL_ON.DAL.Server; using HDL_ON.Entity; using Shared; namespace HDL_ON { [System.Serializable] public class OnAppConfig { /// /// OnAppConfig /// //public const string ConfigFile = "OnAppConfig"; static OnAppConfig instance; public static OnAppConfig Instance { get { if (instance == null) { try { var userConfigBytes = Common.FileUtlis.Files.ReadAppConfig (); var userConfigString = System.Text.Encoding.UTF8.GetString (userConfigBytes); OnAppConfig temp = null; if (userConfigString != null) { temp = Newtonsoft.Json.JsonConvert.DeserializeObject (userConfigString); } if (temp == null) { instance = new OnAppConfig { }; } else { instance = temp; } } catch { instance = new OnAppConfig() { }; } } return instance; } } /// /// app设置的语言 /// public string SetLanguage = ""; /// /// 分类界面是否显示大图 /// public bool IsShowBigPicture = true; /// /// 最后一位登录的账号的ID /// public string LastLoginUserId = ""; /// /// 是否是登录状态 /// public bool IsLogin { get { if (string.IsNullOrEmpty(LastLoginUserId)) return false; else { //return (DateTime.Now - LastTime).TotalDays < 7; return true; } } } /// /// 存储登录过的用户 /// public List UserList = new List(); #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 public void SaveConfig() { var bytes = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); Common.FileUtlis.Files.WirteAppConfig(bytes); } } public class UserAccount { /// /// 用户ID /// public string ID; /// /// 用户名称 /// public string userName = ""; /// /// 用户 /// public string AccountString = ""; /// /// 用户手机号码 /// public string userMobileInfo = ""; /// /// 用户邮箱信息 /// public string userEmailInfo = ""; /// /// 登录时间 /// public DateTime LoginTime = DateTime.MinValue; } }