wxr
2020-08-13 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -274,15 +274,17 @@
                try
                {
                    var headImageString = dataStr.GetValue("HeadImage").ToString();
                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString);
                    var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString);
                    MainPage.LoginUser.headImagePageBytes = headImageBytes;
                    var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
                    fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
                    fs.Write(headImageBytes, 0, headImageBytes.Length);
                    fs.Flush();
                    MainPage.LoginUser.headImagePagePath = filePath;
                    if (!string.IsNullOrEmpty(headImageString))
                    {
                        var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString);
                        var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString);
                        MainPage.LoginUser.headImagePageBytes = headImageBytes;
                        var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
                        fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
                        fs.Write(headImageBytes, 0, headImageBytes.Length);
                        fs.Flush();
                        MainPage.LoginUser.headImagePagePath = filePath;
                    }
                } catch (Exception ex)
                {
                    MainPage.Log($"download headImage error : {ex.Message}");
@@ -917,23 +919,8 @@
                /// <summary>
                /// 功能ID
                /// 厂商代码   2bytes;     01   HDL
                /// 通讯方式   1byte ;     01   HDL Bus; 02   Zigbee;03   KNX;04   Z-Wave
                /// 产品GUID   8bytes
                /// 产品类别   1byte ;     01  调光器;02继电器;03干接点模块;04传感器;05面板
                /// 物模型类型2bytes      01 开关类    --01开关;02插座
                ///                      02   照明     --01开关类;02调光类;03色温;04LED
                ///                      03   遮阳     --01窗帘电机;02百叶窗;03开合帘;04卷帘
                ///                      04   恒温器    --01空调;02地暖;03毛细空调
                ///                   05   新风
                ///                   06   影音
                ///                   07   音乐
                ///                      08   能源
                ///                      09   安防
                /// 通道号   2bytes
                /// Key_id  2bytes
                /// </summary>
                /// "00010112345678901234560101230123AABB";
                /// "03010112345678901234560101230123AABB";
                var buffer = Guid.NewGuid().ToByteArray();
                string guid = "";
                if (buffer != null)
@@ -971,7 +958,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
                        {
                            sid = "000101" + guid + "0102010001AABB",
                            sid = "030101" + guid + "0102010001AABB",
                            name = ss.GetValue("Name").ToString(),
                            function = new List<Trait>() {
                                    new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off"} },
@@ -997,7 +984,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
                        {
                            sid = "000101" + guid + "0202020001AABB",
                            sid = "030101" + guid + "0202020001AABB",
                            name = ss.GetValue("Name").ToString(),
                            function = new List<Trait>() {
                                        new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "up","down"} },
@@ -1024,7 +1011,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
                        {
                            sid = "000101" + guid + "0202040001AABB",
                            sid = "030101" + guid + "0202040001AABB",
                            name = ss.GetValue("Name").ToString(),
                            function = new List<Trait>() {
                                        new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "on","off"} },
@@ -1053,7 +1040,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.aCs.Add(new AC()
                        {
                            sid = "000101" + guid + "0204010001AABB",
                            sid = "030101" + guid + "0204010001AABB",
                            name = ss.GetValue("Name").ToString(),
                            function = new List<Trait>() {
                                        new Trait { attri="on_off", max=1,min = 0, value= new List<string> { "on","off"} },
@@ -1083,7 +1070,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
                        {
                            sid = "000101" + guid + "0203010001AABB",
                            sid = "030101" + guid + "0203010001AABB",
                            name = ss.GetValue("Name").ToString(),
                            roomIdList = roomIds,
                            //roomIdList = new List<string>() { roomSid },
@@ -1109,7 +1096,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
                        {
                            sid = "000101" + guid + "0203040001AABB",
                            sid = "030101" + guid + "0203040001AABB",
                            name = ss.GetValue("Name").ToString(),
                            roomIdList = roomIds,
                            //roomIdList = new List<string>() { roomSid },
@@ -1135,7 +1122,7 @@
                        }
                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
                        {
                            sid = "000101" + guid + "0203030001AABB",
                            sid = "030101" + guid + "0203030001AABB",
                            name = ss.GetValue("Name").ToString(),
                            roomIdList = roomIds,
                            //roomIdList = new List<string>() { roomSid },