-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.go
More file actions
40 lines (35 loc) · 946 Bytes
/
update.go
File metadata and controls
40 lines (35 loc) · 946 Bytes
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
package main
import (
"github.com/tidwall/gjson"
"strconv"
)
func Update_global_variables() {
//获取下载源
if gjson.Get(RSLSettings, "DownloadSource").String() == "MCBBS" {
DownLoadSource = 2
} else if gjson.Get(RSLSettings, "DownloadSource").String() == "BMCL" {
DownLoadSource = 1
} else {
DownLoadSource = 0
}
//获取重试次数
ret, ret_err := strconv.Atoi(gjson.Get(RSLSettings, "RetryTimes").String())
if ret_err == nil {
if ret > 0 {
DownloadRetryTimes = ret
}
}
//更新游戏列表
Upadate_Game_List()
}
func Upadate_Game_List() {
game_num := int(gjson.Get(RSLSettings, "GameDir.#").Int())
for i := 0; i < game_num; i++ {
game_dir_name := gjson.Get(RSLSettings, "GameDir."+strconv.Itoa(i)).String()
Info(game_dir_name)
//if err != nil {
// Error("Unable to get game list '" + gjson.Get(RSLSettings, "GameDir."+strconv.Itoa(i)).String() + "',Error:" + err.Error())
// continue
//}
}
}