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

            if (!outputSet)
            {
                Output = Util.GetPlaintextFilename(Path);
            }
            Util.CheckForExistingFile(Output, Overwrite, nameof(Overwrite), PoshSyntax.True);

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

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

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

            Result = new FileInfo(Output);
        }