You should use a code-formatter. Here is the result of the built-in one of Delphi XE:
Delphi-Quellcode:
const
iGlobHolderCount = 100;
type
TFiLeSpec = record
iSize: Integer;
end;
TFileSpecLst = array of TFiLeSpec;
TFiLeSpecList = record
iMin: Integer;
iMax: Integer;
iCount: Integer;
FileSpecLst: TFileSpecLst;
end;
TFileChecker = class
Function LoadFromFile(AFileName: string): boolean;
Function SaveToFile(AFileName: string): boolean;
private
FFileSpec: array of TFiLeSpec;
FFileSpecList: array [1 .. iGlobHolderCount] of TFiLeSpecList;
function GetCount: Integer;
public
constructor Create;
destructor Destroy; override;
property iCount: Integer read GetCount;
end;
{ TFileChecker }
constructor TFileChecker.Create;
begin
FFileSpec := nil;
end;
destructor TFileChecker.Destroy;
var
i: Integer;
begin
FFileSpec := nil;
for i := 1 to iGlobHolderCount do
FFileSpecList[i].FileSpecLst := nil;
inherited;
end;
function TFileChecker.GetCount: Integer;
var
x, i: Integer;
begin
Result := 0;
x := 0;
for i := 1 to iGlobHolderCount do
x := x + Length(FFileSpecList[i].FileSpecLst);
Result := Length(FFileSpec) + x;
end;
function TFileChecker.LoadFromFile(AFileName: string): boolean;
var
iStream: TMemoryStream;
i: Integer;
begin
Result := False;
SetLength(FFileSpec, 0);
iStream := TMemoryStream.Create;
Try
iStream.LoadFromFile(AFileName);
// how it can be loaded from the Stream
Result := True;
finally
iStream.Free;
end;
end;
function TFileChecker.SaveToFile(AFileName: string): boolean;
var
iStream: TMemoryStream;
i: Integer;
begin
Result := False;
iStream := TMemoryStream.Create;
Try
// how it can be saved to the Stream
iStream.SaveToFile(AFileName);
Result := True;
finally
iStream.Free;
end;
end;
Well, there are dynamic elements in your static array which also contain dynamic elements themselves. The only way to store/load such kind of data is IMO an additional field which stores/retrieves the length of the dynamic array(s). Let' s say your TFiLeSpecList contains 10 FileSpecLst. So you must save the number 10. Now for each FileSpecLst the number of containing FiLeSpec has also to be stored, so you can jump step by step from one record to the other, read them and go to the next FileSpecLst. When 10 is reached, the next TFiLeSpecList can be processed.