public override int GetHashCode() { if (!_isComputed) { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(FilePath); hashCodeCombiner.Add(File.FullName); _computedHash = hashCodeCombiner; _isComputed = true; } return(_computedHash); }
public virtual int GetHashCode(BoundAttributeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Kind); hash.Add(descriptor.Name, _stringComparer); return(hash.CombinedHash); }
public int GetHashCode(TagHelperAttributeDescriptor descriptor) { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(descriptor.IsIndexer); hashCodeCombiner.Add(descriptor.Name, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.PropertyName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.TypeName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.IsStringProperty); hashCodeCombiner.Add(TagHelperAttributeDesignTimeDescriptorComparer.Default.GetHashCode( descriptor.DesignTimeDescriptor)); return(hashCodeCombiner); }
public int GetHashCode(DirectiveDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(descriptor.Directive, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.Kind); return(hashCodeCombiner.CombinedHash); }
/// <inheritdoc /> public virtual int GetHashCode(RequiredAttributeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Name, StringComparer.Ordinal); hash.Add(descriptor.Value, StringComparer.Ordinal); return(hash.CombinedHash); }
public override int GetHashCode() { var combiner = HashCodeCombiner.Start(); // This will truncate if the value length isn't a multiple of 4, but ¯\_(ツ)_/¯ var asInts = MemoryMarshal.Cast <byte, int>(Value.Span); foreach (var val in asInts) { combiner.Add(val); } return(combiner.CombinedHash); }
/// <inheritdoc /> public virtual int GetHashCode(TagHelperDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Kind, StringComparer.Ordinal); hash.Add(descriptor.AssemblyName, StringComparer.Ordinal); hash.Add(descriptor.Name, StringComparer.Ordinal); return(hash.CombinedHash); }
/// <inheritdoc /> public override int GetHashCode() { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(Name, StringComparer.Ordinal); if (ValueStyle != HtmlAttributeValueStyle.Minimized) { hashCodeCombiner.Add(Value); } hashCodeCombiner.Add(ValueStyle); return(hashCodeCombiner.CombinedHash); }
public virtual int GetHashCode(BoundAttributeParameterDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Kind, StringComparer.Ordinal); hash.Add(descriptor.Name, StringComparer.Ordinal); hash.Add(descriptor.TypeName, StringComparer.Ordinal); hash.Add(descriptor.Metadata?.Count); return(hash.CombinedHash); }
public override int GetHashCode() { var hash = HashCodeCombiner.Start(); hash.Add(NamespaceUri); var comparer = NamespaceUri == HTML.NAMESPACES.HTML || NamespaceUri == HTML.NAMESPACES.MATHML || NamespaceUri == HTML.NAMESPACES.SVG ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; hash.Add(Prefix, comparer); hash.Add(Name, comparer); return(hash.CombinedHash); }
public override string GetFileHash(string virtualPath, IEnumerable virtualPathDependencies) { if (virtualPathDependencies == null) { return(_previous.GetFileHash(virtualPath, virtualPathDependencies)); } var fileNames = MapDependencyPaths(virtualPathDependencies.Cast <string>(), out _); var combiner = HashCodeCombiner.Start(); foreach (var fileName in fileNames) { combiner.Add(new FileInfo(fileName)); } return(combiner.CombinedHashString); }
public override int GetHashCode() { if (!_isComputed) { var hashCodeCombiner = HashCodeCombiner.Start(); foreach (var item in _dic) { hashCodeCombiner.Add(item.GetHashCode()); } _computedHash = hashCodeCombiner; _isComputed = true; } return(_computedHash); }
/// <inheritdoc /> public virtual int GetHashCode([NotNull] TagHelperDescriptor descriptor) { var hashCodeCombiner = HashCodeCombiner.Start() .Add(descriptor.TypeName, StringComparer.Ordinal) .Add(descriptor.TagName, StringComparer.OrdinalIgnoreCase) .Add(descriptor.AssemblyName, StringComparer.Ordinal); var attributes = descriptor.RequiredAttributes.OrderBy( attribute => attribute, StringComparer.OrdinalIgnoreCase); foreach (var attribute in attributes) { hashCodeCombiner.Add(attribute, StringComparer.OrdinalIgnoreCase); } return(hashCodeCombiner.CombinedHash); }
public int GetHashCode(BoundAttributeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Kind, StringComparer.Ordinal); hash.Add(descriptor.Name, StringComparer.Ordinal); hash.Add(descriptor.IsEditorRequired); hash.Add(descriptor.TypeName, StringComparer.Ordinal); hash.Add(descriptor.Documentation, StringComparer.Ordinal); if (descriptor.BoundAttributeParameters != null) { for (var i = 0; i < descriptor.BoundAttributeParameters.Count; i++) { hash.Add(descriptor.BoundAttributeParameters[i]); } } // � Avoid enumerator allocations for Dictionary<TKey, TValue> if (descriptor.Metadata is Dictionary <string, string> metadata) { foreach (var kvp in metadata) { hash.Add(kvp.Key); hash.Add(kvp.Value); } } else { foreach (var kvp in descriptor.Metadata) { hash.Add(kvp.Key); hash.Add(kvp.Value); } } return(hash.CombinedHash); }
/// <inheritdoc /> public override int GetHashCode() { if (_key == null) { return(_key?.GetHashCode() ?? 0); } var hashCodeCombiner = HashCodeCombiner.Start(); // ReSharper disable ForCanBeConvertedToForeach for (var i = 0; i < _keys.Length; i++) { // ReSharper restore ForCanBeConvertedToForeach hashCodeCombiner.Add(_keys[i], StringComparer.Ordinal); } return(hashCodeCombiner.CombinedHash); }
private string GetFileHash(Bundle bundle, IEnumerable <string> files) { var fileProvider = bundle.FileProvider ?? _options.CurrentValue.FileProvider; var combiner = HashCodeCombiner.Start(); foreach (var file in files) { var fileInfo = fileProvider.GetFileInfo(file); if (fileInfo is IFileHashProvider hashProvider) { combiner.Add(hashProvider.GetFileHash()); } else { combiner.Add(fileInfo); } } return(combiner.CombinedHashString); }
/// <inheritdoc /> public override int GetHashCode() { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(IsMainPage ? 1 : 0); hashCodeCombiner.Add(ViewName, StringComparer.Ordinal); hashCodeCombiner.Add(ControllerName, StringComparer.Ordinal); hashCodeCombiner.Add(AreaName, StringComparer.Ordinal); if (ViewLocationExpanderValues != null) { foreach (var item in ViewLocationExpanderValues) { hashCodeCombiner.Add(item.Key, StringComparer.Ordinal); hashCodeCombiner.Add(item.Value, StringComparer.Ordinal); } } return(hashCodeCombiner); }
public int GetHashCode(ViewLocationCacheKey key) { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(key.IsPartial ? 1 : 0); hashCodeCombiner.Add(key.ViewName, StringComparer.Ordinal); hashCodeCombiner.Add(key.ControllerName, StringComparer.Ordinal); hashCodeCombiner.Add(key.AreaName, StringComparer.Ordinal); if (key.Values != null) { foreach (var item in key.Values) { hashCodeCombiner.Add(item.Key, StringComparer.Ordinal); hashCodeCombiner.Add(item.Value, StringComparer.Ordinal); } } return(hashCodeCombiner); }
/// <inheritdoc /> public override int GetHashCode() { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(IsFoundResult); if (IsFoundResult) { hashCodeCombiner.Add(ViewLocation, StringComparer.Ordinal); } else if (SearchedLocations != null) { foreach (var location in SearchedLocations) { hashCodeCombiner.Add(location, StringComparer.Ordinal); } } return(hashCodeCombiner); }
int IEqualityComparer <TagHelperDescriptor> .GetHashCode(TagHelperDescriptor descriptor) { var hashCodeCombiner = HashCodeCombiner .Start() .Add(base.GetHashCode()) .Add(descriptor.TagName, StringComparer.Ordinal) .Add(descriptor.Prefix); foreach (var requiredAttribute in descriptor.RequiredAttributes) { hashCodeCombiner.Add(requiredAttribute, StringComparer.Ordinal); } foreach (var attribute in descriptor.Attributes) { hashCodeCombiner.Add(CaseSensitiveAttributeDescriptorComparer.Default.GetHashCode(attribute)); } return(hashCodeCombiner.CombinedHash); }
public override int GetHashCode() { if (Value != null && UpperValue != null) { var combiner = HashCodeCombiner .Start() .Add(Value.GetHashCode()) .Add(UpperValue.GetHashCode()); return(combiner.CombinedHash); } else if (UpperValue != null) { return(UpperValue.GetHashCode()); } else if (Value != null) { return(Value.GetHashCode()); } return(0); }
public virtual int GetHashCode(TagMatchingRuleDescriptor rule) { if (rule == null) { throw new ArgumentNullException(nameof(rule)); } var hash = HashCodeCombiner.Start(); hash.Add(rule.TagName, StringComparer.Ordinal); hash.Add(rule.ParentTag, StringComparer.Ordinal); if (rule.Attributes != null) { for (var i = 0; i < rule.Attributes.Count; ++i) { hash.Add(rule.Attributes[i]); } } return(hash.CombinedHash); }
public virtual int GetHashCode(TagMatchingRuleDescriptor rule) { if (rule == null) { throw new ArgumentNullException(nameof(rule)); } var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(rule.TagName, _stringComparer); hashCodeCombiner.Add(rule.ParentTag, _stringComparer); hashCodeCombiner.Add(rule.TagStructure); var attributes = rule.Attributes.OrderBy(attribute => attribute.Name, _stringComparer); foreach (var attribute in attributes) { hashCodeCombiner.Add(_requiredAttributeComparer.GetHashCode(attribute)); } return(hashCodeCombiner.CombinedHash); }
public virtual int GetHashCode(BoundAttributeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(descriptor.Kind); hashCodeCombiner.Add(descriptor.IsIndexerStringProperty); hashCodeCombiner.Add(descriptor.IsEnum); hashCodeCombiner.Add(descriptor.HasIndexer); hashCodeCombiner.Add(descriptor.Name, _stringComparer); hashCodeCombiner.Add(descriptor.IndexerNamePrefix, _stringComparer); hashCodeCombiner.Add(descriptor.TypeName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.IndexerTypeName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.Documentation, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.DisplayName, StringComparer.Ordinal); return(hashCodeCombiner.CombinedHash); }
public override int GetHashCode(TagHelperDescriptor descriptor) { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(base.GetHashCode(descriptor)); hashCodeCombiner.Add(descriptor.TagName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.Prefix, StringComparer.Ordinal); if (descriptor.DesignTimeDescriptor != null) { hashCodeCombiner.Add( TagHelperDesignTimeDescriptorComparer.Default.GetHashCode(descriptor.DesignTimeDescriptor)); } foreach (var requiredAttribute in descriptor.RequiredAttributes.OrderBy(attribute => attribute.Name)) { hashCodeCombiner.Add( CaseSensitiveTagHelperRequiredAttributeDescriptorComparer.Default.GetHashCode(requiredAttribute)); } if (descriptor.AllowedChildren != null) { foreach (var child in descriptor.AllowedChildren.OrderBy(child => child)) { hashCodeCombiner.Add(child, StringComparer.Ordinal); } } var orderedAttributeHashCodes = descriptor.Attributes .Select(attribute => TagHelperAttributeDescriptorComparer.Default.GetHashCode(attribute)) .OrderBy(hashcode => hashcode); foreach (var attributeHashCode in orderedAttributeHashCodes) { hashCodeCombiner.Add(attributeHashCode); } return(hashCodeCombiner.CombinedHash); }
public int GetHashCode(DirectiveDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Directive, StringComparer.Ordinal); hash.Add(descriptor.Kind); if (descriptor.Tokens != null) { for (var i = 0; i < descriptor.Tokens.Count; i++) { hash.Add(descriptor.Tokens[i]); } } return(hash.CombinedHash); }
/// <inheritdoc /> public virtual int GetHashCode(TagHelperDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(descriptor.Kind); hashCodeCombiner.Add(descriptor.AssemblyName, StringComparer.Ordinal); var childTags = descriptor.AllowedChildTags.OrderBy(childTag => childTag.Name, _stringComparer); foreach (var childTag in childTags) { hashCodeCombiner.Add(_AllowedChildTagDescriptorComparer.GetHashCode(childTag)); } var boundAttributes = descriptor.BoundAttributes.OrderBy(attribute => attribute.Name, _stringComparer); foreach (var attribute in boundAttributes) { hashCodeCombiner.Add(_boundAttributeComparer.GetHashCode(attribute)); } var rules = descriptor.TagMatchingRules.OrderBy(rule => rule.TagName, _stringComparer); foreach (var rule in rules) { hashCodeCombiner.Add(_tagMatchingRuleComparer.GetHashCode(rule)); } hashCodeCombiner.Add(descriptor.Documentation, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.DisplayName, StringComparer.Ordinal); hashCodeCombiner.Add(descriptor.TagOutputHint, _stringComparer); return(hashCodeCombiner.CombinedHash); }
public virtual int GetHashCode(BoundAttributeDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } var hash = HashCodeCombiner.Start(); hash.Add(descriptor.Kind, StringComparer.Ordinal); hash.Add(descriptor.Name, StringComparer.Ordinal); if (descriptor.BoundAttributeParameters != null) { for (var i = 0; i < descriptor.BoundAttributeParameters.Count; i++) { hash.Add(descriptor.BoundAttributeParameters[i]); } } hash.Add(descriptor.Metadata.Count); return(hash.CombinedHash); }
public override int GetHashCode() { return(HashCodeCombiner.Start().Add(Namespace).Add(NamespaceKeywordLength).CombinedHash); }
public HashMethodKey(Type type, string methodName, IEnumerable <Type> parameterTypes) { _hash = HashCodeCombiner.Start().Add(type).Add(methodName).Add(parameterTypes).CombinedHash; }