esto es mil veces mejor sin descargar ningun actualizador solo la acualizacion
--#############################3.0#############################
--# Created By NicolasG(31/01/2016)-(12/11/2016) #
--# www.amsspecialist.com #
--# Optimized for Cris690 Using lua socket #
--# Casi echo de 0 coregido el error del bat #
--#############################################################
str=""
--Pone la configuracion
DEFINE_Url = "http://stms.esy.es/recursos/version.lua";
DEFINE_Temporary_Folder = _TempFolder.."\\UpdaterNG";
DEFINE_Destination_Folder = _SourceFolder.."\\"
DEFINE_Path_To_The_File_To_Run_After_Upgrading = (_SourceFolder.."\\".._SourceFilename);
UpdaterNG = {};
function UpdaterNG.ToUpdate()
--Hacemos una prueba de conexion
if UpdaterNG.Conect() then
UpdaterNG.Refresh()
--Comprobamos la version
if DEFINE_Version >= VERSYS then
UI.Dialog("UPDATER","No ahi mas versiones recientes.","CLOSE")
do return end
else
FileInformation = String.SplitPath(urlD);
--Descarga la actualizacion
HTTP.Download(urlD, DEFINE_Temporary_Folder.."\\"..FileInformation.Filename..FileInformation.Extension, MODE_BINARY, 20, 80, nil, nil, UPDATER_DownloadCallback);
if bCancelled then
bCancelled=false
Paragraph.SetProperties("conf_Paragraph6", {BGColor=Math.HexColorToNumber("00A240"),Text="CLICK TO UPDATE.",Enabled=true});
UI.LoadButton("conf_Button124", _SourceFolder.."\\AutoPlay\\Buttons\\ref.btn")
Application.ExitScript();
end
Paragraph.SetText("conf_Paragraph6", "REINICIANDO")
Zip.Extract(DEFINE_Temporary_Folder.."\\"..FileInformation.Filename..FileInformation.Extension, {"*.*"}, DEFINE_Temporary_Folder.."\\unzip\\", true, true, "", ZIP_OVERWRITE_NEVER, nil);
end
--para mostrar un mesaje al abrir la aplicacion actualizada
INIFile.SetValue(SettingG,"PAGE1", "UPDATED", "YES");
--Esto mueve los archivos a la carpeta
for i,v in pairs(Zip.GetContents(DEFINE_Temporary_Folder.."\\"..FileInformation.Filename..FileInformation.Extension, true)) do
if Folder.DoesExist(String.SplitPath(v).Folder) == false then
Folder.Create(_SourceFolder.."\\"..v);
end
str=str..[[move "]]..DEFINE_Temporary_Folder..[[\unzip\"]]..v..' "'..DEFINE_Destination_Folder..v..'"\r\n'..[[]]
end
TextFile.WriteFromString(DEFINE_Temporary_Folder.."\\MoveUpdate.bat", [[
@ECHO OFF
]].. str ..[[
start]]..' "" "'..DEFINE_Path_To_The_File_To_Run_After_Upgrading..'"\r\n'..[[
DEL "%~f0"
]], false);
File.Run(DEFINE_Temporary_Folder.."\\MoveUpdate.bat", "", "", SW_HIDE, false);
os.exit()
else
Paragraph.SetProperties("conf_Paragraph6", {BGColor=Math.HexColorToNumber("C0004B"),Text="SIN CONEXION."});
end
end
function UpdaterNG.CheckUpdates()
if UpdaterNG.Conect() then
UpdaterNG.Refresh()
--comprobamos
if DEFINE_Version >= VERSYS then
Paragraph.SetProperties("conf_Paragraph6", {Text="ATUALIZADO.",Enabled=false,BGColor=Math.HexColorToNumber("1E88E5")});
else
Paragraph.SetProperties("conf_Paragraph6", {BGColor=Math.HexColorToNumber("00A240"),Text="CLICK TO UPDATE.",Enabled=true});
end
else
Paragraph.SetProperties("conf_Paragraph6", {BGColor=Math.HexColorToNumber("C0004B"),Text="SIN CONEXION."});
end
end
function UpdaterNG.Refresh()
if UpdaterNG.Conect() then
err=lua_dostring(http.request(DEFINE_Url),false)
if err then
Paragraph.SetProperties("conf_Paragraph6", {BGColor=Math.HexColorToNumber("C0004B"),Text="SIN CONEXION."});
do return end
end
end
end
function UpdaterNG.Conect()
if txter ~= "No conection!" then
con=true
else
con=false
end
return con
end
function UPDATER_DownloadCallback(BytesSoFar, TotalBytes, TransferRate)
if(TotalBytes ~= 0)then
strProgress = "Descargando: "..Math.Round(BytesSoFar/TotalBytes * 100) .."%"
strkbs = String.GetFormattedSize(string.format('%.1f', TransferRate)*1024, FMTSIZE_AUTOMATIC, true);
strKbsRate = 'Speed: '..strkbs
else
strProgressText = '';
strKbsRate = '';
strProgress = '';
end
Paragraph.SetText("conf_Paragraph6", strProgress..' '..strKbsRate);
UI.LoadButton("conf_Button124", _SourceFolder.."\\AutoPlay\\Buttons\\cwer.btn")
if bCancelled then
return false;
else
return true;
end
end
bCancelled = false;
function UpdaterNG.CheckSYS()
if UpdaterNG.Conect() then
if VERUI < VERSIONUI then
UI.Dialog("UPDATER","El modulo UI esta obsoleto actualice la aplicacion.","CLOSE")
end
if VERNTS < VERSIONNTS then
UI.Dialog("UPDATER","Notificaciones esta obsoleto actualice la aplicacion.","CLOSE")
end
end
end