Various optimizations related to library extraction.

Updated PackXZExtract to v1.0.1.
If no files are queued for extraction, the step is skipped.
The UI now shows some indication that the extraction is in progress.
This commit is contained in:
Daniel Scalzi 2018-04-28 23:34:23 -04:00
parent d08cfbf248
commit ea758aee1f
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9
3 changed files with 43 additions and 6 deletions

View File

@ -1574,11 +1574,15 @@ class AssetGuard extends EventEmitter {
self.progress -= self[identifier].dlsize
self[identifier] = new DLTracker([], 0)
if(self.totaldlsize === 0) {
if(self.extractQueue.length > 0){
self.emit('extracting')
AssetGuard._extractPackXZ(self.extractQueue, self.javaexec).then(() => {
self.extractQueue = []
self.emit('dlcomplete')
})
} else {
self.emit('dlcomplete')
}
}
})
return true

View File

@ -216,6 +216,8 @@ let serverStatusListener = setInterval(() => refreshServerStatus(true), 300000)
let sysAEx
let scanAt
let extractListener
function asyncSystemScan(launchAfter = true){
setLaunchDetails('Please wait..')
@ -315,7 +317,17 @@ function asyncSystemScan(launchAfter = true){
remote.getCurrentWindow().setProgressBar(-1)
// Wait for extration to complete.
setLaunchDetails('Extracting..')
const eLStr = 'Extracting'
let dotStr = ''
setLaunchDetails(eLStr)
extractListener = setInterval(() => {
if(dotStr.length >= 3){
dotStr = ''
} else {
dotStr += '.'
}
setLaunchDetails(eLStr + dotStr)
}, 750)
} else if(m.task === 2){
@ -323,6 +335,11 @@ function asyncSystemScan(launchAfter = true){
ConfigManager.setJavaExecutable(m.jPath)
ConfigManager.save()
if(extractListener != null){
clearInterval(extractListener)
extractListener = null
}
setLaunchDetails('Java Installed!')
if(launchAfter){
@ -356,6 +373,8 @@ let serv
let versionData
let forgeData
let progressListener
function dlAsync(login = true){
// Login parameter is temporary for debug purposes. Allows testing the validation/downloads without
@ -443,12 +462,26 @@ function dlAsync(login = true){
} else if(m.task === 0.7){
// Download done, extracting.
setLaunchDetails('Extracting libraries..')
const eLStr = 'Extracting libraries'
let dotStr = ''
setLaunchDetails(eLStr)
progressListener = setInterval(() => {
if(dotStr.length >= 3){
dotStr = ''
} else {
dotStr += '.'
}
setLaunchDetails(eLStr + dotStr)
}, 750)
} else if(m.task === 1){
// Download will be at 100%, remove the loading from the OS progress bar.
remote.getCurrentWindow().setProgressBar(-1)
if(progressListener != null){
clearInterval(progressListener)
progressListener = null
}
setLaunchDetails('Preparing to launch..')
aEx.send({task: 0, content: 'loadForgeData', argsArr: [serv.id]})

Binary file not shown.