From da3634e011bbda29cf4e1c168997b780fe795b20 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 13 五月 2020 09:05:23 +0800
Subject: [PATCH] 优化新风模块和新风面板的测试功能,请合并代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index 5c90b24..76799e9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -869,7 +869,7 @@
                 UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
 
                 //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
-                var hadNet = await InitUserAccoutInfo();
+                var hadNet = await InitUserAccoutInfo(true);
                 //濡傛灉鏈夌綉缁滅殑璇�
                 if (hadNet == true)
                 {
@@ -990,14 +990,18 @@
         /// <summary>
         /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
         /// </summary>
+        /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param>
         /// <returns></returns>
-        private async static Task<bool> InitUserAccoutInfo()
+        private async static Task<bool> InitUserAccoutInfo(bool reLoad)
         {
             //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
             UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
-            //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
-            UserCenterResourse.UserInfo = GetUserInformationFromLocation();
-            UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            if (reLoad == true)
+            {
+                //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
+                UserCenterResourse.UserInfo = GetUserInformationFromLocation();
+                UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            }
 
             //鑾峰彇鐧诲綍璐﹀彿鐨勪俊鎭�
             var pra = new AccountInfoPra();
@@ -1120,7 +1124,7 @@
         private async static Task<bool> ReInitUserAccoutInfo()
         {
             //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭�
-            var result = await InitUserAccoutInfo();
+            var result = await InitUserAccoutInfo(false);
             if (result == false)
             {
                 return result;
@@ -1467,10 +1471,21 @@
         /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param>
         public static void SaveFileContent(string fullName, object obj)
         {
-            var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            var byteData = System.Text.Encoding.UTF8.GetBytes(data);
+            var data = JsonConvert.SerializeObject(obj);
+            var byteData = Encoding.UTF8.GetBytes(data);
             //鍐欏叆鍐呭
-            Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
+            System.IO.FileStream fileStream = null;
+            try
+            {
+                fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
+                fileStream.Write(byteData, 0, byteData.Length);
+                fileStream.Flush();
+            }
+            catch { }
+            finally
+            {
+                fileStream?.Close();
+            }
         }
 
         /// <summary>

--
Gitblit v1.8.0