C#代码帮忙翻译成Delphi7代码,该如何处理
C#代码帮忙翻译成Delphi7代码
------解决方案--------------------
BASS_ChannelGetTags是个鸟东西
p可以用Pchar代替,剩下的就是处理Pchar或string了
IntPtr p = BASS_ChannelGetTags(stream, BASS_TAG_ID3);
// check, if ID3v1
string id = Marshal.PtrToStringAnsi(p, 3);
if (id != "TAG")
return false;
// song title (comes after 'TAG')...
p = new IntPtr((byte*)p.ToPointer() + 3);
string title = Marshal.PtrToStringAnsi(p).TrimEnd('\0');
int idx = title.IndexOf('\0');
if (idx > 0)
title = title.Substring(0, idx);
// artist...
p = new IntPtr((byte*)p.ToPointer() + 30);
string artist = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = artist.IndexOf('\0');
if (idx > 0)
artist = artist.Substring(0, idx);
// album...
p = new IntPtr((byte*)p.ToPointer() + 30);
string album = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = album.IndexOf('\0');
if (idx > 0)
album = album.Substring(0, idx);
// year...
p = new IntPtr((byte*)p.ToPointer() + 30);
string year = Marshal.PtrToStringAnsi(p, 4).TrimEnd('\0');
idx = year.IndexOf('\0');
if (idx > 0)
year = year.Substring(0, idx);
// comment...
p = new IntPtr((byte*)p.ToPointer() + 4);
string comment = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = comment.IndexOf('\0');
if (idx > 0)
comment = comment.Substring(0, idx);
// genre-id...
p = new IntPtr((byte*)p.ToPointer() + 30);
int genreId = (int)Marshal.ReadByte(p);
------解决方案--------------------
BASS_ChannelGetTags是个鸟东西
p可以用Pchar代替,剩下的就是处理Pchar或string了