D
Dinsdale
I must be totally missing something.
I am trying to use DirectX to play an AVI file that is stored as a
Manifest Resource. Apperently the Video class only takes a string path
as a parameter, so I wanted to write the avi to a file from the
manifest. I thought I would just be able to read it in as a Stream and
then write it out to a FileStream but this does not seem to be the
case.
To complicate things, I just found out about the ResourceManager, but
I'm not quite sure how to use that in an abstracted sort of way (the
My.Resource stuff that is generated is very specific and I want it to
be generalized). This is what I have so far:
Function GetVideo(ByVal resourceIdentifier As String, ByVal videoName
As String) As Video
Dim fileLocation As String
Dim videoFileInfo As FileInfo
Dim aviFile As Video
fileLocation = Application.StartupPath + "\" + videoName
videoFileInfo = New FileInfo(fileLocation)
If Not videoFileInfo.Exists Then
Dim resourceStream As Stream
resourceStream = System.Reflection.Assembly _
.GetExecutingAssembly.GetManifestResourceStream(resourceIdentifier
+ "." + videoName)
Dim videoFileStream As New FileStream(fileLocation,
FileMode.Create)
'SO HOW DO I WRITE???
videoFileStream.Close()
End If
aviFile = New Video(fileLocation)
Return aviFile
End Function
Obviously I need some logic to catch any exceptions, but could someone
tell me what the easy way to do this is?
Cheers!
Dinsdale
I am trying to use DirectX to play an AVI file that is stored as a
Manifest Resource. Apperently the Video class only takes a string path
as a parameter, so I wanted to write the avi to a file from the
manifest. I thought I would just be able to read it in as a Stream and
then write it out to a FileStream but this does not seem to be the
case.
To complicate things, I just found out about the ResourceManager, but
I'm not quite sure how to use that in an abstracted sort of way (the
My.Resource stuff that is generated is very specific and I want it to
be generalized). This is what I have so far:
Function GetVideo(ByVal resourceIdentifier As String, ByVal videoName
As String) As Video
Dim fileLocation As String
Dim videoFileInfo As FileInfo
Dim aviFile As Video
fileLocation = Application.StartupPath + "\" + videoName
videoFileInfo = New FileInfo(fileLocation)
If Not videoFileInfo.Exists Then
Dim resourceStream As Stream
resourceStream = System.Reflection.Assembly _
.GetExecutingAssembly.GetManifestResourceStream(resourceIdentifier
+ "." + videoName)
Dim videoFileStream As New FileStream(fileLocation,
FileMode.Create)
'SO HOW DO I WRITE???
videoFileStream.Close()
End If
aviFile = New Video(fileLocation)
Return aviFile
End Function
Obviously I need some logic to catch any exceptions, but could someone
tell me what the easy way to do this is?
Cheers!
Dinsdale