public Repository FindRepository(Purl path)
 {
   Purl manifestPath = path.Join("Manifest.xml");
   if (!_fileSystem.IsFile(manifestPath.AsString))
   {
     Console.WriteLine("Creating new repository: " + path.AsString);
     _log.Info("Creating new repository: " + path.AsString);
     return Hydrate(new Repository(), manifestPath);
   }
   _log.Info("Opening: " + path.AsString);
   using (StreamReader stream = new StreamReader(_fileSystem.OpenFile(manifestPath.AsString)))
   {
     return Hydrate(_serializer.DeserializeString(stream.ReadToEnd()), manifestPath);
   }
 }
 private void CopyFiles(FileSet fileSet, Purl destiny, bool overwrite)
 {
   if (!_fileSystem.IsDirectory(destiny.AsString))
   {
     _fileSystem.CreateDirectory(destiny.AsString);
   }
   int filesSoFar = 0;
   foreach (FileSystemFile file in fileSet.Files)
   {
     Purl fileDestiny = destiny.Join(file.Path.ChangeRoot(fileSet.FindCommonDirectory()));
     fileDestiny.CreateParentDirectory();
     _fileSystem.CopyFile(file.Purl.AsString, fileDestiny.AsString, overwrite);
     filesSoFar++;
     DistributionDomainEvents.OnProgress(this, new FileCopyProgressEventArgs(filesSoFar / (double)fileSet.Count, file, destiny));
   }
 }
 private Purl BuildDirectory()
 {
   Purl purl = new Purl(ConfigurationPaths.RootDataDirectory);
   return purl.Join(this.Name);
 }