This repository was archived by the owner on Oct 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathxtoolui.dpr
More file actions
164 lines (151 loc) · 4.78 KB
/
xtoolui.dpr
File metadata and controls
164 lines (151 loc) · 4.78 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
library xtoolui;
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$R *.res}
uses
System.StartUpCopy,
FMX.Forms,
FMX.Types,
FMX.Controls,
FMX.StdCtrls,
FMX.TabControl,
WinAPI.Windows,
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
Unit1 in 'Unit1.pas' {Form1} ,
Unit2 in 'Unit2.pas' {Form2};
const
PLUGIN_DATABASE = 0;
PLUGIN_CONFIG = 1;
PLUGIN_LIBRARY = 2;
PLUGIN_EXECUTABLE = 3;
type
PUIFuncs = ^TUIFuncs;
TUIFuncs = record
IsZlibLoaded: Boolean;
IsReflateLoaded: Boolean;
IsPreflateLoaded: Boolean;
IsLZ4Loaded: Boolean;
IsLZOLoaded: Boolean;
IsZSTDLoaded: Boolean;
IsOodleLoaded: Boolean;
IsFLACLoaded: Boolean;
IsBrunsliLoaded: Boolean;
IsPackJPGLoaded: Boolean;
IsJoJpegLoaded: Boolean;
IsXDeltaLoaded: Boolean;
IsLZMALoaded: Boolean;
IsSrepAvailable: Boolean;
end;
var
UIInitialised: Boolean = False;
procedure XTLUI1;
begin
Form1 := TForm1.Create(nil);
Form2 := TForm2.Create(Form1);
end;
function XTLUI2(Funcs: PUIFuncs; var Params: TArray<String>;
out LibType: Integer; out LibPath: String): Boolean;
var
I, J, X: Integer;
Expander: TExpander;
begin
if not UIInitialised then
begin
UIInitialised := True;
Form1.Edit6.Text := GetIniString('UI', 'Plugins', '',
ChangeFileExt(GetModuleName, '.ini'));
Form1.Edit28.Text := Form1.Edit6.Text;
Form1.Edit6.OnChange := Form1.Edit6Change;
Form1.Edit28.OnChange := Form1.Edit6Change;
{ Form2.CheckBox3.Enabled := Funcs^.IsZlibLoaded;
Form2.CheckBox1.Enabled := Funcs^.IsReflateLoaded;
Form2.CheckBox2.Enabled := Funcs^.IsPreflateLoaded;
Form2.CheckBox4.Enabled := Funcs^.IsLZ4Loaded;
Form2.CheckBox5.Enabled := Funcs^.IsLZ4Loaded;
Form2.CheckBox6.Enabled := Funcs^.IsLZ4Loaded;
Form2.CheckBox7.Enabled := Funcs^.IsLZOLoaded;
Form2.CheckBox8.Enabled := Funcs^.IsZSTDLoaded;
Form2.CheckBox10.Enabled := Funcs^.IsOodleLoaded;
Form2.CheckBox12.Enabled := Funcs^.IsOodleLoaded;
Form2.CheckBox14.Enabled := Funcs^.IsOodleLoaded;
Form2.CheckBox16.Enabled := Funcs^.IsOodleLoaded;
Form2.CheckBox18.Enabled := Funcs^.IsOodleLoaded;
Form2.CheckBox21.Enabled := Funcs^.IsFLACLoaded;
Form2.RadioButton4.Enabled := Funcs^.IsFLACLoaded;
Form2.CheckBox26.Enabled := Funcs^.IsBrunsliLoaded or
Funcs^.IsPackJPGLoaded or Funcs^.IsJoJpegLoaded;
Form2.RadioButton1.Enabled := Funcs^.IsBrunsliLoaded;
Form2.RadioButton2.Enabled := Funcs^.IsPackJPGLoaded;
Form2.RadioButton3.Enabled := Funcs^.IsJoJpegLoaded; }
Form1.GroupBox5.Enabled := Funcs^.IsLZMALoaded;
if not Funcs^.IsSrepAvailable then
Form1.ComboBox5.Items.Delete(2);
Form1.ComboBox5.ItemIndex := 0;
for I := Low(Methods) to High(Methods) do
begin
case Methods[I].FType of
PLUGIN_DATABASE:
Form2.ListBox2.Items.Add(Methods[I].FName);
PLUGIN_CONFIG:
begin
J := Length(CfgCtrls);
Insert(TConfigCtrl.Create(Form2, Form2.VertScrollBox3), CfgCtrls,
Length(CfgCtrls));
CfgCtrls[J].SetText(Methods[I].FName);
for X := Low(Methods[I].Codecs) to High(Methods[I].Codecs) do
CfgCtrls[J].AddCodec(Methods[I].Codecs[X]);
end;
PLUGIN_LIBRARY:
begin
J := Length(LibCtrls);
Insert(TLibraryCtrl.Create(Form2, Form2.VertScrollBox3), LibCtrls,
Length(LibCtrls));
LibCtrls[J].SetText(Methods[I].FName);
for X := Low(Methods[I].Codecs) to High(Methods[I].Codecs) do
LibCtrls[J].AddCodec(Methods[I].Codecs[X]);
end;
end;
end;
for I := 0 to Form2.ComponentCount - 1 do
if Form2.Components[I] is TExpander then
TExpander(Form2.Components[I]).IsExpanded := False;
for I := 0 to Form1.ComponentCount - 1 do
if Form1.Components[I] is TTabControl then
TTabControl(Form1.Components[I]).TabIndex := 0;
if Form2.ListBox2.Items.Count = 0 then
Form2.Expander10.Visible := False;
end;
Result := Form1.ShowModal = mrOk;
LibType := Form1.ComboBox4.ItemIndex;
LibPath := Form1.Edit5.Text;
if Result then
begin
SetLength(Params, Length(CmdStr));
for I := Low(CmdStr) to High(CmdStr) do
Params[I] := CmdStr[I];
end;
end;
procedure XTLAddPlugin(S: String; I: Integer);
var
J: Integer;
begin
J := Length(Methods);
SetLength(Methods, Succ(J));
Methods[J].FName := S;
Methods[J].FType := I;
SetLength(Methods[J].Codecs, 0);
end;
procedure XTLAddCodec(S: String);
var
J: Integer;
begin
J := Pred(Length(Methods));
Insert(S, Methods[J].Codecs, Length(Methods[J].Codecs));
end;
exports XTLUI1, XTLUI2, XTLAddPlugin, XTLAddCodec;
begin
FormatSettings := TFormatSettings.Invariant;
end.