Example Code - PMStanley/ARMax GitHub Wiki
Opening and listing contents of an existing .max save:
procedure TForm1.Button1Click(Sender: TObject);
var
theResult, a, fileSize : integer;
aName : PChar;
begin
if OpenDialog1.Execute then begin
InitMaxSave;
LoadSave(PChar(OpenDialog1.FileName));
theResult := NumberOfFiles;
memo1.lines.add('Number of Files: ' + intToStr(theResult));
getMem(aName, 32);
for a := 1 to theResult do begin
theResult := fileDetails(a, aName, 32, fileSize);
memo1.Lines.Add(aName + ' ' + intToStr(fileSize));
end;
GetRootDir(aName, 32);
memo1.Lines.Add('Root Dir: ' + aName);
FreeMem(aName);
FreeMaxSave;
end;
end;
Creating a new .max save, adding a file and saving:
procedure TForm1.AddFileandSaveNewButton(Sender: TObject);
begin
if opendialog1.Execute then begin
InitMaxSave;
addFileToSave(PChar(openDialog1.FileName));
setRootDir(PChar('My Files'));
if SaveDialog1.Execute then begin
SaveMaxFile(PChar(saveDialog1.FileName));
end;
FreeMaxSave;
end;
end;