public override bool CanGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out string failureReason)
            {
                Debug.Assert(pivotDirectory != null); // Enforced by contract
                string pathResultUnused;

                return(AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathResultUnused, out failureReason));
            }
コード例 #2
0
            public override bool CanGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out string failureMessage)
            {
                Argument.IsNotNull(nameof(pivotDirectory), pivotDirectory);

                string pathResultUnused;

                return(AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathResultUnused, out failureMessage));
            }
            //
            //  Absolute/Relative pathString conversion
            //
            IRelativeDirectoryPath IAbsoluteDirectoryPath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory)
            {
                Debug.Assert(pivotDirectory != null);
                string pathRelativeString, failureReason;

                if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathRelativeString, out failureReason))
                {
                    throw new ArgumentException(failureReason);
                }
                Debug.Assert(pathRelativeString != null);
                Debug.Assert(pathRelativeString.Length > 0);
                return(pathRelativeString.ToRelativeDirectoryPath());
            }
コード例 #4
0
            //
            //  Absolute/Relative pathString conversion
            //
            IRelativeFilePath IAbsoluteFilePath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory)
            {
                Debug.Assert(pivotDirectory != null);                 // Enforced by contract
                string pathRelative, failureReason;

                if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathRelative, out failureReason))
                {
                    throw new ArgumentException(failureReason);
                }
                Debug.Assert(pathRelative != null);
                Debug.Assert(pathRelative.Length > 0);
                return(new RelativeFilePath(pathRelative + MiscHelpers.DIR_SEPARATOR_CHAR + FileName));
            }
コード例 #5
0
            IRelativeFilePath IAbsoluteFilePath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory)
            {
                Argument.IsNotNull(nameof(pivotDirectory), pivotDirectory);

                string relativePath, failureMessage;

                if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out relativePath, out failureMessage))
                {
                    throw new ArgumentException(failureMessage);
                }

                //Debug.Assert(pathRelative != null);
                //Debug.Assert(pathRelative.Length > 0);

                return(new RelativeFilePath(relativePath + MiscHelpers.DirectorySeparatorChar + FileName));
            }