Rev 77 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
75 | daniel-mar | 1 | unit RecyclerListingMain; |
2 | |||
3 | interface |
||
4 | |||
5 | uses |
||
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
||
7 | Dialogs, StdCtrls, ComCtrls, ExtCtrls; |
||
8 | |||
9 | type |
||
10 | TRecyclerListingMainForm = class(TForm) |
||
11 | TreeView1: TTreeView; |
||
12 | Panel1: TPanel; |
||
13 | Button1: TButton; |
||
14 | CheckBox1: TCheckBox; |
||
15 | procedure Button1Click(Sender: TObject); |
||
16 | private |
||
17 | { Private-Deklarationen } |
||
18 | public |
||
19 | { Public-Deklarationen } |
||
20 | end; |
||
21 | |||
22 | var |
||
23 | RecyclerListingMainForm: TRecyclerListingMainForm; |
||
24 | |||
25 | implementation |
||
26 | |||
27 | {$R *.dfm} |
||
28 | |||
29 | uses |
||
30 | RecBinUnit2, ContNrs, SIDUnit; |
||
31 | |||
32 | // TODO: SID Namen auflösen und dementsprechend anzeigen |
||
33 | // TODO: zu jedem element mehr informationen anzeigen, nicht nur den ursprungsnamen |
||
34 | |||
35 | procedure TRecyclerListingMainForm.Button1Click(Sender: TObject); |
||
36 | var |
||
37 | drives: TObjectList{TRbDrive}; |
||
38 | iDrive: integer; |
||
39 | drive: TRbDrive; |
||
40 | nDrive: TTreeNode; |
||
41 | |||
42 | bins: TObjectList{TRbRecycleBin}; |
||
43 | iBin: integer; |
||
44 | bin: TRbRecycleBin; |
||
45 | nBin: TTreeNode; |
||
46 | |||
47 | items: TObjectList{TRbRecycleBinItem}; |
||
48 | iItem: integer; |
||
49 | item: TRbRecycleBinItem; |
||
50 | nItem: TTreeNode; |
||
51 | begin |
||
52 | TreeView1.Items.Clear; |
||
53 | TreeView1.Items.BeginUpdate; |
||
54 | drives := TObjectList.Create(true); |
||
55 | bins := TObjectList.Create(true); |
||
56 | items := TObjectList.Create(true); |
||
57 | try |
||
58 | drives.Clear; |
||
59 | TRecycleBinManager.ListDrives(drives); |
||
60 | for iDrive := 0 to drives.Count - 1 do |
||
61 | begin |
||
62 | drive := drives.Items[iDrive] as TRbDrive; |
||
63 | |||
64 | nDrive := TreeView1.Items.AddObject(nil, 'Drive '+drive.DriveLetter+': ' + GUIDToString(drive.VolumeGUID), drive); |
||
65 | |||
66 | bins.Clear; |
||
67 | if CheckBox1.Checked then |
||
68 | drive.ListRecycleBins(bins, GetMySID) |
||
69 | else |
||
70 | drive.ListRecycleBins(bins); |
||
71 | for iBin := 0 to bins.Count - 1 do |
||
72 | begin |
||
73 | bin := bins.Items[iBin] as TRbRecycleBin; |
||
74 | |||
75 | nBin := TreeView1.Items.AddChildObject(nDrive, bin.FileOrDirectory, bin); |
||
76 | |||
77 | items.Clear; |
||
78 | bin.ListItems(items); |
||
79 | for iItem := 0 to items.Count - 1 do |
||
80 | begin |
||
81 | item := items.Items[iItem] as TRbRecycleBinItem; |
||
82 | nItem := TreeView1.Items.AddChildObject(nBin, item.Source, bin); |
||
83 | end; |
||
84 | end; |
||
85 | end; |
||
86 | finally |
||
87 | drives.Free; |
||
88 | bins.Free; |
||
89 | items.Free; |
||
90 | TreeView1.Items.EndUpdate; |
||
91 | end; |
||
92 | end; |
||
93 | |||
94 | end. |