Delphi-Quellcode:
type
TArchiv = class(TComponent)
private
fFilename: String;
fTitel: String;
fInterpret: String;
fAlbum: String;
fGenre: String;
fDauer: TTime;
fBewertung: Integer;
fCounter: Integer;
fDatum: TDate;
function GetPlaylistName: String;
published
property Filename: String read fFilename write fFilename;
property Titel: String read fTitel write fTitel;
property Interpret: String read fInterpret write fInterpret;
property Album: String read fAlbum write fAlbum;
property Genre: String read fGenre write fGenre;
property Dauer: TTime read fDauer write fDauer;
property Bewertung: Integer read fBewertung write fBewertung;
property Counter: Integer read fCounter write fCounter;
property Datum: TDate read fDatum write fDatum;
public
property Playlistname: String read GetPlaylistname;
end;
var
a,b: TArchiv;
mstream: TMemoryStream;
begin
a:=TArchiv.Create(nil);
a.Filename:='test';
a.Datum:=now;
mstream:=TMemoryStream.Create();
mstream.WriteComponent(a);
mstream.SaveToFile('c:\temp\a.dat');
mstream.Seek(soFromBeginning, 0);
b:=TArchiv.create(nil);
mstream.ReadComponent(b);
caption:=b.Filename;
mstream.free;
a.free;
b.free;
end;
Der VST hat noch paar Routinen die dir helfen können:
Delphi-Quellcode:
VirtualStringTree1.SaveToFile(...);
VirtualStringTree1.SaveToStream(...);