序列
procedure TForm1.Button2Click(Sender: TObject);
var
msgpack: TQMsgPack;
begin
msgpack := TQMsgPack.Create;
try
msgpack.AsVariant := cds.Data;
if SaveDialog1.Execute then
begin
msgpack.SaveToFile(SaveDialog1.FileName);
end;
finally
FreeAndNil(msgpack);
end;
end;
还原
procedure TForm1.Button3Click(Sender: TObject);
var
msgpack: TQMsgPack;
begin
msgpack := TQMsgPack.Create;
try
if OpenDialog1.Execute() then
begin
msgpack.LoadFromFile(OpenDialog1.FileName);
cds.Close;
cds.Data := msgpack.AsVariant;
end;
finally
FreeAndNil(msgpack);
end;
end;
时间: 2024-12-25 06:35:39