示例#1
0
        private ISet <TargetRelativePath> DeployDirectoryContents(IFileSystemDirectory depDir, string directoryPath, string subDir)
        {
            var result = new HashSet <TargetRelativePath>();

            //Files
            foreach (var file in repository.ListFiles(directoryPath))
            {
                var fileName = Path.GetFileName(file);
                repository.Copy(file, depDir, Path.Combine(subDir, fileName));
                result.Add(new TargetRelativePath(targetRoot.GetRelativePath(depDir), Path.Combine(subDir, fileName)));
            }

            //Child directories
            var directory = new LocalFileSystemDirectory(directoryPath);

            foreach (var childDirectory in directory.ChildDirectories)
            {
                var dir         = directory.GetChildDirectory(childDirectory);
                var dirContents = DeployDirectoryContents(depDir, dir.ToString(), Path.Combine(subDir, childDirectory));
                foreach (var path in dirContents)
                {
                    result.Add(path);
                }
            }

            return(result);
        }
        private ISet <TargetRelativePath> DeployDirectoryContents(IFileSystemDirectory depDir)
        {
            var result = new HashSet <TargetRelativePath>();

            foreach (var file in repository.ListFiles(Path.GetDirectoryName(resolvedPath)))
            {
                var fileName = Path.GetFileName(file);
                repository.Copy(file, depDir, fileName);
                result.Add(new TargetRelativePath(targetRoot.GetRelativePath(depDir), fileName));
            }

            return(result);
        }
示例#3
0
 /// <summary>
 /// Creates fingerprint of the dependencies represented by this object, which can later be compared
 /// to other fingerprints.
 /// </summary>
 /// <returns>Returns the fingerprint of the dependent item's current state.</returns>
 protected override IDependencyFingerprint CreateFingerprint()
 {
     if (Path.GetFileName(path) == "*.*")
     {
         var files = repository.ListFiles(Path.GetDirectoryName(path)).ToList();
         if (files.Count == 1)
         {
             return(fingerprintFactory.CreateFSRepositoryFingerprint(repository, files[0]));
         }
         else
         {
             return(new CombinedFingerprint(files.Select(file => new FSRepositoryReferenceDependencies(fingerprintFactory, repository, file))));
         }
     }
     else
     {
         return(fingerprintFactory.CreateFSRepositoryFingerprint(repository, path));
     }
 }