I have this project in VB NET that should play a mp3 file from the clipboard using AxWindowsMediaPlayer1. I wrote the code as a text in order to allow each freelancer to use it in his own Visual Studio regardless of version. Just copy and past the code and change the file address of your mp3 to test. The Form needs 3 Buttons, 1 Label, 1 Windows Media Player...
The code is working up to the last line. The task of a freelancer is to complete this code successfully.
Here' the code:
Imports [login to view URL]
Imports [login to view URL]
Imports [login to view URL]
Public Class Form1
Private Sub Button3_Click(ByVal sender As [login to view URL], ByVal e As [login to view URL]) Handles [login to view URL]
End
End Sub
Private Sub Button1_Click(ByVal sender As [login to view URL], ByVal e As [login to view URL]) Handles [login to view URL]
Dim rijndael As New RijndaelManaged()
[login to view URL] = 256
[login to view URL] = 256
[login to view URL] = New [Byte]() {24, 23, 35, 83, 77, 35, 28, 34, 94, 25, 45, 2, 73, 26, 27, 78, 12, 23, 35, 83, 57, 35, 28, 34, 94, 25, 45, 22, 73, 26, 27, 78}
Dim password As Byte() = New Byte(31) {}
[login to view URL]("123abc").CopyTo(password, 0)
Dim file_to_read As New CryptoStream([login to view URL]("C:\Users\User\Desktop\[login to view URL]"),
[login to view URL](password, [login to view URL]), [login to view URL])
Dim file_to_write As Stream = [login to view URL]("C:\Users\User\Desktop\[login to view URL]")
[login to view URL](file_to_write)
[login to view URL]()
[login to view URL]()
[login to view URL]()
[login to view URL] = "Crypted!"
End Sub
Private Sub Button2_Click(ByVal sender As [login to view URL], ByVal e As [login to view URL]) Handles [login to view URL]
Dim rijndael As New RijndaelManaged()
[login to view URL] = 256
[login to view URL] = 256
[login to view URL] = New [Byte]() {24, 23, 35, 83, 77, 35, 28, 34, 94, 25, 45, 2, 73, 26, 27, 78, 12, 23, 35, 83, 57, 35, 28, 34, 94, 25, 45, 22, 73, 26, 27, 78}
Dim password As Byte() = New Byte(31) {}
[login to view URL]("123abc").CopyTo(password, 0)
Dim mp3Bytes() As Byte
Using file_to_read As New CryptoStream([login to view URL]("C:\Users\User\Desktop\[login to view URL]"), [login to view URL](password, [login to view URL]), [login to view URL])
Using memory_stream As New MemoryStream
[login to view URL](memory_stream)
mp3Bytes = [login to view URL]
End Using
End Using
[login to view URL] = "Decrypted!"
[login to view URL]() 'clear the clipboard
[login to view URL](mp3Bytes) 'set the mp3 audio file bytes to the clipboard
If [login to view URL] Then
Dim bytes_from_clipboard() As Byte = {}
Using clipboard_stream As Stream = [login to view URL]
ReDim bytes_from_clipboard(CInt([login to view URL]) - 1)
[login to view URL](bytes_from_clipboard, 0, CInt([login to view URL]))
End Using
'UP TO THIS POINT THE CODE IS OKAY. FROM HERE THE FREELANCER'S TASK BEGINS
'I would like to play with Windows Media Player the mp3 file (just decrypted) from the clipboard.
[login to view URL]() ' ????
End If
End Sub
End Class