private extern static int zplay_LoadID3ExW(uint objptr, ref TID3InfoEx_Internal pId3Info, int fDecodeEmbededPicture);
private extern static int zplay_LoadFileID3ExW(uint objptr, [MarshalAs(UnmanagedType.LPWStr)] string pchFileName, int nFormat, ref TID3InfoEx_Internal pId3Info, int fDecodeEmbededPicture);
public bool LoadFileID3Ex(string FileName, TStreamFormat Format, ref TID3InfoEx Info, bool fDecodePicture) { TID3InfoEx_Internal tmp = new TID3InfoEx_Internal(); if (zplay_LoadFileID3ExW(objptr, FileName, System.Convert.ToInt32(Format), ref tmp, 0) == 1) { Info.Album = Marshal.PtrToStringUni(tmp.Album); Info.Artist = Marshal.PtrToStringUni(tmp.Artist); Info.Comment = Marshal.PtrToStringUni(tmp.Comment); Info.Genre = Marshal.PtrToStringUni(tmp.Genre); Info.Title = Marshal.PtrToStringUni(tmp.Title); Info.Track = Marshal.PtrToStringUni(tmp.Track); Info.Year = Marshal.PtrToStringUni(tmp.Year); Info.AlbumArtist = Marshal.PtrToStringUni(tmp.AlbumArtist); Info.Composer = Marshal.PtrToStringUni(tmp.Composer); Info.OriginalArtist = Marshal.PtrToStringUni(tmp.OriginalArtist); Info.Copyright = Marshal.PtrToStringUni(tmp.Copyright); Info.Encoder = Marshal.PtrToStringUni(tmp.Encoder); Info.Publisher = Marshal.PtrToStringUni(tmp.Publisher); Info.BPM = tmp.BPM; Info.Picture.PicturePresent = false; if (fDecodePicture) { try { if (tmp.PicturePresent == 1) { byte[] stream_data = new byte[System.Convert.ToInt32(tmp.PictureDataSize) + 1]; Marshal.Copy(tmp.PictureData, stream_data, 0, tmp.PictureDataSize); Info.Picture.BitStream = new System.IO.MemoryStream(); Info.Picture.BitStream.Write(stream_data, 0, tmp.PictureDataSize); Info.Picture.Bitmap = new Bitmap(Info.Picture.BitStream); Info.Picture.PictureType = tmp.PictureType; Info.Picture.Description = Marshal.PtrToStringUni(tmp.Description); Info.Picture.PicturePresent = true; } else { Info.Picture.Bitmap = new Bitmap(1, 1); } return true; } catch { Info.Picture.PicturePresent = false; } } } else { return false; } return false; }