FAES/Utilities/FileAES_IntUtilities.cs
/// <summary>
/// Creates the various paths required when encrypting a file
/// </summary>
/// <param name="file">FAES File to encrypt</param>
/// <param name="compressionType">Compression Type</param>
/// <param name="tempRawPath">Raw temp filepath</param>
/// <param name="tempRawFile">Raw filepath for file</param>
/// <param name="tempOutputPath">Raw output filepath</param>
Creates the various paths required when encrypting a file
Creates the various paths required when encrypting a file
internal static void CreateEncryptionFilePath(FAES_File file, string compressionType, out string tempRawPath, out string tempRawFile, out string tempOutputPath)
        {
            string tempPath;
            if (FileAES_Utilities.LocalEncrypt)
                tempPath = FileAES_IntUtilities.CreateTempPath(file, FileAES_IntUtilities.CreateLocalTempPath(file), compressionType + "_Compress-" + FileAES_IntUtilities.GetUnixTime(), true);
            else
                tempPath = FileAES_IntUtilities.CreateTempPath(file, FileAES_Utilities.GetFaesTempFolder(), compressionType + "_Compress-" + FileAES_IntUtilities.GetUnixTime());
            tempRawPath = Path.Combine(tempPath, "contents");
            tempRawFile = Path.Combine(tempRawPath, file.GetFileName());
            tempOutputPath = Path.Combine(Directory.GetParent(tempPath)?.FullName ?? throw new InvalidOperationException("An unexpected error occurred when creating an encryption path!"), Path.ChangeExtension(file.GetFileName(), FileAES_Utilities.ExtentionUFAES));
            if (!Directory.Exists(tempRawPath))
                Directory.CreateDirectory(tempRawPath);
            if (file.IsFile())
                File.Copy(file.GetPath(), tempRawFile);
            else
                FileAES_IntUtilities.DirectoryCopy(file.GetPath(), tempRawPath);
        }
internal static void CreateEncryptionFilePath ( FAES_File file , string compressionType , out string tempRawPath , out string tempRawFile , out string tempOutputPath ) { string tempPath ; if ( FileAES_Utilities . LocalEncrypt ) tempPath = FileAES_IntUtilities . CreateTempPath ( file , FileAES_IntUtilities . CreateLocalTempPath ( file ) , compressionType + " " + FileAES_IntUtilities . GetUnixTime ( ) , true ) ; else tempPath = FileAES_IntUtilities . CreateTempPath ( file , FileAES_Utilities . GetFaesTempFolder ( ) , compressionType + " " + FileAES_IntUtilities . GetUnixTime ( ) ) ; tempRawPath = Path . Combine ( tempPath , " " ) ; tempRawFile = Path . Combine ( tempRawPath , file . GetFileName ( ) ) ; tempOutputPath = Path . Combine ( Directory . GetParent ( tempPath ) ? . FullName ?? throw new InvalidOperationException ( " " ) , Path . ChangeExtension ( file . GetFileName ( ) , FileAES_Utilities . ExtentionUFAES ) ) ; if ( ! Directory . Exists ( tempRawPath ) ) Directory . CreateDirectory ( tempRawPath ) ; if ( file . IsFile ( ) ) File . Copy ( file . GetPath ( ) , tempRawFile ) ; else FileAES_IntUtilities . DirectoryCopy ( file . GetPath ( ) , tempRawPath ) ; }
Creates the various paths required when encrypting a file
Creates the various paths required when encrypting a file
file
FAES_File
FAES File to encrypt
FAES File to encrypt
compressionType
string
None
string
out
tempRawPath
Raw temp filepath
Raw temp filepath
tempRawFile
Raw filepath for file
Raw filepath for file
tempOutputPath
Raw output filepath
Raw output filepath