示例#1
0
        public void CopyDirectory(
            IDirectoryPath directoryPath,
            bool overwrite   = true,
            bool copySubDirs = true,
            ICollection <string> excludeFileRelativePaths = null)
        {
            var dir  = new DirectoryInfo(this.Value);
            var dirs = dir.GetDirectories();

            this.CreateDirectoryRecursively();

            foreach (var file in dir.GetFiles())
            {
                if (excludeFileRelativePaths?.Contains(
                        file.FullName.ToFilePath().GetRelativePath(
                            dir.FullName.ToDirectoryPath()).Value) == true)
                {
                    continue;
                }

                file.CopyTo(Path.Combine(this.Value, file.Name), overwrite);
            }

            if (copySubDirs)
            {
                foreach (var subDirectory in dirs)
                {
                    var tempPath = Path.Combine(this.Value, subDirectory.Name);
                    subDirectory.FullName.ToDirectoryPath().CopyDirectory(tempPath.ToDirectoryPath(), overwrite, true, excludeFileRelativePaths);
                }
            }
        }
			internal static string GetChildDirectoryPath(IDirectoryPath directoryPath, string directoryName)
			{
				Argument.IsNotNull(nameof(directoryPath), directoryPath);
				Argument.IsNotNullOrEmpty(nameof(directoryName), directoryName);

				return directoryPath.ToString() + MiscHelpers.DirectorySeparatorChar + directoryName;
			}
示例#3
0
 static void GetProfiles(IDirectoryPath path, List <string> profiles, string ext)
 {
     if (Directory.Exists(path.ToString()))
     {
         profiles.AddRange(GetProfilesInternal(path, ext));
     }
 }
            internal static string GetChildDirectoryPath(IDirectoryPath directoryPath, string directoryName)
            {
                Argument.IsNotNull(nameof(directoryPath), directoryPath);
                Argument.IsNotNullOrEmpty(nameof(directoryName), directoryName);

                return(directoryPath.ToString() + MiscHelpers.DirectorySeparatorChar + directoryName);
            }
示例#5
0
            public bool IsChildOf(IDirectoryPath parentDirectory)
            {
                Debug.Assert(parentDirectory != null);
                var parentDirectoryString = parentDirectory.ToString();

                // Don't accept equals pathString!
                var parentDirectoryStringLength = parentDirectoryString.Length;

                if (m_PathString.Length <= parentDirectoryStringLength)
                {
                    return(false);
                }

                // Possible since at this point (m_PathString.Length > parentDirectoryStringLength)
                var c = m_PathString[parentDirectoryStringLength];

                // Need to check that char at pos pathStringLength is a separator,
                // else @"D:/Foo bar" is considered as a child of @"D:/Foo".
                // Note that m_PathString is normalized in ctor, hence its separator(s) are DIR_SEPARATOR_CHAR.
                if (c != MiscHelpers.DIR_SEPARATOR_CHAR)
                {
                    return(false);
                }

                string parentPathLowerCase = parentDirectory.ToString().ToLower();
                string thisPathLowerCase   = m_PathString.ToLower();

                return(thisPathLowerCase.IndexOf(parentPathLowerCase) == 0);
            }
			public bool IsChildOf(IDirectoryPath parentDirectory)
			{
				Argument.IsNotNull(nameof(parentDirectory), parentDirectory);

				var parentDirectoryString = parentDirectory.ToString();

				// Don't accept equals pathString!
				var parentDirectoryStringLength = parentDirectoryString.Length;

				if (CurrentPath.Length <= parentDirectoryStringLength)
				{
					return false;
				}

				// Possible since at this point (m_PathString.Length > parentDirectoryStringLength)
				var c = CurrentPath[parentDirectoryStringLength];

				// Need to check that char at pos pathStringLength is a separator, 
				// else @"D:/Foo bar" is considered as a child of @"D:/Foo".
				// Note that m_PathString is normalized in ctor, hence its separator(s) are DIR_SEPARATOR_CHAR.
				if (c != MiscHelpers.DirectorySeparatorChar)
				{
					return false;
				}

				var parentPathLowerCase = parentDirectory.ToString().ToLower();
				var thisPathLowerCase = CurrentPath.ToLower();

				return thisPathLowerCase.IndexOf(parentPathLowerCase, StringComparison.Ordinal) == 0;
			}
