wei
2021-06-23 d4973876384be55df64de45db8a511d1e0330872
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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
    {
        /// <summary>
        /// OnAppConfig
        /// </summary>
        //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<OnAppConfig> (userConfigString);
                        }
                        if (temp == null) {
                            instance = new OnAppConfig { };
                        } else {
                            instance = temp;
                        }
                    } catch {
                        instance = new OnAppConfig() { };
                    }
                }
                return instance;
            }
        }
 
        /// <summary>
        /// app设置的语言
        /// </summary>
        public string SetLanguage = "";
 
        /// <summary>
        /// 分类界面是否显示大图
        /// </summary>
        public bool IsShowBigPicture = true;
 
        /// <summary>
        /// 最后一位登录的账号的ID
        /// </summary>
        public string LastLoginUserId = "";
        /// <summary>
        /// 是否是登录状态
        /// </summary>
        public bool IsLogin
        {
            get
            {
                if (string.IsNullOrEmpty(LastLoginUserId))
                    return false;
                else
                {
                    //return (DateTime.Now - LastTime).TotalDays < 7;
                    return true;
                }
            }
        }
 
        /// <summary>
        /// 存储登录过的用户
        /// </summary>
        public List<UserAccount> UserList = new List<UserAccount>();
 
        #region 服务器数据
        /// <summary>
        ///  账号注册服务器信息
        /// </summary>
        public string RequestHttpsHost ="https://china.hdlcontrol.com";
        /// <summary>
        /// 
        /// </summary>
        public GlobalRegionListRes GlobalRegion;
 
        /// <summary>
        /// 是否同意协议
        /// </summary>
        public bool isAgreePrivacyPolicy;
 
        /// <summary>
        /// 忽略更新的版本号
        /// </summary>
        public string IgnoreUpdateVersion = string.Empty;
 
        /// <summary>
        /// 信息推送标记
        /// </summary>
        public string PushDeviceToken;
        /// <summary>
        /// phoneName
        /// </summary>
        public string PhoneName;
        /// <summary>
        /// 添加推送Token成功时返回的Id
        /// </summary>
        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
    {
 
        /// <summary>
        /// 用户ID
        /// </summary>
        public string ID;
        /// <summary>
        /// 用户名称
        /// </summary>
        public string userName = "";
        /// <summary>
        /// 用户
        /// </summary>
        public string AccountString = "";
        /// <summary>
        /// 用户手机号码
        /// </summary>
        public string userMobileInfo = "";
        /// <summary>
        /// 用户邮箱信息
        /// </summary>
        public string userEmailInfo = "";
        /// <summary>
        /// 登录时间
        /// </summary>
        public DateTime LoginTime = DateTime.MinValue;
 
    }
}