Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    222

    Download-Unzip call back functions

    Hello, I use to have this 2 functions (don't remember the one who coded them) but they are quite slow, is there any other way to do this??

    Here are the functions...

    Thx
    Code:
    -- Callback function for zip action
    function ZipCallback(sDestinationPath, nPercentage, nStatus)
    	Label.SetText("L_Status2", "Installing:");
    	-- Update progress bar if percentage is for entire zip file	
    	if nStatus == ZIP_STATUS_MAJOR then
    		-- Info is for zip file as a whole, update progress
    		Progress.SetCurrentPos("Progress2", nPercentage);
    		UpdateOverallTaskProgress(2, nPercentage);
    		Progress.SetText("Progress2", "Installing (" .. nPercentage .. "%)");
    	end
    	-- No matter what, we want to continue extracting!
    	return true;
    end
    
    
    -- callback function for http.download action
    function HTTPCallback (nBytesRead, nFileSize, nTransferRate, nSecondsLeft, sSecondsLeftFormat, sMessage)
    	-- check if current message is a server status message
    	if sMessage == "" then
    		-- no server message is present, update status
    		Label.SetText("L_Status2", "Downloading:");
    		nPercent = Math.Round((nBytesRead/nFileSize)*100,0);
    		Progress.SetCurrentPos("Progress2", nPercent);
    		Progress.SetText("Progress2", nPercent .. "%");
    		UpdateOverallTaskProgress(1, nPercent);
    	end
    	-- keep the download running!
    	return true;
    end

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    The only thing I can see here is that you should remove the SetText for Label LStatus_2 from both functions. It makes no sense to rewrite the labels with the same text on each iteration. Move the SetText to the main code instead, and execute it only once.

    What does UpdateOverallTaskProgress do? A call to this function is present in both callbacks, and if anything is hosed there, both callbacks would degradate.

    Ulrich

Similar Threads

  1. HTTPS download
    By rohit.khambe in forum TrueUpdate 3.5 Discussion
    Replies: 2
    Last Post: 04-15-2008, 07:08 AM
  2. download and install problems
    By screwed over in forum AutoPlay Media Studio 7.5
    Replies: 0
    Last Post: 02-28-2008, 01:45 PM
  3. Web download, and Install
    By Sheritlw in forum Setup Factory 7.0
    Replies: 6
    Last Post: 03-21-2007, 02:34 PM
  4. Bug? Http download error not recorded by GetHTTPErrorInfo()
    By Ken Gartner in forum TrueUpdate 2.0
    Replies: 1
    Last Post: 03-16-2005, 07:56 AM
  5. HOWTO: Download and Install Files from the Web
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-23-2002, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts