update: parse UTF-8 to lib in C#

This commit is contained in:
TaurusXin 2024-04-06 12:10:56 +08:00
parent 321e5f342e
commit 8a13d0fe07
Signed by: taurusxin
GPG Key ID: C334DCA04AC2D2CC
1 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,13 @@ namespace libncmdump_demo_cli
/// <param name="FileName">网易云音乐 ncm 加密文件路径</param> /// <param name="FileName">网易云音乐 ncm 加密文件路径</param>
public NeteaseCrypt(string FileName) public NeteaseCrypt(string FileName)
{ {
NeteaseCryptClass = CreateNeteaseCrypt(Marshal.StringToHGlobalAnsi(FileName)); byte[] bytes = Encoding.UTF8.GetBytes(FileName);
IntPtr inputPtr = Marshal.AllocHGlobal(bytes.Length + 1);
Marshal.Copy(bytes, 0, inputPtr, bytes.Length);
Marshal.WriteByte(inputPtr, bytes.Length, 0);
NeteaseCryptClass = CreateNeteaseCrypt(inputPtr);
} }
/// <summary> /// <summary>