public static void RestoreDirectoryName(string folderPath)
 {
     try
     {
         NullChecks.Strings(folderPath);
         string anonymisedDirectoryName = Path.GetFileName(folderPath);
         // Get the path where the original directory name is stored
         string storageFileName = $"{anonymisedDirectoryName}.txt";
         string storageFilePath = Path.Combine(folderPath, storageFileName);
         if (File.Exists(storageFilePath))
         {
             string originalDirectoryName = File.ReadAllText(storageFilePath);
             string originalDirectoryPath = folderPath.Replace(anonymisedDirectoryName, originalDirectoryName);
             Directory.Move(folderPath, originalDirectoryPath);
             storageFilePath = Path.Combine(originalDirectoryPath, storageFileName);
             if (File.Exists(storageFilePath))
             {
                 File.Delete(storageFilePath);
             }
         }
     }
     catch (Exception ex) when(ExceptionFilters.FileAccessExceptions(ex))
     {
         Logging.LogException(ex.ToString(), Logging.Severity.High);
         DisplayMessage.ErrorResultsText(folderPath, ex.GetType().Name, "Unable to restore original directory name.");
     }
 }
 public static string GetAnonymousFileName(string filePath)
 {
     try
     {
         NullChecks.Strings(filePath);
         string originalFileName  = Path.GetFileName(filePath);
         string randomFileName    = GenerateRandomFileName();
         string anonymousFilePath = filePath.Replace(originalFileName, randomFileName);
         return(anonymousFilePath);
     }
     catch (ArgumentException ex)
     {
         Logging.LogException(ex.ToString(), Logging.Severity.Bug);
         DisplayMessage.ErrorResultsText(filePath, ex.GetType().Name, "Unable to get anonymous file name. This is a bug - please report it.");
         return(filePath);
     }
 }