|
9391
|
Programación / .NET (C#, VB.NET, ASP) / Re: (ayuda) auto navegador
|
en: 18 Abril 2013, 21:18 pm
|
Vale ya he visto tu proyecto, el error es que estás deteniendo la ejecución del Thread al usar Thread.sleep. El timer tickea cada 100 ms, y tu estás deteniendo el Thread por 5 segundos en cada Tick, BIG PROBLEM xD. Te recomiendo que uses la propiedad interval del timer para ajustar el tiempo que deseas: Timer1.Interval = 5 * 1000 Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) ' Añadimos el dato TextBox1.SelectAll() ' Seleccionamos el texto TextBox1.Select() ' y activamos el TextBox End Sub Private Sub Timer1_Tick(Sender As Object, e As EventArgs) Handles Timer1.Tick Static i As Integer = 0 If i = ListBox1.Items.Count Then Sender.Stop() i = 0 MsgBox("Terminó la lista") Else ListBox1.SelectedIndex = i WebBrowser1.Navigate(ListBox1.SelectedItem) Me.Text = "Navegando en '" & ListBox1.SelectedItem & "'" i += 1 End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Timer1.Interval = 5 * 1000 Timer1.Start() End Sub End Class
EDITO: Otra forma de hacerlo, sin depender de un Timer, sería así: Public Class Form1 Dim Seconds As Long = 0 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) ' Añadimos el dato TextBox1.SelectAll() ' Seleccionamos el texto TextBox1.Select() ' y activamos el TextBox End Sub Private Sub NavigateListBox() For Each URL As String In ListBox1.Items Me.Text = "Navegando en '" & URL & "'" WebBrowser1.Navigate(URL) Sleep(Seconds) ' Segundos Next End Sub Private Sub Sleep(ByVal Duration As Int64) Dim Starttime = DateTime.Now Do While (DateTime.Now - Starttime).TotalSeconds < Duration : Application.DoEvents() : Loop End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click NavigateListBox() End Sub Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged Seconds = CLng(sender.text) End Sub End Class
Saludos!
|
|
|
9392
|
Programación / .NET (C#, VB.NET, ASP) / Re: (ayuda) auto navegador
|
en: 18 Abril 2013, 21:05 pm
|
hmmm pues que raro, a mi si que me funciona corréctamente: public class class1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ClientSize = New Point(640, 480) Dim ListBox1 As New ListBox, WebBrowser1 As New WebBrowser ListBox1.Dock = DockStyle.Top : WebBrowser1.Dock = DockStyle.Bottom Me.Controls.Add(ListBox1) : Me.Controls.Add(WebBrowser1) ListBox1.Items.Clear() ListBox1.Items.Add("https://mega.co.nz/#!AdFTjLDb!BPFoK2i7Q25IzVmFxA2tBD-NvgQU3gL4Tez94cR1vHc") ListBox1.SelectedIndex = 0 WebBrowser1.Navigate(ListBox1.SelectedItem) End Sub end class
Prueba el código a ver si a ti te funciona como a mi, ¿Vale? No se me ocurre porque puede ser.
|
|
|
9395
|
Programación / Programación General / Re: Teclados para programadores?
|
en: 18 Abril 2013, 18:21 pm
|
he mirado en foros y eso y el mejor teclado sería este: Doy fé! OMG esos teclados tienen las teclas más duras que el pan xD.
No sé recomendarte un teclado en particular, pero si me permites darte unos consejos... : Evita los teclados gamers con 800 teclas que nunca usarás ...y evita la tentación de los teclados multimedia con 50 mini-pantallas y teclas para manejar el reproductor de video y el volumen de la música que no sirven pa ná más que pa distraer y aumentar el peso del dispositivo. Los he tenido, y al final se hacen muy incomodos tanto por las teclas inútiles como por su tamaño. No es esencial que el teclado lleve reposa muñecas extra, pero no te compres un teclado con una mini-carcasa, asegúrate que la carcasa del teclado séa un poco grande en la zona de las muñecas, no se si me hago entender: Carcasa incomodisima (Mini-carcasa, no hay donde reposar las manos): (Este teclado lo he probado, es lo peor, no hay por donde cogerlo y siempre acabas tocando una tecla que no querías tocar.)  Carcasa cómoda:  Carcasa con reposamuñecas exagerádamente grande, con intención de ser lo más cómodo del mundo para las manos pero que en realidad es una *****:  Hazte una idea. Saludos!
|
|
|
9396
|
Programación / Scripting / Re: batch acceder a carpeta sin nombre
|
en: 18 Abril 2013, 17:46 pm
|
necesito entrar a una carpeta que no tiene nombre Una carpeta no puede existir sin un nombre asignado. (Aunque este séa un nombre reservado de Windows y quizás por eso te parezca que la carpeta no tiene nombre...) Quizás deberías dar más detalles del problema... Para modificar el directório de trabajo actual (Es decir, entrar a una carpeta oculta o no): CD /D "C:\Nombre de la carpeta"" Si lo que quieres es encontrar una carpeta cuyo nombre desconoces, entonces puedes usar el comando DIR, o un búcle para recorrer las carpetas en un nivel superior del directorio donde quieres encontrar dicho nombre de carpeta: Set "FOLDER= %USERPROFILE%" Echo: [+] Nombres de carpetas del directorio " %FOLDER%": | MORE
Output: EDITO: ...Y para encontrar los nombres de carpetas ocultas: FOR /F "tokens=*" %%X IN ('DIR /AD /B') do ... Saludos!
|
|
|
9397
|
Programación / .NET (C#, VB.NET, ASP) / Re: (ayuda) auto navegador
|
en: 18 Abril 2013, 16:37 pm
|
Error 2 Los argumentos de método se deben incluir entre paréntesis Vuelvo a citar el error: Error 2 Los argumentos de método se deben incluir entre paréntesis. No debería ser necesário una explicación para ese error, aquí tienes la solución: WebBrowser1.Navigate(ListBox1.List(i - 1))
Error 4 'Caption' no es un miembro de 'WindowsApplication1.Form1'. La propiedad "Caption" no existe, su equivalente es "Text": me.text = "Navegando en '" & ListBox1.List(i - 1) & "'"
Error 1 'ListCount' no es un miembro de 'System.Windows.Forms.ListBox'. C:\Users\x\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 23 16 WindowsApplication1 Error 3 'List' no es un miembro de 'System.Windows.Forms.ListBox'. C:\Users\x\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 29 30 WindowsApplication1 Error 5 'List' no es un miembro de 'System.Windows.Forms.ListBox'. C:\Users\x\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 30 41 WindowsApplication1 Error 6 'Selected' no es un miembro de 'System.Windows.Forms.ListBox'. C:\Users\x\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 31 9 WindowsApplication1
Lo mismo que antes, esas propiedades no existen, debes buscar sus equivalentes. Como nota adicional: Estás intentando mostrar un msgbox antes de desactivar el timer, y si haces eso el timer seguirá tickeando. Aquí tienes: Private Sub Timer1_Tick(Sender As Object, e As EventArgs) Handles Timer1.Tick Static i As Integer = 0 If i = ListBox1.Items.Count Then Sender.enabled = False i = 0 MsgBox("Terminó la lista") Else ListBox1.SelectedIndex = i WebBrowser1.Navigate(ListBox1.SelectedItem) Me.Text = "Navegando en '" & ListBox1.SelectedItem & "'" i += 1 End If End Sub
Saludos!
|
|
|
9398
|
Programación / .NET (C#, VB.NET, ASP) / Pasar el nombre de una subrutina como argumento de una función?
|
en: 18 Abril 2013, 15:21 pm
|
Hola Estoy intentando crear una función genérica para crear Threads. El problema es que no consigo pasarle a la función el nombre de un Sub como argumento, para poder asignarlo como el Sub del nuevo thread que se va a crear, sólamente he llegado a conseguir pasarle el nombre de una función, lo cual no me sirve para nada, porque según me dice la IDE el procedimiento de un thread debe ser un Sub, no una función. ¿Tienen idea de como puedo conseguir resolverlo? Me gustaría poder pasarle el nombre del Sub a la función sin tener que declarar un delegado fuera de la función, porque mi intención es hacer una función genérica que acepte cualquier nombre de un Sub como argumento, para simplificar las cosas. El code: Public Class Form1 ' Desired usage: ' Make_Thread(Thread Variable, Thread Name, Thread Priority, Thread Sub) ' ' Example: ' Make_Thread(Thread_1, "Low thread", Threading.ThreadPriority.Low, AddressOf Test_Sub) Private Thread_1 As Threading.Thread ' Thread Variable Private Function Make_Thread(Of TKey)(ByRef Thread_Variable As Threading.Thread, _ ByVal Thread_Name As String, _ ByVal Thread_Priority As Threading.ThreadPriority, _ ByRef Thread_Sub As Func(Of String, TKey)) As Boolean ' I'd ByRef a function but really I will pass a Subroutine. ' See if the thread is already running. Dim is_running As Boolean If Thread_Variable Is Nothing Then _ is_running = False _ Else is_running = Thread_Variable.IsAlive ' If the thread is already running, do nothing. If is_running Then Return False : Exit Function ' Make the thread. Thread_Variable = New Threading.Thread(AddressOf Thread_Sub) Thread_Variable.Priority = Thread_Priority Thread_Variable.IsBackground = True Thread_Variable.Name = Thread_Name ' Start the thread. Thread_Variable.Start() Return True End Function Private Sub Test_Sub() MsgBox("A message from the thread!") End Sub End Class
|
|
|
9399
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 18 Abril 2013, 05:24 am
|
· Modificar la prioridad de un proceso, por el nombre. #Region " Set Process Priority By Name " ' [ Set Process Priority By Name Function ] ' ' // By Elektro H@cker ' ' Examples : ' Set_Process_Priority_By_Name("notepad.exe", ProcessPriorityClass.RealTime) ' Set_Process_Priority_By_Name("notepad", ProcessPriorityClass.Idle, False) Private Function Set_Process_Priority_By_Name(ByVal ProcessName As String, _ ByVal Priority As ProcessPriorityClass, _ Optional ByVal OnlyFirstFound As Boolean = True ) As Boolean Try If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4) For Each Proc As Process In System.Diagnostics.Process.GetProcessesByName(ProcessName) Proc.PriorityClass = Priority If OnlyFirstFound Then Exit For Next Return True Catch ex As Exception ' Return False Throw New Exception(ex.Message) End Try End Function #End Region
· Modificar la prioridad de un proceso, por el handle y usando APIS. #Region " Set Process Priority By Handle " ' [ Set Process Priority By Handle Function ] ' ' // By Elektro H@cker ' ' Examples : ' Set_Process_Priority_By_Handle(Process.GetCurrentProcess().Handle, Process_Priority.RealTime) ' Set_Process_Priority_By_Handle(33033, Process_Priority.Idle) Private Declare Function GetPriorityClass Lib "kernel32" (ByVal hProcess As Long) As Long Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long Public Enum Process_Priority As Int32 RealTime = 256 High = 128 Above_Normal = 32768 Normal = 32 Below_Normal = 16384 Low = 64 End Enum Private Function Set_Process_Priority_By_Handle(ByVal Process_Handle As IntPtr, _ ByVal Process_Priority As Process_Priority) As Boolean SetPriorityClass(Process_Handle, Process_Priority) If GetPriorityClass(Process_Handle) = Process_Priority Then _ Return True _ Else Return False ' Return false if priority can't be changed 'cause user permissions. End Function #End Region
· modificar la prioridad del Thread actual: #Region " Set Current Thread Priority " ' [ Set Current Thread Priority Function ] ' ' // By Elektro H@cker ' ' Examples : ' Set_Current_Thread_Priority(Threading.ThreadPriority.AboveNormal) ' MsgBox(Set_Current_Thread_Priority(Threading.ThreadPriority.Highest)) Public Shared Function Set_Current_Thread_Priority(ByVal Thread_Priority As Threading.ThreadPriority) As Boolean Try Threading.Thread.CurrentThread.Priority = Thread_Priority Return True Catch ex As Exception ' Return False Throw New Exception(ex.Message) End Try End Function #End Region
|
|
|
9400
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 17 Abril 2013, 21:28 pm
|
· Comprimir con DotNetZip #Region " DotNetZip Compress " ' [ DotNetZip Compress Function ] ' ' // By Elektro H@cker ' ' Instructions : ' 1. Add a reference to "Ionic.Zip.dll". ' 2. Use the code below. ' ' Examples: ' DotNetZip_Compress("C:\File.txt") ' DotNetZip_Compress("C:\Folder") ' DotNetZip_Compress("C:\Folder", "C:\Folder\Test.zip", , CompressionLevel.BestCompression, "Password", EncryptionAlgorithm.WinZipAes256) Imports Ionic.Zip Imports Ionic.Zlib Private Function DotNetZip_Compress(ByVal Input_DirOrFile As String, _ Optional ByVal OutputFileName As String = Nothing, _ Optional ByVal CompressionMethod As CompressionMethod = CompressionMethod.None, _ Optional ByVal CompressionLevel As CompressionLevel = CompressionLevel.Default, _ Optional ByVal Password As String = Nothing, _ Optional ByVal Encrypt_Password As EncryptionAlgorithm = EncryptionAlgorithm.None _ ) As Boolean Try ' Create compressor Dim Compressor As ZipFile = New ZipFile ' Set compression parameters Compressor.CompressionLevel = CompressionLevel ' Archiving compression level. Compressor.CompressionMethod = CompressionMethod ' Compression method Compressor.Password = Password ' Zip Password Compressor.TempFileFolder = System.IO.Path.GetTempPath() ' Temp folder for operations If Password Is Nothing AndAlso Not Encrypt_Password = EncryptionAlgorithm.None Then _ Compressor.Encryption = EncryptionAlgorithm.None _ Else Compressor.Encryption = Encrypt_Password ' Encryption for Zip password. ' Add Progress Handler ' AddHandler Compressor.SaveProgress, AddressOf DotNetZip_Compress_Progress ' Removes the end slash ("\") if is given for a directory. If Input_DirOrFile.EndsWith("\") Then Input_DirOrFile = Input_DirOrFile.Substring(0, Input_DirOrFile.Length - 1) ' Generate the OutputFileName if any is given. If OutputFileName Is Nothing Then _ OutputFileName = (My.Computer.FileSystem.GetFileInfo(Input_DirOrFile).DirectoryName & "\" & (Input_DirOrFile.Split("\").Last) & ".zip").Replace("\\", "\") ' Check if given argument is Dir or File ...then start the compression If IO.Directory.Exists(Input_DirOrFile) Then ' It's a Dir Compressor.AddDirectory(Input_DirOrFile) ElseIf IO. File. Exists(Input_DirOrFile ) Then ' It's a File Compressor.AddFile(Input_DirOrFile) End If Compressor.Save(OutputFileName) Compressor.Dispose() Catch ex As Exception 'Return False ' File not compressed Throw New Exception(ex.Message) End Try Return True ' File compressed End Function 'Public Sub DotNetZip_Compress_Progress(ByVal sender As Object, ByVal e As SaveProgressEventArgs) ' ' If e.EventType = ZipProgressEventType.Saving_Started Then ' MsgBox("Begin Saving: " & _ ' e.ArchiveName) ' Destination ZIP filename ' ' ElseIf e.EventType = ZipProgressEventType.Saving_BeforeWriteEntry Then ' MsgBox("Writing: " & e.CurrentEntry.FileName & _ ' " (" & (e.EntriesSaved + 1) & "/" & e.EntriesTotal & ")") ' Input filename to be compressed ' ' ' ProgressBar2.Maximum = e.EntriesTotal ' Count of total files to compress ' ' ProgressBar2.Value = e.EntriesSaved + 1 ' Count of compressed files ' ' ElseIf e.EventType = ZipProgressEventType.Saving_EntryBytesRead Then ' ' ProgressBar1.Value = CType((e.BytesTransferred * 100) / e.TotalBytesToTransfer, Integer) ' Total Progress ' ' ElseIf e.EventType = ZipProgressEventType.Saving_Completed Then ' MessageBox.Show("Compression Done: " & vbNewLine & _ ' e.ArchiveName) ' Compression finished ' End If ' 'End Sub #End Region
· Crear un SFX con DotNetZip #Region " DotNetZip Compress SFX " ' [ DotNetZip Compress SFX Function ] ' ' // By Elektro H@cker ' ' Instructions : ' 1. Add a reference to "Ionic.Zip.dll". ' 2. Use the code below. ' ' Examples: ' DotNetZip_Compress_SFX("C:\File.txt") ' DotNetZip_Compress_SFX("C:\Folder") ' ' DotNetZip_Compress_SFX( _ ' "C:\File.txt", "C:\Test.exe", , CompressionLevel.BestCompression, _ ' "MyPassword", EncryptionAlgorithm.WinZipAes256, , , _ ' ExtractExistingFileAction.OverwriteSilently, , , , _ ' System.IO.Path.GetFileName("notepad.exe") _ ' ) Imports Ionic.Zip Imports Ionic.Zlib Private Function DotNetZip_Compress_SFX(ByVal Input_DirOrFile As String, _ Optional ByVal OutputFileName As String = Nothing, _ Optional ByVal CompressionMethod As CompressionMethod = CompressionMethod.None, _ Optional ByVal CompressionLevel As CompressionLevel = CompressionLevel.Default, _ Optional ByVal Password As String = Nothing, _ Optional ByVal Encrypt_Password As EncryptionAlgorithm = EncryptionAlgorithm.None, _ Optional ByVal Extraction_Directory As String = ".\", _ Optional ByVal Silent_Extraction As Boolean = False, _ Optional ByVal Overwrite_Files As ExtractExistingFileAction = ExtractExistingFileAction.InvokeExtractProgressEvent, _ Optional ByVal Delete_Extracted_Files_After_Extraction As Boolean = False, _ Optional ByVal Icon As String = Nothing, _ Optional ByVal Window_Title As String = Nothing, _ Optional ByVal Window_Style As SelfExtractorFlavor = SelfExtractorFlavor.WinFormsApplication, _ Optional ByVal Command_Line_Argument As String = Nothing _ ) As Boolean Try ' Create compressor Dim Compressor As ZipFile = New ZipFile ' Set compression parameters Compressor.CompressionLevel = CompressionLevel ' Archiving compression level. ' Compression method Compressor.Password = Password ' Zip Password Compressor.TempFileFolder = System.IO.Path.GetTempPath() ' Temp folder for operations If Password Is Nothing AndAlso Not Encrypt_Password = EncryptionAlgorithm.None Then Compressor.Encryption = EncryptionAlgorithm.None ' No encryption because no password. Compressor.CompressionMethod = CompressionMethod ' Set any compression method. Else Compressor.Encryption = Encrypt_Password ' Set Encryption for Zip password. Compressor.CompressionMethod = CompressionMethod.Deflate ' Set deflate method to don't destroy the SFX if AES encryption. End If Dim SFX_Options As New SelfExtractorSaveOptions() SFX_Options.DefaultExtractDirectory = Extraction_Directory SFX_Options.Quiet = Silent_Extraction SFX_Options.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently SFX_Options.RemoveUnpackedFilesAfterExecute = Delete_Extracted_Files_After_Extraction SFX_Options.Flavor = Window_Style SFX_Options.PostExtractCommandLine = Command_Line_Argument If Not Icon Is Nothing Then SFX_Options.IconFile = Icon If Not Window_Title Is Nothing Then SFX_Options.SfxExeWindowTitle = Window_Title ' Add Progress Handler ' AddHandler Compressor.SaveProgress, AddressOf DotNetZip_Compress_SFX_Progress ' Removes the end slash ("\") if is given for a directory. If Input_DirOrFile.EndsWith("\") Then Input_DirOrFile = Input_DirOrFile.Substring(0, Input_DirOrFile.Length - 1) ' Generate the OutputFileName if any is given. If OutputFileName Is Nothing Then _ OutputFileName = (My.Computer.FileSystem.GetFileInfo(Input_DirOrFile).DirectoryName & "\" & (Input_DirOrFile.Split("\").Last) & ".exe").Replace("\\", "\") ' Check if given argument is Dir or File ...then start the compression If IO.Directory.Exists(Input_DirOrFile) Then ' It's a Dir Compressor.AddDirectory(Input_DirOrFile) ElseIf IO. File. Exists(Input_DirOrFile ) Then ' It's a File Compressor.AddFile(Input_DirOrFile) End If Compressor.SaveSelfExtractor(OutputFileName, SFX_Options) Compressor.Dispose() Catch ex As Exception 'Return False ' File not compressed Throw New Exception(ex.Message) End Try Return True ' File compressed End Function ' Public Sub DotNetZip_Compress_SFX_Progress(ByVal sender As Object, ByVal e As SaveProgressEventArgs) ' ' If e.EventType = ZipProgressEventType.Saving_Started Then ' MsgBox("Begin Saving: " & _ ' e.ArchiveName) ' Destination ZIP filename ' ' ElseIf e.EventType = ZipProgressEventType.Saving_BeforeWriteEntry Then ' MsgBox("Writing: " & e.CurrentEntry.FileName & _ ' " (" & (e.EntriesSaved + 1) & "/" & e.EntriesTotal & ")") ' Input filename to be compressed ' ' ' ProgressBar2.Maximum = e.EntriesTotal ' Count of total files to compress ' ' ProgressBar2.Value = e.EntriesSaved + 1 ' Count of compressed files ' ' ElseIf e.EventType = ZipProgressEventType.Saving_EntryBytesRead Then ' ' ProgressBar1.Value = CType((e.BytesTransferred * 100) / e.TotalBytesToTransfer, Integer) ' Total Progress ' ' ElseIf e.EventType = ZipProgressEventType.Saving_Completed Then ' MessageBox.Show("Compression Done: " & vbNewLine & _ ' e.ArchiveName) ' Compression finished ' End If ' ' End Sub #End Region
· Descomprimir con DotNetZip #Region " DotNetZip Extract " ' [ DotNetZip Extract Function ] ' ' // By Elektro H@cker ' ' Instructions : ' 1. Add a reference to "Ionic.Zip.dll". ' 2. Use the code below. ' ' Examples: ' DotNetZip_Extract("C:\File.zip") ' DotNetZip_Extract("C:\File.zip", "C:\Folder\Test\", , "MyPassword") Imports Ionic.Zip Imports Ionic.Zlib Dim ZipFileCount As Long = 0 Dim ExtractedFileCount As Long = 0 Private Function DotNetZip_Extract(ByVal InputFile As String, _ Optional ByVal OutputDir As String = Nothing, _ Optional ByVal Overwrite As ExtractExistingFileAction = ExtractExistingFileAction.DoNotOverwrite, _ Optional ByVal Password As String = "Nothing" _ ) As Boolean Try ' Create Extractor Dim Extractor As ZipFile = ZipFile.Read(InputFile) ' Set Extractor parameters Extractor.Password = Password ' Zip Password Extractor.TempFileFolder = System.IO.Path.GetTempPath() ' Temp folder for operations Extractor.ZipErrorAction = ZipErrorAction.Throw ' Specify the output path where the files will be extracted If OutputDir Is Nothing Then OutputDir = My.Computer.FileSystem.GetFileInfo(InputFile).DirectoryName ' Add Progress 'AddHandler Extractor.ExtractProgress, AddressOf DotNetZip_Extract_Progress ' Progress Handler 'For Each Entry As ZipEntry In Extractor.Entries : ZipFileCount += 1 : Next ' Total bytes size of Zip 'ZipFileCount = Extractor.Entries.Count ' Total files inside Zip ' Start the extraction For Each Entry As ZipEntry In Extractor.Entries : Entry.Extract(OutputDir, Overwrite) : Next ZipFileCount = 0 : ExtractedFileCount = 0 ' Reset vars Extractor.Dispose() Return True ' File Extracted Catch ex As Exception ' Return False ' File not extracted Throw New Exception(ex.Message) End Try End Function ' Public Sub DotNetZip_Extract_Progress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs) ' ' If e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry Then ' If ExtractedFileCount = 0 Then ' MsgBox("Begin Extracting: " & _ ' e.ArchiveName) ' Input ZIP filename ' End If ' ' ExtractedFileCount += 1 ' MsgBox("Writing: " & e.CurrentEntry.FileName & _ ' " (" & (ExtractedFileCount) & "/" & ZipFileCount & ")") ' Output filename uncompressing ' ' ProgressBar1.Maximum = ZipFileCount ' Count of total files to uncompress ' ProgressBar1.Value = ExtractedFileCount ' Count of uncompressed files ' ' ElseIf e.EventType = ZipProgressEventType.Extracting_AfterExtractEntry Then ' If ExtractedFileCount = ZipFileCount Then ' MessageBox.Show("Extraction Done: " & vbNewLine & _ ' e.ArchiveName) ' Uncompression finished ' End If ' End If ' ' End Sub #End Region
|
|
|
|
|
|
|