コード例 #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);
         }
     }
 }
コード例 #2
0
ファイル: RealFileReader.cs プロジェクト: zsvanderlaan/docfx
        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
            });
        }
コード例 #3
0
        public override Stream Create(RelativePath file)
        {
            var f = Path.Combine(ExpandedOutputFolder, file.RemoveWorkingFolder());

            Directory.CreateDirectory(Path.GetDirectoryName(f));
            return(File.Create(f));
        }
コード例 #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);
        }
コード例 #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;
     }
 }
コード例 #6
0
ファイル: RealFileWriter.cs プロジェクト: zyj0021/docfx
        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);
        }
コード例 #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)));
        }
コード例 #8
0
ファイル: ManifestFileReader.cs プロジェクト: z784916/docfx-1
        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) });
        }
コード例 #9
0
ファイル: ManifestFileWriter.cs プロジェクト: timpatt/docfx
 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);
     }
 }
コード例 #10
0
ファイル: RealFileReader.cs プロジェクト: zyj0021/docfx
 public IEnumerable <string> GetExpectedPhysicalPath(RelativePath file) =>
 new[] { Path.Combine(InputFolder, file.RemoveWorkingFolder().ToString()) };