private void DoWork() { if (File.Exists(Path)) { bool overWriteApproved = false; if (Overwrite) { if (Quiet || Util.WarnConfirm($"A file already exists at the path {Path.InQuotes()}. Is it OK to overwrite it?", Constants.Affirm)) { overWriteApproved = true; } } if (!overWriteApproved) { throw new X509CryptoException($"A file already exists at the path {Path.InQuotes()}. Set {nameof(Overwrite)} = {PoshSyntax.True} in order to enable overwriting."); } } Alias.Export(ref path, includeCert: true, Overwrite); Util.ConsoleMessage($"{nameof(X509Alias)} aliasName was successfully exported to file {Path.InQuotes()}"); Result = new FileInfo(Path); }