This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.go
84 lines (71 loc) · 1.73 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
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
package main
import (
"context"
"embed"
"os"
"github.com/JensvandeWiel/ArkAscendedServerManager/config"
"github.com/JensvandeWiel/ArkAscendedServerManager/helpers"
"github.com/JensvandeWiel/ArkAscendedServerManager/installer"
"github.com/JensvandeWiel/ArkAscendedServerManager/logger"
"github.com/JensvandeWiel/ArkAscendedServerManager/server"
"github.com/wailsapp/wails/v2"
wailsLogger "github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
)
//go:embed all:frontend/dist
var assets embed.FS
//go:embed wails.json
var WailsConfigFile []byte
//go:embed KEY
var KEY string
const (
logFilePath = "main.log"
)
func main() {
file, err := os.Create(logFilePath)
if err != nil {
println("Error creating log file")
}
defer file.Close()
l := logger.New(file)
helpers.CheckForUpdates(l, WailsConfigFile)
// Create an instance of the app structure
app := NewApp()
h := helpers.NewHelpersController()
c := config.NewConfigController()
s := server.NewServerController(h)
i := installer.NewInstallerController(c)
// Create application with options
err = wails.Run(&options.App{
Title: "Ark Ascended Server Manager",
Width: 1024,
Height: 768,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1},
OnStartup: func(ctx context.Context) {
app.startup(ctx)
h.Startup(ctx, WailsConfigFile)
c.Startup(ctx)
s.Startup(ctx)
i.Startup(ctx)
},
OnShutdown: func(ctx context.Context) {
s.Shutdown()
},
Logger: l,
LogLevel: wailsLogger.TRACE,
Bind: []interface{}{
app,
h,
c,
s,
i,
},
})
if err != nil {
l.Error("Error: " + err.Error())
}
}