Josué Alba
08-27-2008, 12:31 AM
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
-- 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
Here are the functions...
Thx
-- 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