Buenas tardes que tal, estaba intentando realizar este ejemplo que comprime esta echo en c #, lo pase a visual basic pero no me esta funcionando, no ingresa al ciclo for
este es el link del ejemplo
http://copstone.com/2010/03/comprimir-y-descomprimir-archivos-con-net-framework/este es el codigo que yo estaba realizando en visual basic.net
por favor si me podria ayudar, estoy intentando comprimir una carpeta utilizando las librerias del frameword
Imports System
Imports System.Data
Imports System.Math
Imports System.Collections.Generic
Imports System.Text
Imports System.IO
Imports System.IO.Compression
Imports System.IO.DirectoryInfo
Sub Main()
Dim path As String
path = "C:\pruebass"
Comprimir_Archivos_Carpeta(Path)
Console.ReadLine()
End Sub
Public Sub Comprimir_Archivos_Carpeta(ByVal path As String)
Dim dr As New DirectoryInfo(path)
Dim fsOrigen As FileStream = Nothing
Dim fsDestino As FileStream = Nothing
Dim gzip As GZipStream = Nothing
Dim filename As String = ""
Const bufferSize As Integer = 4096
Dim buffer(0 To bufferSize - 1) As Byte
For Each fl As FileInfo In dr.GetFiles()
filename = fl.FullName & ".gz"
fsOrigen = New FileStream(fl.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)
fsDestino = New FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None)
gzip = New GZipStream(fsOrigen, CompressionMode.Compress, True)
While True
Dim cantleida As Integer = gzip.Read(buffer, 0, bufferSize)
If cantleida <> 0 Then
gzip.Write(buffer, 0, cantleida)
Else
Exit For
End If
End While
Next
End Sub