none
How to asynchronously download a directory? RRS feed

  • Question

  • Ok so I am making a custom installer for my game but I have a problem.  I know how to show progress for the download but I cant show progress for extracting the zip files could someone tell me either how to show progress for extraction(note it must start the progress bar when the download starts and end when the extraction is finished) or show me how to download directories.

    Thx,

    Snowcone

    Code:

    Imports System.Net
    Public Class Form1
       
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim client As WebClient = New WebClient
            AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
            AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
    
            client.DownloadFileAsync(New Uri("Download Link"), "Hard Drive Download Location")
            Button1.Text = "Download in Progress"
            Button1.Enabled = False
    
    
        End Sub
        Private Sub client_ProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
            Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString())
            Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString())
            Dim percentage As Double = bytesIn / totalBytes * 100
    
            ProgressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString())
        End Sub
        Private Sub client_DownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
            MessageBox.Show("Download Complete")
            Button1.Text = "Start Download"
            Button1.Enabled = True
        End Sub
    End Class


    I am not tasty


    • Edited by Snowcone_65 Wednesday, November 15, 2017 1:48 PM
    Wednesday, November 15, 2017 1:42 PM

Answers

  • I would look at translating the following from Stack Overflow which is done in C# (so if you are not into doing a conversion ignore this link).

    https://stackoverflow.com/questions/43661211/extract-an-archive-with-progress-bar


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    Wednesday, November 15, 2017 2:35 PM
    Moderator
  • Done

    I am not tasty

    You have built an application using VB net, correct?

    What we're talking about now -- is it an actual installer or just a file copier (whereby you upload files, the user downloads them, and the copy process starts)?

    An actual installer is quite involved. As an example, I'm sure you've seen messages indicating that you should use "Windows Add/Remove..." right? How does Windows know anything about it?

    Answer: The installer does that.

    Short story: A few years ago, I was out of town on business and that night at the hotel, when I got my laptop all setup it showed that there was an update for Acrobat (the full version, not the reader). So I clicked "Proceed" and it starts.

    About halfway through, it prompted me to insert my install disk and that's when it occurred to me that I can only do that from home. I subsequently clicked to "Cancel" and once it confirmed, it started the rollback procedure.

    How in the world could it 'undo' all that and put my 'old' version of Acrobat back like it was?

    Answer: The installer!

    The installer also updates the GAC (if applicable) and a lot of other things. It's not just a file copier by a long shot.

    My concluding question then is this: Are you making an installer or are you just wanting to upload files (possibly compressed) and let your users download them at a later point in time?

    The more you explain, the better. ;-)


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    An installer would be nice but I want to make it so that it would just start up and install meaning there would be no prompt message it would just install is there any way I can do this?



    I am not tasty

    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    • Unmarked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    Thursday, November 16, 2017 2:58 PM

