Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (TrueAddress.Length != 0)
            {
                hash ^= TrueAddress.GetHashCode();
            }
            if (IsSecure != false)
            {
                hash ^= IsSecure.GetHashCode();
            }
            if (BuildNumber != 0)
            {
                hash ^= BuildNumber.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
 /// <summary>
 /// Checks if the current WebCookie is equal to the provided one.
 /// </summary>
 /// <param name="other">The instance to compare to.</param>
 /// <returns>True if both are value-wise equal, otherwise false.</returns>
 public Boolean Equals(WebCookie other) =>
 Domain.Equals(other.Domain) &&
 Expires.Equals(other.Expires) &&
 IsHostOnly.Equals(other.IsHostOnly) &&
 IsHttpOnly.Equals(other.IsHttpOnly) &&
 IsSecure.Equals(other.IsSecure) &&
 Key.Equals(other.Key) &&
 Value.Equals(other.Value) &&
 Path.Equals(other.Path) &&
 MaxAge.Equals(other.MaxAge);
Пример #3
0
 public override int GetHashCode()
 {
     unchecked {
         int hashCode = UserAgent?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (HttpMethod?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ IsSecure.GetHashCode();
         hashCode = (hashCode * 397) ^ (Host?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Port;
         hashCode = (hashCode * 397) ^ (Path?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Referrer?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ClientIpAddress?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Cookies?.GetCollectionHashCode(_cookieHashCodeExclusions) ?? 0);
         hashCode = (hashCode * 397) ^ (QueryString?.GetCollectionHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Data?.GetCollectionHashCode() ?? 0);
         return(hashCode);
     }
 }
Пример #4
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = UserAgent == null ? 0 : UserAgent.GetHashCode();
         hashCode = (hashCode * 397) ^ (HttpMethod == null ? 0 : HttpMethod.GetHashCode());
         hashCode = (hashCode * 397) ^ IsSecure.GetHashCode();
         hashCode = (hashCode * 397) ^ (Host == null ? 0 : Host.GetHashCode());
         hashCode = (hashCode * 397) ^ Port;
         hashCode = (hashCode * 397) ^ (Path == null ? 0 : Path.GetHashCode());
         hashCode = (hashCode * 397) ^ (Referrer == null ? 0 : Referrer.GetHashCode());
         hashCode = (hashCode * 397) ^ (ClientIpAddress == null ? 0 : ClientIpAddress.GetHashCode());
         hashCode = (hashCode * 397) ^ (Cookies == null ? 0 : Cookies.GetCollectionHashCode(_cookieHashCodeExclusions));
         hashCode = (hashCode * 397) ^ (QueryString == null ? 0 : QueryString.GetCollectionHashCode());
         hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode());
         return(hashCode);
     }
 }
Пример #5
0
        public override string ToString()
        {
            NumberFormatInfo moneyFormatInfo = new NumberFormatInfo();

            moneyFormatInfo.NumberDecimalSeparator = ".";

            if (CreditCard == null)
            {
                CreditCard = new CreditCard();
            }


            var str = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(HostMerchantId))
            {
                str.AppendFormat("{0}={1}&", "HostMerchantId", HostMerchantId);
            }

            if (AmountCode.HasValue)
            {
                str.AppendFormat("{0}={1}&", "AmountCode", (int)Enum.Parse(typeof(Currency), AmountCode.Value.ToString()));
            }

            str.AppendFormat("{0}={1}&", "Amount", Amount.ToString(moneyFormatInfo));

            if (!string.IsNullOrWhiteSpace(MerchantPassword))
            {
                str.AppendFormat("{0}={1}&", "MerchantPassword", MerchantPassword);
            }
            if (!string.IsNullOrWhiteSpace(TransactionId))
            {
                str.AppendFormat("{0}={1}&", "TransactionId", TransactionId);
            }
            if (!string.IsNullOrWhiteSpace(OrderId))
            {
                str.AppendFormat("{0}={1}&", "OrderID", OrderId);
            }
            if (!string.IsNullOrWhiteSpace(OrderDescription))
            {
                str.AppendFormat("{0}={1}&", "OrderDescription", OrderDescription);
            }
            if (CreditCard.NumberOfInstallments.HasValue)
            {
                str.AppendFormat("{0}={1}&", "InstallmentCount", CreditCard.NumberOfInstallments);
            }
            if (TransactionType.HasValue)
            {
                str.AppendFormat("{0}={1}&", "TransactionType", TransactionType.ToString());
            }

            str.AppendFormat("{0}={1}&", "IsSecure", IsSecure.ToString().ToLowerInvariant());

            if (AllowNotEnrolledCard.HasValue)
            {
                str.AppendFormat("{0}={1}&", "AllowNotEnrolledCard", AllowNotEnrolledCard.ToString().ToLowerInvariant());
            }
            if (!string.IsNullOrWhiteSpace(SuccessUrl))
            {
                str.AppendFormat("{0}={1}&", "SuccessUrl", SuccessUrl);
            }
            if (!string.IsNullOrWhiteSpace(FailUrl))
            {
                str.AppendFormat("{0}={1}&", "FailUrl", FailUrl);
            }
            if (CreditCard.BrandName.HasValue)
            {
                str.AppendFormat("{0}={1}&", "BrandNumber", (int)Enum.Parse(typeof(BrandName), CreditCard.BrandName.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.CVV))
            {
                str.AppendFormat("{0}={1}&", "CVV", CreditCard.CVV);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.Pan))
            {
                str.AppendFormat("{0}={1}&", "PAN", CreditCard.Pan);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.ExpireMonth))
            {
                str.AppendFormat("{0}={1}&", "ExpireMonth", CreditCard.ExpireMonth);
            }
            if (!string.IsNullOrWhiteSpace(CreditCard.ExpireYear))
            {
                str.AppendFormat("{0}={1}&", "ExpireYear", CreditCard.ExpireYear);
            }
            if (!string.IsNullOrWhiteSpace(RequestLanguage))
            {
                str.AppendFormat("{0}={1}&", "RequestLanguage", RequestLanguage);
            }
            if (MerchantType.HasValue)
            {
                str.AppendFormat("{0}={1}&", "MerchantType", (int)Enum.Parse(typeof(MerchantType), MerchantType.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(HostTerminalId))
            {
                str.AppendFormat("{0}={1}&", "HostTerminalId", HostTerminalId);
            }
            if (!string.IsNullOrWhiteSpace(HostSubMerchantId))
            {
                str.AppendFormat("{0}={1}&", "HostSubMerchantId", HostSubMerchantId);
            }


            return(str.ToString().Remove(str.ToString().Length - 1));
        }
Пример #6
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     return((_endpoint.GetHashCode() ^ 963144320)
            ^ (IsMulticast.GetHashCode() ^ 1491585648)
            ^ (IsSecure.GetHashCode() ^ 1074623538));
 }