@@ -166,7 +166,7 @@ TFormTrackerModify = class(TForm)
166166 procedure UpdateViewRemoveTracker ;
167167
168168
169- procedure ReloadAllTorrentAndRefreshView ;
169+ function ReloadAllTorrentAndRefreshView : boolean ;
170170 function AddTorrentFileList (TorrentFileNameStringList: TStringList): boolean;
171171 function ReadAddTrackerFileFromUser (const FileName: UTF8String): boolean;
172172 function LoadTorrentViaDir (const Dir: UTF8String): boolean;
@@ -516,7 +516,7 @@ procedure TFormTrackerModify.UpdateTorrent;
516516var
517517 Reply, BoxStyle, i, CountTrackers: integer;
518518 PopUpMenuStr: string;
519- SomeFilesCannotBeWriten, SomeFilesAreReadOnly: boolean;
519+ SomeFilesCannotBeWriten, SomeFilesAreReadOnly, AllFilesAreReadBackCorrectly : boolean;
520520
521521begin
522522 // Update all the torrent files.
@@ -656,12 +656,14 @@ procedure TFormTrackerModify.UpdateTorrent;
656656 // update the torrent public/private flag
657657 if CheckListBoxPublicPrivateTorrent.Checked[i] then
658658 begin
659+ // Create a public torrent
659660 // if private torrent then make it public torrent by removing the private flag.
660661 if FDecodePresentTorrent.PrivateTorrent then
661662 FDecodePresentTorrent.RemovePrivateTorrentFlag;
662663 end
663664 else
664665 begin
666+ // Create a private torrent
665667 FDecodePresentTorrent.AddPrivateTorrentFlag;
666668 end ;
667669
@@ -680,7 +682,7 @@ procedure TFormTrackerModify.UpdateTorrent;
680682 SaveTrackerFinalListToFile;
681683
682684 // Show/reload the just updated torrent files.
683- ReloadAllTorrentAndRefreshView;
685+ AllFilesAreReadBackCorrectly := ReloadAllTorrentAndRefreshView;
684686
685687 // make sure cursor is default again
686688 finally
@@ -726,6 +728,16 @@ procedure TFormTrackerModify.UpdateTorrent;
726728
727729 end ;// case
728730
731+
732+ // Check if there are some error that need to be notify to the end user.
733+
734+ if not AllFilesAreReadBackCorrectly then
735+ begin
736+ // add warning if torrent files can not be read back again
737+ PopUpMenuStr := PopUpMenuStr +
738+ ' WARNING: Some torrent files can not be read back again after updating.' ;
739+ end ;
740+
729741 if SomeFilesAreReadOnly then
730742 begin
731743 // add warning if read only files are detected.
@@ -965,6 +977,7 @@ function TFormTrackerModify.DecodeTorrentFile(const FileName: UTF8String): boole
965977 Result := FDecodePresentTorrent.DecodeTorrent(FileName);
966978 if Result then
967979 begin
980+ // visual update this one torrent file.
968981 ViewUpdateOneTorrentFileDecoded;
969982 end ;
970983end ;
@@ -1495,7 +1508,7 @@ function TFormTrackerModify.AddTorrentFileList(TorrentFileNameStringList:
14951508end ;
14961509
14971510
1498- procedure TFormTrackerModify.ReloadAllTorrentAndRefreshView ;
1511+ function TFormTrackerModify.ReloadAllTorrentAndRefreshView : boolean ;
14991512var
15001513 TorrentFileStr: UTF8String;
15011514begin
@@ -1505,6 +1518,9 @@ procedure TFormTrackerModify.ReloadAllTorrentAndRefreshView;
15051518 And show that everything is updated and OK
15061519}
15071520
1521+ // will be set to False if error occure
1522+ Result := True;
1523+
15081524 ViewUpdateBegin;
15091525 // Copy all the trackers in inside the torrent files to FTrackerList.TrackerFromInsideTorrentFilesList
15101526 FTrackerList.TrackerFromInsideTorrentFilesList.Clear;
@@ -1513,6 +1529,11 @@ procedure TFormTrackerModify.ReloadAllTorrentAndRefreshView;
15131529 if DecodeTorrentFile(TorrentFileStr) then
15141530 begin
15151531 UpdateTorrentTrackerList;
1532+ end
1533+ else
1534+ begin
1535+ // some files can not be read/decoded
1536+ Result := False;
15161537 end ;
15171538 end ;
15181539
0 commit comments