示例#7
0
            public bool IsChildOf(IDirectoryPath parentDirectory)
            {
                Argument.IsNotNull(nameof(parentDirectory), parentDirectory);

                var parentDirectoryString = parentDirectory.ToString();

                // Don't accept equals pathString!
                var parentDirectoryStringLength = parentDirectoryString.Length;

                if (CurrentPath.Length <= parentDirectoryStringLength)
                {
                    return(false);
                }

                // Possible since at this point (m_PathString.Length > parentDirectoryStringLength)
                var c = CurrentPath[parentDirectoryStringLength];

                // Need to check that char at pos pathStringLength is a separator,
                // else @"D:/Foo bar" is considered as a child of @"D:/Foo".
                // Note that m_PathString is normalized in ctor, hence its separator(s) are DIR_SEPARATOR_CHAR.
                if (c != MiscHelpers.DirectorySeparatorChar)
                {
                    return(false);
                }

                var parentPathLowerCase = parentDirectory.ToString().ToLower();
                var thisPathLowerCase   = CurrentPath.ToLower();

                return(thisPathLowerCase.IndexOf(parentPathLowerCase, StringComparison.Ordinal) == 0);
            }
示例#8
0
 internal static string GetChildDirectoryWithName(IDirectoryPath directoryPath, string directoryName)
 {
     Debug.Assert(directoryPath != null);
     Debug.Assert(directoryName != null);    // Enforced by contract
     Debug.Assert(directoryName.Length > 0); // Enforced by contract
     return(directoryPath.ToString() + MiscHelpers.DIR_SEPARATOR_CHAR + directoryName);
 }
 internal static string GetChildFileWithName(IDirectoryPath directoryPath, string fileName)
 {
     Debug.Assert(directoryPath != null);
     Debug.Assert(fileName != null); // Enforced by contract
     Debug.Assert(fileName.Length > 0); // Enforced by contract
     return directoryPath.ToString() + MiscHelpers.DIR_SEPARATOR_CHAR + fileName;
 }
 public bool IsChildOf(IDirectoryPath parentDirectory) {
    Debug.Assert(parentDirectory != null);
    string parentPathLowerCase = parentDirectory.ToString().ToLower();
    string thisPathLowerCase = m_PathString.ToLower();
    // Don't accept equals pathString!
    if (thisPathLowerCase.Length <= parentPathLowerCase.Length) { return false; }
    return thisPathLowerCase.IndexOf(parentPathLowerCase) == 0;
 }
 public void Test_InvalidInputPathEmpty()
 {
     Assert.IsFalse((null as string).IsValidAbsoluteDirectoryPath());
     Assert.IsFalse((null as string).IsValidRelativeDirectoryPath());
     Assert.IsFalse(string.Empty.IsValidAbsoluteDirectoryPath());
     Assert.IsFalse(string.Empty.IsValidRelativeDirectoryPath());
     IDirectoryPath directoryPath = string.Empty.ToAbsoluteDirectoryPath();
 }
示例#12
0
 public static void MakeSurePathExistsWithRetry(this IDirectoryPath path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     Tools.FileUtil.Ops.CreateDirectoryWithRetry(path.ToString());
 }
示例#13
0
        static IEnumerable <string> GetProfilesInternal(IDirectoryPath path, string ext)
        {
            var filenames = Directory.EnumerateFiles(path.ToString(), "*." + ext, SearchOption.AllDirectories);

            return(from filename in filenames
                   where !filename.Contains(".vars.")
                   select Uri.UnescapeDataString(Path.GetFileNameWithoutExtension(filename)));
        }
示例#14
0
        public void Test_BuildDirectoryPath()
        {
            IDirectoryPath path = @".\..\Dir1".ToDirectoryPath();

            Assert.IsTrue(path.IsRelativePath);

            path = @"C:\Dir1\Dir2".ToDirectoryPath();
            Assert.IsTrue(path.IsAbsolutePath);
        }
示例#15
0
        public void Test_InvalidInputPathEmpty()
        {
            Assert.IsFalse((null as string).IsValidAbsoluteDirectoryPath());
            Assert.IsFalse((null as string).IsValidRelativeDirectoryPath());
            Assert.IsFalse(string.Empty.IsValidAbsoluteDirectoryPath());
            Assert.IsFalse(string.Empty.IsValidRelativeDirectoryPath());

            Assert.Throws(typeof(ArgumentException), delegate { IDirectoryPath directoryPath = string.Empty.ToAbsoluteDirectoryPath(); });
        }
