Change format of collection of flames to force correct XML syntax.

This commit is contained in:
ronaldhordijk 2005-09-25 08:32:27 +00:00
parent ea11c313df
commit 29bfa4d098
2 changed files with 13 additions and 7 deletions

View File

@ -2,7 +2,7 @@ object MainForm: TMainForm
Left = 387
Top = 166
Width = 605
Height = 575
Height = 595
Caption = 'Apophysis'
Color = clBtnFace
Font.Charset = ANSI_CHARSET
@ -313,7 +313,7 @@ object MainForm: TMainForm
Left = 1
Top = 1
Width = 431
Height = 478
Height = 492
Align = alClient
AutoSize = True
PopupMenu = DisplayPopup

View File

@ -1561,17 +1561,23 @@ begin
try
FileList.LoadFromFile(filename);
if pos('<flame', FileList.text) <> 0 then
// fix first line
if (FileList.Count > 0) then begin
FileList[0] := '<Flames name="' + Tag + '">';
end;
if pos('<flame ', FileList.text) <> 0 then
repeat
FileList.Delete(FileList.Count - 1);
until (Pos('</flame>', FileList[FileList.count - 1]) <> 0)
else
repeat
FileList.Delete(FileList.Count - 1);
until (Pos('<' + Tag + '>', FileList[FileList.count - 1]) <> 0);
until (Pos('<' + Tag + '>', FileList[FileList.count - 1]) <> 0) or
(Pos('</Flames>', FileList[FileList.count - 1]) <> 0);
FileList.Add(Trim(FlameToXML(cp1, false)));
FileList.Add('</' + Tag + '>');
FileList.Add('</Flames>');
FileList.SaveToFile(filename);
finally
@ -1583,9 +1589,9 @@ begin
// New file ... easy
AssignFile(IFile, filename);
ReWrite(IFile);
Writeln(IFile, '<' + Tag + '>');
Writeln(IFile, '<Flames name="' + Tag + '">');
Write(IFile, FlameToXML(cp1, false));
Writeln(IFile, '</' + Tag + '>');
Writeln(IFile, '</Flames>');
CloseFile(IFile);
end;
except on E: EInOutError do