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


C# IPath.ToString方法代码示例

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


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

示例1: PrivateEquals

 //
 // Comparison
 //
 private bool PrivateEquals(IPath path) {
    Debug.Assert(path != null);
    if (this.PathMode != path.PathMode) {
       return false;
    }
    // A FilePath could be equal to a DirectoryPath
    if (this.IsDirectoryPath != path.IsDirectoryPath) {
       return false;
    }
    return String.Compare(this.m_PathString, path.ToString(), true) == 0;
 }
开发者ID:ArsenShnurkov,项目名称:NDepend.Path,代码行数:14,代码来源:PathHelpers+PathBase.cs

示例2: Exclude

        /// <summary>
        /// Removes the second path from the first. E.g., Exclude("c:\users\foo\bar", "c:\users") would
        /// return "foo\bar".
        /// </summary>
        /// <param name="FirstPathObject"></param>
        /// <param name="SecondPathObject"></param>
        /// <returns></returns>
        public IPath Exclude(IPath SecondPathObject)
        {
            string SecondPath = SecondPathObject.ToString();

            if (!Path.StartsWith(SecondPath))
            {
                return null;
            }

            return new Win32Path(Path.Remove(0, SecondPath.Length));
        }
开发者ID:jasonsch,项目名称:WindowsCLI,代码行数:18,代码来源:Win32Path.cs

