Esempio n. 1
0
 public override Stream Create(RelativePath file)
 {
     lock (Manifest)
     {
         var entry = FindEntryInManifest(file.RemoveWorkingFolder());
         if (entry == null)
         {
             throw new InvalidOperationException("File entry not found.");
         }
         if (_noRandomFile)
         {
             Directory.CreateDirectory(
                 Path.Combine(ManifestFolder, file.RemoveWorkingFolder().GetDirectoryPath()));
             var result = File.Create(Path.Combine(ManifestFolder, file.RemoveWorkingFolder()));
             entry.LinkToPath = null;
             return(result);
         }
         else
         {
             var pair = CreateRandomFileStream();
             entry.LinkToPath = Path.Combine(OutputFolder, pair.Item1);
             return(pair.Item2);
         }
     }
 }
Esempio n. 2
0
        public PathMapping?FindFile(RelativePath file)
        {
            var pp = Path.Combine(_expandedInputFolder, file.RemoveWorkingFolder());

            if (!File.Exists(pp))
            {
                return(null);
            }
            return(new PathMapping(file, Path.Combine(InputFolder, file.RemoveWorkingFolder()))
            {
                Properties = Properties
            });
        }
Esempio n. 3
0
        public override Stream Create(RelativePath file)
        {
            var f = Path.Combine(ExpandedOutputFolder, file.RemoveWorkingFolder());

            Directory.CreateDirectory(Path.GetDirectoryName(f));
            return(File.Create(f));
        }
Esempio n. 4
0
        public override void Copy(PathMapping sourceFileName, RelativePath destFileName)
        {
            var f = Path.Combine(ExpandedOutputFolder, destFileName.RemoveWorkingFolder());

            Directory.CreateDirectory(Path.GetDirectoryName(f));
            File.Copy(Environment.ExpandEnvironmentVariables(sourceFileName.PhysicalPath), f);
        }
Esempio n. 5
0
 public override void Copy(PathMapping sourceFileName, RelativePath destFileName)
 {
     lock (Manifest)
     {
         var entry = FindEntryInManifest(destFileName.RemoveWorkingFolder());
         if (entry == null)
         {
             throw new InvalidOperationException("File entry not found.");
         }
         var pair = CreateRandomFileStream();
         entry.LinkToPath = sourceFileName.PhysicalPath;
     }
 }
Esempio n. 6
0
        public override void Copy(PathMapping sourceFileName, RelativePath destFileName)
        {
            var dest = Path.Combine(ExpandedOutputFolder, destFileName.RemoveWorkingFolder());

            EnsureFolder(Path.GetDirectoryName(dest));
            var source = Environment.ExpandEnvironmentVariables(sourceFileName.PhysicalPath);

            if (!FilePathComparer.OSPlatformSensitiveStringComparer.Equals(source, dest))
            {
                File.Copy(source, dest, true);
            }
            File.SetAttributes(dest, FileAttributes.Normal);
        }
Esempio n. 7
0
        public PathMapping?FindFile(RelativePath file)
        {
            OutputFileInfo entry;

            lock (Manifest)
            {
                entry = FindEntryInManifest(file.RemoveWorkingFolder());
            }
            if (entry == null)
            {
                return(null);
            }
            return(new PathMapping(file, entry.LinkToPath ?? Path.Combine(ManifestFolder, entry.RelativePath)));
        }
Esempio n. 8
0
        public IEnumerable <string> GetExpectedPhysicalPath(RelativePath file)
        {
            OutputFileInfo entry;

            lock (Manifest)
            {
                entry = FindEntryInManifest(file.RemoveWorkingFolder());
            }
            if (entry == null)
            {
                return(Enumerable.Empty <string>());
            }
            return(new[] { entry.LinkToPath ?? Path.Combine(ManifestFolder, entry.RelativePath) });
        }
Esempio n. 9
0
 public override Stream Create(RelativePath file)
 {
     lock (Manifest)
     {
         var entry = FindEntryInManifest(file.RemoveWorkingFolder());
         if (entry == null)
         {
             throw new InvalidOperationException("File entry not found.");
         }
         var pair = CreateRandomFileStream();
         entry.LinkToPath = Path.Combine(OutputFolder, pair.Item1);
         return(pair.Item2);
     }
 }
Esempio n. 10
0
 public IEnumerable <string> GetExpectedPhysicalPath(RelativePath file) =>
 new[] { Path.Combine(InputFolder, file.RemoveWorkingFolder().ToString()) };