mirror of
https://github.com/SabreTools/NDecrypt.git
synced 2026-02-04 05:35:53 +00:00
More prep for a better future
This commit is contained in:
@@ -21,7 +21,7 @@ namespace NDecrypt.Core
|
||||
#region Encrypt
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool EncryptFile(string input, bool force)
|
||||
public bool EncryptFile(string input, string? output, bool force)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace NDecrypt.Core
|
||||
#region Decrypt
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool DecryptFile(string input, bool force)
|
||||
public bool DecryptFile(string input, string? output, bool force)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -6,17 +6,21 @@
|
||||
/// Attempts to encrypt an input file
|
||||
/// </summary>
|
||||
/// <param name="input">Name of the file to encrypt</param>
|
||||
/// <param name="output">Optional name of the file to write to</param>
|
||||
/// <param name="force">Indicates if the operation should be forced</param>
|
||||
/// <returns>True if the file could be encrypted, false otherwise</returns>
|
||||
bool EncryptFile(string input, bool force);
|
||||
/// <remarks>If an output filename is not provided, the input file will be overwritten</remarks>
|
||||
bool EncryptFile(string input, string? output, bool force);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to decrypt an input file
|
||||
/// </summary>
|
||||
/// <param name="input">Name of the file to decrypt</param>
|
||||
/// <param name="output">Optional name of the file to write to</param>
|
||||
/// <param name="force">Indicates if the operation should be forced</param>
|
||||
/// <returns>True if the file could be decrypted, false otherwise</returns>
|
||||
bool DecryptFile(string input, bool force);
|
||||
/// <remarks>If an output filename is not provided, the input file will be overwritten</remarks>
|
||||
bool DecryptFile(string input, string? output, bool force);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get information on an input file
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace NDecrypt.Core
|
||||
#region Decrypt
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool DecryptFile(string input, bool force)
|
||||
public bool DecryptFile(string input, string? output, bool force)
|
||||
{
|
||||
// Ensure the constants are all set
|
||||
if (_decryptArgs.IsReady != true)
|
||||
@@ -448,7 +448,7 @@ namespace NDecrypt.Core
|
||||
#region Encrypt
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool EncryptFile(string input, bool force)
|
||||
public bool EncryptFile(string input, string? output, bool force)
|
||||
{
|
||||
// Ensure the constants are all set
|
||||
if (_decryptArgs.IsReady != true)
|
||||
|
||||
@@ -67,13 +67,18 @@ namespace NDecrypt
|
||||
|
||||
Console.WriteLine($"Processing {path}");
|
||||
|
||||
// TODO: Determine how separate output files should be named
|
||||
// - Consider using something like `.enc` and `.dec` appended/replaced
|
||||
// - Needs a new flag to enable not overwriting
|
||||
// - Maybe make overwriting an option and new file be default?
|
||||
|
||||
// Encrypt or decrypt the file as requested
|
||||
if (feature == Feature.Encrypt && !tool.EncryptFile(path, force))
|
||||
if (feature == Feature.Encrypt && !tool.EncryptFile(path, null, force))
|
||||
{
|
||||
Console.WriteLine("Encryption failed!");
|
||||
return;
|
||||
}
|
||||
else if (feature == Feature.Decrypt && !tool.DecryptFile(path, force))
|
||||
else if (feature == Feature.Decrypt && !tool.DecryptFile(path, null, force))
|
||||
{
|
||||
Console.WriteLine("Decryption failed!");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user