From 40d2c999ef8067cd9bfc584c89250930f1ee2b53 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Wed, 1 Sep 2021 18:47:48 -0400 Subject: [PATCH] Update Picocrypt.go --- src/unstable/Picocrypt.go | 40 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/unstable/Picocrypt.go b/src/unstable/Picocrypt.go index d76003d..75dd6b8 100644 --- a/src/unstable/Picocrypt.go +++ b/src/unstable/Picocrypt.go @@ -286,7 +286,27 @@ func startUI(){ giu.Custom(func(){ if showKeyfile{ giu.PopupModal(s("Manage keyfile(s):")).Layout( - giu.Label(s("Drop and drop your keyfile(s) here.")), + giu.Row( + giu.Label(s("Drop and drop your keyfile(s) here or")), + giu.Button(s("select")).OnClick(func(){ + file,_ := dialog.File().Title(s("Select a keyfile")).Load() + + // Return if user canceled the file dialog + if file==""{ + return + } + + keyfiles = append(keyfiles,file) + tmp := []string{} + for _,i := range keyfiles{ + if i!=file{ + tmp = append(tmp,i) + } + } + tmp = append(tmp,file) + keyfiles = tmp + }), + ), giu.Custom(func(){ if mode!="decrypt"{ giu.Row( @@ -494,7 +514,7 @@ func startUI(){ giu.Tooltip(s("Click to toggle the password state.")), giu.Custom(func(){ if !(mode=="decrypt"&&!keyfile){ - giu.Button(s("Keyfile(s)")).OnClick(func(){ + giu.Button(s("Keyfiles")).OnClick(func(){ showKeyfile = true }).Size(71,0).Build() } @@ -939,7 +959,19 @@ func onDrop(names []string){ if tab==0{ if showKeyfile{ keyfiles = append(keyfiles,names...) - giu.Update() + tmp := []string{} + for _,i := range keyfiles{ + duplicate := false + for _,j := range tmp{ + if i==j{ + duplicate = true + } + } + if !duplicate{ + tmp = append(tmp,i) + } + } + keyfiles = tmp return } @@ -1171,6 +1203,8 @@ func onDrop(names []string){ func work(){ // Set some variables status = s("Starting...") + _status = "Working..." + _status_color = color.RGBA{0xff,0xff,0xff,0xff} working = true padded := false var salt []byte