-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQuizz.vb
More file actions
1775 lines (1527 loc) · 69.2 KB
/
Quizz.vb
File metadata and controls
1775 lines (1527 loc) · 69.2 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
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
Imports System.IO
Imports System.Threading
Imports System.Linq
Imports System.Drawing.Imaging
Imports AxWMPLib
Imports System.ComponentModel
Public Class Quizz
Private WithEvents Proc As New Process
Private Sub Quizz_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'On alimente le gamelist
For Each foundDirectory In Directory.GetDirectories(My.Settings.RecalboxFolder & "\roms", ".", SearchOption.TopDirectoryOnly)
If File.Exists(foundDirectory & "\gamelist.xml") Then
Dim nomconsole = foundDirectory.Substring((InStr(foundDirectory, "roms\",) + 4))
ConsoleList.Items.Add(nomconsole)
End If
Next
'On hide le groupe parametres
'Afficher le groupParametres
GroupFiltres.Hide()
GroupConfigPartie.Hide()
ButtonDoRandom1.Hide()
GroupConfigPartie.Hide()
Label10.Hide()
TxtTotalEntrees.Hide()
Label20.Hide()
ButtonInfo.Hide()
TabControl1.Hide()
TitleBox.Hide()
GroupDifficulty.Hide()
'on load le gifmaker
Proc.StartInfo.UseShellExecute = False
Proc.StartInfo.CreateNoWindow = True
Proc.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) & "\ffmpeg.exe"
Proc.EnableRaisingEvents = True
End Sub
Private Sub ButtonGetBack1_Click(sender As Object, e As EventArgs) Handles ButtonGetBack1.Click
Me.Close()
Form1.Show()
End Sub
Private Sub ButtonValidConsole1_Click(sender As Object, e As EventArgs) Handles ButtonValidConsole1.Click
'On stop par securité
PlayerStop.PerformClick()
'Afficher le groupParametres
GroupConfigPartie.Show()
'On va hider le bouton des console + jeu si un seul systeme est selectionné
If ConsoleList.SelectedItems.Count = 1 Then
ConsoleTitre.Hide()
ListConsoleDesJeux.Hide()
PasTitreNiConsole.Show()
Else
ConsoleTitre.Show()
ListConsoleDesJeux.Show()
PasTitreNiConsole.Show()
End If
'On met le tooltip
ToolTipNbJeux.SetToolTip(TxtTotalEntrees, "Ce nombre représente le nombre de jeux total filtré. Plus vous avez un grand chiffre, Meilleur sera l'aléatoire")
'Conditionnelle pour ne rien lancer si aucun selectionnés
If ConsoleList.SelectedItems.Count = 0 Then
MsgBox("Merci de Selectionner une/des Consoles")
Exit Sub
End If
'On affiche les listboxhelpers
listhelpingboxGenre.Show()
listhelpingboxDev.Show()
listhelpingboxPubl.Show()
listhelpingboxAnnee.Show()
listhelpingboxPlayers.Show()
listhelpingboxPlayCount.Show()
listhelpingboxNote.Show()
'Showing stuff
If ConsoleList.Items.Count = 0 Then Exit Sub
Dim gamelist As String = ConsoleList.Items(0)
Dim table As New DataTable()
Dim dv As DataView
Dim column As DataColumn
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Console"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Titre"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "CheminRom"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Synopsis"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "CheminImage"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "CheminVideo"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Genre"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Note"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Developer"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "Publisher"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "NbPlayers"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "DateSortie"
End With
table.Columns.Add(column)
column = New DataColumn()
With column
.DataType = Type.GetType("System.String")
.ColumnName = "NbLancé"
End With
table.Columns.Add(column)
'Loop for every gamelists
For Each i In ConsoleList.SelectedItems
'generating the console name
Dim nomconsole As String = i
Dim consolederom As String = My.Settings.RecalboxFolder & "\roms\" & nomconsole & "\gamelist.xml"
gamelist = consolederom
Dim gamelistXml As XElement = XElement.Load(gamelist)
'getting the list for the xml with nodes
Dim query2 = From st In gamelistXml.Descendants("game") Select st
For Each xEle As XElement In query2
Dim romconsole As String = nomconsole
Dim romname As String = xEle.Element("name")
Dim romId As String
Dim temprom As String = Replace(Replace(Replace(xEle.Element("path"), "/", "\"), "./", ""), ".\", "")
Dim rompath As String = My.Settings.RecalboxFolder & "\roms\" & nomconsole & "\" & temprom
Dim romgenre As String
Dim romdesc As String
Dim romimage As String
Dim romvideo As String
Dim romnote As String
Dim romdev As String
Dim rompubl As String
Dim romnbplayers As String
Dim romdate As String
Dim romCompteur As String
Dim romhidden As String = xEle.Element("hidden")
'Conditionnelles sur tous les champs
If romhidden = "true" Then GoTo romsuivante 'si la rom est hidden, on l'affiche pas (Roms multicd)
If xEle.Element("video") Is Nothing Then
GoTo romsuivante
Else
romvideo = My.Settings.RecalboxFolder & "\roms\" & nomconsole & "\" & Replace(Replace(Replace(xEle.Element("video"), "/", "\"), "./", ""), ".\", "")
End If
Dim ExistGameId As Boolean = xEle.Attributes("id").Any
If ExistGameId = True Then
romId = xEle.Attribute("id").Value
Else
romId = Nothing
End If
If xEle.Element("desc") Is Nothing Then
romdesc = Nothing
Else
romdesc = xEle.Element("desc")
End If
If xEle.Element("image") Is Nothing Then
romimage = Nothing
Else
romimage = My.Settings.RecalboxFolder & "\roms\" & nomconsole & "\" & Replace(Replace(Replace(xEle.Element("image"), "/", "\"), "./", ""), ".\", "")
End If
If xEle.Element("genre") Is Nothing Then
romgenre = Nothing
Else
romgenre = xEle.Element("genre")
End If
If xEle.Element("rating") Is Nothing Then
romnote = Nothing
Else
romnote = xEle.Element("rating")
End If
If xEle.Element("rating") Is Nothing Then
romnote = Nothing
Else
romnote = xEle.Element("rating")
End If
If xEle.Element("developer") Is Nothing Then
romdev = Nothing
Else
romdev = xEle.Element("developer")
End If
If xEle.Element("publisher") Is Nothing Then
rompubl = Nothing
Else
rompubl = xEle.Element("publisher")
End If
If xEle.Element("players") Is Nothing Then
romnbplayers = Nothing
Else
romnbplayers = xEle.Element("players")
End If
If xEle.Element("releasedate") Is Nothing Then
romdate = Nothing
Else
romdate = xEle.Element("releasedate")
End If
If xEle.Element("playcount") Is Nothing Then
romCompteur = Nothing
Else
romCompteur = xEle.Element("playcount")
End If
'on ajoute le tout dans une table
table.Rows.Add(romconsole, romname, rompath, romdesc, romimage, romvideo, romgenre, romnote, romdev, rompubl, romnbplayers, romdate, romCompteur)
romsuivante:
Next
Next
'Sorting A-Z the console
dv = table.DefaultView
TempGrid.DataSource = table
'Width for columns
TempGrid.Columns("Console").Width = 50
TempGrid.Columns("Titre").Width = 190
TempGrid.Columns("CheminRom").Visible = False
TempGrid.Columns("CheminRom").Width = 50
TempGrid.Columns("Synopsis").Visible = False
TempGrid.Columns("Synopsis").Width = 50
TempGrid.Columns("CheminImage").Visible = False
TempGrid.Columns("CheminImage").Width = 50
TempGrid.Columns("CheminVideo").Visible = False
TempGrid.Columns("CheminVideo").Width = 50
TempGrid.Columns("Genre").Visible = False
TempGrid.Columns("Genre").Width = 50
TempGrid.Columns("Note").Visible = False
TempGrid.Columns("Note").Width = 50
TempGrid.Columns("Developer").Visible = False
TempGrid.Columns("Developer").Width = 50
TempGrid.Columns("Publisher").Visible = False
TempGrid.Columns("Publisher").Width = 50
TempGrid.Columns("NbPlayers").Visible = False
TempGrid.Columns("NbPlayers").Width = 50
TempGrid.Columns("DateSortie").Visible = True
TempGrid.Columns("DateSortie").Width = 50
TempGrid.Columns("NbLancé").Visible = False
TempGrid.Columns("NbLancé").Width = 50
'Reajusting Interface and Showing Final Interface
dv.Sort = "Console asc, Titre asc"
'On compte le nombre total d'entrées
TxtTotalEntrees.Text = TempGrid.Rows.Count - 1
'On va alimenter les filtres de la combobox
PeuplerCombobox()
'On affiche pas la partie des options pour forcer la saisie
Label17.Hide()
Label11.Hide()
txtnbmanches.Hide()
Label16.Hide()
txttempsaffichprop.Hide()
'Focus sur le nombre de parties
txtnbmanches.Focus()
End Sub
Sub PeuplerCombobox()
Dim valeur As String
For ligne = 0 To TempGrid.RowCount - 1
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Genre").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Genre").Index).Value) = True Then
GoTo suite1
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("Genre").Index).Value ' on check si la valeur est déja presente ou non
If listhelpingboxGenre.Items.Contains(valeur) Then
listhelpingboxGenre.Items.Remove(valeur)
Else
listhelpingboxGenre.Items.Add(valeur) ' si non on l'ajoute
End If
suite1:
End If
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Developer").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Developer").Index).Value) = True Then
GoTo suite2
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("Developer").Index).Value ' on check si la valeur est déja presente ou non
If listhelpingboxDev.Items.Contains(valeur) Then
listhelpingboxDev.Items.Remove(valeur)
Else
listhelpingboxDev.Items.Add(valeur) ' si non on l'ajoute
End If
suite2:
End If
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Publisher").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Publisher").Index).Value) = True Then
GoTo suite3
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("Publisher").Index).Value ' on check si la valeur est déja presente ou non
If listhelpingboxPubl.Items.Contains(valeur) Then
listhelpingboxPubl.Items.Remove(valeur)
Else
listhelpingboxPubl.Items.Add(valeur) ' si non on l'ajoute
End If
suite3:
End If
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("NbPlayers").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("NbPlayers").Index).Value) = True Then
GoTo suite4
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("NbPlayers").Index).Value ' on check si la valeur est déja presente ou non
If listhelpingboxPlayers.Items.Contains(valeur) Then
listhelpingboxPlayers.Items.Remove(valeur)
Else
listhelpingboxPlayers.Items.Add(valeur) ' si non on l'ajoute
End If
suite4:
End If
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Note").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("Note").Index).Value) = True Then
GoTo suite5
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("Note").Index).Value ' on check si la valeur est déja presente ou non
If listhelpingboxNote.Items.Contains(valeur) Then
listhelpingboxNote.Items.Remove(valeur)
Else
listhelpingboxNote.Items.Add(valeur) ' si non on l'ajoute
End If
suite5:
End If
If IsDBNull(TempGrid.Rows(ligne).Cells(TempGrid.Columns("DateSortie").Index).Value) = True Or IsNothing(TempGrid.Rows(ligne).Cells(TempGrid.Columns("DateSortie").Index).Value) = True Then
GoTo suite6
Else
valeur = TempGrid.Rows(ligne).Cells(TempGrid.Columns("DateSortie").Index).Value ' on check si la valeur est déja presente ou non
If valeur = Nothing Then GoTo suite6
Dim annee As String = valeur.Substring(0, 4)
If listhelpingboxAnnee.Items.Contains(annee) Then
listhelpingboxAnnee.Items.Remove(annee)
Else
listhelpingboxAnnee.Items.Add(annee) ' si non on l'ajoute
End If
suite6:
End If
Next
End Sub
'Ensemble Got Focus et Leave Focus pour les listboxes
Private Sub Txtgenre_GotFocus(sender As Object, e As EventArgs) Handles txtgenre.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxGenre.Show()
'On met la bonne en haut
listhelpingboxGenre.BringToFront()
'On resize la bonne
listhelpingboxGenre.Location = New Point(2, 15)
listhelpingboxGenre.Size = New Point(145, 300)
End Sub
Private Sub Txtdev_GotFocus(sender As Object, e As EventArgs) Handles txtdev.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxDev.Show()
'On met la bonne en haut
listhelpingboxDev.BringToFront()
'On resize la bonne
listhelpingboxDev.Location = New Point(2, 15)
listhelpingboxDev.Size = New Point(145, 300)
End Sub
Private Sub Txtpub_GotFocus(sender As Object, e As EventArgs) Handles txtpub.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxPubl.Show()
'On met la bonne en haut
listhelpingboxPubl.BringToFront()
'On resize la bonne
listhelpingboxPubl.Location = New Point(2, 15)
listhelpingboxPubl.Size = New Point(145, 300)
End Sub
Private Sub TxtAnnee_GotFocus(sender As Object, e As EventArgs) Handles TxtAnnee.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxAnnee.Show()
'On met la bonne en haut
listhelpingboxAnnee.BringToFront()
'On resize la bonne
listhelpingboxAnnee.Location = New Point(2, 15)
listhelpingboxAnnee.Size = New Point(145, 300)
End Sub
Private Sub Txtplayers_GotFocus(sender As Object, e As EventArgs) Handles txtplayers.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxPlayers.Show()
'On met la bonne en haut
listhelpingboxPlayers.BringToFront()
'On resize la bonne
listhelpingboxPlayers.Location = New Point(2, 15)
listhelpingboxPlayers.Size = New Point(145, 300)
End Sub
Private Sub TxtPlayCount_GotFocus(sender As Object, e As EventArgs) Handles TxtPlayCount.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxPlayCount.Show()
'On met la bonne en haut
listhelpingboxPlayCount.BringToFront()
'On resize la bonne
listhelpingboxPlayCount.Location = New Point(2, 15)
listhelpingboxPlayCount.Size = New Point(145, 300)
End Sub
Private Sub TxtSynopsis_GotFocus(sender As Object, e As EventArgs) Handles TxtSynopsis.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
End Sub
Private Sub TxtRating_GotFocus(sender As Object, e As EventArgs) Handles TxtRating.GotFocus
'On hide tout
listhelpingboxGenre.Hide()
listhelpingboxDev.Hide()
listhelpingboxPubl.Hide()
listhelpingboxAnnee.Hide()
listhelpingboxPlayers.Hide()
listhelpingboxPlayCount.Hide()
listhelpingboxNote.Hide()
'Sauf
listhelpingboxNote.Show()
'On met la bonne en haut
listhelpingboxNote.BringToFront()
'On resize la bonne
listhelpingboxNote.Location = New Point(2, 15)
listhelpingboxNote.Size = New Point(145, 300)
End Sub
Private Sub TxtSynopsis_LostFocus(sender As Object, e As EventArgs) Handles TxtSynopsis.GotFocus
listhelpingboxGenre.Show()
listhelpingboxDev.Show()
listhelpingboxPubl.Show()
listhelpingboxAnnee.Show()
listhelpingboxPlayers.Show()
listhelpingboxPlayCount.Show()
listhelpingboxNote.Show()
End Sub
Sub Entreesurfiltres()
'commande pour filtrer
TryCast(TempGrid.DataSource, DataTable).DefaultView.RowFilter = String.Format("[Genre] Like '%{0}%' AND [Developer] like '%{1}%' AND [Publisher] like '%{2}%' AND [DateSortie] like '%{3}%' AND [NbPlayers] like '%{4}%' AND [NbLancé] like '%{5}%' AND [Synopsis] like '%{6}%' AND [Note] like '%{7}%'", txtgenre.Text, txtdev.Text, txtpub.Text, TxtAnnee.Text, txtplayers.Text, TxtPlayCount.Text, TxtSynopsis.Text, TxtRating.Text)
'Recalcul des resultats
TxtTotalEntrees.Text = TempGrid.RowCount - 1
End Sub
Private Sub Txtgenre_KeyDown(sender As Object, e As KeyEventArgs) Handles txtgenre.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub Txtdev_KeyDown(sender As Object, e As KeyEventArgs) Handles txtdev.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub Txtpub_KeyDown(sender As Object, e As KeyEventArgs) Handles txtpub.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub TxtAnnee_KeyDown(sender As Object, e As KeyEventArgs) Handles TxtAnnee.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub Txtplayers_KeyDown(sender As Object, e As KeyEventArgs) Handles txtplayers.KeyDown
If e.KeyCode = Keys.Enter Then
End If
End Sub
Private Sub TxtPlayCount_KeyDown(sender As Object, e As KeyEventArgs) Handles TxtPlayCount.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub TxtSynopsis_KeyDown(sender As Object, e As KeyEventArgs) Handles TxtSynopsis.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub ComboRating_KeyDown(sender As Object, e As KeyEventArgs) Handles TxtRating.KeyDown
If e.KeyCode = Keys.Enter Then
Call Entreesurfiltres()
End If
End Sub
Private Sub ButtonDoRandom1_Click(sender As Object, e As EventArgs) Handles ButtonDoRandom1.Click
If txtnbmanches.Text <= 0 Then
MsgBox("Impossible de Générer des Manches")
txtnbmanches.Focus()
Exit Sub
End If
If Val(txtnbmanches.Text) > Val(TxtTotalEntrees.Text) Then
MsgBox("Trop de Manches > Nb Roms dans le(s) Gamelist(s)")
Exit Sub
End If
If TxtTotalEntrees.Text < 12 Then
MsgBox("Votre Total Roms doit etre Superieur à 12")
Exit Sub
End If
Dim nbdemanches As Integer = Val(txtnbmanches.Text)
Dim nbroms As Integer = TxtTotalEntrees.Text
'On Clear par securité
RandomList.Items.Clear()
'On enleves toutes les listbox de reponses par securité
ListTitreDesJeux.Items.Clear()
ListConsoleDesJeux.Items.Clear()
'On remplit la randobox de toutes les possibilités
listrandobox.Items.Clear()
Dim rando As Integer
For rando = 0 To TxtTotalEntrees.Text - 1
listrandobox.Items.Add(rando)
Next
'On va generer un chiffre et tester
Dim rnd As New Random
Dim x As Integer
'On clear par securité
RandomList.Items.Clear()
Historique.Items.Clear()
Do Until RandomList.Items.Count = nbdemanches
recalculrando:
x = listrandobox.Items(rnd.Next(0, listrandobox.Items.Count - 1)) 'generer un chiffre entre 0 et le nb de roms
Dim xremade As Integer = (x + 5) * 37
If Not RandomList.Items.Contains(xremade) Then
RandomList.Items.Add(xremade) 'si le titre n'est pas present, on l'ajoute dans la liste des titres
'on va creer le log historique
Dim consoledujeu = TempGrid.Rows(x).Cells(TempGrid.Columns("Console").Index).Value
Dim anneedujeu = TempGrid.Rows(x).Cells(TempGrid.Columns("DateSortie").Index).Value
If IsDBNull(anneedujeu) = True Then
anneedujeu = "0000"
Else
anneedujeu = anneedujeu.ToString.Substring(0, 4)
End If
Dim titredujeu = TempGrid.Rows(x).Cells(TempGrid.Columns("Titre").Index).Value
Dim nomdujeu = consoledujeu & " (" & anneedujeu & ") - " & titredujeu
Historique.Items.Add(nomdujeu) ' on ajoute a la liste
End If
listrandobox.Items.Remove(x)
Loop
'On Remet la temp listbox en vide
listrandobox.Items.Clear()
'On va maintenant Charger les options du jeu
GroupDifficulty.Show()
'On mets les tooltips
ToolTipNormalVideo.SetToolTip(VidNormal, "La video sera lue normalement (Facile)")
ToolTipPartielVideo.SetToolTip(VidPartiel, "La video se decouvrira au fil du temps jusqu'aux 10 dernières sec. (Moyen)")
ToolTipSansVideo.SetToolTip(VidSans, "Sans Video, concentrez vous sur le son ! (Difficile)")
ToolTipRepeatOnce.SetToolTip(PlayerOnce, "La Video ne sera lue qu'une seule fois")
ToolTipRepeat.SetToolTip(PlayerRepeat, "La Video sera repétée à la fin")
'Selectionner l'index 0
RandomList.SelectedIndex = 0
'Recalcul safety du total
txtpositionend.Text = RandomList.Items.Count
End Sub
Sub Afficherlesoptions()
txtnbmanches.Show()
txtnbmanches.Focus()
Label16.Show()
Label17.Show()
Label11.Show()
txttempsaffichprop.Show()
End Sub
Private Sub TitreOnly_CheckedChanged(sender As Object, e As EventArgs) Handles TitreOnly.CheckedChanged
Call Afficherlesoptions()
Call PlayerStop.PerformClick()
End Sub
Private Sub ConsoleTitre_CheckedChanged(sender As Object, e As EventArgs) Handles ConsoleTitre.CheckedChanged
Call Afficherlesoptions()
Call PlayerStop.PerformClick()
End Sub
Private Sub PasTitreNiConsole_CheckedChanged(sender As Object, e As EventArgs) Handles PasTitreNiConsole.CheckedChanged
Call Afficherlesoptions()
Call PlayerStop.PerformClick()
End Sub
Private Sub Txtnbmanches_TextChanged(sender As Object, e As EventArgs) Handles txtnbmanches.TextChanged
If txtnbmanches.Text Is Nothing Or txtnbmanches.Text = "" Then
Label20.Hide()
ButtonInfo.Hide()
Label10.Hide()
TxtTotalEntrees.Hide()
ButtonDoRandom1.Hide()
Exit Sub
Else
If TitreOnly.Checked = False And ConsoleTitre.Checked = False And PasTitreNiConsole.Checked = False Then
Label20.Hide()
ButtonInfo.Hide()
Label10.Hide()
TxtTotalEntrees.Hide()
ButtonDoRandom1.Hide()
Exit Sub
End If
'On a tout, on peut afficher
Label20.Show()
ButtonInfo.Show()
Label10.Show()
TxtTotalEntrees.Show()
ButtonDoRandom1.Show()
txtpositionend.Text = txtnbmanches.Text
End If
End Sub
Private Sub Txtnbmanches_KeyDown(sender As Object, e As KeyEventArgs) Handles txtnbmanches.KeyDown
If e.KeyCode = Keys.Enter Then
ButtonDoRandom1.PerformClick()
End If
End Sub
Private Sub RandomList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RandomList.SelectedIndexChanged
txtpositionrandom.Text = RandomList.SelectedIndex + 1
Historique.SelectedIndex = RandomList.SelectedIndex 'on change aussi celui qui est selectionné dans l'historique
PlayerStop.PerformClick()
'calcul du vrai chiffre
Dim chiffreactuel = RandomList.SelectedItem
If chiffreactuel = Nothing Then Exit Sub
Dim vraichiffre As Integer = Convert.ToInt32(RandomList.SelectedItem.ToString) / 37 - 5
TempGrid.ClearSelection()
TempGrid.CurrentCell = TempGrid.Item("Titre", CInt(vraichiffre))
If TabControl1.SelectedTab Is TabPage2 Then
TabControl1.SelectedTab = TabPage2
Else
TabControl1.SelectedTab = TabPage1
End If
End Sub
Private Sub PlayerNext_Click(sender As Object, e As EventArgs) Handles PlayerNext.Click
Dim selectionactuelle = RandomList.SelectedIndex
If selectionactuelle >= txtpositionend.Text - 1 Then Exit Sub
PlayerStop.PerformClick()
RandomList.SelectedIndex = selectionactuelle + 1
ListTitreDesJeux.Items.Clear()
'On securise en mettant le player en hide
PlayerVideo.uiMode = "none"
End Sub
Private Sub PlayerPrev_Click(sender As Object, e As EventArgs) Handles PlayerPrev.Click
Dim selectionactuelle = RandomList.SelectedIndex
If selectionactuelle <= 0 Then Exit Sub
PlayerStop.PerformClick()
RandomList.SelectedIndex = selectionactuelle - 1
ListTitreDesJeux.Items.Clear()
'On securise en mettant le player en hide
PlayerVideo.uiMode = "none"
End Sub
Private Sub PlayerPlay_Click(sender As Object, e As EventArgs) Handles PlayerPlay.Click
'Force Stopping
PlayerStop.PerformClick()
'si y'a pas de jeux dans la liste msgbox
If Historique.Items.Count = 0 Then
MsgBox("Pas De Jeux dans Le Quizz !")
Exit Sub
End If
'test pour voir si c'est à l'arret ou en play
If (PlayerVideo.playState = WMPLib.WMPPlayState.wmppsPlaying) Then 'Si c'est play
Exit Sub
ElseIf PlayerVideo.playState = WMPLib.WMPPlayState.wmppsStopped Or PlayerVideo.playState = WMPLib.WMPPlayState.wmppsStopped = 0 Then 'Si c'est stoppé on load la video
Dim lavraieligne As Integer = Convert.ToInt32(RandomList.SelectedItem.ToString) / 37 - 5
PlayerVideo.URL = TempGrid.Rows(lavraieligne).Cells(TempGrid.Columns("CheminVideo").Index).Value
'Afficher les propositions en fonctions du mode
If PasTitreNiConsole.Checked = True Then
ListConsoleDesJeux.Hide()
ListTitreDesJeux.Hide()
ElseIf TitreOnly.Checked = True Then
ListConsoleDesJeux.Hide()
ListTitreDesJeux.Show()
Else
ListConsoleDesJeux.Show()
ListTitreDesJeux.Show()
End If
'En fonction des choix ci dessus
If VidNormal.Checked = True Then
PlayerVideo.uiMode = "none"
'PixelPicture.Hide()
End If
If VidPartiel.Checked = True Then
PlayerVideo.uiMode = "none"
'PixelPicture.Hide()
''on cree le gif
'Kill(Path.GetDirectoryName(Application.ExecutablePath) & "\temp.gif")
'Convertgif(30, TempGrid.Rows(lavraieligne).Cells(TempGrid.Columns("CheminVideo").Index).Value)
'PixelPicture.Show()
'on l'assigne a la box
'Dim img = Image.FromFile(Path.GetDirectoryName(Application.ExecutablePath) & "\temp.gif")
'PixelPicture.Image = New Bitmap(img)
'img.Dispose()
'on tente une depixelisation
'fillpixeltab(PixelPicture.Width, PixelPicture.Height)
End If
If VidSans.Checked = True Then
PlayerVideo.uiMode = "invisible"
'PixelPicture.Hide()
End If
If SonAvec.Checked = True Then
PlayerVideo.settings.mute = False
End If
If SonSans.Checked = True Then
PlayerVideo.settings.mute = True
End If
If PlayerOnce.Checked = True Then
PlayerVideo.settings.setMode("loop", False)
End If
If PlayerRepeat.Checked = True Then
PlayerVideo.settings.setMode("loop", True)
End If
PlayerVideo.Ctlcontrols.play()
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = PlayerVideo.currentMedia.duration
Timer1.Start()
TimeBox.Text = ""
If PasTitreNiConsole.Checked <> True Then 'si il faut des propositions
'On enleve la liste des jeux par securite
ListTitreDesJeux.Items.Clear()
'On remplit la randobox de toutes les possibilités
listrandobox.Items.Clear()
Dim rando As Integer
For rando = 0 To TxtTotalEntrees.Text - 1
listrandobox.Items.Add(rando)
Next
'et on enleve le bon chiffre
listrandobox.Items.Remove(lavraieligne)
End If
End If
End Sub
Private Sub PlayerStop_Click(sender As Object, e As EventArgs) Handles PlayerStop.Click
PlayerVideo.Ctlcontrols.stop()
Timer1.Stop()
If VidPartiel.Checked = True Then PixelOverlay.Hide()
TimeBox.Text = ""
TimeBox.BackColor = Color.FromArgb(72, 61, 139)
'Remettre les champs en modifiable
txtnbmanches.ReadOnly = False
txtnbmanches.BackColor = Color.FromArgb(0, 102, 204)
txttempsaffichprop.ReadOnly = False
txttempsaffichprop.BackColor = Color.FromArgb(0, 102, 204)
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = PlayerVideo.currentMedia.duration
ProgressBar1.Value = PlayerVideo.Ctlcontrols.currentPosition
ProgressBar1.Increment(1)
Dim tpsrestant As Double
tpsrestant = PlayerVideo.currentMedia.duration - PlayerVideo.Ctlcontrols.currentPosition
TimeBox.Text = tpsrestant.ToString("00.0")
'On va bloquer les nb manches et le temps
If PlayerVideo.playState.wmppsPlaying = True Then
txtnbmanches.ReadOnly = True
txtnbmanches.BackColor = Color.FromArgb(172, 172, 172)
txttempsaffichprop.Show()
txttempsaffichprop.ReadOnly = True
txttempsaffichprop.BackColor = Color.FromArgb(172, 172, 172)
End If
'si le mode sans titre, on l'affiche pas
If PasTitreNiConsole.Checked = True Then
txtnbmanches.ReadOnly = True
txtnbmanches.BackColor = Color.FromArgb(172, 172, 172)
txttempsaffichprop.Hide()
End If
'On check le temps des propositions
Dim tempsprop As String = txttempsaffichprop.Text
'On s'occupe du Partiel si applicable
If VidPartiel.Checked = True Then
If PixelOverlay.Visible = False Then
PixelOverlay.Show()
End If
PixelOverlay.FormBorderStyle = Windows.Forms.FormBorderStyle.None
PixelOverlay.BackColor = Color.Black
PixelOverlay.ShowInTaskbar = False
PixelOverlay.TransparencyKey = Color.White
PixelOverlay.Opacity = 1
PixelOverlay.Size = New Point(PlayerVideo.Width, PlayerVideo.Height)
PixelOverlay.Location = New Point(Me.Location.X + 608, Me.Location.Y + 199)
PixelOverlay.TopMost = True
Select Case ProgressBar1.Value
Case 0 To 7
PixelOverlay.CacaGif.Image = My.Resources.pixelfull
Case 7 To 14
PixelOverlay.CacaGif.Image = My.Resources.pixel1
Case 14 To 21
PixelOverlay.CacaGif.Image = My.Resources.pixel2
Case 21 To 25
PixelOverlay.CacaGif.Image = My.Resources.pixel3
Case >= 25
PixelOverlay.CacaGif.Image = My.Resources.pixelempty
End Select
Else
PixelOverlay.Hide()
End If
'On envoie la couleur
If ProgressBar1.Value <= tempsprop Then 'Si c'est avant les propositions c'est VERT
SendMessage(ProgressBar1.Handle, 1040, 1, 0)
TimeBox.BackColor = Color.FromArgb(6, 176, 37)
ElseIf ProgressBar1.Value >= tempsprop And ProgressBar1.Value < (0.8 * ProgressBar1.Maximum) Then 'Si c'est avant les propositions c'est ORANGE
SendMessage(ProgressBar1.Handle, 1040, 3, 0)
TimeBox.BackColor = Color.FromArgb(218, 203, 38)
Else 'Sinon c'est rouge
SendMessage(ProgressBar1.Handle, 1040, 2, 0)
TimeBox.BackColor = Color.FromArgb(218, 38, 38)
End If
Dim lignefakeremade As Integer = Convert.ToInt32(RandomList.SelectedItem.ToString) / 37 - 5
Dim titreencours As String = TempGrid.Rows(lignefakeremade).Cells(TempGrid.Columns("Titre").Index).Value
Dim consoleencours As String = TempGrid.Rows(lignefakeremade).Cells(TempGrid.Columns("Console").Index).Value
'############SI C'EST QUIZZ TITRE + CONSOLE #################
If ConsoleTitre.Checked = True Then ' Titre Et Consoles
RandomizerPropositions(titreencours, consoleencours)
End If
'########### CHECK DU TEMPS POUR LES TITRES ONLY ###############
If PlayerVideo.Ctlcontrols.currentPosition < tempsprop Then Exit Sub
'############SI C'EST QUIZZ TITRE#################