示例3: SelectEnumerable

        public IEnumerable<object> SelectEnumerable(IPath path, object data)
        {
            IInterrogator interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            INavigator navigator = interrogator.CreateNavigator(data, path.GetType());

            if (navigator == null)
            {
                throw new Exception(string.Concat("Couldn't create a navigator for the path '", path.ToString(), "'."));
            }

            IEnumerable<object> values = navigator.SelectEnumerable(path);

            navigator.Dispose();

            return values;
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:16,代码来源:DataBrowser.cs

示例4: TryGetAbsolutePathFrom

         internal static bool TryGetAbsolutePathFrom(IAbsoluteDirectoryPath pathFrom, IPath pathTo, out string pathResult, out string failureReason) {
            Debug.Assert(pathFrom != null);
            Debug.Assert(pathTo != null);
            Debug.Assert(pathTo.IsRelativePath);
           
            if (pathFrom.Kind == AbsolutePathKind.DriveLetter) {
               // Only work with Directory 
               if (pathTo.IsFilePath) { pathTo = pathTo.ParentDirectoryPath; }
               return TryGetAbsolutePath(pathFrom.ToString(), pathTo.ToString(), out pathResult, out failureReason);
            }


            //
            // Special case when a relative path is asked from a UNC path like ".." from "\\Server\Share".
            // In such case we cannot return "\\Server" that is not a valis UNC path
            // To address this we create a temporary drive letter absolute path and do the TryGetAbsolutePathFrom() on it!
            //
            Debug.Assert(pathFrom.Kind == AbsolutePathKind.UNC);
            var pathFromString = pathFrom.ToString();
            string uncServerShareStart;
            var fakePathFromString = UNCPathHelper.TranformUNCIntoDriveLetter(pathFromString, out uncServerShareStart);
            Debug.Assert(fakePathFromString.IsValidAbsoluteDirectoryPath());
            var fakePathFrom = fakePathFromString.ToAbsoluteDirectoryPath();

            // Call me, but this time with a DriveLetter path (no risk of infinite recursion!)
            string pathResultDriveLetter;
            if (!TryGetAbsolutePathFrom(fakePathFrom, pathTo, out pathResultDriveLetter, out failureReason)) {
               failureReason = failureReason.Replace(UNCPathHelper.FAKE_DRIVE_LETTER_PREFIX, uncServerShareStart);
               pathResult = null;
               return false;
            }

            Debug.Assert(pathResultDriveLetter != null);
            Debug.Assert(pathResultDriveLetter.Length > 0);
            Debug.Assert(pathResultDriveLetter.StartsWith(UNCPathHelper.FAKE_DRIVE_LETTER_PREFIX));
            pathResult = UNCPathHelper.TranformDriveLetterIntoUNC(pathResultDriveLetter, uncServerShareStart);

            return true;
         }
开发者ID:ArsenShnurkov,项目名称:NDepend.Path,代码行数:39,代码来源:PathHelpers+AbsoluteRelativePathHelpers.cs

示例5: FilterPath

 public string FilterPath(IPath info) {
     return info == null ? null : FilterPath(info.ToString());
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:3,代码来源:File.cs

示例6: Combine

 public IPath Combine(IPath SecondPath)
 {
     return new Win32Path(System.IO.Path.Combine(Path, SecondPath.ToString()));
 }
开发者ID:jasonsch,项目名称:WindowsCLI,代码行数:4,代码来源:Win32Path.cs

示例7: IsAudioPath

 private bool IsAudioPath(IPath relativeTargetDir)
 {
     var path = relativeTargetDir.ToString().Substring(2);
     return _audioPaths.Any(x => path.StartsWith(x, StringComparison.CurrentCultureIgnoreCase));
 }
开发者ID:SIXNetworks,项目名称:gta-toolkit,代码行数:5,代码来源:RpfListBuilder.cs

示例8: FilterPath

 public string FilterPath(IPath info) => info == null ? null : FilterPath(info.ToString());
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:1,代码来源:ToolsFile.cs

示例9: DeleteParentFilesIfExists

 static void DeleteParentFilesIfExists(IPath path, IAbsoluteDirectoryPath backupPath) {
     while (path.HasParentDirectory) {
         path = path.ParentDirectoryPath;
         var s = path.ToString();
         if (File.Exists(s)) {
             File.Delete(s);
             break;
         }
         if (path.Equals(backupPath))
             break;
     }
 }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:12,代码来源:ContentInstaller.cs

示例10: TryGetAbsolutePathFrom

			internal static bool TryGetAbsolutePathFrom(IAbsoluteDirectoryPath pathFrom, IPath pathTo, out string absolutePath, out string failureMessage)
			{
				//Argument.IsNotNull(nameof(pathFrom), pathFrom);
				//Argument.IsNotNull(nameof(pathTo), pathTo);
				//Debug.Assert(pathTo.IsRelativePath);

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

					return TryGetAbsolutePath(pathFrom.ToString(), pathTo.ToString(), out absolutePath, out failureMessage);
				}

				//Debug.Assert(pathFrom.Kind == AbsolutePathKind.UNC);

				string uncServerShareStart;
				string pathResultDriveLetter;

				var pathFromString = pathFrom.ToString();
				var fakePathFromString = UncPathHelper.ConvertUncToDriveLetter(pathFromString, out uncServerShareStart);
				var fakePathFrom = fakePathFromString.ToAbsoluteDirectoryPath();

				//Debug.Assert(fakePathFromString.IsValidAbsoluteDirectoryPath());

				if (!TryGetAbsolutePathFrom(fakePathFrom, pathTo, out pathResultDriveLetter, out failureMessage))
				{
					failureMessage = failureMessage.Replace(UncPathHelper.FakeDriveLetterPrefix, uncServerShareStart);
					absolutePath = null;

					return false;
				}

				//Debug.Assert(pathResultDriveLetter != null);
				//Debug.Assert(pathResultDriveLetter.Length > 0);
				//Debug.Assert(pathResultDriveLetter.StartsWith(UNCPathHelper.FAKE_DRIVE_LETTER_PREFIX));

				absolutePath = UncPathHelper.ConvertDriveLetterToUnc(pathResultDriveLetter, uncServerShareStart);

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

示例11: PrivateEquals

			private bool PrivateEquals(IPath path)
			{
				if (PathType != path.PathType)
				{
					return false;
				}

				// A FilePath could be equal to a DirectoryPath
				if (IsDirectoryPath != path.IsDirectoryPath)
				{
					return false;
				}

				return string.Compare(CurrentPath, path.ToString(), StringComparison.OrdinalIgnoreCase) == 0;
			}
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:15,代码来源:PathHelpers.PathBase.cs


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