public void HiearchalFolderSearch() { SubmissionCandidates candidates = new SubmissionCandidates(); candidates.Add(@"C:\dev\_work\dotBunny\Galileo\Tests\Text Documents\"); candidates.Resolve(Path.GetTempPath()); var candidate = candidates.FirstResolved; while (candidate != null) { string name = candidate.ReadPath; candidate = candidates.NextResolved; } }
/// <summary> /// Initializes a new instance of the <see cref="T:Galileo.Core.HunterSession"/> class. /// </summary> /// <param name="profile">The <see cref="T:Galileo.Core.HunterProfile"/> to use for the session.</param> /// <param name="HandlerName"><see cref="T:Galileo.Client.HuntHandler"/>'s unique name.</param> /// <param name="workingDirectory">The working directory to search for submissions/candidates.</param> /// <param name="config">The <see cref="T:Galileo.Core.HunterConfig"/> to use when searching.</param> /// <param name="options">A set of options outlining features to use.</param> public HunterSession(HunterProfile profile, string HandlerName, string workingDirectory, HunterConfig config, HunterSessionOptions options = HunterSessionOptions.Any) { Name = HandlerName; //// options = options | HunterSessionOptions.Export; // Assign references _profile = profile; _options = options; _config = config; // Create the Log. if (HasOption(HunterSessionOptions.Logging)) { _log = new Log(); } else { _log = new NullLog(); } // Create the Analytics if (HasOption(HunterSessionOptions.Analytics)) { _analytics = new GoogleAnalytics(profile.PackageVersion, true); } else { _analytics = new NullAnalytics(); } // Setup the class variables to their default states _resolvedFiles = new List <string>(1); _isAborting = new AtomicBool(false); _isRunning = new AtomicBool(false); _progressPercentage = 0.0f; _workUnitsCount = 0; _workUnitsComplete = 0; _processThread = null; _candidates = new SubmissionCandidates(); _submissions = new ConcurrentBag <Submission>(); // Setup working directory SetWorkingDirectory(workingDirectory); if (HasOption(HunterSessionOptions.Export)) { _exporter = new ContextExporter.TextFileContentWriter(System.IO.Path.Combine(workingDirectory, HunterConfig.GalileoDefaultDataFolder)); } else { _exporter = new ContextExporter.NullContentExporter(); } }
public void FlatFolderSearch() { SubmissionCandidates candidates = new SubmissionCandidates(); candidates.Add(@"C:\dev\_work\dotBunny\Galileo\Tests\Text Documents\DEV_WordPerfect_ONLY"); candidates.Resolve(Path.GetTempPath()); // Test?.wpd var candidate1 = candidates.FirstResolved; Assert.NotNull(candidate1); Assert.True((Path.GetFileNameWithoutExtension(candidate1.ReadPath).StartsWith("Test"))); Assert.Equal(".wpd", Path.GetExtension(candidate1.ReadPath)); Assert.Equal(Galileo.Core.FileTypes.Types.CorelWordPerfect, candidate1.FileType); // Test?.wpd var candidate2 = candidates.NextResolved; Assert.NotNull(candidate2); Assert.True((Path.GetFileNameWithoutExtension(candidate2.ReadPath).StartsWith("Test"))); Assert.Equal(".wpd", Path.GetExtension(candidate2.ReadPath)); Assert.Equal(Galileo.Core.FileTypes.Types.CorelWordPerfect, candidate2.FileType); Assert.NotEqual(candidate1, candidate2); // No more. Assert.Null(candidates.NextResolved); }