From c7df85937f73fb347ee0b19e9c052d2d00a6df6c Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 18 九月 2020 13:58:19 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
index e396d32..04a86a6 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
@@ -147,12 +147,11 @@
                     return null;
                 }
                 //灏嗚緭鍏ュ啓鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
-                HdlFileLogic.Current.SaveTextToFile(System.IO.Path.Combine(newDir, fileName), System.Text.Encoding.UTF8.GetString(result));
+                HdlFileLogic.Current.SaveByteToFile(System.IO.Path.Combine(newDir, fileName), result);
                 //璁剧疆杩涘害鍊�
                 ProgressFormBar.Current.SetValue(i + 1, listFileCount);
             }
-            //鍏抽棴杩涘害鏉�
-            ProgressFormBar.Current.Close();
+
             //鍏佽鎸夌郴缁熺殑杩斿洖閿�
             Shared.Common.CommonPage.BackKeyCanClick = true;
             UserCenterResourse.AccountOption.AppCanSignout = true;
@@ -242,6 +241,7 @@
             List<string> listAllFile = null;
             //鏂囦欢澶圭殑鍏ㄨ矾寰�
             string fullDir = string.Empty;
+            string localTemplateName = string.Empty;
             if (upPath == string.Empty)
             {
                 //灏嗘ā鏉挎暟鎹繚瀛樺埌鍒版寚瀹氱殑鏂囦欢澶逛腑
@@ -249,7 +249,8 @@
                 var templateFile = TemplateData.TemplateCommonLogic.Current.SaveTemplateDataToFile(templateName, "HomeTemplate");
 
                 //灏嗘ā鏉縝in鏂囦欢绉诲姩鍒板浠芥枃浠跺す涓�
-                try { System.IO.File.Move(templateFile, System.IO.Path.Combine(Config.Instance.FullPath, templateName)); }
+                localTemplateName = System.IO.Path.Combine(Config.Instance.FullPath, templateName);
+                try { System.IO.File.Move(templateFile, localTemplateName); }
                 catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex, "绉诲姩妯℃澘澶辫触"); }
 
                 //鑾峰彇鏈湴鏂囦欢
@@ -289,7 +290,7 @@
             }
 
             //寮�鍚繘搴︽潯
-            int listFileCount = listAllFile.Count;
+            int listFileCount = listPicFile.Count + listNormalFile.Count;
             if (showBar == true)
             {
                 //寮�鍚繘搴︽潯 姝e湪涓婁紶澶囦唤鏂囦欢
@@ -314,6 +315,11 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
                 //鏁寸悊鏁版嵁
@@ -334,6 +340,11 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
                 //璁剧疆杩涘害鍊�
@@ -351,6 +362,11 @@
                     //鍏佽鎸夌郴缁熺殑杩斿洖閿�
                     Shared.Common.CommonPage.BackKeyCanClick = true;
                     UserCenterResourse.AccountOption.AppCanSignout = true;
+                    if (localTemplateName != string.Empty)
+                    {
+                        //鍒犻櫎鎺夎繖涓ā鏉挎枃浠�
+                        HdlFileLogic.Current.DeleteFile(localTemplateName);
+                    }
                     return false;
                 }
 
@@ -366,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);
             }
 
             //杩涘害鏉″叧闂�
@@ -761,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;
@@ -789,8 +828,6 @@
                 ProgressFormBar.Current.Close();
                 return false;
             }
-            //鍏抽棴杩涘害鏉�
-            ProgressFormBar.Current.Close();
 
             //娓呯┖鍏ㄩ儴鎴块棿
             HdlRoomLogic.Current.DeleteAllRoom();
@@ -811,6 +848,9 @@
             //鍒锋柊鏈湴缂撳瓨
             UserCenterLogic.RefreshAllMemory();
 
+            //鍏抽棴杩涘害鏉�
+            ProgressFormBar.Current.Close();
+
             return true;
         }
 

--
Gitblit v1.8.0