-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScript.iss
5206 lines (4791 loc) · 190 KB
/
Script.iss
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
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define ScriptVersion "7.2.0"
;#define DEBUG
#define ScriptVersionInternal "7.2.0"
#include "Settings.ini"
#include "Resources\Modules\External\Settings.iss"
#include "Resources\Modules\External\CustomMessages.iss"
#include "Resources\Modules\External\Languages.iss"
#include "Resources\Modules\External\Messages.iss"
#define Compression "lzma"
#if InternalRecords == "1"
#include "Records.ini"
#endif
[Setup]
UsePreviousLanguage=yes
UsePreviousAppDir=yes
UsePreviousGroup=yes
DisableWelcomePage=no
DisableProgramGroupPage=yes
DisableDirPage={#CompactMode == "1" ? "yes" : "no"}
DisableFinishedPage={#CompactMode == "1" ? "yes" : "no"}
DisableReadyPage={#CompactMode == "1" || UseRedists == "0" ? "yes" : "no"}
DisableReadyMemo={#CompactMode == "1" ? "yes" : "no"}
ShowLanguageDialog=no
#if UseInfo == "1"
#ifexist "Setup\InfoBefore.txt"
InfoBeforeFile=Setup\InfoBefore.txt
#else
InfoBeforeFile=Setup\InfoBefore.rtf
#endif
#endif
WizardImageFile=Setup\{#WelcomeBackground}
WizardSmallImageFile=Setup\{#BannerBackground}
#if FileExists(SourcePath + "Setup.ico")
SetupIconFile=Setup.ico
#else
SetupIconFile=Resources\Setup.ico
#endif
AppName={#Name}
AppVersion=1.0
VersionInfoProductVersion={#ScriptVersionInternal}
VersionInfoVersion={#ScriptVersionInternal}
#if VER >= 0x06000000
WizardStyle=classic
WizardResizable=no
WizardSizePercent=100
UsedUserAreasWarning=no
UsePreviousPrivileges=no
#define DefaultDir StringChange(DefaultDir, "{pf}", "{commonpf}")
#endif
DefaultDirName={#DefaultDir}\{#Name}
DefaultGroupName={#Name}
VersionInfoCompany=Advanced Simple Installer Script
OutputBaseFilename=Setup
OutputDir=.
Compression=lzma2
SolidCompression=yes
UninstallFilesDir={app}\{#UnInstallFolder}
Uninstallable=IsUninstallable
UninstallDisplayIcon={uninstallexe}
#if x64 == "1"
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
#endif
#if defined(IS_ENHANCED) || !defined(UNICODE) /* Don't delete these lines */
#error "Standard Edition" of Inno Setup "UNICODE" from (JRSoftware) is required to compile this script
#endif
[Files]
; Thanks to Cesar82!
#define public i 0
#define public y 0
#define public n 0
#define public FileLine
#define public FileHandle
#define public FindHandle
#define public FindResult
#define GetEnabled(str Section, str StrValue, str StrName = "") \
Local[0] = LowerCase(ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", Section, "Type", "")), \
Local[1] = (ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", Section, "Enabled", "0") == "1"), \
Local[0] == "" && StrValue != "" ? Local[0] = "x86" : void, \
Local[2] = Local[0] == Trim(LowerCase(StrName)) + "-" + Trim(LowerCase(StrValue)), \
Local[3] = Local[0] == Trim(LowerCase(StrName)) + Trim(LowerCase(StrValue)), \
Pos("-", Local[0]) > 0 ? Local[1] && Local[2] : Local[1] && Local[3]
#define AFR_019 GetEnabled("AFR", "019")
#define SREP_O GetEnabled("SREP", "x86", "O")
#define XTool (ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", "XTool", "Enabled", "0") == "1")
#define ZTool (ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", "ZTool", "Enabled", "0") == "1")
#define RazorPMT GetEnabled("MPZ", "PMT") && (GetEnabled("PMT", "x64") || GetEnabled("PMT", "DUAL"))
#define MpzPMT GetEnabled("MPZ", "PMT") && (GetEnabled("PMT", "") || GetEnabled("PMT", "x86") || GetEnabled("PMT", "DUAL"))
#emit "; AFR_019: Enabled=" + Str(AFR_019) + " - SREP_O: Enabled=" + Str(SREP_O) + " - RazorPMT: Enabled=" + Str(RazorPMT) + " - MpzPMT: Enabled=" + Str(MpzPMT)
#define Name
#define Value
#define Section
#define FileName
#sub DoAddToList
#define GetItemEnabled(str Item) \
ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", Item, "Enabled", "0") == "1"
#define GetItemType(str Item) \
Local[0] = LowerCase(ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", Item, "Type", "")), \
Pos("-", Local[0]) > 0 ? Trim(Copy(Local[0], Pos("-", Local[0]) + Len("-"), Len(Local[0]))) : Trim(Local[0])
#define GetItemName(str Item) \
Local[0] = LowerCase(ReadIni(AddBackslash(SourcePath) + "Resources\Compressors\COMPRESSOR.ini", Item, "Type", "")), \
Pos("-", Local[0]) > 0 ? Trim(Copy(Local[0], 0, Pos("-", Local[0]) - 1)) : ""
#if GetItemEnabled(Section)
#define ItemName GetItemName(Section)
#define ItemType GetItemType(Section)
#if (Value == "") || (ItemType == Value) || ((ItemType == "") && (Value == "x86")) || ((ItemType == "dual") && ((Value == "x86") || (Value == "x64")))
#if (Name == "") || (ItemName == Name)
#define TmpInt DimOf(PathList)
#redim public PathList[TmpInt + 1]
#redim public DualList[TmpInt + 1]
#define public PathList[TmpInt] "Resources\Compressors\" + FileName
#define public DualList[TmpInt] ((ItemType == "dual") && ((Value == "x86") || (Value == "x64")))
#pragma message "Parsing folder: " + FileName + " >> Type: """ + ItemType + """ >> Value: """ + Value + """ >> IsDual: " + Str(DualList[TmpInt])
#endif
#endif
#endif
#endsub
#define AddToList(str File, str Sec, str Val = "", str Nam = "") /* AddToList(Files, Name, Class, Type) */ \
FileName = File, Section = Trim(Sec), Value = Trim(LowerCase(Val)), Name = Trim(LowerCase(Nam)), \
DoAddToList
//////////////////////////// COMPRESSOR //////////////////////////////////////////////////////////
// ---------- Precompressors -------------------------------- /* ------------------------------ */
#expr AddToList("SREP\N\Win64\*.*", "SREP", "x64", "N") /* SREP Inside N x64 */
#expr AddToList("SREP\N\Win32\*.*", "SREP", "x86", "N") /* SREP Inside N x86 */
#expr AddToList("SREP\N\*.*", "SREP", "", "N") /* SREP N Common */
#expr AddToList("SREP\O\*.*", "SREP", "", "O") /* SREP O */
#expr AddToList("Precomp\Win64\*.*", "PRECOMP", "x64") /* Precomp x64 */
#expr AddToList("Precomp\Win32\*.*", "PRECOMP", "x86") /* Precomp x86 */
#expr AddToList("Precomp\Win64\X\*.*", "PRECOMP", "x64", "X") /* PrecompX x64 */
#expr AddToList("Precomp\Win32\X\*.*", "PRECOMP", "x86", "X") /* PrecompX x86 */
#expr AddToList("AFR\CLS-AFR.dll", "AFR", "019") /* Anvil Forge Recompressor 019 */
#expr AddToList("AFR\Alpha7\*.*", "AFR", "020") /* Anvil Forge Recompressor 020 */
#expr AddToList("UELR\Win64\*.*", "UELR", "x64") /* UELR x64 */
#expr AddToList("UELR\Win32\*.*", "UELR", "x86") /* UELR x86 */
#expr AddToList("UELR\*.*", "UELR") /* UELR x64/x86 */
#expr AddToList("OodleRec\Oodle4\*.*", "OodleRec", "Oodle4") /* OodleRec Oodle4 */
#expr AddToList("OodleRec\Oodle5\*.*", "OodleRec", "Oodle5") /* OodleRec Oodle5 */
#expr AddToList("OodleRec\Oodle6\*.*", "OodleRec", "Oodle6") /* OodleRec Oodle6 */
#expr AddToList("OodleRec\Oodle7\*.*", "OodleRec", "Oodle7") /* OodleRec Oodle7 */
#expr AddToList("OodleRec\Oodle8\*.*", "OodleRec", "Oodle8") /* OodleRec Oodle8 */
#expr AddToList("OodleRec\*.*", "OodleRec") /* OodleRec Common x64 */
#expr AddToList("RazorTools\*.*", "RazorTools") /* RazorTools x64 */
#expr AddToList("pZLib3\Win64\*.*", "pZLib3", "x64") /* pZLib3 x64 */
#expr AddToList("pZLib3\Win32\*.*", "pZLib3", "x86") /* pZLib3 x86 */
#expr AddToList("XTool\Win64\*.*", "XTool", "x64") /* XTool x64 */
#expr AddToList("XTool\Win32\*.*", "XTool", "x86") /* XTool x86 */
#expr AddToList("XTool\*.*", "XTool") /* XTool Common */
#expr AddToList("ZSTDRec\*.*", "ZSTDRec") /* ZSTDRec x64 */
#expr AddToList("ZTool\Win64\*.*", "ZTool", "x64") /* ZTool x64 */
#expr AddToList("ZTool\Win32\*.*", "ZTool", "x86") /* ZTool x86 */
// --------- Complementary Compressor ----------------------- /* ------------------------------ */
#expr AddToList("COMMON\PMT\Win64\*.*", "PMT", "x64") /* Parallel Multithreaded x64 */
#expr AddToList("COMMON\PMT\Win32\*.*", "PMT", "x86") /* Parallel Multithreaded x86 */
#expr AddToList("COMMON\PMT\*.*", "PMT") /* Parallel Multithreaded Common */
#expr AddToList("COMMON\ZLib\Win64\*.*", "ZLib", "x64") /* ZLib x64 XTool/ZTool */
#expr AddToList("COMMON\ZLib\Win32\*.*", "ZLib", "x86") /* ZLib x86 XTool/ZTool */
#expr AddToList("COMMON\Reflate\Win64\*.*", "Reflate", "x64") /* Reflate x64 pZLib3/XTool/ZTool */
#expr AddToList("COMMON\Reflate\Win32\*.*", "Reflate", "x86") /* Reflate x64 pZLib3/XTool/ZTool */
#expr AddToList("COMMON\Facompress\*.*", "Facompress") /* Facompress x86 All Tools */
// --------- Media Streams Compressor ----------------------- /* ------------------------------ */
#expr AddToList("MSC\TAK\*.*", "MSC", "TAK") /* MSCInside TAK */
#expr AddToList("MSC\FROG\*.*", "MSC", "FROG") /* MSCInside FROG */
#expr AddToList("MPZ\*.*", "MPZ") /* MPZ Slimmer x86 */
#expr AddToList("MPZ\STANDARD\*.*", "MPZ", "NORMAL") /* MPZ Slimmer STANDARD x86 */
#expr AddToList("OGGRE\*.*", "OGGRE", "x86") /* OGGRE x86 */
#expr AddToList("BPK\*.*", "BPK", "x86") /* Bink Pack x86 */
// --------- Final Compressor ------------------------------- /* ------------------------------ */
#expr AddToList("7Zip\Win64\*.*", "7ZIP", "x64") /* 7Zip x64 */
#expr AddToList("7Zip\Win32\*.*", "7ZIP", "x86") /* 7Zip x86 */
#expr AddToList("RAZOR\STDIO\*.*", "RAZOR", "STDIO") /* RAZOR STDIO Patched x64 */
#expr AddToList("RAZOR\STANDARD\*.*", "RAZOR", "PMT") /* RAZOR Archiver + PMT x64 */
#expr AddToList("RAZOR\STANDARD\*.*", "RAZOR", "NORMAL") /* RAZOR Archiver x64 */
#expr AddToList("LOLZ\Win64\*.*", "LOLZ", "x64") /* LOLZ x64 */
#expr AddToList("LOLZ\Win32\*.*", "LOLZ", "x86") /* LOLZ x86 */
#expr AddToList("LOLZ\*.*", "LOLZ") /* LOLZ Common */
#expr AddToList("ZSTD\Win64\*.*", "ZSTD", "x64") /* ZStandard x64 */
#expr AddToList("ZSTD\Win32\*.*", "ZSTD", "x86") /* ZStandard x86 */
#expr AddToList("XDelta\*.*", "XDELTA") /* XDelta3 x86 */
#expr AddToList("RAR\*.*", "RAR") /* RAR x86 */
//////////////////////////// COMPRESSOR //////////////////////////////////////////////////////////
#sub AddFile
#if LowerCase(ExtractFileExt(FindGetFileName(FindHandle))) != 'txt' /* exclude ".txt" files */
#if (DualList[i] == 1)
#define StrPath LowerCase(ExtractFileName(ExtractFilePath(PathList[i])))
#if Pos("win64", StrPath) + Pos("win32", StrPath) + Pos("x64", StrPath) + Pos("x86", StrPath) == 0
#define StrPath LowerCase(ExtractFileName(ExtractFilePath(ExtractFilePath(PathList[i]))))
#endif
#if (Pos("win64", StrPath) > 0) || (Pos("x64", StrPath) > 0)
#emit "Source: """ + AddBackslash(ExtractFilePath(PathList[i])) + FindGetFileName(FindHandle) + """; DestName: """ + FindGetFileName(FindHandle) + ".win64""; DestDir: ""COMPRESSORS""; Flags: dontcopy;"
#else
#emit "Source: """ + AddBackslash(ExtractFilePath(PathList[i])) + FindGetFileName(FindHandle) + """; DestName: """ + FindGetFileName(FindHandle) + ".win32""; DestDir: ""COMPRESSORS""; Flags: dontcopy;"
#endif
#else
#emit "Source: """ + AddBackslash(ExtractFilePath(PathList[i])) + FindGetFileName(FindHandle) + """; DestDir: ""COMPRESSORS""; Flags: dontcopy;"
#endif
#endif
#endsub
#sub AddPathOrFile
#for {FindHandle = FindResult = FindFirst(PathList[i], 0); FindResult; FindResult = FindNext(FindHandle)} AddFile
#if FindHandle
#expr FindClose(FindHandle)
#endif
#if FindResult
#expr FindClose(FindResult)
#endif
#endsub
#for {i = 0; i < DimOf(PathList); i++} AddPathOrFile
///////////////////////////////////////////////////////////////////////////////////////////
//////////////// FreeArc/ISDone Files /////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
Source: "Resources\Compressors\COMMON\DiskSpan\CLS-DISKSPAN.dll"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\FreeArc\Arc.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\FreeArc\CLS.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\FreeArc\UnArc.dll"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\ISDone\ISDone.dll"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\ISDone\English.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy
Source: "Resources\Compressors\COMMON\ISDone\French.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\German.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\Italian.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\Spanish.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\Polish.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\Russian.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\ISDone\PortugueseBrazil.ini"; DestDir: "COMPRESSORS"; Flags: dontcopy;
Source: "Resources\Compressors\COMMON\Split\Split.exe"; DestDir: "COMPRESSORS"; Flags: dontcopy
//////////////// Modules ///////////////////////////////////////////////////////
Source: "Resources\Modules\FolderImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\DiskSpaceImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\InfoBeforeImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\CallbackCtrl.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Logo2.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
////////////////////////////////////////////////////////////////////////////////
Source: "Resources\Modules\Music\bass.dll"; DestDir: "{tmp}"; Flags: dontcopy;
#if Splash == "1"
Source: "Resources\Modules\Splash\isgsg.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Setup\{#SplashFile}"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if CompactMode == "0"
Source: "Resources\Modules\Components\SelectComponentsImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
#if UseLicense == "1"
Source: "Resources\Modules\License\LicenseImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if UseRedists == "1"
Source: "Resources\Modules\Redist\SelectRedistsImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if UseSystemReq == "1"
Source: "Resources\Modules\SystemReq\ISSysInfo.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\SystemReq\SystemReqImage.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if UseInstallBackground == "1"
Source: "Resources\Modules\InstallBG\InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy
Source: "Resources\Modules\InstallBG\isSlideShow.dll"; DestDir: "{tmp}"; Flags: dontcopy
#endif
#if UseInstallBackground == "1"
#sub AddFile2
Source: "Setup\Background\{#i}.jpg"; DestDir: "{tmp}"; Flags: dontcopy
#endsub
#for {i = 1; FileExists("Setup\Background\" + Str(i) + ".jpg" ) != 0; i++} AddFile2
#endif
#ifexist "Setup\Font.ttf"
Source: "Setup\Font.ttf"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
Source: "Setup\{#FinishBackground}"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Setup\{#BannerBackground}"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if CheckCRC == "1"
Source: "Setup\{#CRCFileName}"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\CRC\ISHash.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Resources\Modules\CRC\HashCheck.bmp"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if Music == "1"
Source: "Setup\{#MusicFile}"; DestDir: "{tmp}"; Flags: dontcopy nocompression;
#endif
#if UWPGame == "1"
Source: "Resources\UWP\UWP_Tool.exe"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
#if VCL == "1"
Source: "Resources\Modules\Style\VclStylesinno.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Setup\{#VCLName}"; DestDir: "{tmp}"; Flags: dontcopy;
#elif Cjstyles == "1"
Source: "Resources\Modules\Style\ISSkin.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "Setup\{#CjstylesName}"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
Source: "Settings.ini"; DestDir: "{tmp}"; Flags: dontcopy;
#if InternalRecords == "1"
Source: "Records.ini"; DestDir: "{tmp}"; Flags: dontcopy;
#endif
////////////////////////////////////////////////////////////////////////////////
#ifexist "Registry.iss"
#include "Registry.iss"
#endif
#if (CompactMode == "0") && (UseSystemReq == "1")
#include "Resources\Modules\SystemReq\ISSysInfo.iss"
#endif
#if CheckCRC == "1"
#include "Resources\Modules\CRC\ISHash.iss"
#endif
[Icons]
Name: "{group}\{cm:UninstallProgram,{code:AppName}}"; Filename: "{uninstallexe}"; Check: CreateIcons;
#sub AddShortcut
#emit "Name: ""{userdesktop}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) + """; " + \
"FileName: ""{app}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExePath", "")) + """; " + \
"WorkingDir: """ + ExtractFileDir("{app}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExePath", ""))) + """; " + \
"Parameters: """ + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExeParam", "")) + """; " + \
"Check: CreateIcons;"
#emit "Name: ""{group}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) + """; " + \
"FileName: ""{app}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExePath", "")) + """; " + \
"WorkingDir: """ + ExtractFileDir("{app}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExePath", ""))) + """; " + \
"Parameters: """ + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ExeParam", "")) + """; " + \
"Check: CreateIcons;"
#endsub
#for {i = 1; Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) != ""; i++} AddShortcut
[Code]
const
DI_NORMAL = 3;
FR_PRIVATE = $10; {added to compact Mode}
BASS_SAMPLE_LOOP = 4;
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_UNICODE = $80000000;
BASS_CONFIG_GVOL_STREAM = {#MusicVolume};
EncodingFlag = BASS_UNICODE;
MB_ICONERROR = $10;
MB_ICONQUESTION = $20;
MB_ICONWARNING = $30;
MB_ICONINFORMATION = $40;
MB_APPLMODAL = $00000000;
MB_SYSTEMMODAL = $00001000;
MB_TASKMODAL = $00002000;
#if CheckCRC == "1"
PM_REMOVE = 1;
WM_QUIT = 18;
#endif
type
TData = record Arc: array of String; end;
TCallback = function (OveralPct, CurrentPct: integer; CurrentFile, TimeStr1, TimeStr2, TimeStr3: PAnsiChar): Longword;
TPBProc = function (h:hWnd;Msg,wParam,lParam:Longint):Longint;
TIniMemory = record Section: String; Key, Value: TArrayOfString; end;
TRequestDisk = function(APath, AFilename: String): String;
HSTREAM = DWORD;
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TTimerProc = procedure(hWnd, uMsg, idEvent, dwTime: LongWord);
#if AFR_019
TSystemInfo = record
wProcessorArchitecture: Word;
wReserved: Word;
dwPageSize: DWORD;
lpMinimumApplicationAddress: Integer;
lpMaximumApplicationAddress: Integer;
dwActiveProcessorMask: DWORD;
dwNumberOfProcessors: DWORD;
dwProcessorType: DWORD;
dwAllocationGranularity: DWORD;
wProcessorLevel: Integer;
wProcessorRevision: Word;
end;
#endif
#if CheckCRC == "1"
TMsg = record
hwnd: HWND;
message: UINT;
wParam: Longint;
lParam: Longint;
time: DWORD;
pt: TPoint;
end;
#endif
var
//////////////////////// Check boxes ////////////////////////
IconsCB, StartMenuCB, CRCCheckCB, PauseCB, UninstallCB, LimitRAMCB: TNewCheckBox;
////////////////////////// Buttons //////////////////////////
{#if Music == "1"}MusicButton,{#endif} PauseButton: TNewButton;
/////////////////////////// Label ///////////////////////////
LabelCurrFileName, FreeSpaceLabel, NeedSpaceLabel: TLabel;
////////////////////////// Integer //////////////////////////
#if XTool || ZTool || (UWPGame == "1")
ResultCode: Integer;
#endif
//////////////////////// Static Text ////////////////////////
PercentLabel, ElapsedLabel, RemainingLabel: TNewStaticText;
//////////////////////// Components /////////////////////////
#if UseComponents == "1"
ComponentsList: TNewCheckListBox;
SelectComponentsLabel, ComponentsDiskSpaceLabel: TNewStaticText;
CompIndexList: TArrayOfInteger;
ComponentsPageAvai {#if CompactMode == "1"}, ComponentsPageVisible, ComponentsDiskSpaceLabelVisible{#endif}: Boolean;
ComponentsSize: Extended;
{#if CompactMode == "1"}ComponentsOKButton: TNewButton;{#endif}
#endif
///////////////////////// Redists ///////////////////////////
#if UseRedists == "1"
RedistsList: TNewCheckListBox;
Redist1, Redist2, Redist3, Redist4, Redist5, Redist6, Redist7, Redist8, Redist9, Redist10: Integer;
#endif
/////////////////////////// Others //////////////////////////
#if Music == "1"
SoundStream: HSTREAM;
#endif
FreeMB, TotalMB: Cardinal;
StartTick: DWORD;
ISDoneCancel: Integer;
ISDoneError: Boolean;
SplitPct: Longint;
Data: array of TData;
InstallationSize: Extended;
#if CompactMode == "0"
FolderImage, DiskSpaceImage, InfoBeforeImage, {#if UseRedists == "1"}SelectRedistsImage,{#endif} BannerImage, SelectComponentsImage: TBitmapImage;
WebsiteButton, AboutButton: TNewButton;
NeedSizeFreeSizeBevel: TBevel;
ComponentsPage: TWizardPage;
#else
RedistCB: TNewCheckBox;
AboutButtonCM {#if UseInfo == "1"}, InfoButtonCM{#endif}: TNewButton;
#endif
#if (CompactMode == "0") && (UseInfo == "1")
InfoBeforeMemo: TNewMemo;
#endif
#if (CompactMode == "0") && (UseLicense == "1")
LicenseImage: TBitmapImage;
LicenseMemo: TNewMemo;
#endif
#if (CompactMode == "0") && (UseSystemReq == "1")
SystemReqPage: TWizardPage;
SystemReqImage: TBitmapImage;
Case1: TPanel;
SysReqCheckLabel, IfReadyLabel, HardwareDetectLabel: TNewStaticText;
SystemLabel, SystemNameLabel, CPUGHZLabel, GPUGHZLabel, HwLabel: TLabel;
CPULabel, CPUNameLabel, GPULabel, GPUNameLabel, DirectXLabel, DirectXVersionLabel, RAMLabel, TotalRAMLabel: TLabel;
ProcessorBevel, VideoCardBevel, DirectXBevel, RAMBevel, SystemBevel, ProcessorNameBevel, VideoCardNameBevel, DirectXVersionBevel, RAMTotalBevel: TBevel;
SystemNameBevel, CPUMHZBevel, GPUMHZBevel: TBevel;
Processor, VideoRam, Ram, OpSystem, DirectX, DX, OSNumber: Integer;
#endif
#if (CompactMode == "0") && (UseInstallBackground == "1")
BackgroundForm: TForm;
BackgroundButton: TNewButton;
BackgroundCB: TNewCheckBox;
CurrentPicture: Integer;
PicList: TStringlist;
TimerID: LongWord;
#endif
#if CheckCRC == "1"
#if CompactMode == "0"
HashImage: TBitmapImage;
#endif
CRCPage: TWizardPage;
CRCInfoMemo, CRCLogMemo: TNewMemo;
CRCCancelButton, LogButton: TNewButton;
HashProgressBar1, HashProgressBar2: TNewProgressBar;
CheckFileLabel, OveralCheckLabel: TLabel;
HashHdrLabel: TNewStatictext;
BadFile, MissingFile, FileOK: Integer;
ContinueHash, Checked: Boolean;
Msg: Tmsg;
#endif
#if Music == "1"
function BASS_Init(device: LongInt; freq, flags: DWORD; win: HWND; clsid: Cardinal): BOOL;
external 'BASS_Init@files:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD; offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_Start: BOOL;
external 'BASS_Start@files:bass.dll stdcall';
function BASS_Pause: BOOL;
external 'BASS_Pause@files:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
external 'BASS_SetConfig@files:bass.dll stdcall';
function BASS_ChannelIsActive(handle: DWORD): DWORD;
external 'BASS_ChannelIsActive@files:bass.dll stdcall';
function BASS_Free: BOOL;
external 'BASS_Free@files:bass.dll stdcall';
#endif
#if AFR_019
procedure GetSystemInfo(var lpSystemInfo: TSystemInfo);
external '[email protected] stdcall';
#endif
#if Splash == "1"
procedure ShowSplashScreen(p1:HWND; p2:AnsiString; p3,p4,p5,p6,p7:integer; p8:boolean; p9:Cardinal; p10:integer);
external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
#endif
#if VCL == "1"
procedure LoadVCLStyle(VClStyleFile: String);
external 'LoadVCLStyleW@{tmp}\VclStylesInno.dll stdcall delayload';
procedure UnLoadVCLStyles;
external 'UnLoadVCLStyles@{tmp}\VclStylesInno.dll stdcall delayload';
#elif Cjstyles == "1"
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@{tmp}\ISSkin.dll stdcall delayload';
procedure UnloadSkin();
external 'UnloadSkin@{tmp}\ISSkin.dll stdcall delayload';
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external '[email protected] stdcall';
#endif
#if CheckCRC == "1"
function TranslateMessage(var lpMsg: TMsg): Boolean;
external '[email protected] stdcall';
function DispatchMessage(var lpMsg: TMsg): Boolean;
external '[email protected] stdcall';
function PeekMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL;
external '[email protected] stdcall';
#endif
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem: longint; callback:TCallback):boolean;
external 'ISDoneInit@files:ISDone.dll stdcall';
function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile: boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ): boolean;
external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean;
external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean;
external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean;
external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean;
external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean;
external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneStop:boolean;
external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean;
external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean;
external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean;
external 'ResumeProc@files:ISDone.dll stdcall';
procedure ExitProcess(exitCode:integer);
external '[email protected] stdcall';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean;
external 'Exec2@files:ISDone.dll stdcall delayload';
function AddFontResource(lpszFilename: String; fl, pdv: DWORD): Integer;
external '[email protected] stdcall';
function RemoveFontResource(lpFileName: String; fl, pdv: DWORD): BOOL;
external '[email protected] stdcall';
function GetTickCount: DWORD;
external '[email protected] stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint;
external '[email protected] stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint;
external '[email protected] stdcall';
function CallBackProc(P:TPBProc;ParamCount:integer):LongWord;
external 'wrapcallbackaddr@files:CallbackCtrl.dll stdcall';
procedure ClsInit(Path: String; Parent: HWND);
external 'ClsInit@files:cls-diskspan.dll cdecl';
function ExtractIcon(hInst: Longint; lpszExeFileName: String; nIconIndex: UINT): Longint;
external '[email protected] stdcall';
function DrawIconEx(hdc: Longint; xLeft, yTop: Integer; hIcon: Longint; cxWidth, cyWidth: Integer; istepIfAniCur: Longint; hbrFlickerFreeDraw, diFlags: Longint): Longint;
external '[email protected] stdcall';
function DestroyIcon(hIcon: Longint): Longint;
external '[email protected] stdcall';
function GetModuleHandle(lpModuleName: Longint): Longint;
external '[email protected] stdcall';
function ShellExecute(hWnd: HWND; lpOperation: String; lpFile: String; lpParameters: String; lpDirectory: String; nShowCmd: Integer): THandle;
external '[email protected] stdcall';
function MessageBox(hWnd: HWND; lpText, lpCaption: String; uType: UINT): Integer;
external '[email protected] stdcall delayload';
function CreateLangDialog(): Boolean;
var
I: Integer;
TmpStr: String;
Params: String;
Instance: THandle;
SL1, SL2: TStringList;
LangList: TStringList;
LangIcon: Longint;
LangRect: TRect;
LangDialogForm: TSetupForm;
LangDialogLabel: TNewStaticText;
LangDialogComboBox: TNewComboBox;
LangDialogOKButton: TNewButton;
LangDialogCancelButton: TNewButton;
begin
SL1 := TStringList.Create; { Values from LanguageName= key, [LangOptions] section in external language file }
SL1.Add('English'); //'English'
SL1.Add('Fran'#$00E7'ais'); //'Fran<00E7>ais'
SL1.Add('Deutsch'); //'Deutsch'
SL1.Add('Italiano'); //'Italiano'
SL1.Add('Espa'#$00F1'ol'); //'Espa<00F1>ol'
SL1.Add('Polski'); //'Polski'
SL1.Add(#$0420#$0443#$0441#$0441#$043A#$0438#$0439); //'<0420><0443><0441><0441><043A><0438><0439>'
SL1.Add('Portugu'#$00EA's Brasileiro'); //'Portugu<00EA>s Brasileiro'
SL1.Add(#$010C'e'#$0161'tina'); //'<010C>e<0161>tina'
SL2 := TStringList.Create; {Values from section [Languages] Name: in script}
SL2.Add('English');
SL2.Add('French');
SL2.Add('German');
SL2.Add('Italian');
SL2.Add('Spanish');
SL2.Add('Polish');
SL2.Add('Russian');
SL2.Add('PortugueseBrazil');
SL2.Add('Czech');
LangDialogForm := CreateCustomForm();
try
with LangDialogForm do
begin
ClientWidth := ScaleX(297);
ClientHeight := ScaleY(125);
Position := poScreenCenter;
Caption := SetupMessage(msgSelectLanguageTitle);
Color := clBtnFace;
BorderIcons := [biSystemMenu];
ActiveControl := LangDialogOKButton;
end;
LangDialogLabel := TNewStaticText.Create(LangDialogForm);
with LangDialogLabel do
begin
Parent := LangDialogForm;
Left := ScaleX(56);
Top := ScaleY(8);
Width := ScaleX(233);
Height := ScaleY(39);
AutoSize := False;
WordWrap := True;
Caption := SetupMessage(msgSelectLanguageLabel);
end;
LangDialogComboBox := TNewComboBox.Create(LangDialogForm);
with LangDialogComboBox do
begin
Left := ScaleX(56);
Top := ScaleY(56);
Width := ScaleX(233);
Height := ScaleY(21);
Parent := LangDialogForm;
Style := csDropDownList;
DropDownCount := 16;
Sorted := True;
Items.AddStrings(SL1);
ItemIndex := 0;
LangList := TStringList.Create;
for I := 0 to SL2.Count - 1 do
begin
LangList.Append(SL2.Strings[SL1.IndexOf(LangDialogComboBox.Items.Strings[I])]);
end;
ItemIndex := LangList.IndexOf(ActiveLanguage);
end;
LangDialogOKButton := TNewButton.Create(LangDialogForm);
with LangDialogOKButton do
begin
Parent := LangDialogForm;
Left := ScaleX(133);
Top := ScaleY(93);
Width := ScaleX(75);
Height := ScaleY(23);
Caption := SetupMessage(msgButtonOK);
ModalResult := mrOk;
Default := True;
end;
LangDialogCancelButton := TNewButton.Create(LangDialogForm);
with LangDialogCancelButton do
begin
Parent := LangDialogForm;
Left := ScaleX(214);
Top := ScaleY(93);
Width := ScaleX(75);
Height := ScaleY(23);
Caption := SetupMessage(msgButtonCancel);
ModalResult := mrCancel;
end;
try
LangRect.Left := ScaleX(0);
LangRect.Top := ScaleY(0);
LangRect.Right := ScaleX(32);
LangRect.Bottom := ScaleY(32);
LangIcon := ExtractIcon(GetModuleHandle(0), ExpandConstant('{srcexe}'), 0);
try
with TBitmapImage.Create(LangDialogForm) do
begin
Parent := LangDialogForm;
Left := ScaleX(10);
Top := ScaleY(10);
Width := ScaleX(32);
Height := ScaleY(32);
with Bitmap do
begin
Width := LangRect.Bottom;
Height := LangRect.Right;
Canvas.Brush.Color := LangDialogForm.Color;
Canvas.FillRect(LangRect);
DrawIconEx(Canvas.Handle, 0, 0, LangIcon, LangRect.Bottom, LangRect.Right, 0, 0, DI_NORMAL);
end;
end;
finally
DestroyIcon(LangIcon);
end;
except
end;
if (LangDialogForm.ShowModal = mrOk) then
begin
{ Collect current instance parameters }
for I := 1 to ParamCount do
begin
TmpStr := ParamStr(I);
{ Unique log file name for the elevated instance }
if CompareText(Copy(TmpStr, 1, 5), '/LOG=') = 0 then
begin
TmpStr := TmpStr + '-localized';
end;
{ Do not pass our /SL5 switch }
if CompareText(Copy(TmpStr, 1, 5), '/SL5=') <> 0 then
begin
Params := Params + AddQuotes(TmpStr) + ' ';
end;
end;
Params := Params + '/LANG=' + LangList[LangDialogComboBox.ItemIndex];
Instance := ShellExecute(0, '', ExpandConstant('{srcexe}'), Params, '', SW_SHOW);
if Instance <= 32 then
MsgBox(Format('Running installer with selected language failed. Code: %d', [Instance]), mbError, MB_OK);
end;
finally
LangDialogForm.Free();
Result := False;
end;
end;
const
POWER_KB = 1;
POWER_MB = 2;
POWER_GB = 3;
POWER_TB = 4;
POWER_PB = 5;
KFactor = 1024;
function FormatBytes(const Bytes: Extended; Offset: Integer; HideZero: Boolean): String;
var
Idx: Byte;
Amount: Extended;
Dms: TArrayOfString;
begin
Dms := ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
Amount := Bytes;
Idx := 0;
while Amount > (0.9 * KFactor) do
begin
Idx := Idx + 1;
Amount := Amount / KFactor;
end;
if Idx = 0 then
Result := Format('%.0f %s', [Amount, Dms[Idx]])
else
Result := Format('%.' + IntToStr(Offset) + 'f %s', [Amount, Dms[Idx]]);
if Result = '0 B' then
begin
if HideZero then
Result := ''
else
Result := '0 Byte';
end;
end;
function StrToFloatDef(S: String; Def: Extended): Extended;
begin
if Trim(S) = '' then
Result := Def
else
try
Result := StrToFloat(S);
except
Result := Def;
end;
end;
function PowerK(Value: Extended; Offset: Integer): Extended;
var
I: Integer;
begin
Result := Value;
for I := 1 to Offset do
Result := Result * KFactor;
end;
function GetSizeBytes(const Value: String; Default: Extended): Extended;
var
I: Integer;
Pt: Integer;
TmpStr: String;
Unity: String;
begin
I := 1;
Pt := 0;
Unity := '';
TmpStr := Trim(Value);
StringChangeEx(TmpStr, ',', '.', True);
while Length(TmpStr) >= I do {remove no numeric character}
begin
if StrToIntDef(TmpStr[I], 10) = 10 then
begin
if (Pt = 0) and (I > 1) and (TmpStr[I] = '.') then
begin
Inc(Pt);
Inc(I);
end else
begin
if (TmpStr[I] <> '.') and (TmpStr[I] <> ' ') and (Length(Unity) < 3) then
Unity := Unity + TmpStr[I];
Delete(TmpStr, I, 1)
end;
end else
Inc(I);
end;
if TmpStr <> '' then
begin
SetLength(Unity, 2);
case Trim(Uppercase(Unity)) of
'PB', 'P' : Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_PB);
'TB', 'T' : Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_TB);
'GB', 'G' : Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_GB);
'MB', 'M' : Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_MB);
'KB', 'K' : Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_KB);
'BY', 'B' : Result := StrToFloatDef(TmpStr, Default);
else begin
if Pos('.', Copy(TmpStr, Pos('.', TmpStr), Length(TmpStr))) > 0 then
begin
StringChangeEx(TmpStr, '.', '', True);
Result := StrToFloatDef(TmpStr, Default);
end else
Result := PowerK(StrToFloatDef(TmpStr, Default), POWER_MB);
end;
end;
end else
Result := Default;
end;
function FormatDiskSpaceLabel(Labl: String; Size: Extended): String;
begin
Result := Labl;
StringChangeEx(Result, '[mb] MB', '[size]', True)
StringChangeEx(Result, '[size]', FormatBytes(Size, 2, True), True);
end;
function NumToStr(Float: Extended): string;
begin
Result := Format('%.2n', [Float]);
StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
end;
function MbOrTb(Float: Extended): String;
begin
if Float < KFactor then
Result := NumToStr(Float) + ' MB'
else
if Float/KFactor < KFactor then
Result := NumToStr(Float / KFactor) + ' GB'
else
Result := NumToStr(Float / (KFactor * KFactor)) + ' TB'
end;
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
InstallationSize := {#if UseComponents == "1"}ComponentsSize + {#endif}GetSizeBytes(GetIniString('Settings', 'Size', '0', ExpandConstant('{tmp}\Settings.ini')), 0);
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
#if CompactMode == "0"
FreeSpaceLabel.Caption := ExpandConstant('{cm:FreeSpace} ') + MbOrTb(FreeMB) + ' (' + IntToStr((FreeMB * 100) div TotalMB) + '%)';
NeedSpaceLabel.Caption := ExpandConstant('{cm:NeedSpace} ') + FormatBytes(InstallationSize, 2, True);
#else
FreeSpaceLabel.Caption := 'F: ' + MbOrTb(FreeMB) + ' (' + IntToStr((FreeMB * 100) div TotalMB) + '%)';
NeedSpaceLabel.Caption := 'N: ' + FormatBytes(InstallationSize, 2, True);
#endif
if Extended(FreeMB) < Extended(InstallationSize / PowerK(1, POWER_MB)) then
begin
FreeSpaceLabel.Font.Color := clRed;
WizardForm.NextButton.Enabled := False;
end else
begin
FreeSpaceLabel.Font.Color := NeedSpaceLabel.Font.Color;
WizardForm.NextButton.Enabled := True;
end;
end;
#if Music == "1"
procedure MusicButtonClick(Sender: TObject);
begin
case BASS_ChannelIsActive(SoundStream) of
BASS_ACTIVE_PLAYING:
begin
if BASS_Pause then
MusicButton.Caption := ExpandConstant('{cm:MusicButtonCaptionSoundOn}');
end;
BASS_ACTIVE_PAUSED:
begin
if BASS_Start then
MusicButton.Caption := ExpandConstant('{cm:MusicButtonCaptionSoundOff}');
end;
end;
end;
#endif
procedure PauseButtonClick(Sender: TObject);
begin
if PauseCB.Checked then
begin
PauseButton.Caption := ExpandConstant('{cm:Pause}');
ResumeProc;
end else
begin
PauseButton.Caption := ExpandConstant('{cm:Resume}');
SuspendProc;
end;
PauseCB.Checked := not PauseCB.Checked;
end;
#if (CompactMode == "0") && (UseInstallBackground == "1")
procedure BackgroundButtonClick(Sender: TObject);
begin
if BackgroundCB.Checked then
begin
BackgroundButton.Caption := ExpandConstant('{cm:BackgroundON}');
BackgroundForm.Show;
WizardForm.BringToFront;
end else
begin
BackgroundButton.Caption := ExpandConstant('{cm:BackgroundOFF}');
BackgroundForm.Hide;
end;
BackgroundCB.Checked := not BackgroundCB.Checked;
end;
#endif