From 7e863a33397f317ffc3ffd9288496d0e4f16aa66 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 12 十二月 2019 14:58:20 +0800
Subject: [PATCH] 合并了新代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs |   87 +++++++++++++++++++++++--------------------
 1 files changed, 47 insertions(+), 40 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index ebed985..eaaeb52 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -345,7 +345,6 @@
             var formTemp = UserCenterResourse.DicActionForm[formName];
             formTemp.CloseForm();
             UserCenterResourse.DicActionForm.Remove(formName);
-            formTemp = null;
 
             return true;
         }
@@ -466,9 +465,7 @@
                 //绉婚櫎ID
                 UserCenterResourse.listActionFormId.Remove(UserCenterResourse.DicActionForm[formName].FormID);
                 //绉婚櫎鐢婚潰
-                var formTemp = UserCenterResourse.DicActionForm[formName];
                 UserCenterResourse.DicActionForm.Remove(formName);
-                formTemp = null;
             }
         }
 
@@ -807,6 +804,8 @@
         {
             //APP缂撳瓨鍔犺浇寮�濮�
             UserCenterResourse.Option.AppCanSignout = false;
+            //杩樺師杩滅▼杩炴帴鍙橀噺
+            ZigBee.Device.ZbGateway.AllowRemoteCtrl = true;
 
             //鍙湁鍦ㄤ綇瀹匢D涓嶄竴鏍风殑鏃跺�欐墠鍋氳繖涓搷浣�
             if (Common.Config.Instance.HomeId != UserCenterResourse.Option.OldHomeStringId
@@ -1231,24 +1230,28 @@
         /// <returns></returns>
         public static string EncryptPassword(string keys, string strPsw)
         {
-            if (strPsw == string.Empty)
+            try
             {
-                return strPsw;
+                if (strPsw == string.Empty)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+                byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+                StringBuilder ret = new StringBuilder();
+                foreach (byte b in ms.ToArray())
+                {
+                    ret.AppendFormat("{0:X2}", b);
+                }
+                return ret.ToString().ToLower();
             }
-            var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-            byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
-            des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-            des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-            var ms = new System.IO.MemoryStream();
-            var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-            cs.Write(inputByteArray, 0, inputByteArray.Length);
-            cs.FlushFinalBlock();
-            StringBuilder ret = new StringBuilder();
-            foreach (byte b in ms.ToArray())
-            {
-                ret.AppendFormat("{0:X2}", b);
-            }
-            return ret.ToString();
+            catch { return strPsw; }
         }
 
         /// <summary>
@@ -1258,29 +1261,33 @@
         /// <returns></returns>
         public static string DecryptPassword(string keys, string strPsw)
         {
-            if (strPsw == string.Empty)
+            try
             {
-                return strPsw;
+                if (strPsw == string.Empty)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+
+                byte[] inputByteArray = new byte[strPsw.Length / 2];
+                for (int x = 0; x < strPsw.Length / 2; x++)
+                {
+                    int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
+                    inputByteArray[x] = (byte)i;
+                }
+
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+
+                StringBuilder ret = new StringBuilder();
+
+                return System.Text.Encoding.Default.GetString(ms.ToArray());
             }
-            var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-
-            byte[] inputByteArray = new byte[strPsw.Length / 2];
-            for (int x = 0; x < strPsw.Length / 2; x++)
-            {
-                int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
-                inputByteArray[x] = (byte)i;
-            }
-
-            des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-            des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-            var ms = new System.IO.MemoryStream();
-            var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-            cs.Write(inputByteArray, 0, inputByteArray.Length);
-            cs.FlushFinalBlock();
-
-            StringBuilder ret = new StringBuilder();
-
-            return System.Text.Encoding.Default.GetString(ms.ToArray());
+            catch { return strPsw; }
         }
         #endregion
 

--
Gitblit v1.8.0