Пример #1
0
        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;
            }
        }
Пример #2
0
        /// <summary>
        /// Resolves the files, folders and directories based on the working directory,
        /// populating the <see cref="HunterSession.SubmissionsBag"/> with the filtered submissions.
        /// </summary>
        /// <remarks>An enumerator is available from <see cref="HunterSession.Submissions"/>.</remarks>
        internal void CreateSubmissions()
        {
            //// Do we have a working directory?
            //bool hasWorkingDirectory = !string.IsNullOrWhiteSpace(WorkingDirectory);

            // Resolve any candidates into possible submissions, applying the
            // current filters
            _candidates.Resolve(WorkingDirectory);

            // Maybe get the first candidate
            SubmissionCandidate candidate = _candidates.FirstResolved;

            // Process each valid candidate
            while (candidate != null)
            {
                // Try to create a submission from that candidate
                if (candidate.TryCreateSubmission(this, out Submission submission))
                {
                    // Add it to the submissions bag
                    _submissions.Add(submission);

                    //// If there isn't a working directory/base path, then we assume the first submission to be it.
                    //if (hasWorkingDirectory == false)
                    //{
                    //    hasWorkingDirectory = true;
                    //    WorkingDirectory = candidate.ContainerPath;
                    //}
                }

                // Fetch the next submission for processing, or null if there aren't any left
                candidate = _candidates.NextResolved;
            }
        }
Пример #3
0
        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);
        }