Exemplo n.º 1
0
        public static void ShredSelectedFiles(BackgroundWorker bgwShredFiles)
        {
            int progress = 0;

            Globals.SuccessfulCount = 0;
            Globals.TotalCount      = Globals.GetSelectedFiles().Count;
            // Use XChaCha20 - store current setting
            int selectedCipher = Globals.EncryptionAlgorithm;

            Globals.EncryptionAlgorithm = (int)Cipher.XChaCha20;
            foreach (string filePath in Globals.GetSelectedFiles())
            {
                bool?directory = FileHandling.IsDirectory(filePath);
                if (directory != null)
                {
                    if (directory == false)
                    {
                        CallShredFilesMethod(filePath, ref progress, bgwShredFiles);
                    }
                    else
                    {
                        ShredDirectory(filePath, ref progress, bgwShredFiles);
                    }
                }
            }
            // Restore encryption algorithm setting
            Globals.EncryptionAlgorithm = selectedCipher;
        }
Exemplo n.º 2
0
        public static void GetFilePaths(bool encryption, byte[] passwordBytes, BackgroundWorker backgroundWorker)
        {
            int progress = 0;

            Globals.SuccessfulCount = 0;
            Globals.TotalCount      = Globals.GetSelectedFiles().Count;
            foreach (string filePath in Globals.GetSelectedFiles())
            {
                bool?fileIsDirectory = FileHandling.IsDirectory(filePath);
                if (fileIsDirectory != null)
                {
                    if (fileIsDirectory == false)
                    {
                        CallEncryption(encryption, filePath, passwordBytes, ref progress, backgroundWorker);
                    }
                    else
                    {
                        DirectoryEncryption(encryption, filePath, passwordBytes, ref progress, backgroundWorker);
                    }
                }
            }
        }