예제 #1
0
        public void ChangeCurrentDirectoryAbsolute(string absolutePath)
        {
            if (!Directory.Exists(absolutePath))
            {
                throw new InvalidPathException();
            }

            SessionData.ChangeCurrentDirectoryPath(absolutePath);
        }
예제 #2
0
 public void ChangeCurrentDirectoryRelative(string relativePath)
 {
     if (relativePath == "..")
     {
         try
         {
             string currentPath      = SessionData.GetCurrentDirectoryPath();
             int    indexOfLastSlash = currentPath.LastIndexOf("\\");
             string newPath          = currentPath.Substring(0, indexOfLastSlash);
             SessionData.ChangeCurrentDirectoryPath(newPath);
         }
         catch (ArgumentOutOfRangeException)
         {
             throw new ArgumentOutOfRangeException("indexOfLastSlash", ExceptionMessages.UnableToGoHigherInPartitionHierarchy);
         }
     }
     else
     {
         string currentPath = SessionData.GetCurrentDirectoryPath();
         currentPath += "\\" + relativePath;
         ChangeCurrentDirectoryAbsolute(currentPath);
     }
 }