From 0f5a53c7b36c27a0f2bec12e6119207edb6860f8 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 29 十月 2019 14:29:21 +0800
Subject: [PATCH] 修改主页卡死问题

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
index df93dac..12b2406 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
@@ -66,14 +66,21 @@
                 //    return;
                 //}
                 //Log鏂囦欢
-                string fileName = this.GetLogFile(div);
-                string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName);
-
-                strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n";
-                var sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
-                sw.WriteLine(strLog);
-                sw.Close();
-                sw = null;
+                System.IO.StreamWriter sw = null;
+                try
+                {
+                    string fileName = this.GetLogFile(div);
+                    string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName);
+                    strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n";
+                    sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
+                    sw.WriteLine(strLog);
+                }
+                catch { }
+                finally
+                {
+                    sw?.Close();
+                    sw = null;
+                }
             }
         }
 

--
Gitblit v1.8.0