Jump to content

VB.NET - ZipFile hung variable??


Recommended Posts

So I've made the move from autoit to VB.NET and I have a very weird issue that I cannot figure out. Google has turned up nothing so I'm asking the people I trust, the AutoIT community.

So here is a snippet of code I'm using:

 

Public Shared Function _TempExtract(zipPATH)

        If Not Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp") Then
            Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp")
        End If

        Dim subDirs = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp")
        For Each Path In subDirs
            Directory.Delete(Path, True)
        Next


        Dim xmlPath As String
        xmlPath = ""
        Dim cleanup As String
        Dim zippedFile = ZipFile.Open(zipPATH, ZipArchiveMode.Read)

        For Each e As ZipArchiveEntry In zippedFile.Entries
            cleanup = Regex.Replace(e.FullName, Path.GetFileNameWithoutExtension(zipPATH) & "/", "")
            MessageBox.Show(e.FullName)
            If cleanup = "ModData.xml" Then
                'Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp\" & Path.GetFileNameWithoutExtension(zipPATH))
                ZipFile.ExtractToDirectory(zipPATH, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp\")
                xmlPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\MIMMPlus\temp\" & Path.GetFileNameWithoutExtension(zipPATH) & "\ModData.xml"

            End If
        Next



        zippedFile.Dispose()

        Return xmlPath
End Function

I have ran the debug once and it worked as expected/desired but upon running it a second time using a different zip file the e.FullName is acting like it is stuck on the previous zip file as it shows the name of the previous zip in the messagebox.show(e.FullName) part....

I have no idea how to fix this and cannot find anything related to it online... am I doing something to cause this that I'm unaware of?

 

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Link to post
Share on other sites

Nevermind.... :>

 

I figured out the problem, wow I'm embarrassed... 

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...