From 5986f63b75bd81c6cef262c670e9251c038cbf5d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 17 十二月 2019 17:21:07 +0800 Subject: [PATCH] 合并一个版本 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 92 ++++++++++++++++++++++++---------------------- 1 files changed, 48 insertions(+), 44 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index ebed985..929b8ce 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 @@ -815,7 +814,7 @@ try { //鏂紑杩滅▼Mqtt杩炴帴 - ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); + await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); } catch { } @@ -872,9 +871,6 @@ //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� HdlGatewayLogic.Current.SynchronizeDbGateway(); } - - //鍒濆鍖栦綇瀹呭璞� - Common.Config.Instance.Home = House.GetHouseByHouseId(Common.Config.Instance.HomeId); //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�) Room.RefreshAllRoomByLocation(); @@ -1231,24 +1227,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 +1258,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