feat: allow sepecify output dir; process dir recursively
use cxxopts library to parse command line options
This commit is contained in:
@@ -14,7 +14,7 @@ namespace libncmdump_demo_cli
|
||||
private static extern IntPtr CreateNeteaseCrypt(IntPtr path);
|
||||
|
||||
[DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int Dump(IntPtr NeteaseCrypt);
|
||||
private static extern int Dump(IntPtr NeteaseCrypt, IntPtr outputPath);
|
||||
|
||||
[DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void FixMetadata(IntPtr NeteaseCrypt);
|
||||
@@ -42,10 +42,17 @@ namespace libncmdump_demo_cli
|
||||
/// <summary>
|
||||
/// 启动转换过程。
|
||||
/// </summary>
|
||||
/// <param name="OutputPath">指定一个路径输出,如果为空,则输出到原路径</param>
|
||||
/// <returns>返回一个整数,指示转储过程的结果。如果成功,返回0;如果失败,返回1。</returns>
|
||||
public int Dump()
|
||||
public int Dump(string OutputPath)
|
||||
{
|
||||
return Dump(NeteaseCryptClass);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(OutputPath);
|
||||
|
||||
IntPtr outputPtr = Marshal.AllocHGlobal(bytes.Length + 1);
|
||||
Marshal.Copy(bytes, 0, outputPtr, bytes.Length);
|
||||
Marshal.WriteByte(outputPtr, bytes.Length, 0);
|
||||
|
||||
return Dump(NeteaseCryptClass, outputPtr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace libncmdump_demo_cli
|
||||
NeteaseCrypt neteaseCrypt = new NeteaseCrypt(filePath);
|
||||
|
||||
// 启动转换过程
|
||||
int result = neteaseCrypt.Dump();
|
||||
int result = neteaseCrypt.Dump(""); // 为空则输出到源
|
||||
|
||||
// 修复元数据
|
||||
neteaseCrypt.FixMetadata();
|
||||
|
||||
Reference in New Issue
Block a user