Click here to Skip to main content
15,887,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a custom installer a bit ago and it works fine but I am having a few issues with it.

Unlike a package installer it is by far slower at installing.

This is how the installer works:

1. It deletes all the temporary files on the computer in case the installer was previously installed

2. Then the installers moves a .zip file to the users computer from the resources folder

3. After which it extracts the .zip (I use DotNetZip library for thus)

4. Then it moves the files it extracted to the correct director(y)(ies)

5. ...and finally it just deletes the .zip and the extracted folder off the computer

I have used installers before their job in around 5 - 7 seconds.

They move the same files as mine, but my installer that was custom made by me does the same exact job in around 40 seconds or so on my computer... For the users, it could last for up to 3 - 4 minutes.

I wouldn't be so annoyed by this fact, if not one factor... The files that the program deals with is only worth 40 - 50MB which is basically nothing.

...So I was thinking, how do they do that? Maybe there is a way for me to avoid moving the .zip and unpacking it.

Is there a way I could possibly place the already extracted folder into my Resources folder or place it inside the project and move it to the computer.

If you have an suggestions, I would be more than happy to consider them!

Code snippets:

Deleting Temp Files:

VB
Try
           Dim peth As String = (DirectoryToInstall & "\Svatekl2.zip")
           If File.Exists(peth) = True Then
               FileSystem.Kill(peth)
           End If

       Catch
       End Try

       Try

           If My.Computer.FileSystem.DirectoryExists(DirectoryToInstall & "\Svatekl3") = True Then
               My.Computer.FileSystem.DeleteDirectory(DirectoryToInstall & "\Svatekl3", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
           End If
       Catch
       End Try


Moving the zip file...
VB
Private Sub MoveZip()
        IO.File.WriteAllBytes(DirectoryToInstall & "\Svatekl2.zip", My.Resources.Svatekl2)
    End Sub


Extracting...
Private Sub MyExtract()

        Dim ZipToUnpack As String = (DirectoryToInstall & "\Svatekl2.zip")
        Dim UnpackDirectoryToInstall As String = (DirectoryToInstall & "\Svatekl3")
        Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
            Dim e As ZipEntry
            For Each e In zip1
                e.Extract(UnpackDirectoryToInstall, ExtractExistingFileAction.OverwriteSilently)
            Next
        End Using
    End Sub


To move the files I use a TON of code... I will not post it all here, I will just give you an example of how one of them looks! (They all look really similar)

VB
If SafeShot.Checked = True Then
            My.Computer.FileSystem.MoveDirectory(DirectoryToInstall & "\Svatekl3\Svatekl2\SafeShot\Allies and Dead\scripts", (DirectoryToInstall) & "\res_mods\0.9.7\scripts", True)
        End If


Lastly it runs the DeleteTemp() again which is the first thing it does in the installation process as well.
Posted
Updated 27-Apr-15 12:50pm
v2

1 solution

Based on what you described and without seeing any code, I suspect your issue is the deleting of temporary files. It sounds like you are deleting the contents of the entire temporary directory and for some users, this could be tens of gigabytes of data. I suggest you create a directory in the temporary folder with a GUID as the folder name. Let your install run, then remove the folder you created. Let the user handle cleaning up their temporary directory.
 
Share this answer
 
Comments
dimaba10000 27-Apr-15 15:45pm    
Incorrect. I do not delete the %temp% files.

The only "temporary files" I delete, are the ones that the program places on the computer.

For example... The .zip file.
virusstorm 27-Apr-15 15:50pm    
I would need to see your code to help you diagnose what the issue is then. Have you tried placing trace statements that log the time it takes to complete various activities? This would help you to narrow down here your bottleneck is at.
dimaba10000 27-Apr-15 18:42pm    
Well of what I am aware... The extraction consumes the largest amount of time.

My product (mod installer) is quite popular in a gaming community and there are a few videos on YouTube where our fans posted guides on how to use the installer.

Most of them would get stuck at the extraction part for around 20 seconds... Some longer. I am guessing it depends on their computer configurations.

I will post code snippets in the thread right now! Give me around 5 - 7 minutes.
dimaba10000 27-Apr-15 18:54pm    
The extraction library I use is, DotNetZip... I have compared it to Shell32, 7zip, and CMD extraction. DotNetZip was the fastest.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900