示例#16
0
        public void Test_VariablePathBrowsing_DirectoryUntyped()
        {
            IDirectoryPath dir = @"$(Var)\Dir".ToVariableDirectoryPath();

            Assert.IsTrue(dir.GetBrotherDirectoryWithName("MyDir").ToString() == @"$(Var)\MyDir");
            Assert.IsTrue(dir.GetBrotherFileWithName("File.txt").ToString() == @"$(Var)\File.txt");
            Assert.IsTrue(dir.GetChildDirectoryWithName("MyDir").ToString() == @"$(Var)\Dir\MyDir");
            Assert.IsTrue(dir.GetChildFileWithName("File.txt").ToString() == @"$(Var)\Dir\File.txt");
        }
            public IAbsoluteDirectoryPath GetBrotherDirectoryWithName(string directoryName)
            {
                Debug.Assert(directoryName != null);    // Enforced by contract
                Debug.Assert(directoryName.Length > 0); // Enforced by contract
                IDirectoryPath path      = PathBrowsingHelpers.GetBrotherDirectoryWithName(this, directoryName);
                var            pathTyped = path as IAbsoluteDirectoryPath;

                Debug.Assert(pathTyped != null);
                return(pathTyped);
            }
示例#18
0
        public CleanCommand(IMediator mediator) {
            _mediator = mediator;

            IsCommand("clean", "Cleanup packages");
            HasOption("w|workdir=", SynqStrings.WorkDirStr, r => WorkDir = r);
            HasOption("r|repodir=", SynqStrings.RepoDirStr, r => RepoDir = r == null ? null : r.ToDirectoryPath());
            HasOption<int?>("l|limit=", "Limit amount (default 1)", r => Limit = r.HasValue ? r.Value : 1);
            //HasOption("b|bundle", "Bundle instead of Package", c => IsBundle = c != null);
            HasOption("a|all", "All", r => All = r != null);
            AllowsAnyAdditionalArguments("<packagename> [<packagename2> ...]");
        }
示例#19
0
        private string getEventFrom(string _event)
        {
            string eventFrom;

            //IAbsolutePath _eventAbsolutePath = Path.GetFullPath(_event);
            IDirectoryPath _eventAbsolutePath = _event.ToAbsoluteDirectoryPath();

            //var _eventAbsolutePath = _event.ToAbsolutePath();
            eventFrom = _eventAbsolutePath.DirectoryName.Split('_')[0];
            return(eventFrom);
        }
示例#20
0
        public void Test_PathModeOk(string pathString, PathMode pathMode)
        {
            IDirectoryPath path = pathString.ToDirectoryPath();

            Assert.IsFalse(path.IsFilePath);
            Assert.IsTrue(path.IsDirectoryPath);
            Assert.IsTrue(path.PathMode == pathMode);
            Assert.IsTrue(path.IsAbsolutePath == (pathMode == PathMode.Absolute));
            Assert.IsTrue(path.IsRelativePath == (pathMode == PathMode.Relative));
            Assert.IsTrue(path.IsVariablePath == (pathMode == PathMode.Variable));
            Assert.IsTrue(path.IsEnvVarPath == (pathMode == PathMode.EnvVar));
        }
            public bool IsChildOf(IDirectoryPath parentDirectory)
            {
                Debug.Assert(parentDirectory != null);
                string parentPathLowerCase = parentDirectory.ToString().ToLower();
                string thisPathLowerCase   = m_PathString.ToLower();

                // Don't accept equals pathString!
                if (thisPathLowerCase.Length <= parentPathLowerCase.Length)
                {
                    return(false);
                }
                return(thisPathLowerCase.IndexOf(parentPathLowerCase) == 0);
            }
        public void Test_IsValidRelativeDirectoryPath(string str, bool isValidRelativePath)
        {
            Assert.IsTrue(str.IsValidRelativeDirectoryPath() == isValidRelativePath);

            if (!isValidRelativePath)
            {
                bool bThrown = false;
                try {
                    IDirectoryPath directoryPath = str.ToRelativeDirectoryPath();
                }
                catch (ArgumentException) {
                    bThrown = true;
                }
                Assert.IsTrue(bThrown);
            }
        }
示例#23
0
        public void Test_NormalizePath()
        {
            IDirectoryPath path = @".\".ToRelativeDirectoryPath();

            Assert.IsTrue(path.ToString() == ".");

            path = @".\\\".ToRelativeDirectoryPath();
            Assert.IsTrue(path.ToString() == ".");

            path = @".\\\..\\".ToRelativeDirectoryPath();
            Assert.IsTrue(path.ToString() == "..");

            path = @".\/dir1\//\dir2\/dir3///".ToRelativeDirectoryPath();
            Assert.IsTrue(path.ToString() == @".\dir1\dir2\dir3");

            path = "C:/dir1/dir2".ToAbsoluteDirectoryPath();
            Assert.IsTrue(path.ToString() == @"C:\dir1\dir2");
        }
