FAES/Packaging/Compressors/GZIP.cs
/// <summary>
/// Decompress an encrypted FAES File.
/// </summary>
/// <param name="encryptedFile">Encrypted FAES File</param>
/// <param name="percentComplete">Percent complete for decompression</param>
/// <param name="overridePath">Override the read path</param>
/// <returns>Path of the encrypted, Decompressed file</returns>
Decompress an encrypted FAES File.
Decompress an encrypted FAES File .
public string DecompressFAESFile(FAES_File encryptedFile, ref decimal percentComplete, string overridePath = "")
        {
            string path;
            path = !String.IsNullOrWhiteSpace(overridePath) ? overridePath : Path.ChangeExtension(encryptedFile.GetPath(), FileAES_Utilities.ExtentionUFAES);
            using (Stream stream = File.OpenRead(path))
            {
                var reader = ReaderFactory.Open(stream);
                while (reader.MoveToNextEntry())
                {
                    try
                    {
                        percentComplete = Math.Ceiling((decimal)((Convert.ToDouble(stream.Position) / Convert.ToDouble(stream.Length)) * 100));
                        if (percentComplete > 100) percentComplete = 100;
                    }
                    catch (Exception)
                    {
                        percentComplete = 100;
                    }
                    reader.WriteEntryToDirectory(Directory.GetParent(Path.ChangeExtension(path, Path.GetExtension(encryptedFile.GetOriginalFileName())))?.FullName, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
                }
            }
            return path;
        }
public string DecompressFAESFile ( FAES_File encryptedFile , ref decimal percentComplete , string overridePath = " " ) { string path ; path = ! String . IsNullOrWhiteSpace ( overridePath ) ? overridePath : Path . ChangeExtension ( encryptedFile . GetPath ( ) , FileAES_Utilities . ExtentionUFAES ) ; using ( Stream stream = File . OpenRead ( path ) ) { var reader = ReaderFactory . Open ( stream ) ; while ( reader . MoveToNextEntry ( ) ) { try { percentComplete = Math . Ceiling ( ( decimal ) ( ( Convert . ToDouble ( stream . Position ) / Convert . ToDouble ( stream . Length ) ) * 100 ) ) ; if ( percentComplete > 100 ) percentComplete = 100 ; } catch ( Exception ) { percentComplete = 100 ; } reader . WriteEntryToDirectory ( Directory . GetParent ( Path . ChangeExtension ( path , Path . GetExtension ( encryptedFile . GetOriginalFileName ( ) ) ) ) ? . FullName , new ExtractionOptions ( ) { ExtractFullPath = true , Overwrite = true } ) ; } } return path ; }
Decompress an encrypted FAES File.
Decompress an encrypted FAES File .
Path of the encrypted, Decompressed file
Path of the encrypted Decompressed file
encryptedFile
FAES_File
Encrypted FAES File
Encrypted FAES File
decimal
ref
overridePath
string
Override the read path
Override the read path
percentComplete
Percent complete for decompression
Percent complete for decompression