TDataFile = Record
Version: Byte;
BackupFolderName: String;
StartDate : String;
StartTime: Word;
TotalTime: Word;
Completed: Byte;
end;
procedure Tbackup.WriteDataFile(DFPath:String; DFName:String);
var
fsOut : TFileStream;
vDataFile : TDataFile;
begin
with vDataFile do
begin
Version := 1;
BackupNumber := 0;
BackupFolderName := DFName;
StartDate := DateToStr(date);
StartTime := 0;
TotalTime := 0;
Completed := 0;
try
fsOut := TFileStream.Create(DFPath+DFName+'.bck', fmCreate);
fsOut.WriteByte(Version);
fsOut.WriteWord(BackupNumber);
fsOut.WriteAnsiString(BackupFolderName);
//fsOut.WriteWord(StartDate);
fsOut.WriteAnsiString(StartDate);
fsOut.WriteWord(StartTime);
fsOut.WriteWord(TotalTime);
fsOut.WriteByte(Completed);
fsOut.Free;
finally;
end;
end;
end;
function Tbackup.ReadDataFile(DFPath:String; DFName:String):TDataFile;
var
fsOut : TFileStream;
vDataFile : TDataFile;
begin
with vDataFile do
begin
try
fsOut := TFileStream.Create(DFPath+DFName+'.bck', fmOpenRead);
Version := fsOut.ReadByte;
BackupNumber := fsOut.ReadWord;
BackupFolderName := fsOut.ReadAnsiString;
StartDate := fsOut.ReadAnsiString;
StartTime := fsOut.ReadWord;
TotalTime := fsOut.ReadWord;
Completed := fsOut.ReadByte;
fsOut.Free;
finally;
Result := vDataFile;
end;
end;
end