From 9e2ae94d2d3f79fe063fcad7f01867348dc65e1d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 22 六月 2022 14:26:22 +0800
Subject: [PATCH] 备份

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

diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
index dbf79fa..392269d 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;
+        static bool upLoadLink = true;
         /// <summary>
         /// 妫�娴�/杩炴帴杩滅▼
         /// </summary>
@@ -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,39 @@
 
                     Application.RunOnMainThread (() => {
                         MainPage.Loading.Hide ();
+#if DEBUG
+                        //upLoadLink = true;
+#endif
+
+                        //骞冲彴杩佺Щ鏁版嵁澶勭悊 wxr 2022-06-14 13:37:49
+                        if (!UserConfig.Instance.CurrentRegion.indiaIsAsyncDeviceMark) {
+                            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