File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 6
6
"github.com/whtiehack/wingui"
7
7
"io/ioutil"
8
8
"log"
9
+ "os"
9
10
"strconv"
10
11
"syscall"
11
12
)
@@ -29,7 +30,8 @@ var config = &Config{
29
30
}
30
31
31
32
func init () {
32
- file , err := ioutil .ReadFile ("wowjump_config.txt" )
33
+ configDir , _ := os .UserConfigDir ()
34
+ file , err := ioutil .ReadFile (configDir + "/wowjump/wowjump_config.txt" )
33
35
if err != nil {
34
36
return
35
37
}
@@ -48,7 +50,8 @@ func (c *Config) Save() {
48
50
config .InputTime , _ = strconv .Atoi (c .editInputTime .Text ())
49
51
config .CharWaitTime , _ = strconv .Atoi (c .editCharWaitTime .Text ())
50
52
file , _ := json .MarshalIndent (c , "" , " " )
51
- ioutil .WriteFile ("wowjump_config.txt" , file , 777 )
53
+ configDir , _ := os .UserConfigDir ()
54
+ ioutil .WriteFile (configDir + "/wowjump/wowjump_config.txt" , file , 777 )
52
55
}
53
56
54
57
func (c * Config ) InitVal () {
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import "log"
4
+
5
+ func process () {
6
+ defer func () {
7
+ err := recover ()
8
+ log .Println ("process end??" , err )
9
+ if err != nil {
10
+ go process ()
11
+ }
12
+ }()
13
+ var selfLogout = make ([]* Logout , 0 , 10 )
14
+ for {
15
+ mux .Lock ()
16
+ if ! running || logouts == nil || len (logouts ) == 0 {
17
+ mux .Unlock ()
18
+ sleep (1000 )
19
+ continue
20
+ }
21
+ selfLogout = make ([]* Logout , len (logouts ))
22
+ copy (selfLogout , logouts )
23
+ mux .Unlock ()
24
+ for _ , logout := range selfLogout {
25
+ // 处理逻辑
26
+ if ! logout .IsValid () {
27
+ continue
28
+ }
29
+ logout .Update ()
30
+ }
31
+ randomSleep (5000 , 2500 )
32
+ }
33
+ }
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ func init() {
31
31
win .MessageBox (0 , & syscall .StringToUTF16 ("进程已经开启了,不可以多开" )[0 ], nil , 0 )
32
32
os .Exit (- 1 )
33
33
}
34
+ // control
35
+ go process ()
34
36
}
35
37
36
38
var btn * wingui.Button
@@ -102,7 +104,7 @@ func btnClick() {
102
104
}
103
105
out .SetText ("" )
104
106
log .Printf ("找到 %d 个 WOW窗口\n " , len (logouts ))
105
- text = "关闭 "
107
+ text = "停止 "
106
108
//str := skillKey.Text()
107
109
//config.SkillKey = str
108
110
//randomSkill.ParseSkillKey(str)
You can’t perform that action at this time.
0 commit comments