From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs |   84 +++++++++++++++++++++++++++++++++++------
 1 files changed, 71 insertions(+), 13 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
index fffeefb..cf828c0 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
@@ -151,8 +151,7 @@
                 //璁剧疆杩涘害鍊�
                 ProgressFormBar.Current.SetValue(i + 1, listFileCount);
             }
-            //鍏抽棴杩涘害鏉�
-            ProgressFormBar.Current.Close();
+
             //鍏佽鎸夌郴缁熺殑杩斿洖閿�
             Shared.Common.CommonPage.BackKeyCanClick = true;
             UserCenterResourse.AccountOption.AppCanSignout = true;
@@ -242,8 +241,18 @@
             List<string> listAllFile = null;
             //鏂囦欢澶圭殑鍏ㄨ矾寰�
             string fullDir = string.Empty;
+            string localTemplateName = string.Empty;
             if (upPath == string.Empty)
             {
+                //灏嗘ā鏉挎暟鎹繚瀛樺埌鍒版寚瀹氱殑鏂囦欢澶逛腑
+                var templateName = TemplateData.TemplateCommonLogic.Current.GetNewTemplateFileName();
+                var templateFile = TemplateData.TemplateCommonLogic.Current.SaveTemplateDataToFile(templateName, "HomeTemplate");
+
+                //灏嗘ā鏉縝in鏂囦欢绉诲姩鍒板浠芥枃浠跺す涓�
+                localTemplateName = System.IO.Path.Combine(Config.Instance.FullPath, templateName);
+                try { System.IO.File.Move(templateFile, localTemplateName); }
+                catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex, "绉诲姩妯℃澘澶辫触"); }
+
                 //鑾峰彇鏈湴鏂囦欢
                 listAllFile = HdlFileLogic.Current.GetRootPathListFile();
                 fullDir = Common.Config.Instance.FullPath;
@@ -265,6 +274,11 @@
 
             foreach (string fileName in listAllFile)
             {
+                //鍒ゆ柇鎸囧畾鏂囦欢鏄惁闇�瑕佷笂浼�(鏍圭洰褰曠殑鎵嶅垽鏂�)
+                if (upPath == string.Empty && this.IsNotUpLoadFile(fileName) == true)
+                {
+                    continue;
+                }
                 if (fileName.EndsWith(".png") == true
                     || fileName.EndsWith(".bin") == true)
                 {
@@ -276,7 +290,7 @@
             }
 
             //寮�鍚繘搴︽潯
-            int listFileCount = listAllFile.Count;
+            int listFileCount = listPicFile.Count + listNormalFile.Count;
             if (showBar == true)
             {
                 //寮�鍚繘搴︽潯 姝e湪涓婁紶澶囦唤鏂囦欢
@@ -301,12 +315,12 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
-                }
-                //鍒ゆ柇鏄惁鏄簲璇ヤ笂浼犵殑鏂囦欢
-                if (IsNotUpLoadFile(file) == true && upPath == string.Empty)
-                {
-                    continue;
                 }
                 //鏁寸悊鏁版嵁
                 var datainfo = new FileInfoData();
@@ -326,6 +340,11 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
                 //璁剧疆杩涘害鍊�
@@ -343,6 +362,11 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
 
@@ -358,10 +382,21 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
                 //璁剧疆杩涘害鍊�
                 ProgressFormBar.Current.SetValue(i + 1 + listNormalFile.Count, listFileCount);
+            }
+
+            if (localTemplateName != string.Empty)
+            {
+                //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                HdlFileLogic.Current.DeleteFile(localTemplateName);
             }
 
             //杩涘害鏉″叧闂�
@@ -753,6 +788,18 @@
                 //鏄剧ず璁惧鍘嗗彶鐗堟湰(Debug鐢�)
                 UserCenterResourse.HideOption.DeviceHistory = 1;
             }
+            checkKeys = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, DirNameResourse.StartDebugAppFile + UserCenterResourse.UserInfo.Account);
+            if (listFile.Contains(checkKeys) == true)
+            {
+                //寮�鍚悗鍙拌皟璇旳pp鍔熻兘(Debug鐢�)
+                UserCenterResourse.HideOption.StartDebugApp = 1;
+            }
+            checkKeys = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, DirNameResourse.CheckDeviceTypeFile + UserCenterResourse.UserInfo.Account);
+            if (listFile.Contains(checkKeys) == true)
+            {
+                //寮�鍚娴嬭澶嘥ype鐨�(Debug鐢�)
+                UserCenterResourse.HideOption.CheckDeviceType = 1;
+            }
 
             //鎭㈠
             IMessageCommon.Current.IgnoreError = false;
@@ -781,11 +828,16 @@
                 ProgressFormBar.Current.Close();
                 return false;
             }
-            //鍏抽棴杩涘害鏉�
-            ProgressFormBar.Current.Close();
 
+            //娓呯┖鍏ㄩ儴鎴块棿
+            HdlRoomLogic.Current.DeleteAllRoom();
+            //娓呯┖鏈湴鍏ㄩ儴鐨勫満鏅暟鎹�
+            HdlSceneLogic.Current.DeleteAllLocalScene();
             //濡傛灉璇诲彇鍒扮殑鏂囦欢瀹屽叏娌℃湁闂锛屽垯娓呯悊鏈湴鐨勬枃浠�
             HdlFileLogic.Current.DeleteAllLocationFile(false);
+
+            //娓呯悊鏈湴鐨勬ā鏉挎枃浠�
+            TemplateData.TemplateCommonLogic.Current.DeleteAllLocalFile();
 
             //娌℃湁閿欒鐨勮瘽锛屽垯绉诲姩鍒板綋鍓嶄綇瀹呮枃浠跺す涓嬮潰
             HdlFileLogic.Current.MoveDirectoryFileToHomeDirectory(tempDirectory, true);
@@ -795,6 +847,9 @@
 
             //鍒锋柊鏈湴缂撳瓨
             UserCenterLogic.RefreshAllMemory();
+
+            //鍏抽棴杩涘害鏉�
+            ProgressFormBar.Current.Close();
 
             return true;
         }
@@ -829,11 +884,14 @@
         /// </summary>
         /// <param name="file"></param>
         /// <returns></returns>
-        public bool IsNotUpLoadFile(string file)
+        private bool IsNotUpLoadFile(string file)
         {
-            if (file == "Config.json")
+            if (file.StartsWith("Device_") == true
+               || file.StartsWith("Gateway_") == true
+               || file.StartsWith("Room_") == true
+               || file.StartsWith("Scene_") == true)
             {
-                //涓嶈兘瑕嗙洊Config鏂囦欢
+                //璁惧,缃戝叧,鎴块棿,鍦烘櫙鏂囦欢涓嶉渶瑕佷笂浼�,瀹冨凡缁忎繚瀛樺湪bin妯℃澘鏂囦欢涓�
                 return true;
             }
             return false;

--
Gitblit v1.8.0