当前位置: 首页>>代码示例>>C#>>正文


C# RelativePath类代码示例

本文整理汇总了C#中RelativePath的典型用法代码示例。如果您正苦于以下问题:C# RelativePath类的具体用法?C# RelativePath怎么用?C# RelativePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RelativePath类属于命名空间,在下文中一共展示了RelativePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteAllText

 public static void WriteAllText(this FileAbstractLayer fal, RelativePath file, string content)
 {
     using (var writer = CreateText(fal, file))
     {
         writer.Write(content);
     }
 }
开发者ID:vicancy,项目名称:docfx,代码行数:7,代码来源:FileAbstractLayerExtensions.cs

示例2: GetPathChangeKind

 public PathChangeKind GetPathChangeKind(RelativePath path) {
   PathChangeKind result;
   if (!_map.TryGetValue(path, out result)) {
     result = PathChangeKind.None;
   }
   return result;
 }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:7,代码来源:FullPathChanges.cs

示例3: FixLink

 private static void FixLink(XAttribute link, RelativePath filePath, HashSet<string> linkToFiles)
 {
     string linkFile;
     string anchor = null;
     if (PathUtility.IsRelativePath(link.Value))
     {
         var index = link.Value.IndexOf('#');
         if (index == -1)
         {
             linkFile = link.Value;
         }
         else if (index == 0)
         {
             return;
         }
         else
         {
             linkFile = link.Value.Remove(index);
             anchor = link.Value.Substring(index);
         }
         var path = filePath + (RelativePath)linkFile;
         var file = (string)path.GetPathFromWorkingFolder();
         link.Value = file + anchor;
         linkToFiles.Add(HttpUtility.UrlDecode(file));
     }
 }
开发者ID:dotnet,项目名称:docfx,代码行数:26,代码来源:RtfDocumentProcessor.cs

示例4: ReadAllText

 public static string ReadAllText(this FileAbstractLayer fal, RelativePath file)
 {
     using (var sr = OpenReadText(fal, file))
     {
         return sr.ReadToEnd();
     }
 }
开发者ID:vicancy,项目名称:docfx,代码行数:7,代码来源:FileAbstractLayerExtensions.cs

示例5: GetProperty

 public static string GetProperty(this FileAbstractLayer fal, RelativePath file, string propertyName)
 {
     var dict = fal.GetProperties(file);
     string result;
     dict.TryGetValue(propertyName, out result);
     return result;
 }
开发者ID:vicancy,项目名称:docfx,代码行数:7,代码来源:FileAbstractLayerExtensions.cs

示例6: Copy

 public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
 {
     var key = destFilePath.GetPathFromWorkingFolder();
     _mapping[key] = new PathMapping(key, sourceFilePath.PhysicalPath)
     {
         Properties = sourceFilePath.Properties,
     };
 }
开发者ID:vicancy,项目名称:docfx,代码行数:8,代码来源:LinkFileWriter.cs

示例7: GetSection

 public IEnumerable<string> GetSection(string sectionName, Func<IEnumerable<string>, IEnumerable<string>> postProcessing)
 {
     var filename = new RelativePath(sectionName);
       return _configurationFileProvider.ReadFile(filename, (fullPathName, lines) => {
     _volatileToken.AddFile(fullPathName);
     return postProcessing(lines);
       });
 }
开发者ID:nick-chromium,项目名称:vs-chromium,代码行数:8,代码来源:ConfigurationFileSectionProvider.cs

示例8: FileName

 public FileName(DirectoryName parent, RelativePath relativePath) {
   if (parent == null)
     throw new ArgumentNullException("parent");
   if (relativePath.IsEmpty)
     throw new ArgumentException("Relative path is empty", "relativePath");
   _parent = parent;
   _relativePath = relativePath;
 }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:8,代码来源:FileName.cs

示例9: PhpSourceFile

		public PhpSourceFile(FullPath root, FullPath fullPath)
		{
			root.EnsureNonEmpty("root");
			fullPath.EnsureNonEmpty("fullPath");

			this.fullPath = fullPath;
			this.relativePath = RelativePath.Empty;
			this.root = root;
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:9,代码来源:PhpSourceFile.cs

示例10: Exists

 public bool Exists(RelativePath file)
 {
     if (file == null)
     {
         throw new ArgumentNullException(nameof(file));
     }
     EnsureNotDisposed();
     return Reader.FindFile(file) != null;
 }
开发者ID:vicancy,项目名称:docfx,代码行数:9,代码来源:FileAbstractLayer.cs

示例11: FindFile

 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 };
 }
开发者ID:vicancy,项目名称:docfx,代码行数:9,代码来源:RealFileReader.cs

示例12: RelativePath_Unit_Append1_PathContainsAnotherSeparator

        public void RelativePath_Unit_Append1_PathContainsAnotherSeparator()
        {
            String[] nodes = new String[] { "sites" };
            Char separator = RelativePath.ForwardSlash;
            RelativePath target = new RelativePath(nodes, separator);
            String path = "Chad\\Greer";

            target.Append(path);
        }
开发者ID:cegreer,项目名称:Common,代码行数:9,代码来源:RelativePathTests.cs

示例13: MatchFileName

    public bool MatchFileName(RelativePath relativePath, IPathComparer comparer) {
      var path = relativePath.Value;
      CheckPath(path);

      if (PrePassWontMatch(MatchKind.File, path, comparer))
        return false;

      var result = BaseOperator.Match(MatchKind.File, comparer, Operators, 0, path, 0);
      return IsMatch(path, result);
    }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:10,代码来源:PathMatcher.cs

示例14: OpenRead

 public FileStream OpenRead(RelativePath file)
 {
     if (file == null)
     {
         throw new ArgumentNullException(nameof(file));
     }
     EnsureNotDisposed();
     var pp = FindPhysicalPath(file);
     return File.OpenRead(Environment.ExpandEnvironmentVariables(pp.PhysicalPath));
 }
开发者ID:vicancy,项目名称:docfx,代码行数:10,代码来源:FileAbstractLayer.cs

示例15: ReadFile

        public IEnumerable<string> ReadFile(RelativePath relativePath, Func<FullPath, IEnumerable<string>, IEnumerable<string>> postProcessing)
        {
            foreach (var directoryName in PossibleDirectoryNames()) {
            var path = directoryName.Combine(relativePath);
            if (_fileSystem.FileExists(path))
              return postProcessing(path, _fileSystem.ReadAllLines(path));
              }

              throw new FileLoadException(
            string.Format("Could not load configuration file \"{0}\" from the following locations:{1}", relativePath,
                      PossibleDirectoryNames().Aggregate("", (x, y) => x + "\n" + y)));
        }
开发者ID:nick-chromium,项目名称:vs-chromium,代码行数:12,代码来源:ConfigurationFileProvider.cs


注:本文中的RelativePath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。