示例#24
0
        public void Test_ParentDirectoryPath()
        {
            IDirectoryPath path = @".\File.txt".ToRelativeFilePath().ParentDirectoryPath;

            Assert.IsTrue(path.ToString() == @".");

            path = @"C:\File.txt".ToAbsoluteFilePath().ParentDirectoryPath;
            Assert.IsTrue(path.ToString() == @"C:");

            path = @".\\File.txt".ToRelativeFilePath().ParentDirectoryPath;
            Assert.IsTrue(path.ToString() == @".");

            path = @"C:\\\\File.txt".ToAbsoluteFilePath().ParentDirectoryPath;
            Assert.IsTrue(path.ToString() == @"C:");

            path = @"C:\dir1\\//dir2\File.txt".ToAbsoluteFilePath().ParentDirectoryPath;
            Assert.IsTrue(path.ToString() == @"C:\dir1\dir2");
        }
示例#25
0
        public void Test_HasParentDir()
        {
            IDirectoryPath path = @".\".ToRelativeDirectoryPath();

            Assert.IsFalse(path.HasParentDirectory);

            path = @".\Dir1".ToRelativeDirectoryPath();
            Assert.IsTrue(path.HasParentDirectory);

            path = @".\Dir1\Dir".ToRelativeDirectoryPath();
            Assert.IsTrue(path.HasParentDirectory);

            path = @"C:\\".ToAbsoluteDirectoryPath();
            Assert.IsFalse(path.HasParentDirectory);

            path = @"C:\Dir1".ToAbsoluteDirectoryPath();
            Assert.IsTrue(path.HasParentDirectory);
        }
         public bool IsChildOf(IDirectoryPath parentDirectory) {
            Debug.Assert(parentDirectory != null);
            var parentDirectoryString = parentDirectory.ToString();

            // Don't accept equals pathString!
            var parentDirectoryStringLength = parentDirectoryString.Length;
            if (m_PathString.Length <= parentDirectoryStringLength) { return false; }

            // Possible since at this point (m_PathString.Length > parentDirectoryStringLength)
            var c = m_PathString[parentDirectoryStringLength];

            // Need to check that char at pos pathStringLength is a separator, 
            // else @"D:/Foo bar" is considered as a child of @"D:/Foo".
            // Note that m_PathString is normalized in ctor, hence its separator(s) are DIR_SEPARATOR_CHAR.
            if (c != MiscHelpers.DIR_SEPARATOR_CHAR) { return false; }

            string parentPathLowerCase = parentDirectory.ToString().ToLower();
            string thisPathLowerCase = m_PathString.ToLower();
            return thisPathLowerCase.IndexOf(parentPathLowerCase) == 0;
         }
