From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期三, 22 六月 2022 11:22:18 +0800
Subject: [PATCH] 修改引用路径

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs |  258 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 156 insertions(+), 102 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
old mode 100755
new mode 100644
index df93dac..ed94277
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
@@ -1,102 +1,156 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// Log閫昏緫
-    /// </summary>
-    public class HdlLogLogic
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// Log閫昏緫
-        /// </summary>
-        private static HdlLogLogic m_Current = null;
-        /// <summary>
-        /// Log閫昏緫
-        /// </summary>
-        public static HdlLogLogic Current
-        {
-            get
-            {
-                if (m_Current == null)
-                {
-                    m_Current = new HdlLogLogic();
-                }
-                return m_Current;
-            }
-        }
-
-        /// <summary>
-        /// 閿�
-        /// </summary>
-        private object objLock = new object();
-
-        #endregion
-
-        #region 鈻� Log鍑哄姏____________________________
-
-        /// <summary>
-        /// Log鍑哄姏
-        /// </summary>
-        /// <param name="ex"></param>
-        public void WriteLog(Exception ex)
-        {
-            //Log鍑哄姏
-            string msg = ex.Message + "\r\n";
-            msg += ex.StackTrace;
-            this.WriteLog(-1, msg);
-        }
-
-        /// <summary>
-        /// Log鍑哄姏
-        /// </summary>
-        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log</param>
-        /// <param name="strLog">Log鍐呭</param>
-        public void WriteLog(int div, string strLog)
-        {
-            lock (objLock)
-            {
-                //if (div != -1)
-                //{
-                //    //鏆傛椂鍙褰曞紓甯镐俊鎭�
-                //    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;
-            }
-        }
-
-        /// <summary>
-        /// 鑾峰彇LOG鏂囦欢
-        /// </summary>
-        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log</param>
-        /// <returns></returns>
-        private string GetLogFile(int div)
-        {
-            //鍔犲瘑,鍥犱负杩欐槸鏀堕泦鏁版嵁,鏈�濂戒笉璁╁埆浜虹煡閬撹繖鏄粈涔堟渶濂�
-            string fileName = DateTime.Now.ToString("yyyyMMdd");
-            if (div == -1)
-            {
-                fileName += "Log";
-            }
-            else if (div == 1)
-            {
-                fileName += "Error";
-            }
-            fileName = UserCenterLogic.EncryptPassword("4^Olh_3f", fileName);
-            return fileName;
-        }
-        #endregion
-    }
-}
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// Log閫昏緫
+    /// </summary>
+    public class HdlLogLogic
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// Log閫昏緫
+        /// </summary>
+        private static HdlLogLogic m_Current = null;
+        /// <summary>
+        /// Log閫昏緫
+        /// </summary>
+        public static HdlLogLogic Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new HdlLogLogic();
+                }
+                return m_Current;
+            }
+        }
+
+        /// <summary>
+        /// 閿�
+        /// </summary>
+        private object objLock = new object();
+
+        #endregion
+
+        #region 鈻� Log鍑哄姏____________________________
+
+        /// <summary>
+        /// 璋冭瘯鐢�,杩藉姞鍐欏叆鍏朵粬Log
+        /// </summary>
+        /// <param name="fullName">鍏ㄨ矾寰�</param>
+        /// <param name="i_text">瑕佸啓鍏ョ殑鍐呭</param>
+        /// <param name="deleteFile">鏄惁鍏堝垹闄ゆ枃浠�</param>
+        /// <param name="encrypt">鍐欏叆鐨勫唴瀹规槸鍚﹀姞瀵�</param>
+        public void WriteOtherText(string fullName, string i_text, bool deleteFile, bool encrypt)
+        {
+            if (deleteFile == true)
+            {
+                HdlFileLogic.Current.DeleteFile(fullName);
+            }
+            System.IO.StreamWriter sw = null;
+            try
+            {
+                string strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + i_text;
+                if (encrypt == true)
+                {
+                    strLog = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, strLog);
+                }
+                strLog = "\r\n" + strLog + "\r\n";
+                sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
+                sw.WriteLine(strLog);
+            }
+            catch { }
+            finally
+            {
+                sw?.Close();
+                sw = null;
+            }
+        }
+
+        /// <summary>
+        /// Log鍑哄姏
+        /// </summary>
+        /// <param name="ex"></param>
+        /// <param name="appendMsg">闄勫姞娑堟伅</param>
+        public void WriteLog(Exception ex, string appendMsg = "")
+        {
+            //Log鍑哄姏
+            string msg = appendMsg == "" ? string.Empty : appendMsg + "\r\n";
+            msg += ex.Message + "\r\n";
+            msg += ex.StackTrace;
+            this.WriteLog(-1, msg);
+        }
+
+        /// <summary>
+        /// Log鍑哄姏
+        /// </summary>
+        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log,2,3:鐗规畩Log</param>
+        /// <param name="strLog">Log鍐呭</param>
+        public void WriteLog(int div, string strLog)
+        {
+            lock (objLock)
+            {
+                if (div == 1 && UserCenterResourse.HideOption.DetailedLog == 0)
+                {
+                    //鏆傛椂鍙褰曞紓甯镐俊鎭�
+                    return;
+                }
+                //Log鏂囦欢
+                System.IO.StreamWriter sw = null;
+                try
+                {
+                    string fullName = string.Empty;
+                    if (div == 1 || div == -1)
+                    {
+                        string fileName = this.GetLogFile(div);
+                        fullName = System.IO.Path.Combine(DirNameResourse.LogDirectory, fileName);
+                    }
+                    else if (div == 2)
+                    {
+                        fullName = DirNameResourse.SendAndReceveDataLog;
+                    }
+                    else if (div == 3)
+                    {
+                        fullName = DirNameResourse.SocketReceiveDataLog;
+                    }
+                    strLog = "\r\n[" + 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;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇LOG鏂囦欢
+        /// </summary>
+        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log</param>
+        /// <returns></returns>
+        private string GetLogFile(int div)
+        {
+            //鍔犲瘑,鍥犱负杩欐槸鏀堕泦鏁版嵁,鏈�濂戒笉璁╁埆浜虹煡閬撹繖鏄粈涔堟渶濂�
+            string fileName = UserCenterResourse.UserInfo.Account + "-" + DateTime.Now.ToString("yyyyMMdd");
+            if (div == -1)
+            {
+                fileName += "Error";
+            }
+            else if (div == 1)
+            {
+                fileName += "Log";
+            }
+            fileName = UserCenterLogic.EncryptPassword(UserCenterResourse.FileEncryptKey, fileName);
+            return fileName;
+        }
+        #endregion
+    }
+}

--
Gitblit v1.8.0