mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-09 13:52:02 -04:00
Add on-demand decryption
This commit is contained in:
parent
1d7d850674
commit
20098cdb2e
3 changed files with 31 additions and 2 deletions
|
@ -165,6 +165,24 @@ func (mw *MainWindow) ShowAll() {
|
|||
if err != nil {
|
||||
log.Fatal("Unable to create box:", err)
|
||||
}
|
||||
menuBar, _ := gtk.MenuBarNew()
|
||||
toolsSubMenu, _ := gtk.MenuNew()
|
||||
|
||||
toolsMenu, _ := gtk.MenuItemNewWithLabel("Tools")
|
||||
decryptContentsMenuItem, _ := gtk.MenuItemNewWithLabel("Decrypt contents")
|
||||
decryptContentsMenuItem.Connect("activate", func() {
|
||||
mw.progressWindow, err = wiiudownloader.CreateProgressWindow(mw.window)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
mw.progressWindow.Window.ShowAll()
|
||||
go mw.onDecryptContentsMenuItemClicked()
|
||||
})
|
||||
toolsSubMenu.Append(decryptContentsMenuItem)
|
||||
|
||||
toolsMenu.SetSubmenu(toolsSubMenu)
|
||||
menuBar.Append(toolsMenu)
|
||||
mainvBox.PackStart(menuBar, false, false, 0)
|
||||
tophBox, err := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
||||
if err != nil {
|
||||
log.Fatal("Unable to create box:", err)
|
||||
|
@ -329,6 +347,17 @@ func (mw *MainWindow) onCategoryToggled(button *gtk.ToggleButton) {
|
|||
button.Activate()
|
||||
}
|
||||
|
||||
func (mw *MainWindow) onDecryptContentsMenuItemClicked() {
|
||||
selectedPath, err := dialog.Directory().Title("Select the path to decrypt").Browse()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
wiiudownloader.DecryptContents(selectedPath, &mw.progressWindow, false)
|
||||
|
||||
mw.progressWindow.Window.Close()
|
||||
}
|
||||
|
||||
func (mw *MainWindow) onSelectionChanged() {
|
||||
selection, err := mw.treeView.GetSelection()
|
||||
if err != nil {
|
||||
|
|
|
@ -22,7 +22,7 @@ var (
|
|||
decryptionError = false
|
||||
)
|
||||
|
||||
func decryptContents(path string, progress *ProgressWindow, deleteEncryptedContents bool) error {
|
||||
func DecryptContents(path string, progress *ProgressWindow, deleteEncryptedContents bool) error {
|
||||
wg.Add(1)
|
||||
progressInt := 1
|
||||
go runDecryption(path, &progressInt, deleteEncryptedContents)
|
||||
|
|
|
@ -242,7 +242,7 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
|
|||
}
|
||||
|
||||
if doDecryption && !progressWindow.cancelled {
|
||||
if err := decryptContents(outputDir, progressWindow, deleteEncryptedContents); err != nil {
|
||||
if err := DecryptContents(outputDir, progressWindow, deleteEncryptedContents); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue