Copying mp3 - Stream Help!

Diablicolic

Well-known member
Joined
Jul 28, 2003
Messages
168
Location
Your Neighbor
Ok Ive got this mp3 (Gnosis.mp3), and its an embedded resource within my project (Pindleskin Bot).

I want to copy the mp3 to the cookies on the target persons computer (whoever uses the program). The error is on the bottom of the page, and heres the code:

[VB]

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

This just changes my cursor on the form
MyBase.Cursor = New Cursor(Me.GetType().Assembly.GetManifestResourceStream("Pindleskin_Bot.Cross.cur"))

This makes me feel happy
lblTalk.Text = "Welcome Eradication,"

This is where I check and see if Gnosis.mp3 is there
If it is then I just delete it, because it might
be a bad copy
Dim Exists As Boolean
Exists = System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")
If Exists = True Then
System.IO.File.Delete(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")
End If

This is how I hook up to my resources to get Gnosis.mp3
Dim thisExe As System.Reflection.Assembly
thisExe = System.Reflection.Assembly.GetExecutingAssembly()
Dim file As System.IO.Stream = _
thisExe.GetManifestResourceStream("Pindleskin_Bot.Gnosis.mp3")

And this is where I want to write the mp3 to the
cookies path!! But it dont work!
Dim Write_mp3 As New System.IO.StreamWriter(file)
Write_mp3.Write(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")

Write_mp3.Flush()
Write_mp3.Close()
file.Flush()
file.Close()

This is what plays Gnosis.mp3, but there aint no
mp3 to play
Dim Background As Audio
Background.FromFile(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")
End Sub

[/VB]
 

Attachments

Wait I got the streamer to work, I got it backwards, its actually suppose to be this:

[VB]
Dim Write_mp3 As New System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")
Write_mp3.Write(file)
[/VB]

But when I looked in my cookies, I could find Gnosis...but its 33 bytes?

---Edit----

I took out the flushes and closes of the streamwriters, and now the Gnosis.mp3 inside of the cookies....is 0 bytes? The true Gnosis.mp3 that is inside of the project folder is suppose to be 5.10 MB. This is all weird =|
 
Why on earth do you want to store an MP3 in the cookies folder? Would using the Temp directory, the applications direcory or storing it as part of the users application data not be far more appropriate?
 
Back
Top