30 lines
924 B
VB.net
30 lines
924 B
VB.net
Public Class Utilities
|
|
Public Shared Function Shuffle(list)
|
|
Dim max As Integer = list.Count - 1
|
|
Dim random As New Random()
|
|
For x As Integer = 0 To max
|
|
Dim rand As Integer = random.Next(0, max)
|
|
Dim temp As String = list(x)
|
|
list(x) = list(rand)
|
|
list(rand) = temp
|
|
Next
|
|
Return list
|
|
End Function
|
|
Public Shared Function GetCardImage(card) As Image
|
|
Dim num As String = card.split(" ")(0)
|
|
Dim suit As String = card.split(" ")(2)
|
|
Select Case num
|
|
Case "K"
|
|
num = "king"
|
|
Case "Q"
|
|
num = "queen"
|
|
Case "J"
|
|
num = "jack"
|
|
Case "A"
|
|
num = "ace"
|
|
End Select
|
|
|
|
Dim img As String = suit + "_" + num
|
|
Return My.Resources.ResourceManager.GetObject(img.ToLower())
|
|
End Function
|
|
End Class |