예제 #1
0
 /// <summary>
 ///  Instantites the <see cref="BitmapMemoryCacheKey"/>.
 /// </summary>
 public BitmapMemoryCacheKey(
     string sourceString,
     ResizeOptions resizeOptions,
     bool autoRotated,
     ImageDecodeOptions imageDecodeOptions,
     ICacheKey postprocessorCacheKey,
     string postprocessorName,
     object callerContext)
 {
     _sourceString          = Preconditions.CheckNotNull(sourceString);
     _resizeOptions         = resizeOptions;
     _autoRotated           = autoRotated;
     _imageDecodeOptions    = imageDecodeOptions;
     _postprocessorCacheKey = postprocessorCacheKey;
     _postprocessorName     = postprocessorName;
     _hash = HashCodeUtil.HashCode(
         sourceString.GetHashCode(),
         (resizeOptions != null) ? resizeOptions.GetHashCode() : 0,
         autoRotated ? true.GetHashCode() : false.GetHashCode(),
         _imageDecodeOptions,
         _postprocessorCacheKey,
         postprocessorName);
     _callerContext = callerContext;
     _cacheTime     = SystemClock.UptimeMillis;
 }
예제 #2
0
        /// <summary>
        /// Gets the directory to use to store the given key.
        /// </summary>
        /// <param name="resourceId">
        /// The id of the file we're going to store.
        /// </param>
        /// <returns>The directory to store the file in.</returns>
        private string GetSubdirectoryPath(string resourceId)
        {
            int    hashCode     = HashCodeUtil.HashCode(resourceId);
            string subdirectory = Math.Abs(hashCode % SHARDING_BUCKET_COUNT).ToString();

            return(Path.Combine(_versionDirectory.FullName, subdirectory));
        }
예제 #3
0
        public void GetCombinedHash_ReturnsZero_ForNullishArray(ArrayType type)
        {
            var arr = (object[])null;

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (type)
            {
            case ArrayType.Empty:
                arr = _empty;
                break;

            case ArrayType.OnlyNulls:
                arr = _onlyNulls;
                break;
            }
            var hash = HashCodeUtil.GetCombinedHash(arr);

            Assert.Equal(0, hash);
        }
예제 #4
0
        public void GetCombinedHash_ReturnsNonZero_ForNonNullishArray(ArrayType type)
        {
            object[] arr;
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (type)
            {
            case ArrayType.SomeNulls:
                arr = _someNulls;
                break;

            case ArrayType.NoNulls:
                arr = _noNulls;
                break;

            default: throw new InvalidOperationException();
            }
            var hash = HashCodeUtil.GetCombinedHash(arr);

            Assert.NotEqual(0, hash);
        }
예제 #5
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.point.GetHashCode(), this.hitTestMetrics.GetHashCode());
예제 #6
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.designUnitsPerEm.GetHashCode(), this.ascent.GetHashCode(), this.descent.GetHashCode(), this.lineGap.GetHashCode(), this.capHeight.GetHashCode(), this.xHeight.GetHashCode(), this.underlinePosition.GetHashCode(), this.underlineThickness.GetHashCode(), this.strikethroughPosition.GetHashCode(), this.strikethroughThickness.GetHashCode());
예제 #7
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes((int)this.nameTag, this.parameter.GetHashCode());
예제 #8
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.textRange.GetHashCode(), this.value.GetHashCode());
예제 #9
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.point.GetHashCode(), this.tangent.GetHashCode());
예제 #10
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes((int)this.granularity, this.delimiter.GetHashCode(), this.delimiterCount.GetHashCode());
예제 #11
0
 public override int GetHashCode()
 {
     return(HashCodeUtil.GetCombinedHash(ResponseHeaders, ContentType, Content, Status));
 }
예제 #12
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.isTrailingHit.GetHashCode(), this.isInside.GetHashCode(), this.hitTestMetrics.GetHashCode());
예제 #13
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes((this.assembly == null) ? 0 : this.assembly.GetHashCode(), (this.filePath == null) ? 0 : this.filePath.GetHashCode(), (this.Type == null) ? 0 : this.Type.GetHashCode(), this.ErrorString.GetHashCode());
예제 #14
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.width.GetHashCode(), this.thickness.GetHashCode(), this.offset.GetHashCode(), (int)this.readingDirection, (int)this.flowDirection, this.locale.GetHashCode(), (int)this.measuringMode);
예제 #15
0
 public override int GetHashCode()
 {
     return(HashCodeUtil.GetCombinedHash(ConditionName, Success, Info));
 }
예제 #16
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.trimmingOptions.GetHashCode(), this.trimmingSign.GetHashCode());
예제 #17
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes((int)this.Constraint, (int)this.Elide, (int)this.Transform, (int)this.Snapping);
예제 #18
0
 public override int GetHashCode()
 {
     return(HashCodeUtil.GetCombinedHash(Check, Time, Outcome, Details));
 }
예제 #19
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.length.GetHashCode(), this.trailingWhitespaceLength.GetHashCode(), this.newlineLength.GetHashCode(), this.height.GetHashCode(), this.baseline.GetHashCode());
예제 #20
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.left.GetHashCode(), this.top.GetHashCode(), this.right.GetHashCode(), this.bottom.GetHashCode());
예제 #21
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.textPosition.GetHashCode(), this.length.GetHashCode(), this.left.GetHashCode(), this.top.GetHashCode(), this.width.GetHashCode(), this.height.GetHashCode(), this.bidiLevel.GetHashCode(), this.isText.GetHashCode(), this.isTrimmed.GetHashCode());
예제 #22
0
 /// <summary>
 /// Calculates the hash code basing on width and height.
 /// </summary>
 public override int GetHashCode()
 {
     return(HashCodeUtil.HashCode(Width, Height));
 }
예제 #23
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.position.GetHashCode(), HashCodeUtil.CreateHashCode <byte>(this.pattern), HashCodeUtil.CreateHashCode <byte>(this.mask), this.dataOffset.GetHashCode());
예제 #24
0
 public override int GetHashCode()
 {
     return(HashCodeUtil.GetCombinedHash(Environments, Services, Checks));
 }
예제 #25
0
 public int GetHashCode(ref TMatrix m) =>
 HashCodeUtil.CombineHashCodes(m.M11.GetHashCode(), m.M12.GetHashCode(), m.M21.GetHashCode(), m.M22.GetHashCode(), m.OffsetX.GetHashCode(), m.OffsetY.GetHashCode());
예제 #26
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.point.GetHashCode(), this.unitTangentVector.GetHashCode(), this.endSegment, this.endFigure, this.lengthToEndSegment.GetHashCode());
예제 #27
0
 public override int GetHashCode()
 {
     return(HashCodeUtil.GetCombinedHash(Value, Args, Op, StopOnFail));
 }
예제 #28
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.startPoint.GetHashCode(), this.endPoint.GetHashCode());
예제 #29
0
 /// <summary>
 /// Custom GetHashCode method.
 /// </summary>
 public override int GetHashCode()
 {
     return(HashCodeUtil.HashCode(CacheChoice, SourceUri, SourceFile));
 }
예제 #30
0
 public override int GetHashCode() =>
 HashCodeUtil.CombineHashCodes(this.factoryType.GetHashCode(), this.id.GetHashCode());