Hishop.Weixin.Pay/Util/SignHelper.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hishop.Weixin.Pay.Util
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Web;
    using System.Web.Security;

    internal class SignHelper
    {
        public static string BuildQuery(IDictionary<string, string> dict, bool encode)
        {
            SortedDictionary<string, string> dictionary = new SortedDictionary<string, string>(dict);
            StringBuilder builder = new StringBuilder();
            bool flag = false;
            IEnumerator<KeyValuePair<string, string>> enumerator = dictionary.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair<string, string> current = enumerator.Current;
                string key = current.Key;
                current = enumerator.Current;
                string str2 = current.Value;
                if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(str2))
                {
                    if (flag)
                    {
                        builder.Append("&");
                    }
                    builder.Append(key);
                    builder.Append("=");
                    if (encode)
                    {
                        builder.Append(HttpUtility.UrlEncode(str2, Encoding.UTF8));
                    }
                    else
                    {
                        builder.Append(str2);
                    }
                    flag = true;
                }
            }
            return builder.ToString();
        }

        public static string BuildXml(IDictionary<string, string> dict, bool encode)
        {
            SortedDictionary<string, string> dictionary = new SortedDictionary<string, string>(dict);
            StringBuilder builder = new StringBuilder();
            builder.AppendLine("<xml>");
            IEnumerator<KeyValuePair<string, string>> enumerator = dictionary.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair<string, string> current = enumerator.Current;
                string key = current.Key;
                current = enumerator.Current;
                string str2 = current.Value;
                if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(str2))
                {
                    decimal result = 0M;
后面还有 31 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。