All replies

  • Is there some reason for a "custom installer"?

    It seems it would be easier to learn to use a real installer and it will actually work for most all systems. You can package that in one self extracting zip file to download and run. The installer has its own progress bars built in already.

    If the Click-Once does not do it, you can use the MSI installer. These are available for Visual Studio no cost.

    Wednesday, November 15, 2017 1:54 PM
  • Ok so I am making a custom installer for my game but I have a problem.  I know how to show progress for the download but I cant show progress for extracting the zip files could someone tell me either how to show progress for extraction(note it must start the progress bar when the download starts and end when the extraction is finished) or show me how to download directories.

    Tell me more about all of what you're doing please?

    Is it an actual installer? Are you using .msi files or just what do you have?

    If I take this on - which I've not committed to yet - then I'll do the whole thing. It'll be proprietary (and I'm not sure of the other details until I know more about what you're doing).

    If this sounds like something you're interested in then tell me more about what you have and what you're doing and we'll go from there.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, November 15, 2017 2:33 PM
  • I would look at translating the following from Stack Overflow which is done in C# (so if you are not into doing a conversion ignore this link).

    https://stackoverflow.com/questions/43661211/extract-an-archive-with-progress-bar


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    Wednesday, November 15, 2017 2:35 PM
    Moderator
  • @Karen Payne I would not mind having a conversation but where would it be done? 

    I am not tasty


    • Edited by Snowcone_65 Wednesday, November 15, 2017 8:52 PM
    Wednesday, November 15, 2017 7:41 PM
  • I would not mind having a conversation but where would it be done? 

    I am not tasty

    Snowcone,

    Please make it obvious who you're addressing - we don't all see this forum the same way and I can't tell. Just use the person's name or quote part of what they said (like I did here) so it's obvious.

    If you're talking to me then "here" is fine, at least to start the conversation.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, November 15, 2017 7:53 PM
  • I would not mind having a conversation but where would it be done? 


    I am not tasty

    Snowcone,

    Please make it obvious who you're addressing - we don't all see this forum the same way and I can't tell. Just use the person's name or quote part of what they said (like I did here) so it's obvious.

    If you're talking to me then "here" is fine, at least to start the conversation.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Done

    I am not tasty

    Wednesday, November 15, 2017 8:52 PM
  • Done

    I am not tasty

    You have built an application using VB net, correct?

    What we're talking about now -- is it an actual installer or just a file copier (whereby you upload files, the user downloads them, and the copy process starts)?

    An actual installer is quite involved. As an example, I'm sure you've seen messages indicating that you should use "Windows Add/Remove..." right? How does Windows know anything about it?

    Answer: The installer does that.

    Short story: A few years ago, I was out of town on business and that night at the hotel, when I got my laptop all setup it showed that there was an update for Acrobat (the full version, not the reader). So I clicked "Proceed" and it starts.

    About halfway through, it prompted me to insert my install disk and that's when it occurred to me that I can only do that from home. I subsequently clicked to "Cancel" and once it confirmed, it started the rollback procedure.

    How in the world could it 'undo' all that and put my 'old' version of Acrobat back like it was?

    Answer: The installer!

    The installer also updates the GAC (if applicable) and a lot of other things. It's not just a file copier by a long shot.

    My concluding question then is this: Are you making an installer or are you just wanting to upload files (possibly compressed) and let your users download them at a later point in time?

    The more you explain, the better. ;-)


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    • Edited by Frank L. Smith Wednesday, November 15, 2017 9:04 PM ...typo
    Wednesday, November 15, 2017 9:03 PM
  • Done

    I am not tasty

    You have built an application using VB net, correct?

    What we're talking about now -- is it an actual installer or just a file copier (whereby you upload files, the user downloads them, and the copy process starts)?

    An actual installer is quite involved. As an example, I'm sure you've seen messages indicating that you should use "Windows Add/Remove..." right? How does Windows know anything about it?

    Answer: The installer does that.

    Short story: A few years ago, I was out of town on business and that night at the hotel, when I got my laptop all setup it showed that there was an update for Acrobat (the full version, not the reader). So I clicked "Proceed" and it starts.

    About halfway through, it prompted me to insert my install disk and that's when it occurred to me that I can only do that from home. I subsequently clicked to "Cancel" and once it confirmed, it started the rollback procedure.

    How in the world could it 'undo' all that and put my 'old' version of Acrobat back like it was?

    Answer: The installer!

    The installer also updates the GAC (if applicable) and a lot of other things. It's not just a file copier by a long shot.

    My concluding question then is this: Are you making an installer or are you just wanting to upload files (possibly compressed) and let your users download them at a later point in time?

    The more you explain, the better. ;-)


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    An installer would be nice but I want to make it so that it would just start up and install meaning there would be no prompt message it would just install is there any way I can do this?



    I am not tasty

    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    • Unmarked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    • Marked as answer by Snowcone_65 Thursday, November 16, 2017 8:54 PM
    Thursday, November 16, 2017 2:58 PM

  • An installer would be nice but I want to make it so that it would just start up and install meaning there would be no prompt message it would just install is there any way I can do this?



    I am not tasty

    I can do that with mine, mostly because I can embed other assemblies and anything other than that, I have downloaded on an "as-needed" basis.

    Tell me more about your application please? Other than your .exe file, what else is needed in order to run? Does anything involve Windows registry at all?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 16, 2017 3:13 PM

  • An installer would be nice but I want to make it so that it would just start up and install meaning there would be no prompt message it would just install is there any way I can do this?



    I am not tasty

    I can do that with mine, mostly because I can embed other assemblies and anything other than that, I have downloaded on an "as-needed" basis.

    Tell me more about your application please? Other than your .exe file, what else is needed in order to run? Does anything involve Windows registry at all?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    I am making a launcher for a game all the mechanics are working(meaning it detects updates and can download the updater) but I need to make the custom installer that just installs on start up



    I am not tasty

    Thursday, November 16, 2017 4:15 PM

  • I am making a launcher for a game all the mechanics are working(meaning it detects updates and can download the updater) but I need to make the custom installer that just installs on start up

    I am not tasty

    I don't anything about games, but do I understand that you only need to install your application's .exe file?

    If so then just zip it up and send it, no?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 16, 2017 4:21 PM

  • I am making a launcher for a game all the mechanics are working(meaning it detects updates and can download the updater) but I need to make the custom installer that just installs on start up

    I am not tasty

    I don't anything about games, but do I understand that you only need to install your application's .exe file?

    If so then just zip it up and send it, no?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    It has 289 files and 5 folders, plus I want to be able to show the full progress.

    I am not tasty

    Thursday, November 16, 2017 4:30 PM

  • It has 289 files and 5 folders, plus I want to be able to show the full progress.

    I am not tasty

    Ok, that's a little clearer now.

    All totaled, how big (in bytes, megs, etc.) would this be? Do you want it downloaded or do you want to have something that you can distribute "as one single file"?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 16, 2017 4:33 PM

  • It has 289 files and 5 folders, plus I want to be able to show the full progress.

    I am not tasty

    Ok, that's a little clearer now.

    All totaled, how big (in bytes, megs, etc.) would this be? Do you want it downloaded or do you want to have something that you can distribute "as one single file"?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    The Disk Size is 3GB and as one single file.

    I am not tasty


    • Edited by Snowcone_65 Thursday, November 16, 2017 4:47 PM
    Thursday, November 16, 2017 4:47 PM

  • The Disk Size is 3GB and as one single file.

    I am not tasty


    Damn!

    Tell me more - I'm not giving up yet.

    To be clear on this, you have written an application using VB Net.

    Your goal with this is that you'll distribute this application to your users and they'll click a button to have it begin the download. Once the download is complete, the zip archive that they downloaded will be decompressed to their local hard drive somewhere using full recursion of the original directory paths.

    Is this correct so far?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 16, 2017 4:54 PM

  • The Disk Size is 3GB and as one single file.

    I am not tasty


    Damn!

    Tell me more - I'm not giving up yet.

    To be clear on this, you have written an application using VB Net.

    Your goal with this is that you'll distribute this application to your users and they'll click a button to have it begin the download. Once the download is complete, the zip archive that they downloaded will be decompressed to their local hard drive somewhere using full recursion of the original directory paths.

    Is this correct so far?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Yes but it does it when the form loads.

    I am not tasty

    Thursday, November 16, 2017 5:30 PM

  • Yes but it does it when the form loads.

    I am not tasty

    That's up to you, but I think that's a mistake.

    In my opinion, even a form having two buttons ("Start Download" and "Cancel") should be there but it may also need others.

    At least I'm starting to understand what you want now.

    Where's the three gig zip file? Has that been created yet? Is it online somewhere and does that somewhere support FTP?

    Will the user decide where the base directory is to be? The decompression of the archive has to "start" with a base directory. Will you define that or will they?

    Will there be issues with permissions? That's not a small deal these days.

    Please don't be curt in your answers; I'm trying to help...


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Thursday, November 16, 2017 5:35 PM

  • Yes but it does it when the form loads.

    I am not tasty

    That's up to you, but I think that's a mistake.

    In my opinion, even a form having two buttons ("Start Download" and "Cancel") should be there but it may also need others.

    At least I'm starting to understand what you want now.

    Where's the three gig zip file? Has that been created yet? Is it online somewhere and does that somewhere support FTP?

    Will the user decide where the base directory is to be? The decompression of the archive has to "start" with a base directory. Will you define that or will they?

    Will there be issues with permissions? That's not a small deal these days.

    Please don't be curt in your answers; I'm trying to help...


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    I figured it out I dont need help anymore but thx.

    I am not tasty

    Thursday, November 16, 2017 5:56 PM

  • I figured it out I dont need help anymore but thx.

    I am not tasty

    Go back through this thread and your other thread and mark answers please.

    Leaving it open (not answered) isn't fair to those of us who took time to try and help.


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    • Edited by Frank L. Smith Thursday, November 16, 2017 6:00 PM ...typos
    Thursday, November 16, 2017 6:00 PM