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
|
Imports System.IO
Public Class Uni_KnowledgeInput
Public Countries(194) As String
Public Animals(226) As String
Public Fruits(75) As String
Public US_States(50) As String
Public TotalGuessed As Integer
Public CurrentCategory As String
Public Level As Integer
Public ForNextLevel As Integer
Public JustStarted As Boolean = True
Private Sub Uni_KnowledgeInput_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput") = True Then
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Animals.kin") = True Then
Else
If Strings.AvailableFeature(38) = 1 Then
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Animals.kin", My.Resources.KnowledgeInputContent.Animals)
End If
End If
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Fruits.kin") = True Then
Else
If Strings.AvailableFeature(39) = 1 Then
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Fruits.kin", My.Resources.KnowledgeInputContent.Fruits)
End If
End If
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\US_States.kin") = True Then
Else
If Strings.AvailableFeature(42) = 1 Then
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\US_States.kin", My.Resources.KnowledgeInputContent.US_States)
End If
End If
Else
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput")
File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Countries.kin", My.Resources.KnowledgeInputContent.Countries)
End If
CurrentCategory = "Select Category"
LoadCategory()
End Sub
Private Sub lst_Guessed_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles lst_Guessed.DrawItem
e.DrawBackground()
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
e.Graphics.FillRectangle(Brushes.Black, e.Bounds)
End If
Dim sf As New StringFormat
Using b As New SolidBrush(e.ForeColor)
e.Graphics.DrawString(lst_Guessed.GetItemText(lst_Guessed.Items(e.Index)), e.Font, b, e.Bounds, sf)
End Using
e.DrawFocusRectangle()
End Sub
Private Sub cmb_Category_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles cmb_Category.DrawItem
e.DrawBackground()
If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
e.Graphics.FillRectangle(Brushes.Black, e.Bounds)
End If
Dim sf As New StringFormat
Using b As New SolidBrush(e.ForeColor)
e.Graphics.DrawString(cmb_Category.GetItemText(cmb_Category.Items(e.Index)), e.Font, b, e.Bounds, sf)
End Using
e.DrawFocusRectangle()
End Sub
Private Sub txt_InputWord_TextChanged(sender As Object, e As KeyEventArgs) Handles txt_InputWord.KeyDown
Select Case e.KeyCode
Case Keys.Enter
CheckCorrect(txt_InputWord.Text.ToLower)
txt_InputWord.Text = Nothing
JustStarted = False
End Select
End Sub
Private Sub cmb_Category_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmb_Category.SelectedIndexChanged
Dim Available As Boolean = False
JustStarted = True
lbl_TotalGuess.Text = "Guessed : 0/0"
lst_Guessed.Items.Clear()
Select Case cmb_Category.SelectedItem.ToString
Case "Countries"
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentCountries.kin") = True Then
lst_Guessed.Items.AddRange(File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentCountries.kin"))
End If
Available = True
Countries = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Countries.kin")
Case "Animals"
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentAnimals.kin") = True Then
lst_Guessed.Items.AddRange(File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentAnimals.kin"))
End If
Available = True
Animals = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Animals.kin")
Case "Fruits"
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentFruits.kin") = True Then
lst_Guessed.Items.AddRange(File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentFruits.kin"))
End If
Available = True
Fruits = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Fruits.kin")
Case "US States"
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentUS_States.kin") = True Then
lst_Guessed.Items.AddRange(File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentUS_States.kin"))
End If
Available = True
US_States = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\US_States.kin")
End Select
If Available = True Then
TotalGuessed = lst_Guessed.Items.Count
lbl_TotalGuess.Text = "Guessed : " & TotalGuessed & "/"
Select Case cmb_Category.SelectedItem.ToString
Case "Countries"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Countries.Length
Case "Animals"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Animals.Length
Case "Fruits"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Fruits.Length
Case "US States"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & US_States.Length
End Select
Level = Math.Ceiling((TotalGuessed / 10))
CheckLevel()
CurrentCategory = cmb_Category.SelectedItem.ToString
End If
End Sub
Private Sub LoadCategory()
If Strings.AvailableFeature(38) = 0 Then
cmb_Category.Items.Remove("Animals")
End If
If Strings.AvailableFeature(39) = 0 Then
cmb_Category.Items.Remove("Fruits")
End If
If Strings.AvailableFeature(42) = 0 Then
cmb_Category.Items.Remove("US States")
End If
End Sub
Private Sub CheckLevel()
lbl_Level.Text = "Level " & Level
ForNextLevel = Math.Abs(TotalGuessed - (Level * 10))
If ForNextLevel = 0 Then
If JustStarted = False Then
ChangeCP(True, Level * 25)
End If
Level = Level + 1
lbl_Level.Text = "Level " & Level
ForNextLevel = 10
End If
lbl_NextLevel.Text = "Words until next level (" & Level * 25 & " CP) : " & ForNextLevel
End Sub
Private Sub CheckCorrect(Input As String)
Dim Correct As Boolean = False
Select Case cmb_Category.SelectedItem.ToString
Case "Countries"
Dim Lines As Integer = 0
Do
If Lines = Countries.Length Then
Exit Do
End If
If Countries(Lines) = Input Then
Countries(Lines) = "null"
Correct = True
Exit Do
Else
Lines = Lines + 1
End If
Loop
Case "Animals"
Dim Lines As Integer = 0
Do
If Lines = Animals.Length Then
Exit Do
End If
If Animals(Lines) = Input Then
Animals(Lines) = "null"
Correct = True
Exit Do
Else
Lines = Lines + 1
End If
Loop
Case "Fruits"
Dim Lines As Integer = 0
Do
If Lines = Fruits.Length Then
Exit Do
End If
If Fruits(Lines) = Input Then
Fruits(Lines) = "null"
Correct = True
Exit Do
Else
Lines = Lines + 1
End If
Loop
Case "US States"
Dim Lines As Integer = 0
Do
If Lines = US_States.Length Then
Exit Do
End If
If US_States(Lines) = Input Then
US_States(Lines) = "null"
Correct = True
Exit Do
Else
Lines = Lines + 1
End If
Loop
End Select
If Correct = True Then
lst_Guessed.Items.Add(Input)
TotalGuessed = lst_Guessed.Items.Count
lbl_TotalGuess.Text = "Guessed : " & TotalGuessed & "/"
Select Case cmb_Category.SelectedItem.ToString
Case "Countries"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Countries.Length
Case "Animals"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Animals.Length
Case "Fruits"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & Fruits.Length
Case "US States"
lbl_TotalGuess.Text = lbl_TotalGuess.Text & US_States.Length
End Select
CheckLevel()
SaveCategory()
End If
End Sub
Private Sub SaveCategory()
Select Case CurrentCategory
Case "Countries"
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Countries.kin", Countries)
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentCountries.kin", lst_Guessed.Items.Cast(Of String).ToArray)
Case "Animals"
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Animals.kin", Animals)
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentAnimals.kin", lst_Guessed.Items.Cast(Of String).ToArray)
Case "Fruits"
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\Fruits.kin", Fruits)
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentFruits.kin", lst_Guessed.Items.Cast(Of String).ToArray)
Case "US States"
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\US_States.kin", US_States)
File.WriteAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\KnowledgeInput\CurrentUS_States.kin", lst_Guessed.Items.Cast(Of String).ToArray)
End Select
End Sub
End Class
|