Skip to content

Commit 65b79c6

Browse files
Update the tree view for additional information
Add values: - Info Hash V1: - Info Hash V2 - Meta Version: - Padding (beb 47):
1 parent ccaf40a commit 65b79c6

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

source/code/controler_treeview_torrent_data.pas

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ implementation
7070
TORRENT_FILES_CONTENTS_FORM_CAPTION =
7171
'Show all the files inside the torrents. (Use right mouse for popup menu.)';
7272

73-
{ Tcontroler_treeview_torrent_data }
73+
{ Tcontroler_treeview_torrent_data }
7474

7575
procedure Tcontroler_treeview_torrent_data.FillThePopupMenu;
7676
begin
@@ -285,16 +285,16 @@ procedure Tcontroler_treeview_torrent_data.AddOneTorrentFileDecoded(
285285
DecodeTorrent: TDecodeTorrent);
286286
var
287287
CountFiles: integer;
288-
TorrentFileNameStr, TrackerStr: UTF8String;
288+
TorrentFileNameStr, TrackerStr: utf8string;
289289
TreeNodeTorrent, TreeNodeFiles, TreeNodeTrackers, TreeNodeInfo: TTreeNode;
290-
291290
begin
292291
//--------------------- Fill the treeview with torrent files
293292

294293
TorrentFileNameStr := ExtractFileName(DecodeTorrent.FilenameTorrent);
295294

296295
//Add the torrent file name + size of all the files combined.
297-
TorrentFileNameStr := TorrentFileNameStr + ' SIZE: ' +
296+
TorrentFileNameStr := TorrentFileNameStr + ' (Version: ' +
297+
DecodeTorrent.TorrentVersionToString + ') SIZE: ' +
298298
ByteSizeToBiggerSizeFormatStr(DecodeTorrent.TotalFileSize) +
299299
' Files: ' + IntToStr(DecodeTorrent.InfoFilesCount) + '' +
300300
' Tracker: ' + IntToStr(DecodeTorrent.TrackerList.Count) + '';
@@ -305,7 +305,9 @@ procedure Tcontroler_treeview_torrent_data.AddOneTorrentFileDecoded(
305305
TorrentFileNameStr); //Without directory path
306306

307307
//must be in this order (Files, Trackers, Info)
308-
TreeNodeFiles := FTreeViewFileContents.Items.AddChild(TreeNodeTorrent, 'Files');
308+
TreeNodeFiles := FTreeViewFileContents.Items.AddChild(TreeNodeTorrent,
309+
'Files V' + IntToStr(DecodeTorrent.InfoFilesVersion));
310+
309311
TreeNodeTrackers := FTreeViewFileContents.Items.AddChild(TreeNodeTorrent,
310312
'Trackers');
311313
TreeNodeInfo := FTreeViewFileContents.Items.AddChild(TreeNodeTorrent, 'Info');
@@ -340,8 +342,10 @@ procedure Tcontroler_treeview_torrent_data.AddOneTorrentFileDecoded(
340342

341343
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Comment: ' +
342344
DecodeTorrent.Comment);
343-
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Info Hash: ' +
344-
DecodeTorrent.InfoHash);
345+
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Info Hash V1: ' +
346+
DecodeTorrent.InfoHash_V1);
347+
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Info Hash V2: ' +
348+
DecodeTorrent.InfoHash_V2);
345349
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Created On: ' +
346350
DateTimeToStr(DecodeTorrent.CreatedDate));
347351
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Created By: ' +
@@ -363,6 +367,15 @@ procedure Tcontroler_treeview_torrent_data.AddOneTorrentFileDecoded(
363367
DecodeTorrent.InfoSource);
364368
end;
365369

370+
if DecodeTorrent.MetaVersion > 0 then
371+
begin // 'meta version'is in torrent file present
372+
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Meta Version: ' +
373+
IntToStr(DecodeTorrent.MetaVersion));
374+
end;
375+
376+
FTreeViewFileContents.Items.AddChild(TreeNodeInfo, 'Padding (beb 47): ' +
377+
DecodeTorrent.PaddingToString);
378+
366379
//All the files count inside the torrent must be added to FTotalFileInsideTorrent
367380
Inc(FTotalFileInsideTorrent, DecodeTorrent.InfoFilesCount);
368381

0 commit comments

Comments
 (0)