Author Topic: New Audiosurf Daily Challenge Program - V1.2.1 Released! [Source Released]  (Read 20525 times)

Shammah

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #60 on: May 25, 2008, 10:58:21 am »
Posting error's is kinda useless when you use 1.1 :)
I haven't got much time yet to work on the working update...

Lavos^

  • Hero Member
  • *****
  • Posts: 2251
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #61 on: May 25, 2008, 11:03:15 am »
Lets see some sauce code.

Devil_Spawn

  • Hero Member
  • *****
  • Posts: 891
  • Not Devil_Awesome, Devil_0wns, Devil_TheGreatest..
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #62 on: May 25, 2008, 12:37:39 pm »
perhaps you could ask dylan and see if you can get yourself a tab ingame called daily challenge or something :P

DarkSunDS

  • Guest
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #63 on: June 04, 2008, 02:22:03 pm »
Still waiting for a working version.

Shammah

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Hey guys, it's a shame but i don't have the time anymore to carry on the program. I'm way to busy in real-life. If anyone wants to continue or learn from what i've written: the source code is available. It's the source code where i stopped so things may be incomplete.

All you need is Visual Basic Express 2008

Have fun!

Laserrobotics

  • Robot Overlord
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3464
  • Beep boop everyone.
    • View Profile
    • Steam ID
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #65 on: June 08, 2008, 01:25:14 pm »
wooo!! i have Visual Basic!  too bad i'm horrible at coding...
Note to self:  1/24/12 Awawayabeft

ViRUS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3156
    • MSN Messenger - newvirus@live.com.ar
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #66 on: June 08, 2008, 04:42:10 pm »
Me too, but I'll give it a try when I'm less-sick :(

EDIT:
Ok, I'm an anxious motherfu***, I could add my spanish translation, and redirect the little navigator to my own webpage so I can display new... news...

But, I can't make it detect the list.txt file so it can download the song/show it's info, would you mind to explain me how to do that?? ^^
« Last Edit: June 08, 2008, 05:34:03 pm by ViRUS »


LennardF1989

  • Full Member
  • ***
  • Posts: 113
  • That's しナード to you mister!
    • MSN Messenger - lennardfonteijn@hotmail.com
    • View Profile
    • LennardF1989.com
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #67 on: June 09, 2008, 01:47:31 am »
Haha, most of the code is in Dutch, have fun with it guys :P

Being Dutch is good at some times :)

gevondenspul xD

Just a small tip, try to write your code in English, even though it looks very clean, making it English makes it easier for everyone.

Quote
But, I can't make it detect the list.txt file so it can download the song/show it's info, would you mind to explain me how to do that?? ^^
How about:
Code: [Select]
downloadedlijst = pagina.DownloadString(New Uri("http://86.91.146.73/roy/as/list.txt"))  'Download de songlijst
FYI: There is no news functions as far as I can see in the code, it's probably hard coded into the program with the designer. But you could add it on your own using the same method as the line above.
« Last Edit: June 09, 2008, 01:58:51 am by LennardF1989 »



ViRUS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3156
    • MSN Messenger - newvirus@live.com.ar
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #68 on: June 09, 2008, 04:26:12 am »
Well, there isn't a "real" news function, it's just a small WebBrowser that connects to a predefined webpage and shows it.

And,
Code: [Select]
downloadedlijst = pagina.DownloadString(New Uri("http://86.91.146.73/roy/as/list.txt"))  'Download de songlijst, it's exactly like that, I just replaced the link with my own FTP... Maybe an example of the .txt file would be useful?


VDZ

  • Sr. Member
  • ****
  • Posts: 404
  • Nooooooooeees
    • MSN Messenger - supervdz@dolfijn.nl
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #69 on: June 09, 2008, 06:07:32 am »
I was going to translate the source, but seeing as it's visual basic, and you can't just edit everything with a text editor, I can't help you guys this time :\

Lavos^

  • Hero Member
  • *****
  • Posts: 2251
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #70 on: June 09, 2008, 06:12:17 am »
I was going to translate the source, but seeing as it's visual basic, and you can't just edit everything with a text editor, I can't help you guys this time :\

Yes you can. Main.vb opens fine for me in Notepad. Anyway here you go:

Quote
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(8)
        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

VDZ

  • Sr. Member
  • ****
  • Posts: 404
  • Nooooooooeees
    • MSN Messenger - supervdz@dolfijn.nl
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #71 on: June 09, 2008, 06:26:05 am »
It opened in notepad for me as well, and I started translating.
Until you come to a part like
Quote
txtOpslagplaats.Text = taal(14)
You can translate 'taal' into 'language' everywhere in the code, and that would solve that problem.
The problem, however, lies with 'txtOpslagplaats'. If I were to translate it to 'txtSavelocation', it would no longer work with the form it's written for; on the form, that element is still called 'txtOpslagplaats'. If I were to translate it, it would no longer be able to find 'txtOpslagplaats' and stop working correctly.

Lavos^

  • Hero Member
  • *****
  • Posts: 2251
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #72 on: June 09, 2008, 06:41:27 am »
It opened in notepad for me as well, and I started translating.
Until you come to a part like
Quote
txtOpslagplaats.Text = taal(14)
You can translate 'taal' into 'language' everywhere in the code, and that would solve that problem.
The problem, however, lies with 'txtOpslagplaats'. If I were to translate it to 'txtSavelocation', it would no longer work with the form it's written for; on the form, that element is still called 'txtOpslagplaats'. If I were to translate it, it would no longer be able to find 'txtOpslagplaats' and stop working correctly.

Edit the design as well?

ViRUS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3156
    • MSN Messenger - newvirus@live.com.ar
    • View Profile
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #73 on: June 09, 2008, 06:53:17 am »
The source language isn't the real problem, I just made a few modifications to it (added a "Change font" button, erased two languages from the list as there were no real translation into them, made the little WebBrowser connect to my own webpage so I can display the news, changed the FormBorderStyle so it doesn't try to show a non-existen icon)

But I can't make it download the list.txt file ¬¬


LennardF1989

  • Full Member
  • ***
  • Posts: 113
  • That's しナード to you mister!
    • MSN Messenger - lennardfonteijn@hotmail.com
    • View Profile
    • LennardF1989.com
    • Email
Re: New Audiosurf Daily Challenge Program - V1.2.1 Released!
« Reply #74 on: June 09, 2008, 07:22:29 am »
Well, there isn't a "real" news function, it's just a small WebBrowser that connects to a predefined webpage and shows it.

And,
Code: [Select]
downloadedlijst = pagina.DownloadString(New Uri("http://86.91.146.73/roy/as/list.txt"))  'Download de songlijst, it's exactly like that, I just replaced the link with my own FTP... Maybe an example of the .txt file would be useful?
How about just opening that text file...

http://86.91.146.73/roy/as/list.txt