/// <summary>
        /// 转换key/value数组为byte数组。
        /// </summary>
        /// <param name="nameValueCollection">key/value数组</param>
        /// <returns></returns>
        private static byte[] GetContentByteArray(IEnumerable <KeyValuePair <string, object> > nameValueCollection)
        {
            if (nameValueCollection == null)
            {
                throw new ArgumentNullException("nameValueCollection");
            }
            StringBuilder stringBuilder = new StringBuilder();

            foreach (KeyValuePair <string, object> current in nameValueCollection)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append('&');
                }
                stringBuilder.Append(FormUrlEncodedContentEx.Encode(current.Key));
                stringBuilder.Append('=');
                if (current.Value is string)
                {
                    stringBuilder.Append(StringifyValue(current.Value));
                }
                else
                {
                    stringBuilder.Append(CoreUtil.GetObjTranNull <string>(current.Value).ToLower());
                }
            }
            return(Encoding.UTF8.GetBytes(stringBuilder.ToString()));
        }
 /// <summary>
 /// 读取一个json属性,当该属性不存在时,返回空字符转转换的default类型实例。
 /// </summary>
 /// <typeparam name="T">泛型类型,传入目标类型</typeparam>
 /// <param name="result">Json 对象</param>
 /// <param name="name">属性名</param>
 /// <returns></returns>
 public static T GetJObjectPropVal <T>(JObject result, string name)
 {
     if (result.Property(name) == null)
     {
         return(CoreUtil.GetObjTranNull <T>(""));
     }
     return(CoreUtil.GetObjTranNull <T>(result.Property(name).Value));
 }
        /// <summary>
        /// 是否兼容的加密版本。
        /// </summary>
        /// <returns>是 或者 否</returns>
        public static bool IsCompatibleVersion()
        {
            if (!File.Exists(rootFile))
            {
                return(true);
            }
            if (!File.Exists(versionFile))
            {
                LogUtil.HWLogger.DEFAULT.Info("IsCompatibleVersion=!File.Exists...");
                return(false);
            }
            string fVersion = ReadOneLineFromFile(versionFile);

            if (!string.Equals(CoreUtil.GetObjTranNull <string>(fVersion).Trim(), curVersion))
            {
                LogUtil.HWLogger.DEFAULT.InfoFormat("IsCompatibleVersion=!string.Equals({0},curVersion)...", fVersion);
                return(false);
            }

            return(true);
        }