-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
58 lines (52 loc) · 1.26 KB
/
main.go
File metadata and controls
58 lines (52 loc) · 1.26 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
/*
//go:build windows
*/
package main
import (
_ "embed"
"github.com/wailsapp/wails/v3/pkg/w32"
. "main/init"
"main/internal/imageService"
"main/internal/pixivSvr"
"main/internal/pixivlib"
. "main/internal/wailsApp"
. "main/pkg/utils"
"time"
)
// Wails uses Go's `embed` package to embed the web files into the binary.
// Any files in the web/dist folder will be embedded into the binary and
// made available to the web.
// See https://pkg.go.dev/embed for more information.
func init() {
// 尝试设置 DPI 感知(Windows 10 1607+ 推荐)
err := w32.SetProcessDpiAwareness(w32.PROCESS_PER_MONITOR_DPI_AWARE)
if err != nil {
// 回退到旧版 API(Windows 8.1+)
w32.SetProcessDPIAware()
}
}
func main() {
pixivSvr.ServerInit()
imageService.ServerInit()
CacheInit()
AppInit(&Assets)
pixivlib.NewCtl().RegisterService(App)
go func() {
for {
now := time.Now().Format(time.RFC1123)
App.Event.Emit("time", now)
time.Sleep(time.Second)
}
}()
// Run the application. This blocks until the application has been exited.
err := App.Run()
if err != nil {
DebugLog.Fatalln(err)
return
}
pixivSvr.ServerDown()
imageService.ServerDown()
Close()
// If an error occurred while running the application, log it and exit.
DebugLog.Println(err)
}