public void WriteFile(string filePath, Func <Stream> fileContentStream)
        {
            int index = filePath.IndexOf(DirectorySeparator, StringComparison.Ordinal);

            if (index == -1)
            {
                VirtualFileSystemFile file = new VirtualFileSystemFile(filePath, fileContentStream);
                AddFile(file);
                return;
            }
            string subDirectory         = filePath.Substring(0, index);
            string subDirectoryFilePath = filePath.Substring(index + DirectorySeparator.Length,
                                                             filePath.Length - index - DirectorySeparator.Length);
            var existingSubDirectory = _directories.SingleOrDefault(d => d.Name == subDirectory);

            if (existingSubDirectory == null)
            {
                existingSubDirectory = new VirtualFileSystemDirectory(subDirectory);
                AddDirectory(existingSubDirectory);
            }
            existingSubDirectory.WriteFile(subDirectoryFilePath, fileContentStream);
        }
 public void WriteFile(string filePath, Func<Stream> fileContentStream)
 {
     int index = filePath.IndexOf(DirectorySeparator, StringComparison.Ordinal);
     if (index == -1)
     {
         VirtualFileSystemFile file = new VirtualFileSystemFile(filePath, fileContentStream);
         AddFile(file);
         return;
     }
     string subDirectory = filePath.Substring(0, index);
     string subDirectoryFilePath = filePath.Substring(index + DirectorySeparator.Length,
         filePath.Length - index - DirectorySeparator.Length);
     var existingSubDirectory = _directories.SingleOrDefault(d => d.Name == subDirectory);
     if (existingSubDirectory == null)
     {
         existingSubDirectory = new VirtualFileSystemDirectory(subDirectory);
         AddDirectory(existingSubDirectory);
     }
     existingSubDirectory.WriteFile(subDirectoryFilePath, fileContentStream);
 }
 public void AddFile(VirtualFileSystemFile file)
 {
     _files.Add(file);
 }
 public void AddFile(VirtualFileSystemFile file)
 {
     _files.Add(file);
 }