forked from Universal-Rom-Tools/Universal-XML-Scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Universal XML Scraper.au3.Backup.au3
3088 lines (2841 loc) · 148 KB
/
Universal XML Scraper.au3.Backup.au3
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
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Ressources\Images\Universal_Xml_Scraper.ico
#AutoIt3Wrapper_Outfile=..\BIN\Universal_XML_Scraper.exe
#AutoIt3Wrapper_Outfile_x64=..\BIN\Universal_XML_Scraper64.exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Description=Scraper XML Universel
#AutoIt3Wrapper_Res_Fileversion=2.2.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=LEGRAS David
#AutoIt3Wrapper_Res_Language=1036
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/reel
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;*************************************************************************
;** **
;** Universal XML Scraper V2 **
;** LEGRAS David **
;** **
;*************************************************************************
;Autoit Librairy definitions
;---------------------------
#include <Date.au3>
#include <array.au3>
#include <File.au3>
#include <String.au3>
#include <GuiStatusBar.au3>
#include <Crypt.au3>
#include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <InetConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GuiMenu.au3>
TraySetState(2)
;Global Values
;---------------------------
If Not _FileCreate(@ScriptDir & "\test") Then ; Testing UXS Directory
Global $iScriptPath = @AppDataDir & "\UXMLS" ; If not, use Path to current user's Roaming Application Data
DirCreate($iScriptPath) ;
Else
Global $iScriptPath = @ScriptDir
FileDelete($iScriptPath & "\test")
EndIf
Global $iINIPath = $iScriptPath & "\UXS-config.ini"
Global $iLOGPath = $iScriptPath & "\LOGs\log.txt"
Global $iVerboseLVL = IniRead($iINIPath, "GENERAL", "$vVerbose", 0)
Global $MS_AutoConfigItem
;Personnal Librairy definitions
;---------------------------
;~ #include "./Include/_MultiLang.au3"
;~ #include "./Include/_ExtMsgBox.au3"
;~ #include "./Include/_Trim.au3"
;~ #include "./Include/_Hash.au3"
;~ #include "./Include/_XML.au3"
;~ #include "./Include/_MailSlot.au3"
;~ #include "./Include/_GraphGDIPlus.au3"
;~ #include "./Include/_MyFunction.au3"
;~ #include "./Include/_ITaskBarList.au3"
;~ #include "./Include/_WinHttp.au3"
;~ #include "./Include/_AutoItErrorTrap.au3"
; Custom title and text...
_AutoItErrorTrap("AutoItErrorTrap", "Hi!" & @CRLF & @CRLF & "An error was detected in the program, you can try again," & _
" cancel to exit or continue to see more details of the error." & @CRLF & @CRLF & "Sorry for the inconvenience!")
$oTaskbar = _ITaskBar_CreateTaskBarObj()
;Checking Version
;----------------
_LOG_Ceation($iLOGPath) ; Starting Log
If @OSArch = "X64" Then
_LOG("Scrape in x64", 0, $iLOGPath)
Local $iScraper = "Scraper64.exe"
Else
_LOG("Scrape in x86", 0, $iLOGPath)
Local $iScraper = "Scraper.exe"
EndIf
_KillScrapeEngine($iScraper)
Local $vMaj = 0
If @Compiled Then
Local $iScriptVer = FileGetVersion(@ScriptFullPath)
Local $iINIVer = IniRead($iINIPath, "GENERAL", "$verINI", '0.0.0.0')
Local $iSoftname = "UniversalXMLScraperV" & $iScriptVer
If $iINIVer <> $iScriptVer Then
$vMaj = 1
FileDelete($iScriptPath & "\UXS-config.ini")
FileDelete($iScriptPath & "\LanguageFiles")
FileDelete($iScriptPath & "\Ressources")
FileDelete($iScriptPath & "\Mix")
FileDelete($iScriptPath & "\ProfilsFiles")
_LOG("Update file needed from version " & $iINIVer & " to " & $iScriptVer, 1, $iLOGPath)
FileDelete($iScraper)
Else
_LOG("No updated files needed (Version : " & $iScriptVer & ")", 1, $iLOGPath)
EndIf
Else
Local $iScriptVer = 'In Progress'
Local $iINIVer = IniRead($iINIPath, "GENERAL", "$verINI", '0.0.0.0')
Local $iSoftname = "UniversalXMLScraper(TestDev)"
_LOG("Dev version", 1, $iLOGPath)
EndIf
#Region FileInstall
_LOG("Starting files installation", 0, $iLOGPath)
DirCreate($iScriptPath & "\LanguageFiles")
DirCreate($iScriptPath & "\Ressources")
DirCreate($iScriptPath & "\Ressources\Licences")
DirCreate($iScriptPath & "\Mix")
DirCreate($iScriptPath & "\Mix\TEMP")
DirCreate($iScriptPath & "\ProfilsFiles")
DirCreate($iScriptPath & "\ProfilsFiles\Ressources")
FileInstall(".\UXS-config.ini", $iScriptPath & "\UXS-config.ini")
FileInstall(".\Ressources\7za.exe", $iScriptPath & "\Ressources\7za.exe", 0)
FileInstall(".\Scraper.exe", $iScriptPath & "\Scraper.exe", 0)
FileInstall(".\Scraper64.exe", $iScriptPath & "\Scraper64.exe", 0)
FileSetAttrib($iScriptPath & "\Scraper.exe", "+H")
FileSetAttrib($iScriptPath & "\Scraper64.exe", "+H")
FileInstall(".\Ressources.zip", $iScriptPath & "\Ressources.zip")
If $vMaj = 1 Then
$vResult = _Unzip($iScriptPath & "\Ressources.zip", $iScriptPath & "\")
If $vResult < 0 Then
Switch $vResult
Case 1
_LOG("not a Zip file", 2, $iLOGPath)
Case 2
_LOG("Impossible to unzip", 2, $iLOGPath)
Case Else
_LOG("Unknown Zip Error (" & @error & ")", 2, $iLOGPath)
EndSwitch
EndIf
EndIf
_LOG("Ending files installation", 1, $iLOGPath)
#EndRegion FileInstall
;Splash Screen
$F_Splashcreen = GUICreate("", 799, 449, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW)
GUICtrlCreatePic($iScriptPath & "\Ressources\Images\UXS.jpg", -1, -1, 800, 450)
SoundPlay($iScriptPath & "\Ressources\Sons\jingle_uxs.MP3")
GUISetState()
;Const def
;---------
Global $iDevId = BinaryToString(_Crypt_DecryptData("0x1552EDED2FA9B5", "1gdf1g1gf", $CALG_RC4))
Global $iDevPassword = BinaryToString(_Crypt_DecryptData("0x1552EDED2FA9B547FBD0D9A623D954AE7BEDC681", "1gdf1g1gf", $CALG_RC4))
Global $iTEMPPath = $iScriptPath & "\TEMP"
Global $iRessourcesPath = $iScriptPath & "\Ressources"
Global $iLangPath = $iScriptPath & "\LanguageFiles" ; Where we are storing the language files.
Global $iProfilsPath = $iScriptPath & "\ProfilsFiles" ; Where we are storing the profils files.
Global $iMIXPath = $iScriptPath & "\Mix" ; Where we are storing the MIX files.
Global $iPathMixTmp = $iMIXPath & "\TEMP" ; Where we are storing the current MIX files.
Global $iURLScraper = _TestServer(1)
Global $sMailSlotMother = "\\.\mailslot\Mother"
Global $sMailSlotCancel = "\\.\mailslot\Cancel"
Global $sMailSlotCheckEngine = "\\.\mailslot\CheckEngine"
Global $hMailSlotCheckEngine = _CreateMailslot($sMailSlotCheckEngine)
Global $hMailSlotMother = _CreateMailslot($sMailSlotMother)
_LOG("Verbose LVL : " & $iVerboseLVL, 1, $iLOGPath)
_LOG("Path to ini : " & $iINIPath, 1, $iLOGPath)
_LOG("Path to log : " & $iLOGPath, 1, $iLOGPath)
_LOG("Path to language : " & $iLangPath, 1, $iLOGPath)
;Variable def
;------------
Global $vUserLang = IniRead($iINIPath, "LAST_USE", "$vUserLang", -1)
Global $MP_, $aPlink_Command, $vScrapeCancelled
Global $vProfilsPath = IniRead($iINIPath, "LAST_USE", "$vProfilsPath", -1)
Local $vXpath2RomPath, $vFullTimer, $vRomTimer, $vSelectedProfil = -1
Local $L_SCRAPE_Parts[3] = [300, 480, -1]
Local $oXMLProfil, $oXMLSystem, $oXMLCountry, $oXMLGenre
Global $aConfig = 1, $aRomList, $aXMLRomList
Local $nMsg
Local $vNbThread = IniRead($iINIPath, "LAST_USE", "$vNbThread", 1)
Local $vStart = 0, $vWizCancel = 0, $vLaunchScrape = 0, $aOptionMenu = -1
;---------;
;Principal;
;---------;
; Loading language
Local $aLangList = _MultiLang_LoadLangDef($iLangPath, $vUserLang)
If Not IsArray($aLangList) Or $aLangList < 0 Then
_LOG("Impossible to load language", 2, $iLOGPath)
Exit
EndIf
;~ _ArrayDisplay($aLangList, "$aLangList") ;Debug
; Update Checking
_LOG("Update Checking", 1, $iLOGPath)
Local $iChangelogPath = $iScriptPath & "\changelog.txt"
FileDelete($iChangelogPath)
Local $Result = _DownloadWRetry("https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-XML-Scraper/master/changelog.txt", $iChangelogPath)
Switch $Result
Case -1
_LOG("Error downloading Changelog", 2, $iLOGPath)
Case -2
_LOG("Time Out downloading Changelog", 2, $iLOGPath)
Case Else
Local $iChangelogVer = FileReadLine($iChangelogPath)
_LOG("Local : " & $iScriptVer & " - Github : " & $iChangelogVer, 0, $iLOGPath)
If $iChangelogVer <> $iScriptVer And @Compiled = 1 Then
_LOG("Asking to Update", 0, $iLOGPath)
_GUI_Update($iChangelogPath)
EndIf
EndSwitch
$vSSLogin = IniRead($iINIPath, "LAST_USE", "$vSSLogin", "")
$vSSPassword = IniRead($iINIPath, "LAST_USE", "$vSSPassword", "")
;Catching SystemList.xml
$oXMLSystem = _XMLSystem_Create($vSSLogin, $vSSPassword)
If $oXMLSystem = -1 Then Exit
;Catching CountryList.xml
$oXMLCountry = _XMLCountry_Create($vSSLogin, $vSSPassword)
If $oXMLCountry = -1 Then Exit
;Catching GenreList.xml
$oXMLGenre = _XMLGenre_Create($vSSLogin, $vSSPassword)
;Delete Splascreen
GUIDelete($F_Splashcreen)
#Region ### START Koda GUI section ### Form=
Local $F_UniversalScraper = GUICreate(_MultiLang_GetText("main_gui"), 601, 370)
GUISetBkColor(0x34495c, $F_UniversalScraper)
Local $MF = GUICtrlCreateMenu(_MultiLang_GetText("mnu_file"), -1, 1)
Local $MF_Separation = GUICtrlCreateMenuItem("", $MF)
Local $MF_Exit = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_file_exit"), $MF)
Local $MC = GUICtrlCreateMenu(_MultiLang_GetText("mnu_cfg"), -1, 2)
Local $MC_Wizard = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_Wizard"), $MC)
Local $MC_Separation = GUICtrlCreateMenuItem("", $MC)
Local $MC_Profil = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_profil"), $MC)
Local $MC_Langue = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_langue"), $MC)
Local $MC_Separation = GUICtrlCreateMenuItem("", $MC)
Local $MC_Mix = GUICtrlCreateMenu("Mix", $MC)
Local $MC_Miximage = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_miximage"), $MC_Mix)
Local $MC_MixDownload = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_download_miximage"), $MC_Mix)
Local $MC_Separation = GUICtrlCreateMenuItem("", $MC)
Local $MC_config_MISC = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_config_MISC"), $MC)
Local $MC_config_Advanced = GUICtrlCreateMenu("Advanced", $MC)
Local $MC_config_PIC = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_config_PIC"), $MC_config_Advanced)
Local $MC_Config_LU = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_config_LU"), $MC_config_Advanced)
Local $MC_config_autoconf = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_cfg_config_autoconf"), $MC_config_Advanced)
Global $MOption = GUICtrlCreateMenu(_MultiLang_GetText("mnu_cfg_config_Option"), -1, 3)
Local $MS = GUICtrlCreateMenu(_MultiLang_GetText("mnu_scrape"), -1, 4)
Local $MS_AutoConfig = GUICtrlCreateMenu(_MultiLang_GetText("mnu_scrape_autoconf"), $MS, 1)
Local $MS_Scrape = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_scrape_solo"), $MS)
Local $MS_Separation = GUICtrlCreateMenuItem("", $MS)
Local $MS_FullScrape = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_scrape_fullscrape"), $MS)
Local $MP = GUICtrlCreateMenu(_MultiLang_GetText("mnu_ssh"), -1, 5)
Local $MP_Parameter = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_ssh_Parameter"), $MP)
Local $MP_Separation = GUICtrlCreateMenuItem("", $MP)
GUICtrlSetState($MP, $GUI_DISABLE)
Local $MH = GUICtrlCreateMenu(_MultiLang_GetText("mnu_help"), -1, 6)
Local $MH_Help = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_help_wiki"), $MH)
Local $MH_Support = GUICtrlCreateMenu(_MultiLang_GetText("mnu_help_support"), $MH)
Local $MH_Support_Screenscraper = GUICtrlCreateMenuItem("Screenscraper", $MH_Support, 1)
Local $MH_Support_Tipee = GUICtrlCreateMenuItem("Tipee (€)", $MH_Support, 2)
Local $MH_Support_Patreon = GUICtrlCreateMenuItem("Patreon ($)", $MH_Support, 3)
Local $MH_Link = GUICtrlCreateMenu(_MultiLang_GetText("mnu_help_link"), $MH)
Local $MH_Link_Screenzone = GUICtrlCreateMenuItem("http://www.screenzone.fr/", $MH_Link, 1)
Local $MH_Link_Recalbox = GUICtrlCreateMenuItem("https://www.recalbox.com/", $MH_Link, 2)
Local $MH_Link_Retropie = GUICtrlCreateMenuItem("https://retropie.org.uk/", $MH_Link, 3)
Local $MH_Changelog = GUICtrlCreateMenuItem('Changelog', $MH)
Local $MH_Log = GUICtrlCreateMenuItem('Log', $MH)
Local $MH_About = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_help_about"), $MH)
Local $P_BACKGROUND = GUICtrlCreatePic($iScriptPath & "\ProfilsFiles\Ressources\empty.jpg", -1, 0, 600, 293)
Global $P_MIX = GUICtrlCreatePic("", 58, 193, 165, 100, -1, -1)
Global $P_WHEEL = GUICtrlCreatePic("", 270, 225, 120, 60, -1, -1)
Local $PB_SCRAPE = GUICtrlCreateProgress(2, 297, 478, 25)
Local $B_SCRAPE = GUICtrlCreateButton(_MultiLang_GetText("scrap_button"), 481, 296, 118, 27)
Local $L_SCRAPE = _GUICtrlStatusBar_Create($F_UniversalScraper)
_GUICtrlStatusBar_SetParts($L_SCRAPE, $L_SCRAPE_Parts)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_ITaskBar_SetThumbNailToolTip($F_UniversalScraper)
$vProfilDefault = IniRead($iINIPath, "LAST_USE", "$vProfilsPath", "")
If $vProfilDefault = "" Then
$vStart = 1
IniWrite($iINIPath, "LAST_USE", "$vMirror", 0)
Else
;Opening XML Profil file
$oXMLProfil = _XML_Open($vProfilsPath)
If $oXMLProfil = -1 Then Exit
$aOptionMenu = _OptionMenuConstruction($oXMLProfil, $aOptionMenu)
;Setting MIX Template
_LOG("Setting Mix Template", 0, $iLOGPath)
$vLastMIX = $iMIXPath & "\" & IniRead($iINIPath, "LAST_USE", "$vMixImage", "Standard (3img)") & ".zip"
DirRemove($iPathMixTmp, 1)
DirCreate($iPathMixTmp)
$vResult = _Unzip($vLastMIX, $iPathMixTmp)
If $vResult < 0 Then
Switch $vResult
Case 1
_LOG("not a Zip file", 2, $iLOGPath)
Case 2
_LOG("Impossible to unzip", 2, $iLOGPath)
Case Else
_LOG("Unknown Zip Error (" & @error & ")", 2, $iLOGPath)
EndSwitch
EndIf
$aDIRList = _Check_autoconf($oXMLProfil)
_LoadConfig()
_GUI_Refresh($oXMLProfil)
EndIf
_LOG("GUI Constructed", 1, $iLOGPath)
While 1
$nMsg = GUIGetMsg()
If $vStart = 1 Then $nMsg = $MC_Wizard
If $vLaunchScrape = 1 Then
$vLaunchScrape = 0
$nMsg = $B_SCRAPE
EndIf
Switch $nMsg
Case $MC_Wizard ;Wizard
;~ ---------OS Selection---------
$vProfilsPath = _Wizz_OS()
_LOG("Wizard - Profil selected : " & $vProfilsPath, 0, $iLOGPath)
IniWrite($iINIPath, "LAST_USE", "$vProfilsPath", $vProfilsPath)
$oXMLProfil = _XML_Open($vProfilsPath)
If $oXMLProfil = -1 Then Exit
IniWrite($iINIPath, "LAST_USE", "$vRechFiles", _Coalesce(_XML_Read("Profil/General/Research", 0, "", $oXMLProfil), "*.*|*.xml;*.txt;*.dv;*.fs;*.xor;*.drv;*.dat;*.cfg;*.nv;*.sav*|"))
;~ ---------Media Selection---------
$vMediaChoice = _Wizz_MediaChoice($oXMLProfil, $vProfilsPath)
_LOG("Wizard - Media selected : " & $vMediaChoice, 0, $iLOGPath)
If $vMediaChoice = "Simple" Then
;~ ---------Media Simple Selection---------
$vMainMedia = _Wizz_MediaSimpleChoice($oXMLProfil, $vProfilsPath)
_LOG("Wizard - Main Media selected : " & $vMainMedia, 0, $iLOGPath)
$vAltMedia = _Wizz_MediaSimpleAltChoice($oXMLProfil, $vProfilsPath, $vMainMedia)
_LOG("Wizard - Main Media selected : " & $vAltMedia, 0, $iLOGPath)
Else
;~ ---------Media MIX Selection---------
$vMix = _GUI_Config_MIX($iMIXPath, $iPathMixTmp, 1)
_LOG("Wizard - Mix selected : " & $vMix, 0, $iLOGPath)
EndIf
;~ ---------Rom Path Selection---------
$vRomPath = _Wizz_Rom($oXMLProfil)
$aDIRList = _Check_autoconf($oXMLProfil)
If IsArray($aDIRList) Then
IniWrite($iINIPath, "LAST_USE", "$vSource_RomPath", $aDIRList[1][1])
IniWrite($iINIPath, "LAST_USE", "$vTarget_RomPath", $aDIRList[1][2])
IniWrite($iINIPath, "LAST_USE", "$vTarget_XMLName", $aDIRList[1][3])
IniWrite($iINIPath, "LAST_USE", "$vSource_ImagePath", $aDIRList[1][4])
IniWrite($iINIPath, "LAST_USE", "$vTarget_ImagePath", $aDIRList[1][5])
_LoadConfig()
_GUI_Refresh($oXMLProfil)
IniWrite($iINIPath, "LAST_USE", "$vAutoconf_Use", 1)
EndIf
_LOG("Wizard - Rom Path selected : " & $vRomPath, 0, $iLOGPath)
While 1
;~ ---------SS Selection---------
$vSS = _Wizz_SSChoice()
_LOG("Wizard - SS Acount selected : " & $vSS, 0, $iLOGPath)
If $vSS = "Yes" Then
;~ ---------SS Id Selection---------
$vNbThreadDefault = _Wizz_SSId()
If $vNbThreadDefault > 0 Then
_LOG("Wizard - SS Acount OK, Nb Thread selected : " & $vNbThreadDefault, 0, $iLOGPath)
ExitLoop
Else
_LOG("Wizard - SS Acount NOK", 0, $iLOGPath)
EndIf
Else
ExitLoop
EndIf
WEnd
;~ ---------Scrape & Plateform Selection---------
If _Wizz_Scrape() = "Yes" Then
$vSystem = _Wizz_SystemChoice($oXMLProfil)
$vLaunchScrape = 1
_LOG("Wizard - Plateform selected : " & $vSystem, 0, $iLOGPath)
EndIf
$aOptionMenu = _OptionMenuConstruction($oXMLProfil, $aOptionMenu)
_GUI_Refresh($oXMLProfil)
If $vStart = 1 Then $vStart = 0
Case $GUI_EVENT_CLOSE, $MF_Exit ; Exit
DirRemove($iTEMPPath, 1)
_LOG("Universal XML Scraper Closed", 0, $iLOGPath)
Exit
Case $MC_Profil ;Profil Selection
$vProfilsPath = _ProfilSelection($iProfilsPath)
IniWrite($iINIPath, "LAST_USE", "$vProfilsPath", $vProfilsPath)
;Opening XML Profil file
$oXMLProfil = _XML_Open($vProfilsPath)
If $oXMLProfil = -1 Then Exit
$aOptionMenu = _OptionMenuConstruction($oXMLProfil, $aOptionMenu)
IniWrite($iINIPath, "LAST_USE", "$vRechFiles", _Coalesce(_XML_Read("Profil/General/Research", 0, "", $oXMLProfil), "*.*||"))
$aDIRList = _Check_autoconf($oXMLProfil)
_GUI_Refresh($oXMLProfil)
$nMsg = ""
Case $MC_Langue ;Langue Selection
$aLangList = _MultiLang_LoadLangDef($iLangPath, -1)
If Not IsArray($aLangList) Or $aLangList < 0 Then
_LOG("Impossible to load language", 2, $iLOGPath)
Exit
EndIf
$aOptionMenu = _OptionMenuConstruction($oXMLProfil, $aOptionMenu)
_LoadConfig()
_GUI_Refresh($oXMLProfil)
Case $MC_Config_LU ;Manual Path Configuration
_GUI_Config_LU()
_GUI_Refresh($oXMLProfil)
Case $MC_config_PIC ;Picture Configuration
_GUI_Config_Image($oXMLProfil, $iPathMixTmp)
_GUI_Refresh($oXMLProfil)
Case $MC_config_MISC ;General Configuration
_GUI_Config_MISC()
_GUI_Refresh($oXMLProfil)
Case $MC_Miximage ;Mix Image Selection
_GUI_Config_MIX($iMIXPath, $iPathMixTmp)
Case $MC_MixDownload
_GUI_Config_MIX_Download()
Case $MC_config_autoconf ;Autoconf Configuration
$GUI_Config_autoconf = _GUI_Config_autoconf($oXMLProfil)
If $GUI_Config_autoconf = 1 Then
FileDelete($vProfilsPath)
_XML_SaveToFile($oXMLProfil, $vProfilsPath)
EndIf
$aDIRList = _Check_autoconf($oXMLProfil)
_GUI_Refresh($oXMLProfil)
Local $vSystem = StringSplit(IniRead($iINIPath, "LAST_USE", "$vSource_RomPath", ""), "\")
$vSystem = $vSystem[UBound($vSystem) - 1]
If $aDIRList <> -1 Then
For $vBoucle = 1 To UBound($MS_AutoConfigItem) - 1
If $aDIRList[$vBoucle][0] = $vSystem Then
_LOG("Checked system :" & $aDIRList[$vBoucle][0], 0, $iLOGPath)
IniWrite($iINIPath, "LAST_USE", "$vSource_RomPath", $aDIRList[$vBoucle][1])
IniWrite($iINIPath, "LAST_USE", "$vTarget_RomPath", $aDIRList[$vBoucle][2])
IniWrite($iINIPath, "LAST_USE", "$vTarget_XMLName", $aDIRList[$vBoucle][3])
IniWrite($iINIPath, "LAST_USE", "$vSource_ImagePath", $aDIRList[$vBoucle][4])
IniWrite($iINIPath, "LAST_USE", "$vTarget_ImagePath", $aDIRList[$vBoucle][5])
$nMsg = 0
_GUI_Refresh($oXMLProfil)
EndIf
Next
EndIf
Case $MP_Parameter
$GUI_Config_SSHParameter = _GUI_Config_SSHParameter($oXMLProfil)
If $GUI_Config_SSHParameter = 1 Then
FileDelete($vProfilsPath)
_XML_SaveToFile($oXMLProfil, $vProfilsPath)
EndIf
$aDIRList = _Check_autoconf($oXMLProfil)
_GUI_Refresh($oXMLProfil)
Case $MH_Help
ShellExecute("https://github.com/Universal-Rom-Tools/Universal-XML-Scraper/wiki")
Case $MH_Support_Screenscraper
ShellExecute("http://www.screenscraper.fr/")
Case $MH_Support_Tipee
ShellExecute("https://www.tipeee.com/screenscraper")
Case $MH_Support_Patreon
ShellExecute("https://www.patreon.com/screenscraper")
Case $MH_Link_Screenzone
ShellExecute("http://www.screenzone.fr/")
Case $MH_Link_Recalbox
ShellExecute("https://www.recalbox.com/")
Case $MH_Link_Retropie
ShellExecute("https://retropie.org.uk/")
Case $MH_Changelog
_GUI_Update($iChangelogPath, $F_UniversalScraper)
Case $MH_Log
_GUI_Log($F_UniversalScraper)
Case $MH_About ;Help
SoundPlay($iScriptPath & "\Ressources\Sons\jingle_uxs.MP3")
$sMsg = "UNIVERSAL XML SCRAPER - " & $iScriptVer & @CRLF
$sMsg &= _MultiLang_GetText("win_About_By") & @CRLF & @CRLF
$sMsg &= _MultiLang_GetText("win_About_Thanks") & @CRLF
$sMsg &= "All Screenzone comunity" & @CRLF
$sMsg &= "All Recalbox comunity" & @CRLF
$sMsg &= "All Friends on IRC and forum" & @CRLF
$sMsg &= "Special dedicace :" & @CRLF
$sMsg &= "MarbleMad for Screenscraper" & @CRLF
$sMsg &= "Kam3leon for Splashscreen" & @CRLF
$sMsg &= "Neogeronimo for the Jingle" & @CRLF
$sMsg &= "Madmeggo, Paradadf and Lackyluuk for German translation" & @CRLF
$sMsg &= "Paradadf for Spanish translation" & @CRLF
$sMsg &= "Cricetomutante for Italian translation" & @CRLF
$sMsg &= "Digital Lumberjack for the Mirror" & @CRLF
$sMsg &= "Verybadsoldier for the 'In ZIP scrape'" & @CRLF
_ExtMsgBoxSet(1, 2, 0x34495c, 0xFFFF00, 10, "Arial")
_ExtMsgBox($EMB_ICONINFO, "OK", _MultiLang_GetText("win_About_Title"), $sMsg, 15)
Case $B_SCRAPE, $MS_Scrape ;Solo Scrape or Cancel
_GUI_Refresh($oXMLProfil, 1)
$vFullTimer = TimerInit()
_GUICtrlStatusBar_SetText($L_SCRAPE, "Please Wait...")
$vNbThread = IniRead($iINIPath, "LAST_USE", "$vNbThread", 1)
_KillScrapeEngine($iScraper)
$aScrapeEngine = _LaunchEngine($oXMLProfil, $vNbThread)
If IsArray($aScrapeEngine) Then
$aRomList = _SCRAPE($oXMLProfil, $aScrapeEngine, $vNbThread)
If IsArray($aRomList) Then
_LOG("-- Full Scrape in " & Round((TimerDiff($vFullTimer) / 1000), 2) & "s", 0, $iLOGPath)
_Results($aRomList, Round((TimerDiff($vFullTimer) / 1000), 2))
EndIf
_KillScrapeEngine($iScraper)
EndIf
$vScrapeCancelled = 0
_GUI_Refresh($oXMLProfil)
Case $MS_FullScrape ;FullScrape
_GUI_Refresh($oXMLProfil, 1)
Dim $aRomList_FULL[1][12]
$vFullTimer = TimerInit()
$vNbThread = IniRead($iINIPath, "LAST_USE", "$vNbThread", 1)
_KillScrapeEngine($iScraper)
$aScrapeEngine = _LaunchEngine($oXMLProfil, $vNbThread)
If IsArray($aScrapeEngine) Then
For $vBoucleSysteme = 1 To UBound($MS_AutoConfigItem) - 1
_LOG("-- Scrape System n°" & $vBoucleSysteme, 0, $iLOGPath)
IniWrite($iINIPath, "LAST_USE", "$vSource_RomPath", $aDIRList[$vBoucleSysteme][1])
IniWrite($iINIPath, "LAST_USE", "$vTarget_RomPath", $aDIRList[$vBoucleSysteme][2])
IniWrite($iINIPath, "LAST_USE", "$vTarget_XMLName", $aDIRList[$vBoucleSysteme][3])
IniWrite($iINIPath, "LAST_USE", "$vSource_ImagePath", $aDIRList[$vBoucleSysteme][4])
IniWrite($iINIPath, "LAST_USE", "$vTarget_ImagePath", $aDIRList[$vBoucleSysteme][5])
_GUI_Refresh($oXMLProfil)
_GUI_Refresh($oXMLProfil, 1)
$aRomList = _SCRAPE($oXMLProfil, $aScrapeEngine, $vNbThread, 1)
If IsArray($aRomList) Then
For $i = 1 To UBound($aRomList, 1) - 1
ReDim $aRomList_FULL[UBound($aRomList_FULL, 1) + 1][UBound($aRomList, 2)]
For $j = 0 To UBound($aRomList, 2) - 1
$aRomList_FULL[UBound($aRomList_FULL, 1) - 1][$j] = $aRomList[$i][$j]
Next
Next
EndIf
If Not _Check_Cancel() Then $vBoucleSysteme = UBound($MS_AutoConfigItem) - 1
Next
$vNbThread = IniRead($iINIPath, "LAST_USE", "$vNbThread", 1)
_LOG("-- Full Scrape in " & Round((TimerDiff($vFullTimer) / 1000), 2) & "s", 0, $iLOGPath)
_Results($aRomList_FULL, Round((TimerDiff($vFullTimer) / 1000), 2), 1)
_KillScrapeEngine($iScraper)
EndIf
$vScrapeCancelled = 0
_GUI_Refresh($oXMLProfil)
EndSwitch
;Option Menu
If IsArray($aOptionMenu) And $aOptionMenu <> -1 Then
For $vBoucle = 1 To $aOptionMenu[0][0]
If $nMsg = $aOptionMenu[$vBoucle][0] Then
_XML_Replace('Profil/Element[@Type="' & $aOptionMenu[$vBoucle][3] & '"]/' & $aOptionMenu[$vBoucle][4], $aOptionMenu[$vBoucle][6], 0, "", $oXMLProfil)
FileDelete($vProfilsPath)
_XML_SaveToFile($oXMLProfil, $vProfilsPath)
$nMsg = ""
$vBoucle = $aOptionMenu[0][0]
$aOptionMenu = _OptionMenuConstruction($oXMLProfil, $aOptionMenu)
$aOptionMenu = _OptionMenuCheck($aOptionMenu, $oXMLProfil)
_GUI_Refresh($oXMLProfil)
EndIf
Next
EndIf
;SSH Menu
If IsArray($MP_) Then
For $vBoucle = 1 To UBound($MP_) - 1
If $nMsg = $MP_[$vBoucle] Then _Plink($oXMLProfil, $aPlink_Command[$vBoucle][0])
Next
EndIf
;Auto Conf Sub Menu
If $aDIRList <> -1 Then
For $vBoucle = 1 To UBound($MS_AutoConfigItem) - 1
If $nMsg = $MS_AutoConfigItem[$vBoucle] Then
_LOG("Autoconfig Selected :" & $aDIRList[$vBoucle][0], 0, $iLOGPath)
For $vBoucle2 = 1 To UBound($MS_AutoConfigItem) - 1
GUICtrlSetState($MS_AutoConfigItem[$vBoucle2], $GUI_UNCHECKED)
Next
GUICtrlSetState($MS_AutoConfigItem[$vBoucle], $GUI_CHECKED)
IniWrite($iINIPath, "LAST_USE", "$vSource_RomPath", $aDIRList[$vBoucle][1])
IniWrite($iINIPath, "LAST_USE", "$vTarget_RomPath", $aDIRList[$vBoucle][2])
IniWrite($iINIPath, "LAST_USE", "$vTarget_XMLName", $aDIRList[$vBoucle][3])
IniWrite($iINIPath, "LAST_USE", "$vSource_ImagePath", $aDIRList[$vBoucle][4])
IniWrite($iINIPath, "LAST_USE", "$vTarget_ImagePath", $aDIRList[$vBoucle][5])
$nMsg = 0
_GUI_Refresh($oXMLProfil)
EndIf
Next
EndIf
WEnd
;---------;
;Fonctions;
;---------;
Func _LoadConfig()
Local $aMatchingCountry
Dim $aConfig[15]
$aConfig[0] = IniRead($iINIPath, "LAST_USE", "$vTarget_XMLName", " ")
$aConfig[1] = IniRead($iINIPath, "LAST_USE", "$vSource_RomPath", "")
$aConfig[2] = IniRead($iINIPath, "LAST_USE", "$vTarget_RomPath", "./")
$aConfig[3] = IniRead($iINIPath, "LAST_USE", "$vSource_ImagePath", "")
$aConfig[4] = IniRead($iINIPath, "LAST_USE", "$vTarget_ImagePath", "./downloaded_images/")
$aConfig[5] = IniRead($iINIPath, "LAST_USE", "$vScrape_Mode", 0)
$aConfig[6] = IniRead($iINIPath, "LAST_USE", "$vMissingRom_Mode", 0)
$aConfig[7] = IniRead($iINIPath, "LAST_USE", "$vCountryPic_Mode", 0)
If IniRead($iINIPath, "LAST_USE", "$vLangPref", "0") = "0" Then IniWrite($iINIPath, "LAST_USE", "$vLangPref", _MultiLang_GetText("langpref"))
If IniRead($iINIPath, "LAST_USE", "$vCountryPref", "0") = "0" Then IniWrite($iINIPath, "LAST_USE", "$vCountryPref", _MultiLang_GetText("countrypref"))
$aConfig[9] = IniRead($iINIPath, "LAST_USE", "$vLangPref", "")
$aConfig[10] = IniRead($iINIPath, "LAST_USE", "$vCountryPref", "")
$aConfig[11] = $iRessourcesPath & "\regionlist.txt"
$aConfig[12] = 0
$aConfig[13] = IniRead($iINIPath, "LAST_USE", "$vSSLogin", "")
$aConfig[14] = IniRead($iINIPath, "LAST_USE", "$vSSPassword", "")
If Not FileExists($aConfig[1]) Then
_ExtMsgBox($EMB_ICONEXCLAM, "OK", _MultiLang_GetText("err_title"), _MultiLang_GetText("err_PathRom"), 15)
_LOG("Error Access to : " & $aConfig[1], 2, $iLOGPath)
Return 0
EndIf
_LOG("$vTarget_XMLName = " & $aConfig[0], 1, $iLOGPath)
_LOG("$vSource_RomPath = " & $aConfig[1], 1, $iLOGPath)
_LOG("$vTarget_RomPath = " & $aConfig[2], 1, $iLOGPath)
_LOG("$vSource_ImagePath = " & $aConfig[3], 1, $iLOGPath)
_LOG("$vTarget_ImagePath = " & $aConfig[4], 1, $iLOGPath)
_LOG("$vScrape_Mode = " & $aConfig[5], 1, $iLOGPath)
_LOG("$vMissingRom_Mode = " & $aConfig[6], 1, $iLOGPath)
_LOG("$vCountryPic_Mode = " & $aConfig[7], 1, $iLOGPath)
_LOG("$vLangPref = " & $aConfig[9], 1, $iLOGPath)
_LOG("$vCountryPref = " & $aConfig[10], 1, $iLOGPath)
_LOG("$aMatchingCountry = " & $aConfig[11], 1, $iLOGPath)
If Not FileExists($aConfig[3]) Then DirCreate($aConfig[3] & "\")
Return $aConfig
EndFunc ;==>_LoadConfig
Func _ProfilSelection($iProfilsPath, $vProfilsPath = -1) ;Profil Selection
; Loading profils list
$aProfilList = _FileListToArrayRec($iProfilsPath, "*.xml", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT, $FLTAR_FULLPATH)
;~ _ArrayDisplay($aProfilList, "$aProfilList") ;Debug
If Not IsArray($aProfilList) Then
_LOG("No Profils found", 2, $iLOGPath)
Exit
EndIf
_ArrayColInsert($aProfilList, 0)
_ArrayColInsert($aProfilList, 0)
_ArrayDelete($aProfilList, 0)
For $vBoucle = 0 To UBound($aProfilList) - 1
$aProfilList[$vBoucle][0] = _XML_Read("Profil/Name", 1, $aProfilList[$vBoucle][2])
If StringInStr($aProfilList[$vBoucle][0], $vProfilsPath) Then $vProfilsPath = $aProfilList[$vBoucle][2]
Next
;~ _ArrayDisplay($aProfilList, "$aProfilList") ;Debug
If $vProfilsPath = -1 Then $vProfilsPath = _SelectGUI($aProfilList, $aProfilList[0][2], "Profil")
_LOG("Profil selected : " & $vProfilsPath, 0, $iLOGPath)
Return $vProfilsPath
EndFunc ;==>_ProfilSelection
Func _Plink($oXMLProfil, $vPlinkCommand_Menu, $vSilentPlink = 0) ;Send a Command via Plink
Local $vPlink_Ip = _XML_Read("Profil/Plink/Ip", 0, "", $oXMLProfil)
Local $vPlink_Root = _XML_Read("Profil/Plink/Root", 0, "", $oXMLProfil)
Local $vPlink_Pswd = _XML_Read("Profil/Plink/Pswd", 0, "", $oXMLProfil)
If $vSilentPlink = 0 Then
Local $vPlink_Command = _XML_Read("Profil/Plink/Command/" & $vPlinkCommand_Menu, 0, "", $oXMLProfil)
If MsgBox($MB_OKCANCEL, $vPlinkCommand_Menu, _MultiLang_GetText("mess_ssh_" & $vPlinkCommand_Menu)) = $IDOK Then
_LOG("SSH : " & $vPlink_Command, 0, $iLOGPath)
$sRun = $iScriptPath & "\Ressources\plink.exe " & $vPlink_Ip & " -ssh -l " & $vPlink_Root & " -pw " & $vPlink_Pswd & " " & $aPlink_Command
$iPid = Run($sRun, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;@ComSpec & " /c " &
$PlinkTimeout = TimerInit()
While ProcessExists($iPid)
If TimerDiff($PlinkTimeout) > 5000 Then
MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_PlinkGlobal") & @CRLF & "(Timeout)")
_LOG("TimeOut with Plink (" & $vPlink_Root & ":" & $vPlink_Pswd & "@" & $vPlink_Ip & ")", 2, $iLOGPath)
StdioClose($iPid)
Return -1
EndIf
$_StderrRead = StderrRead($iPid)
If Not @error And $_StderrRead <> '' Then
If StringInStr($_StderrRead, 'Unable to open connection') Then
MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_PlinkGlobal") & @CRLF & _MultiLang_GetText("err_PlinkConnection"))
_LOG("Unable to open connection with Plink (" & $vPlink_Root & ":" & $vPlink_Pswd & "@" & $vPlink_Ip & ")", 2, $iLOGPath)
StdioClose($iPid)
Return -1
EndIf
EndIf
WEnd
Else
_LOG("SSH canceled : " & $vPlink_Command, 1, $iLOGPath)
Return -2
EndIf
Else
$sRun = $iScriptPath & "\Ressources\plink.exe " & $vPlink_Ip & " -ssh -l " & $vPlink_Root & " -pw " & $vPlink_Pswd & " " & $vPlinkCommand_Menu
_LOG("SSH : " & $sRun, 1, $iLOGPath)
$iPid = Run(@ComSpec & " /c " & $sRun, '', @SW_HIDE, $STDIN_CHILD + $STDERR_CHILD + $STDOUT_CHILD) ;@ComSpec & " /c " &
$PlinkTimeout = TimerInit()
While ProcessExists($iPid)
If TimerDiff($PlinkTimeout) > 300000 Then
MsgBox($MB_ICONERROR, _MultiLang_GetText("err_title"), _MultiLang_GetText("err_PlinkGlobal") & @CRLF & "(Timeout)")
_LOG("TimeOut with Plink (" & $vPlink_Root & ":" & $vPlink_Pswd & "@" & $vPlink_Ip & ")", 2, $iLOGPath)
StdioClose($iPid)
Return -1
EndIf
$_StderrRead = StderrRead($iPid)
If Not @error And $_StderrRead <> '' Then
If StringInStr($_StderrRead, 'Unable to open connection') Then
_LOG("Unable to open connection with Plink (" & $vPlink_Root & ":" & $vPlink_Pswd & "@" & $vPlink_Ip & ")", 2, $iLOGPath)
StdioClose($iPid)
Return -1
EndIf
EndIf
$_StdoutRead = StdoutRead($iPid)
If $_StdoutRead <> '' Then
_LOG("SSH Return : " & $_StdoutRead, 1, $iLOGPath)
StdioClose($iPid)
Return $_StdoutRead
EndIf
WEnd
EndIf
Return
EndFunc ;==>_Plink
Func _GUI_Config_Image($oXMLProfil, $iPathMixTmp)
#Region ### START Koda GUI section ### Form=
$F_CONFIG = GUICreate(_MultiLang_GetText("win_config_PIC_Title"), 474, 122, -1, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
$G_Picture = GUICtrlCreateGroup(_MultiLang_GetText("win_config_PIC_GroupPICParam"), 8, 0, 225, 113)
$L_PicSize = GUICtrlCreateLabel(_MultiLang_GetText("win_config_PIC_GroupPICParam_PicSize"), 16, 16)
$I_Width = GUICtrlCreateInput("", 16, 36, 89, 21)
$I_Height = GUICtrlCreateInput("", 136, 36, 89, 21)
$L_X = GUICtrlCreateLabel("X", 116, 40, 11, 17)
$L_PicExt = GUICtrlCreateLabel(_MultiLang_GetText("win_config_PIC_GroupPICParam_PicExt"), 16, 76)
$C_PicExt = GUICtrlCreateCombo("", 136, 72, 89, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
GUICtrlSetData($C_PicExt, "defaut|jpg|png", StringLower(_Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Ext", ""), _XML_Read('Profil/General/Target_Image_Extension', 0, "", $oXMLProfil))))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$B_CONFENREG = GUICtrlCreateButton(_MultiLang_GetText("win_config_Enreg"), 240, 72, 105, 41)
$B_CONFANNUL = GUICtrlCreateButton(_MultiLang_GetText("win_config_Cancel"), 358, 72, 105, 41)
GUISetState(@SW_SHOW)
GUISetState(@SW_DISABLE, $F_UniversalScraper)
#EndRegion ### END Koda GUI section ###
If StringLower(_XML_Read('Profil/General/Mix', 0, "", $oXMLProfil)) = "true" Then
GUICtrlSetData($I_Width, _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Width", ""), _XML_Read("Profil/General/Target_Width", 0, $iPathMixTmp & "\config.xml")))
GUICtrlSetData($I_Height, _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Height", ""), _XML_Read("Profil/General/Target_Height", 0, $iPathMixTmp & "\config.xml")))
Else
GUICtrlSetData($I_Width, _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Width", ""), _XML_Read("Profil/General/Target_Image_Width", 0, "", $oXMLProfil)))
GUICtrlSetData($I_Height, _Coalesce(IniRead($iINIPath, "LAST_USE", "$vTarget_Image_Height", ""), _XML_Read("Profil/General/Target_Image_Height", 0, "", $oXMLProfil)))
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $B_CONFANNUL
GUIDelete($F_CONFIG)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
_LOG("Image Configuration Canceled", 0, $iLOGPath)
Return
Case $B_CONFENREG
IniWrite($iINIPath, "LAST_USE", "$vTarget_Image_Width", GUICtrlRead($I_Width))
IniWrite($iINIPath, "LAST_USE", "$vTarget_Image_Height", GUICtrlRead($I_Height))
$vPicExt = GUICtrlRead($C_PicExt)
If $vPicExt = "defaut" Then $vPicExt = ""
IniWrite($iINIPath, "LAST_USE", "$vTarget_Image_Ext", $vPicExt)
_LOG("Image Configuration Saved", 0, $iLOGPath)
_LOG("------------------------", 1, $iLOGPath)
_LOG("$vTarget_Image_Width = " & GUICtrlRead($I_Width), 1, $iLOGPath)
_LOG("$vTarget_Image_Height = " & GUICtrlRead($I_Height), 1, $iLOGPath)
_LOG("$vTarget_Image_Ext = " & $vPicExt, 1, $iLOGPath)
GUIDelete($F_CONFIG)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
Return
EndSwitch
WEnd
EndFunc ;==>_GUI_Config_Image
Func _GUI_Config_MIX($iMIXPath, $iPathMixTmp, $vCancelButton = 0)
Local $vMIXListC = ""
$aMIXList = _FileListToArrayRec($iMIXPath, "*.zip", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT, $FLTAR_NOPATH)
For $vBoucle = 1 To UBound($aMIXList) - 1
$vMIXListC = $vMIXListC & "|" & StringTrimRight($aMIXList[$vBoucle], 4)
Next
$vMIXLast = _Coalesce(_XML_Read("/Profil/Name", 1, $iPathMixTmp & "\config.xml"), StringTrimRight($aMIXList[1], 4), -1)
_Unzip($iMIXPath & "\" & $vMIXLast & ".zip", $iPathMixTmp)
#Region ### START Koda GUI section ### Form=
$F_MIXIMAGE = GUICreate(_MultiLang_GetText("win_config_mix_Title"), 830, 425, -1, -1, BitOR($WS_POPUP, $WS_BORDER), -1, $F_UniversalScraper)
$P_UXS = GUICtrlCreatePic(@ScriptDir & "\" & "Ressources\Images\UXS_Wizard_Half.jpg", 5, 263, 100, 160, -1, -1)
$G_MIXSelection = GUICtrlCreateGroup("Votre Mix", 5, 1, 820, 260, -1, -1)
GUICtrlSetBkColor(-1, "0xF0F0F0")
$L_MIXSelection = GUICtrlCreateLabel("Quel type de Mix souhaitez vous :", 13, 21, 214, 25, $SS_CENTERIMAGE, -1)
GUICtrlSetBkColor(-1, "-2")
$P_Empty = GUICtrlCreatePic("", 13, 53, 400, 200, -1, -1)
GUICtrlSetTip(-1, _MultiLang_GetText("win_config_mix_empty"))
$P_Full = GUICtrlCreatePic("", 420, 53, 400, 200, -1, -1)
GUICtrlSetTip(-1, _MultiLang_GetText("win_config_mix_exemple"))
$C_MIXIMAGE = GUICtrlCreateCombo("", 200, 21, 620, 21, BitOR($CBS_AUTOHSCROLL, $CBS_DROPDOWN), -1)
GUICtrlSetData($C_MIXIMAGE, $vMIXListC, $vMIXLast)
$B_OK = GUICtrlCreateButton(_MultiLang_GetText("win_config_mix_Enreg"), 725, 393, 100, 30, -1, -1)
$B_CANCEL = GUICtrlCreateButton(_MultiLang_GetText("win_config_mix_Cancel"), 620, 393, 100, 30, -1, -1)
If $vCancelButton = 1 Then GUICtrlSetState(-1, $GUI_HIDE)
$B_LINK = GUICtrlCreateButton("Link", 515, 393, 100, 30, -1, -1)
$E_Description = GUICtrlCreateEdit("", 110, 269, 715, 115, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $WS_VSCROLL), -1)
GUISetState(@SW_SHOW)
GUISetState(@SW_DISABLE, $F_UniversalScraper)
#EndRegion ### END Koda GUI section ###
$vMIXExempleEmptyPath = $iPathMixTmp & "\" & _XML_Read("/Profil/General/Empty_Exemple", 0, $iPathMixTmp & "\config.xml")
$vMIXExempleFullPath = $iPathMixTmp & "\" & _XML_Read("/Profil/General/Full_Exemple", 0, $iPathMixTmp & "\config.xml")
GUICtrlSetImage($P_Empty, $vMIXExempleEmptyPath)
GUICtrlSetImage($P_Full, $vMIXExempleFullPath)
$vDescription = "Author : " & _Coalesce(_XML_Read("/Profil/Infos/Author", 0, $iPathMixTmp & "\config.xml"), "", -1)
$vDescription = $vDescription & @CRLF & "Description :" & @CRLF & StringReplace(_Coalesce(_XML_Read("/Profil/Infos/Description", 0, $iPathMixTmp & "\config.xml"), "", -1), "@CRLF", @CRLF)
GUICtrlSetData($E_Description, $vDescription)
$vLink = _Coalesce(_XML_Read("/Profil/Infos/Link", 0, $iPathMixTmp & "\config.xml"), "", -1)
If $vLink = "" Then
GUICtrlSetState($B_LINK, $GUI_HIDE)
Else
GUICtrlSetState($B_LINK, $GUI_SHOW)
EndIf
While 1
Local $nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $B_CANCEL
DirRemove($iPathMixTmp, 1)
DirCreate($iPathMixTmp)
$vResult = _Unzip($iMIXPath & "\" & $vMIXLast & ".zip", $iPathMixTmp)
If $vResult < 0 Then
Switch $vResult
Case 1
_LOG("not a Zip file", 2, $iLOGPath)
Case 2
_LOG("Impossible to unzip", 2, $iLOGPath)
Case Else
_LOG("Unknown Zip Error (" & @error & ")", 2, $iLOGPath)
EndSwitch
EndIf
IniWrite($iINIPath, "LAST_USE", "$vMixImage", $vMIXLast)
GUIDelete($F_MIXIMAGE)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
_LOG("MIX Configuration Canceled", 0, $iLOGPath)
Return -1
Case $B_OK
$vMix = GUICtrlRead($C_MIXIMAGE)
IniWrite($iINIPath, "LAST_USE", "$vTarget_Image_Width", "")
IniWrite($iINIPath, "LAST_USE", "$vTarget_Image_Height", "")
IniWrite($iINIPath, "LAST_USE", "$vMixImage", $vMix)
_LOG("MIX Configuration Saved : " & $vMix, 0, $iLOGPath)
GUIDelete($F_MIXIMAGE)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
Return $vMix
Case $B_LINK
$vLink = _Coalesce(_XML_Read("/Profil/Infos/Link", 0, $iPathMixTmp & "\config.xml"), "", -1)
ShellExecute($vLink)
Case $C_MIXIMAGE
If GUICtrlRead($C_MIXIMAGE) <> _XML_Read("/Profil/Name", 1, $iPathMixTmp & "\config.xml") Then
DirRemove($iPathMixTmp, 1)
DirCreate($iPathMixTmp)
$vResult = _Unzip($iMIXPath & "\" & GUICtrlRead($C_MIXIMAGE) & ".zip", $iPathMixTmp)
If $vResult < 0 Then
Switch $vResult
Case 1
_LOG("not a Zip file", 2, $iLOGPath)
Case 2
_LOG("Impossible to unzip", 2, $iLOGPath)
Case Else
_LOG("Unknown Zip Error (" & @error & ")", 2, $iLOGPath)
EndSwitch
EndIf
$vMIXExempleEmptyPath = $iPathMixTmp & "\" & _XML_Read("/Profil/General/Empty_Exemple", 0, $iPathMixTmp & "\config.xml")
$vMIXExempleFullPath = $iPathMixTmp & "\" & _XML_Read("/Profil/General/Full_Exemple", 0, $iPathMixTmp & "\config.xml")
GUICtrlSetImage($P_Empty, $vMIXExempleEmptyPath)
GUICtrlSetImage($P_Full, $vMIXExempleFullPath)
$vDescription = "Author : " & _XML_Read("/Profil/Infos/Author", 0, $iPathMixTmp & "\config.xml")
$vDescription = $vDescription & @CRLF & "Description :" & @CRLF & StringReplace(_XML_Read("/Profil/Infos/Description", 0, $iPathMixTmp & "\config.xml"), "@CRLF", @CRLF)
GUICtrlSetData($E_Description, $vDescription)
$vLink = _Coalesce(_XML_Read("/Profil/Infos/Link", 0, $iPathMixTmp & "\config.xml"), "", -1)
If $vLink = "" Then
GUICtrlSetState($B_LINK, $GUI_HIDE)
Else
GUICtrlSetState($B_LINK, $GUI_SHOW)
EndIf
EndIf
EndSwitch
WEnd
EndFunc ;==>_GUI_Config_MIX
Func _GUI_Config_MIX_Download()
Local $vMIXListC = "", $vLastMIX = "", $aMIXList
Local $vMIXExempleEmptyPath = $iRessourcesPath & "\Images\Temp\Empty_exemple.jpg"
Local $vMIXExempleFullPath = $iRessourcesPath & "\Images\Temp\Full_exemple.jpg"
Local $vMIXDescriptionPath = $iRessourcesPath & "\Images\Temp\Description.txt"
Local $Result = _DownloadWRetry("https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-XML-Scraper/master/MIX%20Repository/_MIXList.txt", $iRessourcesPath & "\_MIXList.txt")
Switch $Result
Case -1
_LOG("Error downloading _MIXList", 2, $iLOGPath)
Return 0
Case -2
_LOG("Time Out downloading _MIXList", 2, $iLOGPath)
Return 0
EndSwitch
_FileReadToArray($Result, $aMIXList)
For $vBoucle = 1 To UBound($aMIXList) - 1
$vMIXListC = $vMIXListC & "|" & $aMIXList[$vBoucle]
Next
#Region ### START Koda GUI section ### Form=
$F_MIXIMAGE = GUICreate(_MultiLang_GetText("win_config_mix_Download_Title"), 830, 425, -1, -1, BitOR($WS_POPUP, $WS_BORDER), -1, $F_UniversalScraper)
$P_UXS = GUICtrlCreatePic(@ScriptDir & "\" & "Ressources\Images\UXS_Wizard_Half.jpg", 5, 263, 100, 160, -1, -1)
$G_MIXSelection = GUICtrlCreateGroup("Votre Mix", 5, 1, 820, 260, -1, -1)
GUICtrlSetBkColor(-1, "0xF0F0F0")
$L_MIXSelection = GUICtrlCreateLabel("Quel type de Mix souhaitez vous :", 13, 21, 214, 25, $SS_CENTERIMAGE, -1)
GUICtrlSetBkColor(-1, "-2")
$P_Empty = GUICtrlCreatePic("", 13, 53, 400, 200, -1, -1)
GUICtrlSetTip(-1, _MultiLang_GetText("win_config_mix_empty"))
$P_Full = GUICtrlCreatePic("", 420, 53, 400, 200, -1, -1)
GUICtrlSetTip(-1, _MultiLang_GetText("win_config_mix_exemple"))
$C_MIXIMAGE = GUICtrlCreateCombo("", 200, 21, 620, 21, BitOR($CBS_AUTOHSCROLL, $CBS_DROPDOWN), -1)
GUICtrlSetData($C_MIXIMAGE, $vMIXListC)
$B_OK = GUICtrlCreateButton(_MultiLang_GetText("win_config_mix_Download_Download"), 725, 393, 100, 30, -1, -1)
$B_CANCEL = GUICtrlCreateButton(_MultiLang_GetText("win_config_mix_Download_Exit"), 620, 393, 100, 30, -1, -1)
$B_LINK = GUICtrlCreateButton("Link", 515, 393, 100, 30, -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$E_Description = GUICtrlCreateEdit("", 110, 269, 715, 115, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $WS_VSCROLL), -1)
GUISetState(@SW_SHOW)
GUISetState(@SW_DISABLE, $F_UniversalScraper)
#EndRegion ### END Koda GUI section ###
While 1
Local $nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $B_CANCEL
GUIDelete($F_MIXIMAGE)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
_LOG("MIX Download Exit", 0, $iLOGPath)
Return
Case $B_OK
$vMIXURL = 'https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-XML-Scraper/master/MIX Repository/' & GUICtrlRead($C_MIXIMAGE) & '.zip'
_DownloadWRetry($vMIXURL, $iMIXPath & "\" & GUICtrlRead($C_MIXIMAGE) & '.zip')
_LOG("MIX Download : " & GUICtrlRead($C_MIXIMAGE), 0, $iLOGPath)
GUIDelete($F_MIXIMAGE)
GUISetState(@SW_ENABLE, $F_UniversalScraper)
WinActivate($F_UniversalScraper)
Return
Case $C_MIXIMAGE
If GUICtrlRead($C_MIXIMAGE) <> $vLastMIX Then
$vMIXExempleURL = 'https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-XML-Scraper/master/MIX Repository/Preview/' & GUICtrlRead($C_MIXIMAGE) & '/'
$vMIXExempleEmptyPath = _DownloadWRetry($vMIXExempleURL & "Empty_exemple.jpg", $vMIXExempleEmptyPath)
$vMIXExempleFullPath = _DownloadWRetry($vMIXExempleURL & "Full_exemple.jpg", $vMIXExempleFullPath)
GUICtrlSetImage($P_Empty, $vMIXExempleEmptyPath)
GUICtrlSetImage($P_Full, $vMIXExempleFullPath)
$vMIXDescriptionURL = 'https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-XML-Scraper/master/MIX Repository/Preview/' & GUICtrlRead($C_MIXIMAGE) & '/'
ConsoleWrite($vMIXDescriptionURL & "Description.txt" & @CRLF)
$vMIXDescriptionPath = _DownloadWRetry($vMIXDescriptionURL & "Description.txt", $vMIXDescriptionPath)
$vDescription = StringReplace(FileRead($vMIXDescriptionPath), @LF, @CRLF)
GUICtrlSetData($E_Description, $vDescription)
$vLastMIX = GUICtrlRead($C_MIXIMAGE)
EndIf
EndSwitch
WEnd
EndFunc ;==>_GUI_Config_MIX_Download
Func _GUI_Config_MISC()
Local $aRechFiles = StringSplit(IniRead($iINIPath, "LAST_USE", "$vRechFiles", "*.*|*.xml;*.txt;*.dv;*.fs;*.xor;*.drv;*.dat;*.cfg;*.nv;*.sav*|"), '|', $STR_ENTIRESPLIT + $STR_NOCOUNT)
Local $aScrapeMode = StringSplit(_MultiLang_GetText("win_config_MISC_GroupMISC_ScrapeModeChoice"), '|', $STR_ENTIRESPLIT + $STR_NOCOUNT)
Local $aScrapeSearchMode = StringSplit(_MultiLang_GetText("win_config_MISC_GroupMISC_ScrapeSearchModeChoice"), '|', $STR_ENTIRESPLIT + $STR_NOCOUNT)
Local $aVerbose = StringSplit(_MultiLang_GetText("win_config_MISC_GroupMISC_VerboseChoice"), '|', $STR_ENTIRESPLIT + $STR_NOCOUNT)
Local $vNbThreadDefault = 0, $vRootPathOnPI = ""