taurusxin / ncmdump

转换网易云音乐 ncm 到 mp3 / flac. Convert Netease Cloud Music ncm files to mp3/flac files.
MIT License
1.04k stars 168 forks source link

能否发布32位的DLL #14

Closed TheMyceliumOfAntan closed 7 months ago

TheMyceliumOfAntan commented 7 months ago

您好,我对您的项目很满意也很需要,但我在制作GUI时因为使用了很老的架构导致只能支持x86而不支持x64,能否发布一个32位版本的DLL

taurusxin commented 7 months ago

已经上传至1.2.1 Release,请注意如果使用C#调用,则需要修改包装类如下代码所示,并启用C调用约定模式。

    /// <summary>
    /// NeteaseCrypt C# Wrapper
    /// </summary>
    class NeteaseCrypt
    {
        const string DLL_PATH = "libncmdump.dll";

        [DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
        private static extern IntPtr CreateNeteaseCrypt(IntPtr path);

        [DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
        private static extern int Dump(IntPtr NeteaseCrypt);

        [DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
        private static extern void FixMetadata(IntPtr NeteaseCrypt);

        [DllImport(DLL_PATH, CallingConvention = CallingConvention.Cdecl)]
        private static extern void DestroyNeteaseCrypt(IntPtr NeteaseCrypt);

        private IntPtr NeteaseCryptClass = IntPtr.Zero;

        /// <summary>
        /// 创建 NeteaseCrypt 类的实例。
        /// </summary>
        /// <param name="FileName">网易云音乐 ncm 加密文件路径</param>
        public NeteaseCrypt(string FileName)
        {
            NeteaseCryptClass = CreateNeteaseCrypt(Marshal.StringToHGlobalAuto(FileName));
        }

        /// <summary>
        /// 启动转换过程。
        /// </summary>
        /// <returns>返回一个整数,指示转储过程的结果。如果成功,返回0;如果失败,返回1。</returns>
        public int Dump()
        {
            return Dump(NeteaseCryptClass);
        }

        /// <summary>
        /// 修复音乐文件元数据。
        /// </summary>
        public void FixMetadata()
        {
            FixMetadata(NeteaseCryptClass);
        }
    }