old mode 100755
new mode 100644
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | |
| | | |
| | | namespace Shared |
| | | { |
| | | public class Packet |
| | |
| | | /// </summary> |
| | | public virtual void Manager () |
| | | { |
| | | //加密检测 |
| | | EncryptionDetection (); |
| | | |
| | | |
| | | |
| | | //对于操作数据库的时间比较长的,可以创建另一个线程处理 |
| | | if (!"HDLMIRACLE".Equals (System.Text.Encoding.ASCII.GetString (Bytes, 4, 10))) { |
| | | return; |
| | |
| | | } |
| | | return s;// |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 是否本地 |
| | | /// </summary> |
| | | public bool IsLocal = true; |
| | | |
| | | /// <summary> |
| | | /// 本地通讯时 加密检测 |
| | | /// </summary> |
| | | void EncryptionDetection () { |
| | | if (IsLocal) {//本地通讯 |
| | | |
| | | if (UserConfig.Instance.IsLocalEncrypt) { |
| | | if ("Passord error" == (System.Text.Encoding.ASCII.GetString (Bytes, 14, 13))) { |
| | | //网关返回,加密密码key不对 |
| | | |
| | | return; |
| | | } |
| | | var messageGet = Shared.Securitys.EncryptionService.AesEncryptPayload (Bytes, UserConfig.Instance.LocalEncryptKey); |
| | | Bytes = messageGet; |
| | | |
| | | |
| | | } else { |
| | | if ("Locked" == (System.Text.Encoding.ASCII.GetString (Bytes, 14, 6))) { |
| | | //网关已加密,自动切换为加密 |
| | | UserConfig.Instance.IsLocalEncrypt = true; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |