wxr
2019-11-25 29a6e6d747d13fc285c8dd86649417f60613388f
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
using System;
using System.Collections.Generic;
using HDL_ON.DAL;
using HDL_ON.R;
 
namespace HDL_ON
{
    [System.Serializable]
    public class UserConfig
    {
        static string configFile = "UserConfig";
 
        static UserConfig instance;
        public static UserConfig Instance {
            get {
                if (instance == null) {
                    try {
                        var userConfigBytes = MyIO.FileUtils.ReadFile (configFile);
                        var userConfigString = CommonPage.MyEncodingUTF8.GetString (userConfigBytes);
                        UserConfig temp = null;
                        if (userConfigString != null) {
                            temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserConfig> (userConfigString);
                        }
                        if (temp == null) {
                            instance = new UserConfig { };
                            instance.HideDeviceTypes.Add (InternationalizationString.VideoIntercom);
                            instance.HideDeviceTypes.Add (InternationalizationString.Thermostat);
                        } else {
                            instance = temp;
                        }
                    } catch { }
                }
                instance.DeviceTypes = new List<int> (){
                    InternationalizationString.AC,
                    InternationalizationString.Lights,
                    InternationalizationString.Curtain,
                    InternationalizationString.Scenes,
                    InternationalizationString.FoolHeat,
                    InternationalizationString.Monitor,
                    InternationalizationString.Security,
                    InternationalizationString.TV,
                    InternationalizationString.Music,
                    InternationalizationString.ElectricalControl,
                    InternationalizationString.Fan,
                    InternationalizationString.DoorLock,
                    InternationalizationString.UniversalDevice,
                    InternationalizationString.Environmental,
                    InternationalizationString.VideoIntercom,
                    InternationalizationString.Thermostat,
 
                    //-------------------------------------
                };
                return instance;
            }
        }
 
        byte [] GetUserConfigBytes ()
        {
            return CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this));
        }
 
        public void RefreshUserConfig ()
        {
            instance = null;
            SaveUserConfig ();
        }
 
        public void SaveUserConfig ()
        {
            MyIO.FileUtils.WriteFileByBytes (configFile, GetUserConfigBytes ());
        }
 
        public int internetStatus = 2;
 
        /// <summary>
        /// 存放不用调光功能的调光设备
        /// </summary>
        public List<string> UnEnableDimmingLight = new List<string> ();
 
        /// <summary>
        /// 插座开关列表
        /// </summary>
        public List<string> SocketList = new List<string> ();
 
        /// <summary>
        /// 手机appID
        /// </summary>
        public string tokenID = string.Empty;
 
        /// <summary>
        /// 手机别名
        /// </summary>
        public string phoneName = string.Empty;
 
        /// <summary>
        /// 用户界面进入时是否显示的是全局场景界面
        /// </summary>
        public bool SceneOfGloba = false;
 
        /// <summary>
        /// 保存远程连接的网络设备文件名
        /// </summary>
        public string RemoteModeFile = string.Empty;
 
        /// <summary>
        /// 是否展开房间灯光列表
        /// </summary>
        public bool ShowRoomLightList = true;
 
        /// <summary>
        /// 是否展开房间窗帘列表
        /// </summary>
        public bool ShowRoomCurtainList = true;
 
        /// <summary>
        /// 隐藏没有场景的房间
        /// </summary>
        public bool HideInvalidRoomScene = false;
 
        public bool ShowFunctionBackground = true;
 
        //要显示的设备类型先在这里加进文本选择
        public List<int> DeviceTypes = null;
 
        public List<int> HideDeviceTypes = new List<int> ();
 
        public Dictionary<string, int> SkinVision = new Dictionary<string, int> ();
        public Dictionary<string, int> DowlaodSkinVision = new Dictionary<string, int> ();
        /// <summary>
        /// 当前使用的皮肤
        /// </summary>
        public string CurrentSkinName {
            get {
                string skinPath = "Phone";
                if (SkinCode == 0) {
                    skinPath = "Phone";
                } else if (SkinCode == 1) {
                    skinPath = "Phone2";
                }
                return skinPath;
            }
        }
 
        /// <summary>
        /// 安防密码
        /// </summary>
        public string ArmPW = "85521566";
 
 
        /// <summary>
        /// 是否显示场景列表
        /// </summary>
        public bool ShowAlternativeScene = true;
 
        //门锁密码保存
        public Dictionary<string, string> RemoteDoorLockPasswordList = new Dictionary<string, string> ();
 
        public string CountryCode = "CN";
 
        public int SkinCode = 0;
 
        public string SetLanguage = "";
 
        /// <summary>
        /// 商店当前的版本
        /// </summary>
        public string StoreVersion = "";
 
        /// <summary>
        /// 是否为商店最新版本
        /// </summary>
        public bool IsAppStoreVersionNewer = true;
        /// <summary>
        /// 是否需要更新,更新的类型是什么
        /// </summary>
        //public SimpleControl.Phone.UpdateVersionType UpdateVersionType = 0;
 
        public List<RegionInfoRes> HomeLists = new List<RegionInfoRes> ();
 
        public RegionInfoRes CurrentRegion = new RegionInfoRes ();
        [Newtonsoft.Json.JsonIgnore]
        public string GatewayMAC {
            get {
                return CurrentRegion.MAC;
            }
        }
 
        public List<string> RometoUserInfoKeys = new List<string> ();
 
        //public static List<string> LocalFiles = IO.FileUtils.ReadFiles ();
 
        /// <summary>
        /// 记录最后一次触发的场景
        /// </summary>
        public string CurScene = string.Empty;
 
        /// <summary>
        /// 主页是否设置了传感器
        /// </summary>
        public bool IsSetHomePageSensor = false;
        public HomePageSensor temp = null;// new HomePageSensor () { DeviceID = 11, LoopID = 1, Name = "temp.", SubnetID = 1 };
        public HomePageSensor pm25 = null;// new HomePageSensor () { DeviceID = 1, LoopID = 1, Name = "pm25", SubnetID = 1 };
        public HomePageSensor humidity = null;//new HomePageSensor () { DeviceID = 1, LoopID =2, Name = "humidity", SubnetID = 1 };
        public HomePageSensor co2 = null;//new HomePageSensor () { DeviceID = 1, LoopID = 3, Name = "co2", SubnetID = 1 };
        public HomePageSensor tvoc = null;//new HomePageSensor () { DeviceID = 1, LoopID = 4, Name = "tvoc", SubnetID = 1 };
        public HomePageSensor formaldehyde = null;// new HomePageSensor () { DeviceID = 1, LoopID = 5, Name = "formaldehyde", SubnetID = 1 };
    }
 
    public class HomePageSensor
    {
        public byte SubnetID;
        public byte DeviceID;
        public byte LoopID;
        public string Name;
        public double values;
    }
}