-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
147 lines (122 loc) · 4.34 KB
/
Copy pathmain.js
File metadata and controls
147 lines (122 loc) · 4.34 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const {app, BrowserWindow, globalShortcut, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
const fs = require('fs')
const child_process = require('child_process')
const location = require('./league/location.js')
const client = require('./league/client.js')
const championMastery = require('./riotgames/championMastery-riotgames.js')
const champions = require('./riotgames/champions.js')
const league = require('./riotgames/league.js')
// const lolStaticData
// const lolStatus
const match = require('./riotgames/match.js')
// const spectator
const summoner = require('./riotgames/summoner.js')
// const thirdPartyCode
// const tournamentStub
// const tournament
let win
function createWindow() {
win = new BrowserWindow({width: 1280, height: 850, frame:false})
const startUrl = process.env.ELECTRON_START_URL || url.format({
pathname: path.join(__dirname, '/../build/index.html'),
protocol: 'file:',
slashes: true
})
win.loadURL(startUrl)
win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
}
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
app.on('window-all-closed', () => {
child_process.exec('taskkill /f /im node.exe', () => {
app.quit()
})
})
app.on('ready', createWindow)
app.on('ready', () => {
globalShortcut.register('F5', () => {
console.log('f5 pressed')
})
})
ipcMain.on('close', () =>{
child_process.exec('taskkill /f /im node.exe', () => {
app.quit()
})
})
ipcMain.on('minimize', ()=>{
win.minimize()
})
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// league of legends client
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
ipcMain.on('location', event => {
location.initial()
.catch( error => event.sender.send('location-inform', error) )
.then( value => event.sender.send('location-inform', value) )
})
ipcMain.on('client-watch', (event, location)=>{
client.initial(win, location)
.catch( error => event.sender.send('client-message', error) )
.then( value => event.sender.send('client-inform', value) )
})
ipcMain.on('client-unwatch', (event, location)=>{
// end client
})
ipcMain.on('most-games', () => {
// TODO
})
ipcMain.on('most-rank', () => {
// TODO
})
ipcMain.on('most-early-pick', () => {
// TODO
})
ipcMain.on('commend-mate', () => {
// TODO
})
ipcMain.on('commend-bans', () => {
// TODO
})
ipcMain.on('commend-picks', () => {
// TODO
})
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//language form
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// riotgames form
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
ipcMain.on('riotgames', (event, region, s)=>{
summoner.initial(win, region, s)
.then(championMastery.initial)
.then(league.initial)
.then(match.initial)
.then(champions.initial)
.catch(error=>{
console.log(error)
})
})
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// lolcounter form
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// summonery champion cards
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////