public ManagedFileSyDirectoryEnumerable(DirectoryInfo rootPath, string pattern, FileSyEnumerateOptions enumerateOptions)
 {
     this.rootPath         = rootPath;
     this.rootDirectory    = Optional.Wrap(Try.Execute(() => new ManagedFileSyDirectoryInfo(rootPath), null));
     this.pattern          = pattern;
     this.enumerateOptions = enumerateOptions;
 }
 internal ManagedFileSyFileEnumerable(DirectoryInfo rootPath, string pattern, FileSyEnumerateOptions enumerateOptions, Optional <ManagedFileSyDirectoryInfo> parentDirectory)
 {
     this.rootPath         = rootPath;
     this.rootDirectory    = Optional.Wrap(Try.Execute(() => new ManagedFileSyDirectoryInfo(rootPath), null));
     this.pattern          = pattern;
     this.enumerateOptions = enumerateOptions;
     this.parentDirectory  = parentDirectory;
 }
        /// <inheritdoc />
        public IEnumerable <FileSyInfo> EnumerateFileSystemInfos(string path, string pattern, FileSyEnumerateOptions enumerateOptions)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(path));
            }

            if (string.IsNullOrEmpty(pattern))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(pattern));
            }

            // TODO: pattern should be checked ahead of time to see if it is valid and mimic the built in behavior

            var rootPath   = new DirectoryInfo(path);
            var enumerable = new ManagedFileSyFileSystemEnumerable(rootPath, pattern, enumerateOptions);

            return(enumerable);
        }