Автор: Zloy_Gelud
Дата сообщения: 13.12.2011 10:17
dallas page -- тести.
On Click кнопки:
Код: ftp_callback = function(BytesRead, FileSize, ...)
local nPercent = Math.Round(BytesRead * (0.5 * Progress.GetRange("Progress1").End) / FileSize, 0);
Progress.SetCurrentPos("Progress1", nPercent);
return true;
end
extract_callback = function (...)
if arg[3] == 0 then
Progress.SetCurrentPos("Progress1", (0.5 * Progress.GetRange("Progress1").End) + (arg[2] * 0.5 * Progress.GetRange("Progress1").End / 100));
end
return true;
end
-- куда качаем (путь + имя файла)
local sPathOut = "C:\\Acer eRecovery 2.5.4012.zip";
-- куда будем извлекать архив
local sExtractPath = "C:\\UnArc";
Label.SetText("Label1", "Качаю какую-то лабуду ...");
FTPWI.Download("ftp://ftp.work.acer-euro.com/notebook/aspire_5720/vista/Applications/Acer eRecovery 2.5.4012.zip", sPathOut, "", "", MODE_BINARY, 20, 21, true, ftp_callback);
local err = Application.GetLastError();
if err ~= 0 then
Dialog.Message(err, _tblErrorMessages[err]);
else
Label.SetText("Label1", "Пытаюсь распаковать архив ...");
if not Folder.DoesExist(sExtractPath) then Folder.Create(sExtractPath); end
Zip.Extract(sPathOut, {"*.*"}, sExtractPath, true, true, "", ZIP_OVERWRITE_ALWAYS, extract_callback);
local error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Errror", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
Progress.SetCurrentPos("Progress1", Progress.GetRange("Progress1").End);
else
Dialog.Message("Success", "The unzipping was successful.", MB_OK, MB_ICONINFORMATION);
end
end