コード例 #1
0
        public static string GetOutputFilePath(string inputFilePath)
        {
            try
            {
                if (Globals.ObfuscateFileNames)
                {
                    ObfuscateFileName.AppendFileName(inputFilePath);
                    inputFilePath = ObfuscateFileName.ReplaceFilePath(inputFilePath);
                }
            }
            catch (Exception ex) when(ExceptionFilters.FileAccess(ex) || ex is EncoderFallbackException)
            {
                DisplayMessage.FilePathException(inputFilePath, ex.GetType().Name, "Unable to store file name.");
            }
            string outputFilePath = inputFilePath + Constants.EncryptedExtension;

            return(FileHandling.GetUniqueFilePath(outputFilePath));
        }
コード例 #2
0
 public static void RenameFile(string inputFilePath, string outputFilePath, int fileNameLength)
 {
     try
     {
         if (fileNameLength == 0)
         {
             return;
         }
         Globals.ObfuscateFileNames = true;
         string originalFileName   = ReadFileName(outputFilePath, fileNameLength);
         string obfuscatedFileName = Path.GetFileName(outputFilePath);
         string restoredFilePath   = outputFilePath.Replace(obfuscatedFileName, originalFileName);
         restoredFilePath = FileHandling.GetUniqueFilePath(restoredFilePath);
         File.Move(outputFilePath, restoredFilePath);
         DisplayMessage.FileEncryptionResult(inputFilePath, restoredFilePath);
     }
     catch (Exception ex) when(ExceptionFilters.FileAccess(ex))
     {
         DisplayMessage.FilePathException(outputFilePath, ex.GetType().Name, "Unable to restore the original file name.");
     }
 }
コード例 #3
0
        public static string GetOutputFilePath(string inputFilePath)
        {
            string outputFilePath = inputFilePath.Replace(Constants.EncryptedExtension, string.Empty);

            return(FileHandling.GetUniqueFilePath(outputFilePath));
        }