Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok I've got this mp3 (Gnosis.mp3), and it's an embedded resource within my project (Pindleskin Bot).

 

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

 


   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 don't 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 ain't no
       'mp3 to play 
       Dim Background As Audio
       Background.FromFile(System.Environment.GetFolderPath(Environment.SpecialFolder.Cookies) & "/Gnosis.mp3")
   End Sub

"Reality is fake, Dreams are for real"
Posted

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

 

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

 

But when I looked in my cookies, I could find Gnosis...but it's 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 =|

"Reality is fake, Dreams are for real"
  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...