diff --git a/NDecrypt.Core/DSTool.cs b/NDecrypt.Core/DSTool.cs
index c391bf7..7489b64 100644
--- a/NDecrypt.Core/DSTool.cs
+++ b/NDecrypt.Core/DSTool.cs
@@ -585,6 +585,17 @@ namespace NDecrypt.Core
#endregion
+ #region Info
+
+ ///
+ public string? GetInformation(string filename)
+ {
+ // TODO: Get decryption status
+ return null;
+ }
+
+ #endregion
+
#region Common
///
diff --git a/NDecrypt.Core/ITool.cs b/NDecrypt.Core/ITool.cs
index ee526a8..b9a3391 100644
--- a/NDecrypt.Core/ITool.cs
+++ b/NDecrypt.Core/ITool.cs
@@ -17,5 +17,12 @@
/// Indicates if the operation should be forced
/// True if the file could be decrypted, false otherwise
bool DecryptFile(string filename, bool force);
+
+ ///
+ /// Attempts to get information on an input file
+ ///
+ /// Name of the file get information on
+ /// String representing the info, null on error
+ string? GetInformation(string filename);
}
}
diff --git a/NDecrypt.Core/ThreeDSTool.cs b/NDecrypt.Core/ThreeDSTool.cs
index 2a7a0a0..66272ad 100644
--- a/NDecrypt.Core/ThreeDSTool.cs
+++ b/NDecrypt.Core/ThreeDSTool.cs
@@ -31,41 +31,7 @@ namespace NDecrypt.Core
_decryptArgs = decryptArgs;
}
- ///
- public bool EncryptFile(string filename, bool force)
- {
- // Ensure the constants are all set
- if (_decryptArgs.IsReady != true)
- {
- Console.WriteLine("Could not read keys. Please make sure the file exists and try again.");
- return false;
- }
-
- try
- {
- // Open the read and write on the same file for inplace processing
- using var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
- using var output = File.Open(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
-
- // Deserialize the cart information
- var cart = N3DS.Create(input);
- if (cart?.Model == null)
- {
- Console.WriteLine("Error: Not a 3DS cart image!");
- return false;
- }
-
- // Encrypt all 8 NCCH partitions
- EncryptAllPartitions(cart, force, input, output);
- return true;
- }
- catch
- {
- Console.WriteLine($"An error has occurred. {filename} may be corrupted if it was partially processed.");
- Console.WriteLine("Please check that the file was a valid 3DS or New 3DS cart image and try again.");
- return false;
- }
- }
+ #region Decrypt
///
public bool DecryptFile(string filename, bool force)
@@ -103,8 +69,6 @@ namespace NDecrypt.Core
}
}
- #region Decrypt
-
///
/// Decrypt all partitions in the partition table of an NCSD header
///
@@ -478,6 +442,42 @@ namespace NDecrypt.Core
#region Encrypt
+ ///
+ public bool EncryptFile(string filename, bool force)
+ {
+ // Ensure the constants are all set
+ if (_decryptArgs.IsReady != true)
+ {
+ Console.WriteLine("Could not read keys. Please make sure the file exists and try again.");
+ return false;
+ }
+
+ try
+ {
+ // Open the read and write on the same file for inplace processing
+ using var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ using var output = File.Open(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
+
+ // Deserialize the cart information
+ var cart = N3DS.Create(input);
+ if (cart?.Model == null)
+ {
+ Console.WriteLine("Error: Not a 3DS cart image!");
+ return false;
+ }
+
+ // Encrypt all 8 NCCH partitions
+ EncryptAllPartitions(cart, force, input, output);
+ return true;
+ }
+ catch
+ {
+ Console.WriteLine($"An error has occurred. {filename} may be corrupted if it was partially processed.");
+ Console.WriteLine("Please check that the file was a valid 3DS or New 3DS cart image and try again.");
+ return false;
+ }
+ }
+
///
/// Encrypt all partitions in the partition table of an NCSD header
///
@@ -871,5 +871,16 @@ namespace NDecrypt.Core
}
#endregion
+
+ #region Info
+
+ ///
+ public string? GetInformation(string filename)
+ {
+ // TODO: Get decryption status
+ return null;
+ }
+
+ #endregion
}
}
diff --git a/NDecrypt/Program.cs b/NDecrypt/Program.cs
index 183f0fd..addb493 100644
--- a/NDecrypt/Program.cs
+++ b/NDecrypt/Program.cs
@@ -152,7 +152,10 @@ namespace NDecrypt
}
else if (feature == Feature.Info)
{
- Console.WriteLine("Feature 'INFO' is not implemented");
+ string? infoString = tool.GetInformation(path);
+ infoString ??= "There was a problem getting file information!";
+
+ Console.WriteLine(infoString);
return;
}