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 pathUnit1.pas
More file actions
923 lines (855 loc) · 23.8 KB
/
Unit1.pas
File metadata and controls
923 lines (855 loc) · 23.8 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
unit Unit1;
interface
uses
WinAPI.Windows,
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants, System.Math, System.StrUtils, System.IniFiles,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.TabControl,
FMX.Layouts, FMX.ListBox, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit,
FMX.EditBox, FMX.SpinBox, FMX.Menus, FMX.ComboEdit, FMX.Memo.Types,
FMX.ScrollBox, FMX.Memo;
type
TForm1 = class(TForm)
StyleBook1: TStyleBook;
SaveDialog1: TSaveDialog;
OpenDialog1: TOpenDialog;
GroupBox1: TGroupBox;
ComboBox2: TComboBox;
Edit1: TEdit;
SearchEditButton1: TSearchEditButton;
Layout1: TLayout;
GroupBox2: TGroupBox;
Layout3: TLayout;
VertScrollBox1: TVertScrollBox;
GroupBox3: TGroupBox;
Layout7: TLayout;
Edit3: TEdit;
SearchEditButton3: TSearchEditButton;
ComboBox3: TComboBox;
Label1: TLabel;
SpinBox1: TSpinBox;
Label2: TLabel;
SpinBox2: TSpinBox;
Layout2: TLayout;
GroupBox4: TGroupBox;
Layout6: TLayout;
GroupBox5: TGroupBox;
Layout8: TLayout;
Label7: TLabel;
SpinBox7: TSpinBox;
Label4: TLabel;
SpinBox4: TSpinBox;
CheckBox4: TCheckBox;
GroupBox6: TGroupBox;
Layout5: TLayout;
Edit2: TEdit;
Button2: TButton;
CheckBox2: TCheckBox;
GroupBox8: TGroupBox;
Layout10: TLayout;
Edit5: TEdit;
SearchEditButton4: TSearchEditButton;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
ComboEdit1: TComboEdit;
Label6: TLabel;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
TabItem3: TTabItem;
GroupBox9: TGroupBox;
Layout11: TLayout;
Edit7: TEdit;
SearchEditButton6: TSearchEditButton;
ComboBox6: TComboBox;
GroupBox10: TGroupBox;
Layout12: TLayout;
Edit8: TEdit;
SearchEditButton7: TSearchEditButton;
ComboBox7: TComboBox;
GroupBox11: TGroupBox;
Layout13: TLayout;
Edit9: TEdit;
SearchEditButton8: TSearchEditButton;
ComboBox8: TComboBox;
GroupBox12: TGroupBox;
Layout14: TLayout;
Label9: TLabel;
SpinBox6: TSpinBox;
Label10: TLabel;
SpinBox8: TSpinBox;
VertScrollBox2: TVertScrollBox;
TabControl2: TTabControl;
TabItem4: TTabItem;
TabItem5: TTabItem;
TabItem6: TTabItem;
OpenDialog2: TOpenDialog;
Layout4: TLayout;
Button1: TButton;
Label5: TLabel;
Edit6: TEdit;
SearchEditButton5: TSearchEditButton;
Layout18: TLayout;
Button5: TButton;
TabItem9: TTabItem;
VertScrollBox4: TVertScrollBox;
GroupBox15: TGroupBox;
Layout20: TLayout;
Edit10: TEdit;
SearchEditButton9: TSearchEditButton;
ComboBox9: TComboBox;
GroupBox16: TGroupBox;
Layout21: TLayout;
Edit12: TEdit;
SearchEditButton11: TSearchEditButton;
ComboBox10: TComboBox;
GroupBox17: TGroupBox;
Layout22: TLayout;
Label12: TLabel;
SpinBox9: TSpinBox;
Label13: TLabel;
SpinBox10: TSpinBox;
GroupBox18: TGroupBox;
Layout23: TLayout;
Edit13: TEdit;
SearchEditButton12: TSearchEditButton;
ComboBox11: TComboBox;
Layout24: TLayout;
Button7: TButton;
VertScrollBox5: TVertScrollBox;
GroupBox19: TGroupBox;
Layout25: TLayout;
Edit14: TEdit;
SearchEditButton13: TSearchEditButton;
ComboBox12: TComboBox;
GroupBox20: TGroupBox;
Layout26: TLayout;
Edit15: TEdit;
SearchEditButton14: TSearchEditButton;
ComboBox13: TComboBox;
GroupBox21: TGroupBox;
Layout27: TLayout;
Label14: TLabel;
SpinBox11: TSpinBox;
Label15: TLabel;
SpinBox12: TSpinBox;
GroupBox22: TGroupBox;
Layout28: TLayout;
Edit16: TEdit;
SearchEditButton15: TSearchEditButton;
ComboBox14: TComboBox;
Layout29: TLayout;
Button8: TButton;
GroupBox23: TGroupBox;
Layout30: TLayout;
Edit17: TEdit;
SearchEditButton16: TSearchEditButton;
ComboBox15: TComboBox;
VertScrollBox7: TVertScrollBox;
GroupBox28: TGroupBox;
Layout36: TLayout;
Edit21: TEdit;
SearchEditButton20: TSearchEditButton;
ComboBox19: TComboBox;
GroupBox29: TGroupBox;
Layout37: TLayout;
Edit22: TEdit;
SearchEditButton21: TSearchEditButton;
GroupBox30: TGroupBox;
Layout38: TLayout;
Label18: TLabel;
SpinBox15: TSpinBox;
Label19: TLabel;
SpinBox16: TSpinBox;
GroupBox31: TGroupBox;
Layout39: TLayout;
Edit23: TEdit;
SearchEditButton22: TSearchEditButton;
ComboBox21: TComboBox;
GroupBox32: TGroupBox;
Layout40: TLayout;
Edit24: TEdit;
Layout41: TLayout;
Button10: TButton;
SaveDialog2: TSaveDialog;
VertScrollBox8: TVertScrollBox;
GroupBox33: TGroupBox;
Layout42: TLayout;
Edit25: TEdit;
SearchEditButton23: TSearchEditButton;
GroupBox34: TGroupBox;
Layout43: TLayout;
Edit26: TEdit;
SearchEditButton24: TSearchEditButton;
GroupBox35: TGroupBox;
Layout44: TLayout;
Label16: TLabel;
SpinBox13: TSpinBox;
GroupBox36: TGroupBox;
Layout45: TLayout;
Edit27: TEdit;
SearchEditButton25: TSearchEditButton;
Layout46: TLayout;
Button11: TButton;
ComboBox17: TComboBox;
ComboBox18: TComboBox;
CheckBox7: TCheckBox;
Label20: TLabel;
Edit28: TEdit;
SearchEditButton26: TSearchEditButton;
Label21: TLabel;
ComboEdit2: TComboEdit;
CheckBox1: TCheckBox;
Label3: TLabel;
SpinBox3: TSpinBox;
CheckBox6: TCheckBox;
Label8: TLabel;
ComboEdit3: TComboEdit;
procedure FormShow(Sender: TObject);
procedure SearchEditButton1Click(Sender: TObject);
procedure SearchEditButton3Click(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
procedure SearchEditButton4Click(Sender: TObject);
procedure Edit6Change(Sender: TObject);
procedure SearchEditButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ComboBox5Change(Sender: TObject);
procedure ComboBox7Change(Sender: TObject);
procedure ComboBox6Change(Sender: TObject);
procedure ComboBox8Change(Sender: TObject);
procedure SearchEditButton7Click(Sender: TObject);
procedure SearchEditButton6Click(Sender: TObject);
procedure SearchEditButton8Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure ComboBox9Change(Sender: TObject);
procedure ComboBox11Change(Sender: TObject);
procedure ComboBox10Change(Sender: TObject);
procedure SearchEditButton21Click(Sender: TObject);
procedure ComboBox19Change(Sender: TObject);
procedure ComboBox21Change(Sender: TObject);
procedure ComboBox12Change(Sender: TObject);
procedure ComboBox15Change(Sender: TObject);
procedure ComboBox14Change(Sender: TObject);
procedure ComboBox13Change(Sender: TObject);
procedure SearchEditButton20Click(Sender: TObject);
procedure SearchEditButton22Click(Sender: TObject);
procedure SearchEditButton9Click(Sender: TObject);
procedure SearchEditButton12Click(Sender: TObject);
procedure SearchEditButton11Click(Sender: TObject);
procedure SearchEditButton13Click(Sender: TObject);
procedure SearchEditButton16Click(Sender: TObject);
procedure SearchEditButton15Click(Sender: TObject);
procedure SearchEditButton14Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure SearchEditButton23Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure ComboBox18Change(Sender: TObject);
procedure ComboBox17Change(Sender: TObject);
procedure SearchEditButton25Click(Sender: TObject);
procedure SearchEditButton24Click(Sender: TObject);
procedure CheckBox4Change(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit21Change(Sender: TObject);
procedure Edit8Change(Sender: TObject);
procedure Edit10Change(Sender: TObject);
procedure Edit14Change(Sender: TObject);
procedure Edit25Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
CmdStr: TArray<String>;
Init: Boolean = False;
DecodeMode: Integer = -1;
function GetModuleName: string;
function GetIniString(Section, Key, Default, FileName: string): string;
procedure SetIniString(Section, Key, Value, FileName: string);
implementation
{$R *.fmx}
uses
Unit2;
function GetModuleName: string;
var
szFileName: array [0 .. MAX_PATH] of char;
begin
FillChar(szFileName, sizeof(szFileName), #0);
GetModuleFileName(hInstance, szFileName, MAX_PATH);
Result := szFileName;
end;
function GetIniString(Section, Key, Default, FileName: string): string;
var
Ini: TIniFile;
begin
Ini := TIniFile.Create(FileName);
with Ini do
try
Result := Ini.ReadString(Section, Key, Default);
finally
Free;
end;
end;
procedure SetIniString(Section, Key, Value, FileName: string);
var
Ini: TIniFile;
begin
Ini := TIniFile.Create(FileName);
with Ini do
try
Ini.WriteString(Section, Key, Value);
finally
Free;
end;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('generate', CmdStr, Length(CmdStr));
Insert('-c' + SpinBox15.Text + 'mb', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox16.Text, CmdStr, Length(CmdStr));
Insert('-m' + Edit24.Text, CmdStr, Length(CmdStr));
Insert(Edit21.Text, CmdStr, Length(CmdStr));
Insert(Edit23.Text, CmdStr, Length(CmdStr));
Insert(Edit22.Text, CmdStr, Length(CmdStr));
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('decode', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox13.Text, CmdStr, Length(CmdStr));
if CheckBox7.IsChecked then
Insert('-v', CmdStr, Length(CmdStr));
Insert('-bd' + Edit6.Text, CmdStr, Length(CmdStr));
Insert(Edit25.Text, CmdStr, Length(CmdStr));
case DecodeMode of
0:
Insert(Edit26.Text, CmdStr, Length(CmdStr));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
S: String;
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('precomp', CmdStr, Length(CmdStr));
Insert('-c' + SpinBox1.Text + 'mb', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox2.Text, CmdStr, Length(CmdStr));
if CheckBox1.IsChecked then
Insert('-lm', CmdStr, Length(CmdStr));
Insert('-d' + SpinBox3.Text, CmdStr, Length(CmdStr));
if CheckBox2.IsChecked then
Insert('-s', CmdStr, Length(CmdStr));
if CheckBox6.IsChecked then
Insert('-v', CmdStr, Length(CmdStr));
Insert('-m' + Edit2.Text, CmdStr, Length(CmdStr));
if ComboBox5.ItemIndex > 0 then
Insert('-dd' + IfThen(SpinBox4.Enabled, SpinBox4.Text, ''), CmdStr,
Length(CmdStr));
if ComboEdit1.Enabled then
Insert('-sps' + ReplaceText(ComboEdit1.Text, ' ', ''), CmdStr,
Length(CmdStr));
if CheckBox4.IsChecked then
begin
S := '';
if not ComboEdit2.Text.StartsWith('Auto', False) then
S := S + ':d' + ReplaceText(ComboEdit2.Text, ' ', '');
// S := S + ':o8';
Insert('-l' + SpinBox7.Text + IfThen(SameText(ComboEdit2.Text, 'Auto'), '',
'x') + S, CmdStr, Length(CmdStr));
end;
Insert('-p' + ReplaceText(ReplaceText(ComboEdit3.Text, '%', 'p'), ' ', '')
.ToLower, CmdStr, Length(CmdStr));
Insert('-bd' + Edit6.Text, CmdStr, Length(CmdStr));
Insert(Edit1.Text, CmdStr, Length(CmdStr));
if ComboBox3.ItemIndex = 1 then
Insert(Edit3.Text, CmdStr, Length(CmdStr));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form2.Left := Form1.Left + (Form1.Width div 2) - (Form2.Width div 2);
Form2.Top := Form1.Top + (Form1.Height div 2) - (Form2.Height div 2);
Form2.ShowModal;
Form2.Close;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('find', CmdStr, Length(CmdStr));
Insert('-c' + SpinBox6.Text + 'mb', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox8.Text, CmdStr, Length(CmdStr));
Insert(Edit8.Text, CmdStr, Length(CmdStr));
Insert(Edit7.Text, CmdStr, Length(CmdStr));
if ComboBox8.ItemIndex = 1 then
Insert(Edit9.Text, CmdStr, Length(CmdStr));
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('erase', CmdStr, Length(CmdStr));
Insert('-c' + SpinBox9.Text + 'mb', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox10.Text, CmdStr, Length(CmdStr));
Insert(Edit10.Text, CmdStr, Length(CmdStr));
Insert(Edit13.Text, CmdStr, Length(CmdStr));
if ComboBox10.ItemIndex = 1 then
Insert(Edit12.Text, CmdStr, Length(CmdStr));
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
SetLength(CmdStr, 0);
Insert(ParamStr(0), CmdStr, Length(CmdStr));
Insert('replace', CmdStr, Length(CmdStr));
Insert('-c' + SpinBox11.Text + 'mb', CmdStr, Length(CmdStr));
Insert('-t' + SpinBox12.Text, CmdStr, Length(CmdStr));
Insert(Edit14.Text, CmdStr, Length(CmdStr));
Insert(Edit17.Text, CmdStr, Length(CmdStr));
Insert(Edit16.Text, CmdStr, Length(CmdStr));
if ComboBox13.ItemIndex = 1 then
Insert(Edit15.Text, CmdStr, Length(CmdStr));
end;
procedure TForm1.CheckBox4Change(Sender: TObject);
begin
SpinBox7.Enabled := CheckBox4.IsChecked;
ComboEdit2.Enabled := CheckBox4.IsChecked;
end;
procedure TForm1.ComboBox10Change(Sender: TObject);
begin
Edit12.Enabled := ComboBox10.ItemIndex <> 0;
end;
procedure TForm1.ComboBox11Change(Sender: TObject);
begin
Edit13.Text := '';
end;
procedure TForm1.ComboBox12Change(Sender: TObject);
begin
Edit14.Text := '';
end;
procedure TForm1.ComboBox13Change(Sender: TObject);
begin
Edit15.Enabled := ComboBox13.ItemIndex <> 0;
end;
procedure TForm1.ComboBox14Change(Sender: TObject);
begin
Edit16.Text := '';
end;
procedure TForm1.ComboBox15Change(Sender: TObject);
begin
Edit17.Text := '';
end;
procedure TForm1.ComboBox17Change(Sender: TObject);
begin
Edit27.Text := '';
end;
procedure TForm1.ComboBox18Change(Sender: TObject);
begin
Edit26.Text := '';
end;
procedure TForm1.ComboBox19Change(Sender: TObject);
begin
Edit21.Text := '';
end;
procedure TForm1.ComboBox21Change(Sender: TObject);
begin
Edit23.Text := '';
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
SearchEditButton1.Enabled := ComboBox2.ItemIndex <> 2;
Edit1.ReadOnly := ComboBox2.ItemIndex <> 2;
if ComboBox2.ItemIndex = 2 then
Edit1.Text := 'http://mattmahoney.net/dc/silesia.zip'
else
Edit1.Text := '';
end;
procedure TForm1.ComboBox3Change(Sender: TObject);
begin
Edit3.Enabled := ComboBox3.ItemIndex <> 0;
ComboEdit1.Enabled := (ComboBox5.ItemIndex = 2) and (ComboBox3.ItemIndex = 0);
end;
procedure TForm1.ComboBox4Change(Sender: TObject);
begin
Edit5.Enabled := ComboBox4.ItemIndex > 0;
Edit5.Text := '';
end;
procedure TForm1.ComboBox5Change(Sender: TObject);
begin
SpinBox4.Enabled := ComboBox5.ItemIndex = 2;
ComboEdit1.Enabled := (ComboBox5.ItemIndex = 2) and (ComboBox3.ItemIndex = 0);
end;
procedure TForm1.ComboBox6Change(Sender: TObject);
begin
Edit7.Text := '';
end;
procedure TForm1.ComboBox7Change(Sender: TObject);
begin
Edit8.Text := '';
end;
procedure TForm1.ComboBox8Change(Sender: TObject);
begin
Edit9.Enabled := ComboBox8.ItemIndex <> 0;
end;
procedure TForm1.ComboBox9Change(Sender: TObject);
begin
Edit10.Text := '';
end;
procedure TForm1.Edit10Change(Sender: TObject);
begin
Button7.Enabled := (Edit10.Text <> '') and (Edit13.Text <> '');;
end;
procedure TForm1.Edit14Change(Sender: TObject);
begin
Button8.Enabled := (Edit14.Text <> '') and (Edit17.Text <> '') and
(Edit16.Text <> '');
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
Button1.Enabled := Edit1.Text <> '';
end;
procedure TForm1.Edit21Change(Sender: TObject);
begin
Button10.Enabled := (Edit21.Text <> '') and (Edit23.Text <> '') and
(Edit22.Text <> '') and (Edit24.Text <> '');
end;
procedure TForm1.Edit25Change(Sender: TObject);
begin
Button11.Enabled := Edit25.Text <> '';
end;
procedure TForm1.Edit6Change(Sender: TObject);
begin
if Sender = Edit6 then
begin
Edit28.Text := Edit6.Text;
ShowMessage('Restart required to reload new plugins folder.');
end
else
Edit6.Text := Edit28.Text;
end;
procedure TForm1.Edit8Change(Sender: TObject);
begin
Button5.Enabled := (Edit8.Text <> '') and (Edit7.Text <> '');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if Edit6.Text <> GetIniString('UI', 'Plugins', '',
ChangeFileExt(GetModuleName, '.ini')) then
SetIniString('UI', 'Plugins', Edit6.Text,
ChangeFileExt(GetModuleName, '.ini'));
end;
procedure TForm1.FormShow(Sender: TObject);
var
I: Integer;
begin
if not Init then
begin
Init := True;
for I := 0 to ComponentCount - 1 do
begin
if Components[I] is TSpinBox then
TSpinBox(Components[I]).Cursor := crDefault;
if Components[I] is TComboBox then
TComboBox(Components[I]).OnChange(nil);
end;
SpinBox2.Max := CPUCount * 2;
SpinBox2.Value := Max(1, CPUCount div 2);
SpinBox8.Max := CPUCount * 2;
SpinBox8.Value := Max(1, CPUCount div 2);
SpinBox10.Max := CPUCount * 2;
SpinBox10.Value := Max(1, CPUCount div 2);
SpinBox12.Max := CPUCount * 2;
SpinBox12.Value := Max(1, CPUCount div 2);
SpinBox16.Max := CPUCount * 2;
SpinBox16.Value := Max(1, CPUCount div 2);
SpinBox13.Max := CPUCount * 2;
SpinBox13.Value := Max(1, CPUCount div 2);
end;
end;
procedure TForm1.SearchEditButton11Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
Edit12.Text := SaveDialog1.FileName;
end;
procedure TForm1.SearchEditButton12Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox11.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit13.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit13.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton13Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox12.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit14.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit14.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton14Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
Edit15.Text := SaveDialog1.FileName;
end;
procedure TForm1.SearchEditButton15Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox14.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit16.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit16.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton16Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox15.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit17.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit17.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton1Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox2.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit1.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit1.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton20Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox19.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit21.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit21.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton21Click(Sender: TObject);
begin
SaveDialog2.FileName := '';
if SaveDialog2.Execute then
Edit22.Text := SaveDialog2.FileName;
end;
procedure TForm1.SearchEditButton22Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox21.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit23.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit23.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton23Click(Sender: TObject);
function IndexInt(AInteger: Integer; const AValues: array of Integer)
: Integer;
var
I: Integer;
begin
Result := -1;
for I := Low(AValues) to High(AValues) do
if AInteger = AValues[I] then
begin
Result := I;
break;
end;
end;
const
XTOOL_PRECOMP = $304C5458;
XTOOL_IODEC = $314C5458;
XTOOL_EXEC = $324C5458;
var
I: Integer;
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
begin
with TFileStream.Create(OpenDialog1.FileName, fmShareDenyNone) do
try
ReadBuffer(I, I.Size);
finally
Free;
end;
DecodeMode := IndexInt(I, [XTOOL_PRECOMP, XTOOL_IODEC]);
if DecodeMode < 0 then
raise Exception.Create('Unsupported input');
SpinBox13.Enabled := DecodeMode in [0];
GroupBox36.Enabled := DecodeMode in [1, 2];
Edit25.Text := OpenDialog1.FileName;
end;
end;
procedure TForm1.SearchEditButton24Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox18.ItemIndex of
0:
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
Edit26.Text := SaveDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit26.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton25Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox17.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit27.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit27.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton3Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
Edit3.Text := SaveDialog1.FileName;
end;
procedure TForm1.SearchEditButton4Click(Sender: TObject);
var
Dir: string;
begin
if SelectDirectory('', '', Dir) then
Edit5.Text := Dir;
end;
procedure TForm1.SearchEditButton5Click(Sender: TObject);
var
Dir: string;
begin
if SelectDirectory('', '', Dir) then
begin
Edit6.Text := Dir;
Edit28.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton6Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox6.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit7.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit7.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton7Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox7.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit8.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit8.Text := Dir;
end;
end;
procedure TForm1.SearchEditButton8Click(Sender: TObject);
begin
SaveDialog1.FileName := '';
if SaveDialog1.Execute then
Edit9.Text := SaveDialog1.FileName;
end;
procedure TForm1.SearchEditButton9Click(Sender: TObject);
var
Dir: string;
begin
case ComboBox9.ItemIndex of
0:
begin
OpenDialog1.FileName := '';
if OpenDialog1.Execute then
Edit10.Text := OpenDialog1.FileName;
end;
1:
if SelectDirectory('', '', Dir) then
Edit10.Text := Dir;
end;
end;
end.