-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathForm1Impl.go
More file actions
144 lines (120 loc) · 3.66 KB
/
Form1Impl.go
File metadata and controls
144 lines (120 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// generated by res2go
package main
import (
"fmt"
"os/exec"
"strings"
"github.com/ying32/govcl/vcl"
"golang.org/x/sys/windows/registry"
)
//::private::
type TForm1Fields struct {
}
var deletedFolder = ""
var recoveryToFolder = ""
var recoveryType = ""
var recoveryFile = ""
func (f *TForm1) OnButton1Click(vcl.IObject) {
selectDir := f.SelectDirectoryDialog1
if selectDir.Execute() {
filename := selectDir.FileName()
fmt.Println("File you lose from the Folder: ", filename)
f.Edit1.SetText(filename)
deletedFolder = filename
}
}
func (f *TForm1) OnButton2Click(vcl.IObject) {
selectDir := f.SelectDirectoryDialog1
if selectDir.Execute() {
filename := selectDir.FileName()
fmt.Println("Recovery to the Folder: ", filename)
f.Edit2.SetText(filename)
recoveryToFolder = filename
}
}
func (f *TForm1) OnButton3Click(sender vcl.IObject) {
winfrCmd := fmt.Sprintf("winfr %s %s %s /y:%s", deletedFolder, recoveryToFolder, recoveryType, strings.Trim(recoveryFile, ","))
fmt.Println(winfrCmd)
cmd := exec.Command("cmd.exe", "/c", "start "+"dir\npause")
err := cmd.Run()
if err != nil {
vcl.ShowMessage("Error!")
panic(err)
}
}
func (f *TForm1) OnRadioButton2Change(sender vcl.IObject) {
recoveryType = "/r"
fmt.Printf("Recovery type change to: %s\n", recoveryType)
}
func (f *TForm1) OnRadioButton3Change(sender vcl.IObject) {
recoveryType = "/r"
fmt.Printf("Recovery type change to: %s\n", recoveryType)
}
func (f *TForm1) OnRadioButton4Change(sender vcl.IObject) {
recoveryType = "/r"
fmt.Printf("Recovery type change to: %s\n", recoveryType)
}
func (f *TForm1) OnRadioButton5Change(sender vcl.IObject) {
recoveryType = "/x"
fmt.Printf("Recovery type change to: %s\n", recoveryType)
}
func (f *TForm1) OnEdit1Change(sender vcl.IObject) {
f.Edit1.Refresh()
}
func (f *TForm1) OnEdit2Change(sender vcl.IObject) {
f.Edit2.Refresh()
}
func (f *TForm1) OnCheckBox1Change(sender vcl.IObject) {
if f.CheckBox1.Checked() == true {
recoveryFile = strings.Join([]string{recoveryFile, "ASF,MP3"}, ",")
fmt.Printf("checkbox : %s\n", recoveryFile)
} else {
recoveryFile = strings.Replace(recoveryFile, ",ASF,MP3", "", -1)
fmt.Printf("checkbox : %s\n", recoveryFile)
}
}
func (f *TForm1) OnCheckBox2Change(sender vcl.IObject) {
if f.CheckBox2.Checked() == true {
recoveryFile = strings.Join([]string{recoveryFile, "JPEG,PNG"}, ",")
fmt.Printf("checkbox : %s\n", recoveryFile)
} else {
recoveryFile = strings.Replace(recoveryFile, ",JPEG,PNG", "", -1)
fmt.Printf("checkbox : %s\n", recoveryFile)
}
}
func (f *TForm1) OnCheckBox3Change(sender vcl.IObject) {
if f.CheckBox3.Checked() == true {
recoveryFile = strings.Join([]string{recoveryFile, "MPEG"}, ",")
fmt.Printf("checkbox : %s\n", recoveryFile)
} else {
recoveryFile = strings.Replace(recoveryFile, ",MPEG", "", -1)
fmt.Printf("checkbox : %s\n", recoveryFile)
}
}
func (f *TForm1) OnCheckBox4Change(sender vcl.IObject) {
if f.CheckBox4.Checked() == true {
recoveryFile = strings.Join([]string{recoveryFile, "ZIP,PDF"}, ",")
fmt.Printf("checkbox : %s\n", recoveryFile)
} else {
recoveryFile = strings.Replace(recoveryFile, ",ZIP,PDF", "", -1)
fmt.Printf("checkbox : %s\n", recoveryFile)
}
}
func (f *TForm1) OnFormCreate(sender vcl.IObject) {
fmt.Println("Welcome to the debug window !")
ver := readSysVersion()
f.Label3.SetCaption(ver)
}
func readSysVersion() string {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
if err != nil {
fmt.Printf("%s", err)
}
defer k.Close()
ri, _, err := k.GetStringValue("ReleaseId")
if err != nil {
fmt.Printf("%s", err)
}
fmt.Printf("Win10 ReleaseId: %s\n", ri)
return ri
}