diff --git a/local-repository-listing/Searcher/ISearcher.cs b/local-repository-listing/Searcher/ISearcher.cs index e9d25a7..0840f85 100644 --- a/local-repository-listing/Searcher/ISearcher.cs +++ b/local-repository-listing/Searcher/ISearcher.cs @@ -1,7 +1,4 @@ -using System.Collections.ObjectModel; - -namespace LocalRepositoryListing.Searcher; - +namespace LocalRepositoryListing.Searcher; /// /// Represents a searcher that can search for repositories based on specified criteria. /// @@ -10,17 +7,17 @@ public interface ISearcher /// /// Gets the root directories to search in. /// - public string[] RootDirectories { get; } + public IReadOnlyCollection RootDirectories { get; } /// /// Gets the paths to exclude from the search. /// - public ReadOnlyCollection ExcludePaths { get; } + public IReadOnlyCollection ExcludePaths { get; } /// /// Gets the directory names to exclude from the search. /// - public ReadOnlyCollection ExcludeNames { get; } + public IReadOnlyCollection ExcludeNames { get; } /// /// Searches for repositories based on the specified criteria. diff --git a/local-repository-listing/Searcher/NonRecursiveRepositorySearcher.cs b/local-repository-listing/Searcher/NonRecursiveRepositorySearcher.cs index cce3c65..fd8a63d 100644 --- a/local-repository-listing/Searcher/NonRecursiveRepositorySearcher.cs +++ b/local-repository-listing/Searcher/NonRecursiveRepositorySearcher.cs @@ -1,5 +1,4 @@ -using System.Collections.ObjectModel; -using Microsoft.Extensions.FileSystemGlobbing; +using Microsoft.Extensions.FileSystemGlobbing; namespace LocalRepositoryListing.Searcher; @@ -8,9 +7,9 @@ namespace LocalRepositoryListing.Searcher; /// public class NonRecursiveRepositorySearcher : ISearcher { - public string[] RootDirectories { get; init; } - public ReadOnlyCollection ExcludePaths { get; init; } - public ReadOnlyCollection ExcludeNames { get; init; } + public IReadOnlyCollection RootDirectories { get; init; } + public IReadOnlyCollection ExcludePaths { get; init; } + public IReadOnlyCollection ExcludeNames { get; init; } private static readonly EnumerationOptions _enumerationOptions = new() { @@ -29,7 +28,7 @@ public class NonRecursiveRepositorySearcher : ISearcher /// Initializes a new instance of the RepositorySearcher class with the specified root directories. /// /// An array of root directories to search for repositories. - public NonRecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirectories, [], []) { } + public NonRecursiveRepositorySearcher(IList rootDirectories) : this(rootDirectories, [], []) { } /// /// Initializes a new instance of the class. @@ -37,9 +36,9 @@ public NonRecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirec /// The root directories to search in. /// The paths to exclude from the search. /// The names to exclude from the search. - public NonRecursiveRepositorySearcher(string[] rootDirectories, string[] excludePaths, string[] excludeNames) + public NonRecursiveRepositorySearcher(IList rootDirectories, IList excludePaths, IList excludeNames) { - RootDirectories = rootDirectories; + RootDirectories = rootDirectories.AsReadOnly(); ExcludePaths = excludePaths.AsReadOnly(); ExcludeNames = excludeNames.AsReadOnly(); _nameMatcher.AddIncludePatterns(excludeNames); diff --git a/local-repository-listing/Searcher/RecursiveRepositorySearcher.cs b/local-repository-listing/Searcher/RecursiveRepositorySearcher.cs index 3fc7e99..08a2543 100644 --- a/local-repository-listing/Searcher/RecursiveRepositorySearcher.cs +++ b/local-repository-listing/Searcher/RecursiveRepositorySearcher.cs @@ -10,9 +10,9 @@ public class RecursiveRepositorySearcher : ISearcher { private static readonly string _rootSearchPattern = "*"; private static readonly string _searchPattern = ".git"; - public string[] RootDirectories { get; init; } - public ReadOnlyCollection ExcludePaths { get; init; } - public ReadOnlyCollection ExcludeNames { get; init; } + public IReadOnlyCollection RootDirectories { get; init; } + public IReadOnlyCollection ExcludePaths { get; init; } + public IReadOnlyCollection ExcludeNames { get; init; } private static readonly EnumerationOptions _rootEnumerationOptions = new() { @@ -64,7 +64,7 @@ private bool IsMatchExclude(DirectoryInfo directoryInfo) /// Initializes a new instance of the RepositorySearcher class with the specified root directories. /// /// An array of root directories to search for repositories. - public RecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirectories, [], []) { } + public RecursiveRepositorySearcher(IList rootDirectories) : this(rootDirectories, [], []) { } /// /// Initializes a new instance of the class. @@ -72,9 +72,9 @@ public RecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirector /// The root directories to search in. /// The paths to exclude from the search. /// The names to exclude from the search. - public RecursiveRepositorySearcher(string[] rootDirectories, string[] excludePaths, string[] excludeNames) + public RecursiveRepositorySearcher(IList rootDirectories, IList excludePaths, IList excludeNames) { - RootDirectories = rootDirectories; + RootDirectories = rootDirectories.AsReadOnly(); ExcludePaths = excludePaths.AsReadOnly(); ExcludeNames = excludeNames.AsReadOnly(); _nameMatcher.AddIncludePatterns(excludeNames); diff --git a/local-repository-listing/local-repository-listing.csproj b/local-repository-listing/local-repository-listing.csproj index 839ef22..5f1362a 100644 --- a/local-repository-listing/local-repository-listing.csproj +++ b/local-repository-listing/local-repository-listing.csproj @@ -7,7 +7,7 @@ enable enable lepol - 1.0.0 + 1.0.1 true true embedded