From 7c2541f609e8235c4c33b4fb2ee27125f73f8ee6 Mon Sep 17 00:00:00 2001
From: lss <lsc@hdlchina.com.cn>
Date: 星期五, 24 六月 2022 13:28:36 +0800
Subject: [PATCH] 2022-06-24

---
 HDL_ON/DAL/Mqtt/MqttClient.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 01d44d8..f5abbf2 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -483,7 +483,8 @@
                                     {
                                         try
                                         {
-                                            var securityBytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.Instance.HomeGateway.aesKey);
+                                            var securityBytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload,
+                                                DB_ResidenceData.Instance.HomeGateway.aesKey);
                                             var securityString = Encoding.UTF8.GetString(securityBytes);
                                             var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityStatusObj>(securityString);
                                             MainPage.Log($"瀹夐槻鐘舵�佸彉鍖栵細{securityString}");
@@ -511,12 +512,14 @@
                                 }
                                 #endregion
                                 //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
+                                //Tag 缃戠粶鐘舵�佽В鏋�
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send")
                                 {
                                     var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                     var revString = Encoding.UTF8.GetString(bytes);
                                     MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}");
                                     Control.Ins.UpdataFunctionStatus(revString, null, true);
+                                    //Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}");
                                     //Control.Ins.MsgInfoList.Add(revString + "\r\n");
                                 }
                                 //涓�绔彛鏁版嵁瑙f瀽
@@ -529,7 +532,8 @@
 
                                     if (!string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.aesKey))
                                     {
-                                        packet.Bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.Instance.HomeGateway.aesKey);
+                                        packet.Bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload,
+                                            DB_ResidenceData.Instance.HomeGateway.aesKey);
                                     }
                                     else
                                     {
@@ -1094,8 +1098,17 @@
             //鍒涘缓AES瑙e瘑鍣ㄥ璞�
             var cTransform = rm.CreateDecryptor();
 
+            byte[] reData = null;
             //浣跨敤AES灏嗗瘑鏂囨祦杞垚鏄庢枃鐨勫瓧鑺傛暟缁�
-            return cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
+            try
+            {
+                reData = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message);
+            }
+            return reData;
         }
         #endregion
 

--
Gitblit v1.8.0