Ejemplo n.º 1
0
        private void DoWork()
        {
            int wipeTimesToWrite = 0;

            if (!outputSet)
            {
                output = $"{Path}{FileExtensions.Ciphertext}";
            }
            Util.CheckForExistingFile(Output, Overwrite, nameof(Overwrite), PoshSyntax.True);

            if (Erase > 0)
            {
                if (Quiet || Util.WarnConfirm($"You have included the {nameof(Erase).InQuotes()} argument. This will permanently delete the file {Path.InQuotes()} from disk.", Constants.Affirm))
                {
                    wipeTimesToWrite = Erase;
                }
            }

            Alias.EncryptFile(Path, Output, wipeTimesToWrite);
            StringBuilder Expression = new StringBuilder($"The file {Path.InQuotes()} was successfully encrypted. The ciphertext file name is {Output.InQuotes()}");

            if (wipeTimesToWrite > 0)
            {
                Expression.Append($"\r\nThe plaintext file has also been erased from disk");
            }
            Console.WriteLine($"\r\n{Expression}\r\n");

            Result = new FileInfo(Output);
        }