procedure TID3V1.Readtag;
var
st : TFilestream;
buf: array[0..127] of char;
tmppos,curpos : integer;
function ArrayToStr(count:integer):string;
var
i,ende : integer;
begin
result := '';
ende := curpos+(count-1);
for I := curpos to ende do
result := result+buf[i];
curpos := ende+1;
end;
begin
readed := false;
changed := false;
try
st := TFilestream.create(ffilename,fmOpenRead);
st.Seek(-128,soFromEnd);
st.ReadBuffer(buf[0],128);
st.free;
if (BUF[0]='T') and (BUF[1]='A') and (BUF[2]='G') then
begin
readed := true;
curpos := 3;
fTitle := ArrayToStr(30);
fartist := arraytostr(30);
falbum := arraytostr(30);
fyear := arraytostr(4);
tmppos := curpos+28;
if (ord(buf[tmppos]) =$00) and (ord(buf[tmppos+1]) <> $00) then
begin
fversion := 1;
fcomment := arraytostr(28);
falbumtrack := ord(buf[curpos+1]);
inc(curpos,2);
end
else
begin
fversion := 0;
fcomment := trim(arraytostr(30));
end;
fgenre := ord(buf[127]);
end;
except
on e:
exception do
raise e;
end;
end;