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


C# IAbsoluteDirectoryPath.OnSameVolumeThan方法代码示例

本文整理汇总了C#中IAbsoluteDirectoryPath.OnSameVolumeThan方法的典型用法代码示例。如果您正苦于以下问题:C# IAbsoluteDirectoryPath.OnSameVolumeThan方法的具体用法?C# IAbsoluteDirectoryPath.OnSameVolumeThan怎么用?C# IAbsoluteDirectoryPath.OnSameVolumeThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAbsoluteDirectoryPath的用法示例。


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

示例1: TryGetRelativePath

         //
         //  Relative/absolute computation
         //

         internal static bool TryGetRelativePath(IAbsoluteDirectoryPath pathFrom, IAbsolutePath pathTo, out string pathResult, out string failurereason) {
            Debug.Assert(pathFrom != null);
            Debug.Assert(pathTo != null);

            if (!pathFrom.OnSameVolumeThan(pathTo)) {
               failurereason = @"Cannot compute relative path from 2 paths that are not on the same volume 
   PathFrom = """ + pathFrom.ToString() + @"""
   PathTo   = """ + pathTo.ToString() + @"""";
               pathResult = null;
               return false;
            }
            // Only work with Directory 
            if (pathTo.IsFilePath) { pathTo = pathTo.ParentDirectoryPath; }
            pathResult = GetPathRelativeTo(pathFrom.ToString(), pathTo.ToString());
            failurereason = null;
            return true;
         }
开发者ID:ArsenShnurkov,项目名称:NDepend.Path,代码行数:21,代码来源:PathHelpers+AbsoluteRelativePathHelpers.cs

示例2: TryGetRelativePath

			internal static bool TryGetRelativePath(IAbsoluteDirectoryPath pathFrom, IAbsolutePath pathTo, out string relativePath, out string failureMessage)
			{
				//Argument.IsNotNull(nameof(pathFrom), pathFrom);
				//Argument.IsNotNull(nameof(pathTo), pathTo);

				if (!pathFrom.OnSameVolumeThan(pathTo))
				{
					failureMessage = @"Cannot compute relative path from 2 paths that are not on the same volume 
   PathFrom = """ + pathFrom + @"""
   PathTo   = """ + pathTo + @"""";

					relativePath = null;

					return false;
				}

				// Only work with Directory 
				if (pathTo.IsFilePath)
				{
					pathTo = pathTo.ParentDirectoryPath;
				}

				relativePath = GetPathRelativeTo(pathFrom.ToString(), pathTo.ToString());
				failureMessage = null;

				return true;
			}
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:27,代码来源:PathHelpers.AbsoluteRelativePathHelpers.cs


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