4/22/11

[VB.NET][SNP] Drop File From Resources

    Private Sub FileFromResource(ByVal resource, ByVal outputDir)   
        Dim bArray() As Byte = resource  
        Dim fStream As New IO.FileStream(outputDir, IO.FileMode.OpenOrCreate)  
        Using bWrite As New IO.BinaryWriter(fStream)  
          Dim i As Integer = 0  
          Do Until i = bArray.Count  
            bWrite.Write(i)  
            i += 1  
          Loop  
        End Using  
      End Sub  

With this sub you can drop a file from the resources.

Usage:

FileFromResource(My.Resources.MSVCIRTD, "C:\File.exe")

No comments: