Esempio n. 1
0
 private Or(SortedSet <Regex <T> > regexes)
     : base(
         regexes.Any(r => r.AcceptsEmptyString),
         regexes.Aggregate(RegexType.Or.GetHashCode(), (hash, rex) => hash * 7 + rex.GetHashCode()))
 {
     _regexes = regexes;
 }
Esempio n. 2
0
 private bool CheckSignature(Account account, string signature, string timestamp, string nonce)
 {
     ISet<string> paramList = new SortedSet<string> { account.Token, timestamp, nonce };
     var currentSignature = HashCryptography.Sha1Encrypt(paramList.Aggregate((o, t) => o + t));
     FileLogHelper.WriteInfo("CheckSignature:" + currentSignature);
     return currentSignature == signature;
 }
Esempio n. 3
0
 private int GetSumOfPandigitalProducts()
 {
     for (int i = 0; i < firstNumbers.Count(); ++i)
     {
         for (int j = 0; j < secondNumbers.Count(); ++j)
         {
             if (IsPandigitalProduct(firstNumbers[i], secondNumbers[j]))
             {
                 _products.Add(firstNumbers[i] * secondNumbers[j]);
             }
         }
     }
     return(_products.Aggregate((a, b) => a + b));
 }
Esempio n. 4
0
        /// <summary>
        /// 验证签名
        /// </summary>
        /// <param name="signature"></param>
        /// <param name="timestamp"></param>
        /// <param name="nonce"></param>
        /// <returns></returns>
        public static bool VerifySign(string signature, string timestamp, string nonce)
        {
            // 获取公众号配置的token
            var token = Wx.Config.Token;

            SortedSet <string> array = new SortedSet <string>( );

            array.Add(token);
            array.Add(timestamp);
            array.Add(nonce);

            var str = array.Aggregate((s1, s2) => s1 + s2);

            // 签名验证
            var sign = AppUtils.Sha1.SHA1WithUtf8(str).ToLower( );

            return(sign == signature);
        }
Esempio n. 5
0
 private string GenerateRef(SortedSet <short> refIds)
 {
     return(refIds.Aggregate(new StringBuilder(), (a, b) => a.Append(b)).ToString());
 }
Esempio n. 6
0
 public override string ToString()
 {
     return(_combinations.Aggregate("", (current, comb) => current + (comb + Environment.NewLine)));
 }
Esempio n. 7
0
 public override string ToString()
 {
     return(value.Aggregate((current, next) => current.ToString() + ", " + next.ToString()));
 }