public static bool SearchMusicByName_Inside(IntPtr SearchArgPtr, IntPtr testptr) { //Console.WriteLine("SearchArgPtr:{0:X}", SearchArgPtr); var api = new QQMusicAPI(); var searchArg = Marshal.PtrToStructure <ANative_SearchArg>(SearchArgPtr); try { SearchResult result = api.SearchAsync(searchArg).Result; int offset = 0; SearchResultExtend.WriteTo(result, testptr, ref offset); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(false); } }
public static bool DownloadMusic_Inside(IntPtr Native_SongItemPtr, EnumFileType type, IntPtr dirPtr, int dirlength) { try { Native_SongItem nsi = Marshal.PtrToStructure <Native_SongItem>(Native_SongItemPtr); string dir = null; unsafe { dir = new string((char *)dirPtr.ToPointer(), 0, dirlength); } Console.WriteLine($"准备下载{nsi.name.RemoveUnicodeEnd()}到{dir}"); //转换 ISongItem si = SearchResultExtend.ToSongItem(nsi); var api = new QQMusicAPI(); api.downloadSongAsync(si, dir, type).Wait(); api.downloadLyricAsync(si, dir).Wait(); return(true); } catch (Exception ex) { Console.WriteLine(ex); return(false); } }