From 30d5375178a275abd2019f2e5ce0eab1dfa51e0e Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 16 三月 2020 09:50:03 +0800 Subject: [PATCH] 2020-03-16 1.Android 修改包名为com.hdl.crabtreenew. --- Crabtree/SmartHome/HDL/Operation/Packet.cs | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/Packet.cs b/Crabtree/SmartHome/HDL/Operation/Packet.cs index ded4f36..8618286 100644 --- a/Crabtree/SmartHome/HDL/Operation/Packet.cs +++ b/Crabtree/SmartHome/HDL/Operation/Packet.cs @@ -60,7 +60,8 @@ //鍔犲瘑妫�娴� EncryptionDetection (); - + //var mes2 = System.Text.Encoding.ASCII.GetString (Bytes, 0, Bytes.Length); + //System.Console.WriteLine ($"============>GetBytes 锛歿mes2}"); //瀵逛簬鎿嶄綔鏁版嵁搴撶殑鏃堕棿姣旇緝闀跨殑锛屽彲浠ュ垱寤哄彟涓�涓嚎绋嬪鐞� if (!"HDLMIRACLE".Equals (System.Text.Encoding.ASCII.GetString (Bytes, 4, 10))) { @@ -69,7 +70,6 @@ byte subnetID = this.Bytes [17]; //婧愬瓙缃戝彿 byte deviceID = this.Bytes [18]; //婧愯澶囧彿 - //婧愯澶囩被鍨� int deviceType = this.Bytes [19] * 256 + this.Bytes [20]; @@ -81,7 +81,8 @@ //涓嶆槸瑕佹帴鏀剁殑鎸囦护灏辫繑鍥� if (!((targetSubnetID == Global.LocalSubnetID && targetDeviceID == Global.LocalDeviceID) || (targetSubnetID == 0xff && targetDeviceID == 0xff))) { - return; + //System.Console.WriteLine ($"============>targetSubnetID return"); + return; } byte [] usefulBytes = null; if (this.Bytes [16] == 0xFF) { @@ -130,21 +131,26 @@ if (IsLocal) {//鏈湴閫氳 if (UserConfig.Instance.IsLocalEncrypt) { - if ("Passord error" == (System.Text.Encoding.ASCII.GetString (Bytes, 14, 13))) { - //缃戝叧杩斿洖锛屽姞瀵嗗瘑鐮乲ey涓嶅 - - return; + if (Bytes.Length == 28) { + var mes = System.Text.Encoding.ASCII.GetString (Bytes, 14, 14); + if ("Password error" == mes) { + //缃戝叧杩斿洖锛屽姞瀵嗗瘑鐮乲ey涓嶅 + UserConfig.Instance.EncryptedPasswordCorrect = false; + return; + } } - var messageGet = Shared.Securitys.EncryptionService.AesEncryptPayload (Bytes, UserConfig.Instance.LocalEncryptKey); + var messageGet = Shared.Securitys.EncryptionService.AesDecryptPayload (Bytes, UserConfig.Instance.LocalEncryptKey); Bytes = messageGet; } else { - if ("Locked" == (System.Text.Encoding.ASCII.GetString (Bytes, 14, 6))) { - //缃戝叧宸插姞瀵嗭紝鑷姩鍒囨崲涓哄姞瀵� - UserConfig.Instance.IsLocalEncrypt = true; + if (Bytes.Length == 20) { + var mes = System.Text.Encoding.ASCII.GetString (Bytes, 14, 6); + if ("Locked" == mes) { + //缃戝叧宸插姞瀵嗭紝鑷姩鍒囨崲涓哄姞瀵� + UserConfig.Instance.IsLocalEncrypt = true; + } } - } } -- Gitblit v1.8.0