示例#27
0
        public IFilePath GetRelativePath(IDirectoryPath relativeDirectoryPath)
        {
            if (!this.IsAbsolutePath)
            {
                return(this);
            }

            relativeDirectoryPath.ThrowArgumentExceptionIfNull(nameof(relativeDirectoryPath));
            if (!relativeDirectoryPath.Value.OrdinalEndsWith(@"\"))
            {
                relativeDirectoryPath = (relativeDirectoryPath.Value + @"\").ToDirectoryPath();
            }

            var relativeDirectoryUri = new Uri(relativeDirectoryPath.Value);
            var fullUri = new Uri(this.Value);

            // 絶対Uriから相対Uriを取得する
            var relativeUri = relativeDirectoryUri.MakeRelativeUri(fullUri);

            // 文字列に変換する
            return(relativeUri.ToString().Replace(@"/", @"\").ToFilePath());
        }
示例#28
0
 public void Test_Error1OnParentDirectoryPath()
 {
     Assert.Throws(typeof(InvalidOperationException), delegate { IDirectoryPath path = @".\".ToRelativeDirectoryPath().ParentDirectoryPath; });
 }
示例#29
0
 public abstract bool IsChildOf(IDirectoryPath parentDirectory);
示例#30
0
 public bool IsChildOf(IDirectoryPath directory)
 {
     throw new NotImplementedException();
 }
示例#31
0
 public bool IsChildOf(IDirectoryPath parentDir)
 {
     Contract.Requires(parentDir != null, "parentDir must not be null");
     throw new NotImplementedException();
 }
示例#32
0
        /// <summary>
        /// Adds an <see cref="IDirectoryPath"/> to the database.
        /// </summary>
        /// <param name="directoryPath">The <see cref="IDirectoryPath"/> to add.</param>
        /// <returns>
        /// Whether or not the path was added to the database. Returns <c>false</c> if the path existed already.
        /// </returns>
        private async Task<bool> AddPathAsync(IDirectoryPath directoryPath)
        {
            if (!dbConnection.IsInitialized)
            {
                await dbConnection.InitializeAsync();
            }

            var storedModel = await dbConnection.FindAsync<DirectoryPath>(dPath => dPath.Path == directoryPath.Path);
            if (storedModel != null)
            {
                return false;
            }

            await dbConnection.InsertAsync(directoryPath);
            return true;
        }
示例#33
0
 public void Test_IncoherentPathModeException1()
 {
     Assert.IsFalse(".".IsValidAbsoluteDirectoryPath());
     Assert.Throws(typeof(ArgumentException), delegate { IDirectoryPath directoryPath = ".".ToAbsoluteDirectoryPath(); });
 }
 public IEnumerable<IDebugState> GetDebugStates(string serverWebUri, IDirectoryPath directory, IFilePath path)
 {
     yield break;
 }
示例#35
0
        /// <summary>
        /// 5. Generate the stored procedures and 
        /// save the scripts and mappings files in the selected paths location.
        /// </summary>
        /// <param name="path"></param>
        public void SaveScripts(string dasPath)
        {
            try
               {
                    _dp = _df.MakeDirectoryPath();

                    if(_dp == null)
                         throw new Exception("No Directory Path settled.");

                    //generate concurrency code
                    ConcurrencySupportCodeString[] _concurrencyCode = _db.GenerateConcurrencySupportCode();

                    //Generate SPROCS
                    StoreProcedureStream[] _sprocs = _db.GenerateSProcs();

                    if (_concurrencyCode != null)
                    {     //save support code for concurrency
                         _dp.SaveConcurrencySupportCode(_concurrencyCode,dasPath,"ConcurrencySupport.sql");
                    }
                    if (_sprocs != null)
                    {                         //save sprocs in the saved path
                         _dp.SaveSProcsToFile(_sprocs,dasPath,"DALScript.sql");

                         //save mappings file. Who is responsible? DirectoryPath
                    _dp.SaveMappingsToFile(_sprocs, dasPath, "mappings.xml");
                    }
               }
               catch (Exception ex) {Debug.Write(ex.Message); }
        }
示例#36
0
 public static IEnumerable <IAbsoluteFilePath> GetFiles(this IDirectoryPath path,
                                                        IEnumerable <string> searchPatterns,
                                                        SearchOption searchOption = SearchOption.TopDirectoryOnly)
 => GetFiles(path.ToString(), searchPatterns, searchOption).Select(x => x.ToAbsoluteFilePath());
示例#37
0
 public IEnumerable <IDebugState> GetDebugStates(string serverWebUri, IDirectoryPath directory, IFilePath path)
 {
     yield break;
 }
示例#38
0
 ///<summary>
 ///Try get a new <see cref="IDirectoryPath"/> object from this string.
 ///</summary>
 ///<returns><i>true</i> if <paramref name="pathString"/> is a valid directory path and as a consequence, the returned <paramref name="directoryPath"/> is not null.</returns>
 ///<remarks>The path represented by this string doesn't need to exist for this operation to complete properly.</remarks>
 ///<param name="pathString">Represents the path.</param>
 ///<param name="directoryPath">If this method returns <i>true</i>, this is the returned path object.</param>
 public static bool TryGetDirectoryPath(this string pathString, out IDirectoryPath directoryPath) {
    string failureReasonUnused;
    return pathString.TryGetDirectoryPath(out directoryPath, out failureReasonUnused);
 }
示例#39
0
      ///<summary>
      ///Try get a new <see cref="IDirectoryPath"/> object from this string.
      ///</summary>
      ///<returns><i>true</i> if <paramref name="pathString"/> is a valid directory path and as a consequence, the returned <paramref name="directoryPath"/> is not null.</returns>
      ///<remarks>The path represented by this string doesn't need to exist for this operation to complete properly.</remarks>
      ///<param name="pathString">Represents the path.</param>
      ///<param name="directoryPath">If this method returns <i>true</i>, this is the returned path object.</param>
      ///<param name="failureReason">If this method returns <i>false</i>, this is the plain english description of the failure.</param>
      public static bool TryGetDirectoryPath(this string pathString, out IDirectoryPath directoryPath, out string failureReason) {
         directoryPath = null;
         if (pathString.IsPathStringNullOrEmpty(out failureReason)) { return false; }

         if (pathString.IsValidAbsoluteDirectoryPath()) {
            directoryPath = pathString.ToAbsoluteDirectoryPath();
            return true;
         }
         if (pathString.IsValidRelativeDirectoryPath()) {
            directoryPath = pathString.ToRelativeDirectoryPath();
            return true;
         }
         if (pathString.IsValidEnvVarDirectoryPath()) {
            directoryPath = pathString.ToEnvVarDirectoryPath();
            return true;
         }
         if (pathString.IsValidVariableDirectoryPath()) {
            directoryPath = pathString.ToVariableDirectoryPath();
            return true;
         }

         
         var b = pathString.IsValidDirectoryPath(out failureReason);
         Debug.Assert(!b);
         failureReason = @"The parameter pathString is not a valid directory path.
" + failureReason;
         return false;
      }
示例#40
0
		/// <summary>
		///     Try get a new <see cref="IDirectoryPath" /> object from this string.
		/// </summary>
		/// <returns>
		///     <i>true</i> if <paramref name="path" /> is a valid directory path and as a consequence, the returned <paramref name="directoryPath" />
		///     is not null.
		/// </returns>
		/// <remarks>The path represented by this string doesn't need to exist for this operation to complete properly.</remarks>
		/// <param name="path">Represents the path.</param>
		/// <param name="directoryPath">If this method returns <i>true</i>, this is the returned path object.</param>
		public static bool TryGetDirectoryPath(this string path, out IDirectoryPath directoryPath)
		{
			string failureMessage;

			return path.TryGetDirectoryPath(out directoryPath, out failureMessage);
		}
示例#41
0
		/// <summary>
		///     Try get a new <see cref="IDirectoryPath" /> object from this string.
		/// </summary>
		/// <returns>
		///     <i>true</i> if <paramref name="path" /> is a valid directory path and as a consequence, the returned <paramref name="directoryPath" />
		///     is not null.
		/// </returns>
		/// <remarks>The path represented by this string doesn't need to exist for this operation to complete properly.</remarks>
		/// <param name="path">Represents the path.</param>
		/// <param name="directoryPath">If this method returns <i>true</i>, this is the returned path object.</param>
		/// <param name="failureMessage">If this method returns <i>false</i>, this is the plain english description of the failure.</param>
		public static bool TryGetDirectoryPath(this string path, out IDirectoryPath directoryPath, out string failureMessage)
		{
			directoryPath = null;

			if (IsNullOrEmpty(() => path, out failureMessage))
			{
				return false;
			}

			if (path.IsValidAbsoluteDirectoryPath())
			{
				directoryPath = path.ToAbsoluteDirectoryPath();
				return true;
			}

			if (path.IsValidRelativeDirectoryPath())
			{
				directoryPath = path.ToRelativeDirectoryPath();
				return true;
			}

			if (path.IsValidEnvVarDirectoryPath())
			{
				directoryPath = path.ToEnvVarDirectoryPath();
				return true;
			}

			if (path.IsValidVariableDirectoryPath())
			{
				directoryPath = path.ToVariableDirectoryPath();
				return true;
			}

			path.IsValidDirectoryPath(out failureMessage);

			failureMessage = $@"The parameter pathString is not a valid directory path.{Environment.NewLine}{failureMessage}";

			return false;
		}
示例#42
0
 public abstract bool IsChildOf(IDirectoryPath parentDirectory);
示例#43
0
 public void Test_Error2OnParentDirectoryPath()
 {
     Assert.Throws(typeof(InvalidOperationException), delegate { IDirectoryPath path = @"C:\".ToAbsoluteDirectoryPath().ParentDirectoryPath; });
 }
        public IAbsolutePath PrependPath(IDirectoryPath basePath)
        {
            var fullPath = Path.Combine(basePath.ToStringRepresentation(), pathString);

            return(new AbsoluteDirectoryPath(fullPath));
        }
示例#45
0
 public void Test_InvalidInputPathNull()
 {
     Assert.Throws(typeof(ArgumentNullException), delegate { IDirectoryPath directoryPath = PathHelpers.ToAbsoluteDirectoryPath(null); });
 }