/// <summary> /// Translates <seealso cref="FileCollectorScope"/> into platform depandant <seealso cref="DirectorySearchOption"/> /// </summary> /// <param name="scope"><seealso cref="FileCollectorScope"/> to translate</param> /// <returns>Translated <seealso cref="DirectorySearchOption"/> indicator</returns> protected static DirectorySearchOption TranslateScope(FileCollectorScope scope) { switch (scope) { case FileCollectorScope.TopDirectoryOnly: return(DirectorySearchOption.TopDirectoryOnly); case FileCollectorScope.TopAndChildDirectories: return(DirectorySearchOption.AllDirectories); default: throw new UnknownCollectorScopeException(); } }
/// <summary> /// FileCollectorStrategy constructor. /// </summary> /// <param name="scope">Scope of file collection<seealso cref="member"/></param> /// <param name="rule">Rule for pattern matching</param> internal FileCollectorStrategy(FileCollectorScope scope, string rule) { this.rule = rule; this.scope = scope; }
/// <summary> /// RegexFileCollector constructor. /// </summary> /// <param name="scope">Scope of file collection<seealso cref="member"/></param> /// <param name="rule">Regular expressin rule for pattern matching. Reference: /// http://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx </param> public RegexFileCollector(FileCollectorScope scope, string rule) : base(scope, rule) { }
/// <summary> /// SimpleFileCollector constructor. /// </summary> /// <param name="scope">Scope of file collection<seealso cref="member"/></param> /// <param name="rule">Rule rule for pattern matching. Can be a combination of literal and wildcard characters, /// but doesn't support regular expressions.</param> public SimpleFileCollector(FileCollectorScope scope = FileCollectorScope.TopDirectoryOnly, string rule = "*") : base(scope, rule) { }
/// <summary> /// Sets a Regular Expression Collector Strategy for directory analysis. /// </summary> /// <param name="scope">Scope of directory analysis.</param> /// <param name="matchRule">Regular Expression. Reference: /// http://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx </param> public void SetRegexCollector(FileCollectorScope scope, string matchRule) { this.engine.CollectorStrategy = new RegexFileCollector(scope, matchRule); }
/// <summary> /// Sets a Simple Collector Strategy for directory analysis. /// </summary> /// <param name="scope">Scope of directory analysis.</param> /// <param name="matchRule">Rule for pattern matching. Can be a combination of literal and wildcard characters.</param> public void SetSimpleCollector(FileCollectorScope scope, string matchRule = "*") { this.engine.CollectorStrategy = new SimpleFileCollector(scope, matchRule); }