| 1 | unit WhatLinksHere;
|
|---|
| 2 | interface
|
|---|
| 3 | uses
|
|---|
| 4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|---|
| 5 | Dialogs, StdCtrls, Template;
|
|---|
| 6 |
|
|---|
| 7 | type
|
|---|
| 8 | TForm_WhatLinksHere = class(TForm)
|
|---|
| 9 | list: TListBox;
|
|---|
| 10 | label_what: TLabel;
|
|---|
| 11 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|---|
| 12 | procedure FormShow(Sender: TObject);
|
|---|
| 13 | procedure listDblClick(Sender: TObject);
|
|---|
| 14 | private
|
|---|
| 15 | public
|
|---|
| 16 | SenderForm: TForm_ToolTemplate;
|
|---|
| 17 | ConID: Integer;
|
|---|
| 18 | FileID: Integer;
|
|---|
| 19 | end;
|
|---|
| 20 |
|
|---|
| 21 | var
|
|---|
| 22 | Form_WhatLinksHere: TForm_WhatLinksHere;
|
|---|
| 23 |
|
|---|
| 24 | implementation
|
|---|
| 25 | {$R *.dfm}
|
|---|
| 26 | uses ConnectionManager, Access_OUP_ADB, TypeDefs, Functions, Main;
|
|---|
| 27 |
|
|---|
| 28 | { TForm_WhatLinksHere }
|
|---|
| 29 |
|
|---|
| 30 | procedure TForm_WhatLinksHere.FormCloseQuery(Sender: TObject;
|
|---|
| 31 | var CanClose: Boolean);
|
|---|
| 32 | begin
|
|---|
| 33 | Form_Main.Enabled := True;
|
|---|
| 34 | Visible := False;
|
|---|
| 35 | CanClose := False;
|
|---|
| 36 | end;
|
|---|
| 37 |
|
|---|
| 38 | procedure TForm_WhatLinksHere.FormShow(Sender: TObject);
|
|---|
| 39 | var
|
|---|
| 40 | fileinfo: TFileInfo;
|
|---|
| 41 | links: TLinks;
|
|---|
| 42 | i: Integer;
|
|---|
| 43 | fullname: String;
|
|---|
| 44 | begin
|
|---|
| 45 | Form_Main.Enabled := False;
|
|---|
| 46 | list.Items.Clear;
|
|---|
| 47 | fileinfo := ConManager.Connection[ConID].GetFileInfo(FileID);
|
|---|
| 48 | label_what.Caption := FormatNumber(fileinfo.ID, 5, '0') + '-' +
|
|---|
| 49 | fileinfo.Name + '.' + fileinfo.Extension;
|
|---|
| 50 | links := TAccess_OUP_ADB(ConManager.Connection[ConID]).GetLinksToFile(fileinfo.ID);
|
|---|
| 51 | if Length(links.ByID) > 0 then
|
|---|
| 52 | for i := 0 to High(links.ByID) do
|
|---|
| 53 | begin
|
|---|
| 54 | fileinfo := ConManager.Connection[ConID].GetFileInfo(links.ByID[i].Destination);
|
|---|
| 55 | fullname := FormatNumber(fileinfo.ID, 5, '0') + '-' + fileinfo.Name + '.' + fileinfo.Extension;
|
|---|
| 56 | list.Items.Add(fullname + ' (Offset 0x' + IntToHex(links.ByID[i].SrcOffset, 8) + ')');
|
|---|
| 57 | end;
|
|---|
| 58 | end;
|
|---|
| 59 |
|
|---|
| 60 | procedure TForm_WhatLinksHere.listDblClick(Sender: TObject);
|
|---|
| 61 | var
|
|---|
| 62 | id: Integer;
|
|---|
| 63 | begin
|
|---|
| 64 | id := ConManager.Connection[ConID].ExtractFileIDOfName(list.Items.Strings[list.ItemIndex]);
|
|---|
| 65 | SenderForm.SelectFileID(ConID, id);
|
|---|
| 66 | Form_Main.Enabled := True;
|
|---|
| 67 | Visible := False;
|
|---|
| 68 | end;
|
|---|
| 69 |
|
|---|
| 70 | end.
|
|---|