public RemoveOperation(RemoveOperationBuilder builder, LazyItemEvaluator <P, I, M, D> lazyEvaluator)
                : base(builder, lazyEvaluator)
            {
                _matchOnMetadata = builder.MatchOnMetadata.ToImmutable();

                ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(
                    _matchOnMetadata.IsEmpty || _itemSpec.Fragments.All(f => f is ItemSpec <P, I> .ItemExpressionFragment),
                    new BuildEventFileInfo(string.Empty),
                    "OM_MatchOnMetadataIsRestrictedToReferencedItems");

                if (!_matchOnMetadata.IsEmpty)
                {
                    _metadataSet = new MetadataTrie <P, I>(builder.MatchOnMetadataOptions, _matchOnMetadata, _itemSpec);
                }
            }
Exemplo n.º 2
0
        private void Add(IEnumerable <string> metadata, StringComparer comparer)
        {
            MetadataTrie <P, I> current = this;

            foreach (string m in metadata)
            {
                string normalizedString = _normalize(m);
                if (!current._children.TryGetValue(normalizedString, out MetadataTrie <P, I> child))
                {
                    child = new MetadataTrie <P, I>(comparer);
                    current._children.Add(normalizedString, child);
                }
                current = child;
            }
        }
Exemplo n.º 3
0
        internal bool Contains(IEnumerable <string> metadata)
        {
            MetadataTrie <P, I> current = this;

            foreach (string m in metadata)
            {
                if (String.IsNullOrEmpty(m))
                {
                    return(false);
                }
                if (!current._children.TryGetValue(_normalize(m), out current))
                {
                    return(false);
                }
            }
            return(true);
        }