From 6d99f0e231fdc47c252cd17d7d052e5e41c89850 Mon Sep 17 00:00:00 2001 From: Openarl Date: Mon, 31 Oct 2016 19:28:44 +1000 Subject: [PATCH] Tweaks to update system --- Launch.lua | 5 ++++- LaunchInstall.lua | 2 +- Modules/Main.lua | 10 +++++----- UpdateCheck.lua | 3 ++- manifest.xml | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Launch.lua b/Launch.lua index 0d6b2983..89641799 100644 --- a/Launch.lua +++ b/Launch.lua @@ -155,6 +155,8 @@ end function launch:OnSubCall(func, ...) if func == "ConPrintf" and self.subScriptType == "UPDATE" and self.updateChecking then self.updateMsg = string.format(...) + elseif func == "UpdateProgress" then + self.updateProgress = string.format(...) end if _G[func] then return _G[func](...) @@ -257,10 +259,11 @@ function launch:CheckForUpdate(inBackground) if not IsSubScriptRunning() then self.updateChecking = not inBackground self.updateMsg = "Initialising..." + self.updateProgress = "Checking..." self.lastUpdateCheck = GetTime() local update = io.open("UpdateCheck.lua", "r") self.subScriptType = "UPDATE" - LaunchSubScript(update:read("*a"), "GetScriptPath,GetRuntimePath,GetWorkDir,MakeDir", "ConPrintf", "CHECK") + LaunchSubScript(update:read("*a"), "GetScriptPath,GetRuntimePath,GetWorkDir,MakeDir", "ConPrintf,UpdateProgress", "CHECK") update:close() end end diff --git a/LaunchInstall.lua b/LaunchInstall.lua index 9c8679c2..771489a7 100644 --- a/LaunchInstall.lua +++ b/LaunchInstall.lua @@ -11,7 +11,7 @@ local xml = require("xml") local curl = require("lcurl") ConClear() -ConPrintf("Preparing to finalise installation...\n") +ConPrintf("Preparing to complete installation...\n") local localBranch, localSource local localManXML = xml.LoadXMLFile("manifest.xml") diff --git a/Modules/Main.lua b/Modules/Main.lua index 826e3e25..bfbd8882 100644 --- a/Modules/Main.lua +++ b/Modules/Main.lua @@ -134,23 +134,23 @@ function main:Init() self.controls.applyUpdate.shown = function() return launch.updateAvailable and launch.updateAvailable ~= "none" end - self.controls.checkUpdate = common.New("ButtonControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 0, 0, 110, 18, "", function() + self.controls.checkUpdate = common.New("ButtonControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 0, 0, 120, 18, "", function() launch:CheckForUpdate() end) self.controls.checkUpdate.shown = function() - return not launch.devMode and (not launch.updateAvailable or launch.updateAvailable == "none") + return true--not launch.devMode and (not launch.updateAvailable or launch.updateAvailable == "none") end self.controls.checkUpdate.label = function() - return launch.subScriptType == "UPDATE" and "Checking..." or "Check for Update" + return launch.subScriptType == "UPDATE" and launch.updateProgress or "Check for Update" end self.controls.checkUpdate.enabled = function() return not IsSubScriptRunning() end - self.controls.versionLabel = common.New("LabelControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 114, 0, 0, 14, "") + self.controls.versionLabel = common.New("LabelControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 124, 0, 0, 14, "") self.controls.versionLabel.label = function() return "^8Version: "..launch.versionNumber..(launch.versionBranch == "dev" and " (Dev)" or "") end - self.controls.about = common.New("ButtonControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 240, 0, 60, 20, "About", function() + self.controls.about = common.New("ButtonControl", {"BOTTOMLEFT",self.anchorUpdate,"BOTTOMLEFT"}, 250, 0, 50, 20, "About", function() local changeList = { } for line in io.lines("changelog.txt") do local ver, date = line:match("^VERSION%[(.+)%]%[(.+)%]$") diff --git a/UpdateCheck.lua b/UpdateCheck.lua index 6475906f..3201adb0 100644 --- a/UpdateCheck.lua +++ b/UpdateCheck.lua @@ -170,7 +170,8 @@ downloadFile(localSource.."changelog.txt", scriptPath.."/changelog.txt") -- Download files that need updating local failedFile = false local zipFiles = { } -for _, data in ipairs(updateFiles) do +for index, data in ipairs(updateFiles) do + UpdateProgress("Downloading %d/%d", index, #updateFiles) local partSources = remoteSources[data.part] local source = partSources[localPlatform] or partSources["any"] source = source:gsub("{branch}", localBranch) diff --git a/manifest.xml b/manifest.xml index 083c7577..424a4e0d 100644 --- a/manifest.xml +++ b/manifest.xml @@ -4,8 +4,8 @@ - - + + @@ -46,7 +46,7 @@ - +