本文整理汇总了C#中RelativePath.GetPathFromWorkingFolder方法的典型用法代码示例。如果您正苦于以下问题:C# RelativePath.GetPathFromWorkingFolder方法的具体用法?C# RelativePath.GetPathFromWorkingFolder怎么用?C# RelativePath.GetPathFromWorkingFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativePath
的用法示例。
在下文中一共展示了RelativePath.GetPathFromWorkingFolder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
{
var key = destFilePath.GetPathFromWorkingFolder();
_mapping[key] = new PathMapping(key, sourceFilePath.PhysicalPath)
{
Properties = sourceFilePath.Properties,
};
}
示例2: PathMapping
public PathMapping(RelativePath logicalPath, string physicalPath)
{
if (logicalPath == null)
{
throw new ArgumentNullException(nameof(logicalPath));
}
if (physicalPath == null)
{
throw new ArgumentNullException(nameof(physicalPath));
}
LogicalPath = logicalPath.GetPathFromWorkingFolder();
PhysicalPath = physicalPath;
AllowMoveOut = false;
Properties = ImmutableDictionary<string, string>.Empty;
}
示例3: Create
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;
}
示例4: FindFile
public PathMapping? FindFile(RelativePath file)
{
var path = file.GetPathFromWorkingFolder();
foreach (var m in Mappings)
{
if (m.IsFolder)
{
var localPath = path - m.LogicalPath;
if (m.AllowMoveOut || localPath.ParentDirectoryCount == 0)
{
var physicalPath = Path.Combine(m.PhysicalPath, localPath.ToString());
if (File.Exists(Environment.ExpandEnvironmentVariables(physicalPath)))
{
return new PathMapping(path, physicalPath) { Properties = m.Properties };
}
}
}
else if (m.LogicalPath == path)
{
return m;
}
}
return null;
}