''' <summary> ''' Extrait une ressources ''' </summary> ''' Nom de la ressource ''' Dossier de destination ''' <remarks></remarks> Public Sub ExtractRessource(ByVal pResName As String, ByVal pDirDest As String) Try Dim lSrc As IO.Stream = Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(pResName) If lSrc Is Nothing Then Exit Sub Dim lFileName As String = IO.Path.Combine(pDirDest, pResName.Substring(pResName.IndexOf("."c) + 1)) If IO.File.Exists(lFileName) AndAlso MD5(lFileName) = MD5(lSrc) Then lSrc.Close() Exit Sub End If lSrc.Close() lSrc = Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(pResName) Dim lDst As IO.FileStream = IO.File.Open(lFileName, IO.FileMode.Create) Dim lData(1024) As Byte Dim lLng As Integer = 1024 Do While lSrc.Position < lSrc.Length If (lSrc.Length - lSrc.Position) < lLng Then lLng = CInt((lSrc.Length - lSrc.Position)) lSrc.Read(lData, 0, lLng) lDst.Write(lData, 0, lLng) lDst.Flush() Loop lSrc.Close() lDst.Close() Catch ex As Exception #If DEBUG Then Debug.Print(ex.ToString) Stop #End If End Try End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question