-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUFGenerateCache.pas
More file actions
121 lines (96 loc) · 3.03 KB
/
UFGenerateCache.pas
File metadata and controls
121 lines (96 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
unit UFGenerateCache;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, AdvEdit, AdvEdBtn,
AdvFileNameEdit, JclStrings, Clipbrd;
type
TFGenerateChache = class(TForm)
AFEBridgeFile: TAdvFileNameEdit;
BGenerate: TButton;
AFECacheFile: TAdvFileNameEdit;
CBClipBoard: TCheckBox;
procedure BGenerateClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FGenerateChache: TFGenerateChache;
implementation
{$R *.dfm}
procedure TFGenerateChache.BGenerateClick(Sender: TObject);
var
BridgeFile: TextFile;
BridgeIn: string;
CacheOut: string;
GUID1: string;
GUID2: string;
Signature, Signature1, Signature2: string;
CacheLines: TStringList;
begin
if AFEBridgeFile.Text = ''
then
begin
ShowMessage('Please enter Bridge file name');
AFEBridgeFile.SetFocus;
Exit;
end;
if (AFECacheFile.Text = '') and
(not CBClipBoard.Checked)
then
begin
ShowMessage('Please enter Cache file name or check "Copy to clipboard"');
AFECacheFile.SetFocus;
Exit;
end;
CacheLines := TStringList.Create;
AssignFile(BridgeFile, AFEBridgeFile.Text);
Reset(BridgeFile);
GUID1 := '';
while not Eof(BridgeFile) do
begin
Readln(BridgeFile, BridgeIn);
if Pos('[''{', BridgeIn) > 0
then
if GUID1 = ''
then
begin
GUID1 := StrAfter('[''', BridgeIn);
GUID1 := StrBefore(''']', GUID1);
end
else
begin
GUID2 := StrAfter('[''', BridgeIn);
GUID2 := StrBefore(''']', GUID2);
CacheOut := Signature + ' ' + GUID1 + ' ' + GUID2 + ' ' + StrBefore('.pas', ExtractFileName(AFEBridgeFile.Text));
CacheLines.Add(CacheOut);
GUID1 := '';
end;
if Pos('[JavaSignature(''', BridgeIn) > 0
then
begin
Signature := StrAfter('[JavaSignature(''', BridgeIn);
Signature := StrBefore(''')', Signature);
Signature := StringReplace(Signature, '/', '.', [rfReplaceAll]);
Signature2 := StrRestOf(Signature, StrLastPos('.', Signature) + 1);
Signature2 := StringReplace(Signature2, '$', '_', [rfReplaceAll]);
Signature := Signature + ' ' + Signature2;
end;
end;
CloseFile(BridgeFile);
if not CBClipBoard.Checked
then
begin
CacheLines.SaveToFile(AFECacheFile.Text);
ShowMessage('Created file ' + AFECacheFile.Text);
end
else
begin
Clipboard.AsText := CacheLines.Text;
ShowMessage('Copied to clipboard');
end;
CacheLines.Free;
end;
end.