mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-12 22:26:15 -04:00
Improve stability
This commit is contained in:
parent
93e55baa5f
commit
38e6be51c9
3 changed files with 24 additions and 11 deletions
|
@ -489,9 +489,11 @@ func (mw *MainWindow) onCategoryToggled(button *gtk.ToggleButton) {
|
|||
func (mw *MainWindow) onDecryptContentsMenuItemClicked(selectedPath string) error {
|
||||
err := wiiudownloader.DecryptContents(selectedPath, &mw.progressWindow, false)
|
||||
|
||||
glib.IdleAdd(func() {
|
||||
if mw.progressWindow.Window.IsVisible() {
|
||||
mw.progressWindow.Window.Close()
|
||||
}
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -778,9 +780,11 @@ queueProcessingLoop:
|
|||
}
|
||||
|
||||
mw.titleQueue = []wiiudownloader.TitleEntry{} // Clear the queue
|
||||
glib.IdleAdd(func() {
|
||||
if mw.progressWindow.Window.IsVisible() {
|
||||
mw.progressWindow.Window.Close()
|
||||
}
|
||||
})
|
||||
mw.updateTitlesInQueue()
|
||||
mw.onSelectionChanged()
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/gotk3/gotk3/glib"
|
||||
"github.com/gotk3/gotk3/gtk"
|
||||
)
|
||||
|
||||
|
@ -35,11 +36,15 @@ func DecryptContents(path string, progress *ProgressWindow, deleteEncryptedConte
|
|||
|
||||
go runDecryption(path, errorChan, deleteEncryptedContents)
|
||||
|
||||
glib.IdleAdd(func() {
|
||||
progress.bar.SetText("Decrypting...")
|
||||
})
|
||||
|
||||
for progressInt := range progressChan {
|
||||
if progressInt > 0 {
|
||||
glib.IdleAdd(func() {
|
||||
progress.bar.SetFraction(float64(progressInt) / 100)
|
||||
})
|
||||
for gtk.EventsPending() {
|
||||
gtk.MainIteration()
|
||||
}
|
||||
|
|
|
@ -98,8 +98,10 @@ func downloadFile(progressWindow *ProgressWindow, client *grab.Client, downloadU
|
|||
req.BufferSize = bufferSize
|
||||
|
||||
resp := client.Do(req)
|
||||
glib.IdleAdd(func() {
|
||||
progressWindow.bar.SetFraction(resp.Progress())
|
||||
progressWindow.bar.SetText(fmt.Sprintf("Downloading %s (%s/%s) (%s/s)", filePath, humanize.Bytes(uint64(resp.BytesComplete())), humanize.Bytes(uint64(resp.Size())), humanize.Bytes(uint64(resp.BytesPerSecond()))))
|
||||
})
|
||||
for gtk.EventsPending() {
|
||||
gtk.MainIteration()
|
||||
}
|
||||
|
@ -148,7 +150,9 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
|
|||
|
||||
titleEntry := getTitleEntryFromTid(titleID)
|
||||
|
||||
glib.IdleAdd(func() {
|
||||
progressWindow.gameLabel.SetText(titleEntry.Name)
|
||||
})
|
||||
outputDir := strings.TrimRight(outputDirectory, "/\\")
|
||||
baseURL := fmt.Sprintf("http://ccs.cdn.c.shop.nintendowifi.net/ccs/download/%s", titleID)
|
||||
titleIDBytes, err := hex.DecodeString(titleID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue