private void sortPathByLevel() { IList <String> allKeyLevels = this.splitFullPathNameByLevel(this.fullPathNamePattern); for (int level = 1; level <= allKeyLevels.Count; level++) { LevelPathName newKeyNameLevel = new LevelPathName(allKeyLevels[level - 1]); this.PatternPathNamesByLevel.Add(level, newKeyNameLevel); } this.updateFixedPathPart(); }
private void updateFixedPathPart() { this.fixedPathPart = string.Empty; foreach (var keyLevel in this.PatternPathNamesByLevel) { LevelPathName currentKeyLevel = keyLevel.Value; if (currentKeyLevel.IsARegexPattern) { break; } var separator = GetSeparator(this.fullPathNamePattern, this.isUnix).First(); this.fixedPathPart += string.Format(@"{0}{1}", separator, currentKeyLevel.Path); } }
private bool isLevelPathNameMatch(String currentPathNameToMatch, int level) { if (this.PatternPathNamesByLevel.Count() == 1) { level = 1; } LevelPathName currentKeyNamePattern = this.PatternPathNamesByLevel[level]; bool isLevelKeyNameMatch = currentKeyNamePattern.Path.Equals(currentPathNameToMatch, StringComparison.CurrentCultureIgnoreCase); if (currentKeyNamePattern.IsARegexPattern) { String escapedKeyNameToMatch = Regex.Escape(currentPathNameToMatch); isLevelKeyNameMatch = Regex.IsMatch(currentPathNameToMatch, currentKeyNamePattern.Path, RegexOptions.IgnoreCase); } return(isLevelKeyNameMatch); }
private void sortPathByLevel() { IList<String> allKeyLevels = this.splitFullPathNameByLevel(this.fullPathNamePattern); for (int level = 1; level <= allKeyLevels.Count; level++) { LevelPathName newKeyNameLevel = new LevelPathName(allKeyLevels[level-1]); this.PatternPathNamesByLevel.Add(level, newKeyNameLevel); } this.updateFixedPathPart(); }