Example #1
0
 internal static void AddFiles(this IFileSystem fileSystem, IEnumerable <IPackageFile> files, string rootDir)
 {
     foreach (IPackageFile file in files)
     {
         string path = Path.Combine(rootDir, file.Path);
         fileSystem.AddFileWithCheck(path, file.GetStream);
     }
 }
 /// <summary>
 /// Add the files to the specified FileSystem
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="files">The files to add to FileSystem.</param>
 /// <param name="rootDir">The directory of the FileSystem to copy the files to.</param>
 /// <param name="preserveFilePath">if set to <c>true</c> preserve full path of the copies files. Otherwise,
 /// all files with be copied to the <paramref name="rootDir"/>.</param>
 public static void AddFiles(this IFileSystem fileSystem, IEnumerable <IPackageFile> files, string rootDir, bool preserveFilePath)
 {
     foreach (IPackageFile file in files)
     {
         string path = Path.Combine(rootDir, preserveFilePath ? file.Path : Path.GetFileName(file.Path));
         fileSystem.AddFileWithCheck(path, file.GetStream);
     }
 }
Example #3
0
 internal static void AddFileWithCheck(this IFileSystem fileSystem, string path, Action <Stream> write)
 {
     fileSystem.AddFileWithCheck(path, () => {
         var stream = new MemoryStream();
         write(stream);
         stream.Seek(0, SeekOrigin.Begin);
         return(stream);
     });
 }
		public DefaultPackagePathResolver(IFileSystem fileSystem, bool useSideBySidePaths)
		{
			if (fileSystem == null) {
				throw new ArgumentNullException("fileSystem");
			}
			_fileSystem = fileSystem;
			bool excludeVersionMarkerDoesntExist = !_fileSystem.FileExists("ExcludeVersion");
			_useSideBySidePaths = excludeVersionMarkerDoesntExist && useSideBySidePaths;
			if (!useSideBySidePaths)
				_fileSystem.AddFileWithCheck("ExcludeVersion", (Stream st) => { st.WriteByte(49); st.Flush(); });
		}