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