-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (38 loc) · 1.05 KB
/
main.go
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
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/dialog"
"log"
"skyvillage-launcher-rewrite/settings"
"skyvillage-launcher-rewrite/updater"
"skyvillage-launcher-rewrite/utils"
"skyvillage-launcher-rewrite/views"
)
func main() {
log.SetPrefix("SKYVILLAGE|> ")
log.Printf("Starting launcher version %s by %s\n", utils.LauncherVersion, utils.Author)
a := app.NewWithID("hu.skyvillage.launcher")
utils.GameDir = utils.GetGameDir()
settings.LoadSettings()
views.SetOnLogin(func() {
err := updater.CheckForUpdates()
if err != nil {
dialog.ShowError(err, views.MainWindow)
}
})
views.InitMainWindow(a, func() {
log.Println("Closing...")
settings.Save()
}, func() {
if updater.CheckForLauncherUpdates() {
err := updater.UpdateLauncher()
if err != nil {
dialog.ShowError(err, views.MainWindow)
a.SendNotification(fyne.NewNotification("Hiba!", "Hiba történt a kliens frissítése közben!"))
log.Fatalf("Error updating launcher!\n%s", err.Error())
}
}
})
defer views.CloseMainWindow()
}