Delphi-Quellcode:
uses
TypInfo...
procedure TDState.SaveDataToFileStream(S: TFileStream; W: TWriter);
begin
inherited;
W.WriteString('StateType');
W.WriteString(GetEnumName(TypeInfo(TStateType), Ord(StateType)));
W.WriteString('StateTime');
W.WriteDate(StateTime);
W.WriteString('-');
end;
procedure TDState.LoadDataFromFileStream(S: TFileStream; R: TReader);
var
SI: String;
begin
inherited;
repeat
SI := R.ReadString;
if SI = 'StateType' then
StateType := TStateType(GetEnumValue(TypeInfo(TStateType), R.ReadString));
if SI = 'StateTime' then
StateTime := R.ReadDate;
until SI = '-';
end;
EDIT:
Hab´s selbst noch gemerkt, dass das so noch nicht reicht
Lasse es aber stehen, da es vielleicht mal anderen hilft...