From d53e6af2c5f17838fa79659614b15a2a1f383399 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 31 三月 2023 10:04:58 +0800
Subject: [PATCH] 1

---
 Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs |   50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
index 22c41e1..d32f70e 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -15,6 +15,7 @@
 
         static bool isConnectiong = false;
         static DateTime mFlagDateTime;
+        //public static bool upLoadLink = true;
         /// <summary>
         /// 妫�娴�/杩炴帴杩滅▼
         /// </summary>
@@ -50,7 +51,7 @@
                 //Control.IsCanLocal = false;
                 try {
                     if (status == 0) {
-                        Utlis.ShowAppLinkStatus (AppLinkStatus.CloudOffline);
+                        Utlis.ShowAppLinkStatus (AppLinkStatus.WiFiUnlink);
                         Application.RunOnMainThread (() => {
                             MainPage.AddTip (Language.StringByID (R.MyInternationalizationString.InternetStatusTip));
                         });
@@ -106,6 +107,8 @@
                                 MainPage.LoadingStart (Language.StringByID (R.MyInternationalizationString.SearchingGatewayLocally));
 
                                 var control = new Control ();
+
+                                UserConfig.Instance.IsLocalEncrypt = false;
                                 control.Send (new Target () {
                                     IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
                                     Command = Command.ReadGateway,
@@ -115,8 +118,19 @@
                                 }, SendCount.Three, true, true);
                                 var result = control.UsefulBytes;
 
+
                                 #endregion
                                 if (result != null) {
+                                    //娌℃湁閰嶇疆閫氳绉橀挜鏃讹紝鍐欏叆绉橀挜
+                                    if (!string.IsNullOrEmpty (UserConfig.Instance.LocalEncryptKey) && !UserConfig.Instance.IsLocalEncrypt) {
+                                        byte [] AseKeyBytes = UserConfig.Instance.GenerateLocalEncryptionKey ();
+                                        byte [] sendBytes = new byte [17];
+                                        sendBytes [0] =(byte)1 ; //0:涓嶅姞瀵� 1:鍔犲瘑
+                                        Array.Copy (AseKeyBytes, 0, sendBytes, 1, 16);
+                                        byte [] backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayLocalEncryption, SmartHome.MqttCommon.GatewayCommon.SubnetID, SmartHome.MqttCommon.GatewayCommon.DeviceID, sendBytes);
+                                    }
+
+
                                     var mac0 = CommonPage.byteToHex16 (result [5]) + "." + CommonPage.byteToHex16 (result [6]) + "." + CommonPage.byteToHex16 (result [7]) + "." + CommonPage.byteToHex16 (result [8]) + "." + CommonPage.byteToHex16 (result [9]) + "." + CommonPage.byteToHex16 (result [10]) + "." + CommonPage.byteToHex16 (result [11]) + "." + CommonPage.byteToHex16 (result [12]);
                                     if (SmartHome.MqttCommon.GatewayCommon.MAC.Replace (".", "").Replace (":", "").ToUpper () == mac0.Replace (".", "").Replace (":", "").ToUpper ()) {
                                         //鎼滅储鎴愬姛锛屽惎鐢ㄦ湰鍦拌繛鎺�
@@ -188,6 +202,40 @@
 
                     Application.RunOnMainThread (() => {
                         MainPage.Loading.Hide ();
+#if DEBUG
+                        //upLoadLink = true;
+#endif
+
+                        //骞冲彴杩佺Щ鏁版嵁澶勭悊 wxr 2022-06-14 13:37:49
+                        if ( !UserConfig.Instance.CurrentRegion.indiaIsAsyncDeviceMark) {
+                            //upLoadLink = false;
+                            MigrateBean bean = new MigrateBean ();
+                            System.Threading.Tasks.Task.Run (() => {
+                                try {
+                                    //var dd = bean.GetTimerBackupBean ();
+                                    //bean.TimerBakeupFileDetailedInformation (dd.id);
+
+                                    Application.RunOnMainThread (() => {
+                                        MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
+                                    });
+                                    //1.鑾峰彇杩佺Щ澶囦唤
+                                    var migrateBackup = bean.GetMigrateBackupBean ();
+                                    if (migrateBackup != null) {
+                                        //2.涓嬭浇澶囦唤
+                                        bean.UserBakeupFileDetailedInformation (migrateBackup.id);
+                                    }
+
+                                } catch {
+                                } finally {
+                                    Application.RunOnMainThread (() => {
+                                        MainPage.Loading.Hide ();
+                                    });
+                                }
+                            });
+
+                        }
+
+
                     });
 
                     ////涓嶆槸杩滅▼ 骞朵笖鏈湴鎼滅储涓嶅埌鍖归厤鐨勭綉鍏冲氨鎻愮ず绂佹鏈湴鍙戦��

--
Gitblit v1.8.0