/// <inheritdoc/> public override IEnumerable <string> Select(PackageSession packageSession, IAssetIndexMap assetIndexMap) { // Check if we need to create or regenerate regex. bool needGenerateRegex = false; if (regexes == null || regexes.Length != Paths.Count) { needGenerateRegex = true; } else { // Check used pattern for (int i = 0; i < Paths.Count; ++i) { if (Paths[i] != regexes[i].Key) { needGenerateRegex = true; break; } } } // Transform gitignore patterns to regex. if (needGenerateRegex) { regexes = Paths.Select(x => new KeyValuePair <string, Regex>(x, new Regex(TransformToRegex(x)))).ToArray(); } return(assetIndexMap.GetMergedIdMap() .Select(asset => asset.Key) // Select url .Where(assetUrl => regexes.Any(regex => regex.Value.IsMatch(assetUrl)))); // Check if any Regex matches }
/// <inheritdoc/> public override IEnumerable<string> Select(PackageSession packageSession, IAssetIndexMap assetIndexMap) { // Check if we need to create or regenerate regex. bool needGenerateRegex = false; if (regexes == null || regexes.Length != Paths.Count) { needGenerateRegex = true; } else { // Check used pattern for (int i = 0; i < Paths.Count; ++i) { if (Paths[i] != regexes[i].Key) { needGenerateRegex = true; break; } } } // Transform gitignore patterns to regex. if (needGenerateRegex) regexes = Paths.Select(x => new KeyValuePair<string, Regex>(x, new Regex(TransformToRegex(x)))).ToArray(); return assetIndexMap.GetMergedIdMap() .Select(asset => asset.Key) // Select url .Where(assetUrl => regexes.Any(regex => regex.Value.IsMatch(assetUrl))); // Check if any Regex matches }
/// <summary> /// Merges the values from the given asset index map. /// </summary> /// <param name="assetIndexMap">The asset index map to merge.</param> public void Merge(IAssetIndexMap assetIndexMap) { Merge(assetIndexMap.GetMergedIdMap()); }