Beispiel #1
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);
        }
Beispiel #2
0
        public override Stream Create(RelativePath file)
        {
            var         key = file.GetPathFromWorkingFolder();
            bool        getResult;
            PathMapping pm;

            lock (_mapping)
            {
                getResult = _mapping.TryGetValue(key, out pm);
            }
            if (getResult && pm.PhysicalPath.StartsWith(OutputFolder))
            {
                try
                {
                    return(File.Create(Environment.ExpandEnvironmentVariables(pm.PhysicalPath)));
                }
                catch (IOException)
                {
                }
            }
            var pair = CreateRandomFileStream();

            pm = new PathMapping(key, Path.Combine(OutputFolder, pair.Item1));
            lock (_mapping)
            {
                _mapping[key] = pm;
            }
            return(pair.Item2);
        }
Beispiel #3
0
 public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
 {
     var key = destFilePath.GetPathFromWorkingFolder();
     _mapping[key] = new PathMapping(key, sourceFilePath.PhysicalPath)
     {
         Properties = sourceFilePath.Properties,
     };
 }
Beispiel #4
0
        public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
        {
            var key = destFilePath.GetPathFromWorkingFolder();

            _mapping[key] = new PathMapping(key, sourceFilePath.PhysicalPath)
            {
                Properties = sourceFilePath.Properties,
            };
        }
Beispiel #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;
     }
 }
Beispiel #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);
        }
Beispiel #7
0
 public override FileStream Create(RelativePath file)
 {
     var key = file.GetPathFromWorkingFolder();
     PathMapping pm;
     if (_mapping.TryGetValue(key, out pm) &&
         pm.PhysicalPath.StartsWith(OutputFolder))
     {
         return File.Create(Environment.ExpandEnvironmentVariables(pm.PhysicalPath));
     }
     var pair = CreateRandomFileStream();
     _mapping[key] =
         new PathMapping(
             key,
             Path.Combine(OutputFolder, pair.Item1));
     return pair.Item2;
 }
Beispiel #8
0
        public override Stream Create(RelativePath file)
        {
            var         key = file.GetPathFromWorkingFolder();
            PathMapping pm;

            if (_mapping.TryGetValue(key, out pm) &&
                pm.PhysicalPath.StartsWith(OutputFolder))
            {
                return(File.Create(Environment.ExpandEnvironmentVariables(pm.PhysicalPath)));
            }
            var pair = CreateRandomFileStream();

            _mapping[key] =
                new PathMapping(
                    key,
                    Path.Combine(OutputFolder, pair.Item1));
            return(pair.Item2);
        }
Beispiel #9
0
 public abstract void Copy(PathMapping sourceFileName, RelativePath destFileName);
Beispiel #10
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);
 }