Yes you can. Main.vb opens fine for me in Notepad. Anyway here you go:
Public Class Main
Dim laden As Boolean = False
Dim gevonden As Boolean
Dim songinfoapart As String()
Dim pagina As WebClient = New WebClient()
Delegate Sub ChangeTextsSafe(ByVal percent As Integer, ByVal noHost As Integer)
Dim taal() As String
Dim nederlands() As String = {"Artiest: ", "Titel: ", "Lengte: ", "Grootte: ", "Pad: ", "Taal: ", "Verander Pad", "Download!", "Start Audiosurf", "Er is geen lied gevonden.", "Bestand bestaat al!", "Er is een probleem met de connectie, het lied kon niet worden gevonden", "Map bestaat niet!", "Kan geen contact maken met de host.", "<Kies aub een pad in voor de muziek>"}
Dim engels() As String = {"Artist: ", "Titel: ", "Length: ", "Size: ", "Path: ", "Language: ", "Change Folder", "Download!", "Launch Audiosurf", "No song has been found.", "File already exists!", "There's a connection problem, the song couldn't be found", "Directory doesn't exist", "Could not connect with hosting server", "<Please choose a path to store the challenges in>"}
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'///////////Nu gaan we kijken of er al een path is
Dim FS As FileStream
Try
FS = New FileStream(CurDir() + "\settings.ini", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Write)
Catch ex As Exception
MsgBox(e)
Return
End Try
Dim leesByte(FS.Length) As Byte
Dim intByte As Integer
Dim lngLoop As Long = 0
Dim gevondenspul As String
Dim gevondensorteer(2) As String
Do While Not intByte = -1
intByte = FS.ReadByte()
If intByte <> -1 Then leesByte(lngLoop) = CByte(intByte)
lngLoop += 1
Loop
gevondenspul = Encoding.UTF8.GetString(leesByte)
gevondensorteer = gevondenspul.Split(New Char() {Chr(13)})
If gevondensorteer(0).Length < 5 Then
txtOpslagplaats.Text = taal(14)
Else
txtOpslagplaats.Text = gevondensorteer(0).Substring(5)
End If
If gevondensorteer.Rank < 1 Then
comboTaal.Text = "English"
Else
comboTaal.Text = gevondensorteer(1).Substring(6)
End If
FS.Close()
MsgBox(comboTaal.Text)
If comboTaal.Text = "English" Then
taal = engels.Clone
ElseIf comboTaal.Text = "Dutch" Then
taal = nederlands.Clone
Else
taal = engels.Clone
End If
lblArtiest.Text = taal(0)
lblTitel.Text = taal(1)
lblLengte.Text = taal(2)
lblGrootte.Text = taal(3) + "MB"
cmdDownload.Text = taal(7)
cmdStartAS.Text = taal(
cmdVerander.Text = taal(6)
lblPad.Text = taal(4)
lblTaal.Text = taal(5)
Dim song As String
Dim downloadedlijst As String
Dim songinfolijst As String()
downloadedlijst = pagina.DownloadString(New Uri("http://86.91.146.73/roy/as/list.txt")) 'Download de songlijst
songinfolijst = downloadedlijst.Split(New [Char]() {Chr(10)}) 'Split alle regels met enter (Chr(10))
Dim zoek As String = DateString()
Dim i As Integer
Do Until i > (songinfolijst.Length - 1) 'Loop door alle arrays
If songinfolijst(i).ToLower.Contains(zoek) Then 'Kijk of 'naam' er is
gevonden = True
song = songinfolijst(i) 'Zet de gevonden regel in fresults
Exit Do
Else
i = i + 1
gevonden = False
End If
Loop
If song = "" Then
MsgBox(taal(9))
Else
'////////////////Uitendelijk na lang zoeken zit alle data van het liedje in variable 'song'
songinfoapart = song.Split(New Char() {Chr(44)}) 'Split alles met ,
lblArtiest.Text = taal(0) + songinfoapart(1)
lblTitel.Text = taal(1) + songinfoapart(2)
lblLengte.Text = taal(2) + songinfoapart(3)
lblGrootte.Text = taal(3) + songinfoapart(4) + "MB"
End If
laden = True
End Sub
Sub veranderSettings(ByVal pad As String, ByVal taal As String)
Dim FS As FileStream
FS = New FileStream(CurDir() + "\settings.ini", FileMode.Create, FileAccess.Write)
Dim bteWrite() As Byte
Dim intByte As Integer
Dim lngLoop As Long
intByte = Encoding.UTF8.GetBytes("PATH=" + pad + System.Environment.NewLine + "LANG=" + taal).Length
ReDim bteWrite(intByte)
bteWrite = Encoding.UTF8.GetBytes("PATH=" + pad + System.Environment.NewLine + "LANG=" + taal)
For lngLoop = 0 To intByte - 1
FS.WriteByte(bteWrite(lngLoop))
Next
FS.Close()
End Sub
Private Sub cmdVerander_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdVerander.Click
fldDialog.ShowDialog()
txtOpslagplaats.Text = fldDialog.SelectedPath
If fldDialog.SelectedPath = "" Then
txtOpslagplaats.Text = taal(14)
End If
veranderSettings(txtOpslagplaats.Text, comboTaal.Text)
End Sub
Private Sub cmdDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDownload.Click
If My.Computer.FileSystem.DirectoryExists(txtOpslagplaats.Text) Then
If My.Computer.FileSystem.FileExists(txtOpslagplaats.Text + "/" + DateString() + ".mp3") Then
MsgBox(taal(10))
Else
If gevonden Then
cmdDownload.Enabled = False
bgWerker.RunWorkerAsync()
Else
MsgBox(taal(11))
End If
End If
Else
MsgBox(taal(12))
End If
End Sub
Private Sub cmdStartAS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStartAS.Click
webMain.Navigate(New Uri("steam://run/12900"))
End Sub
Sub ChangeTexts(ByVal percent As Short, ByVal noHost As Integer)
proDownloadBar.Value = percent
If noHost = 101 Then
cmdDownload.Enabled = True
End If
If percent = 100 Then
cmdDownload.Enabled = True
End If
End Sub
Private Sub bgWerker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgWerker.DoWork
Dim theResponse As HttpWebResponse
Dim theRequest As HttpWebRequest
Dim safedelegate As New ChangeTextsSafe(AddressOf ChangeTexts)
Try
theRequest = WebRequest.Create(songinfoapart(5))
theResponse = theRequest.GetResponse
Catch
MsgBox(taal(13))
Me.Invoke(safedelegate, 0, 101)
Return
End Try
Dim length As Long = theResponse.ContentLength 'Size of the response (in bytes)
Dim FS As FileStream
FS = New FileStream(txtOpslagplaats.Text + "\" + DateString() + ".mp3", FileMode.Create)
Me.Invoke(safedelegate, 0, 0) 'Invoke the TreadsafeDelegate
Dim nRead As Integer
Do
Dim leesByte(1024) As Byte
Dim ingeheugen As Stream = theResponse.GetResponseStream
Dim totaalBytes As Integer
totaalBytes = ingeheugen.Read(leesByte, 0, 1024)
If totaalBytes = 0 Then Exit Do
FS.Write(leesByte, 0, totaalBytes)
nRead += totaalBytes
Dim percent As Short = (nRead * 100) / length
Me.Invoke(safedelegate, percent, 0)
Loop
Me.Invoke(safedelegate, 100, 0)
theResponse.GetResponseStream.Close()
FS.Close()
End Sub
Private Sub txtOpslagplaats_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtOpslagplaats.TextChanged
If laden Then
If txtOpslagplaats.Text <> taal(14) Then
veranderSettings(txtOpslagplaats.Text, comboTaal.Text)
End If
End If
End Sub
Private Sub comboTaal_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboTaal.SelectedIndexChanged
If laden Then
veranderSettings(txtOpslagplaats.Text, comboTaal.Text)
End If
End Sub
End Class