This repository has been archived by the owner on Feb 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Koncord
committed
Aug 24, 2016
1 parent
bf22fa1
commit f4ee624
Showing
22 changed files
with
27,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env node | ||
|
||
const electron = require('electron'); | ||
const app = electron.app; | ||
const BrowserWindow = electron.BrowserWindow; | ||
|
||
electron.crashReporter.start({ | ||
productName: 'TES3MP-Launcher', | ||
companyName: 'TES3MP Team', | ||
submitURL: 'https://tes3mp.com/url-to-submit', | ||
autoSubmit: false | ||
}); | ||
|
||
app.on('window-all-closed', function () { | ||
if(process.platform != 'darwin') | ||
app.quit(); | ||
}); | ||
|
||
var mainWindow = null; | ||
app.on('ready', function () { | ||
mainWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
minWidth: 800, | ||
minHeight: 600, | ||
'accept-first-mouse': true | ||
}); | ||
//mainWindow.setMenu(null); | ||
|
||
mainWindow.loadURL('file://' + __dirname + '/public/index.html'); | ||
|
||
//mainWindow.webContents.openDevTools(); | ||
|
||
mainWindow.on('closed', function () { | ||
mainWindow = null; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "TES3MP-Launcher", | ||
"publishName": "launcher", | ||
"version": "0.0.0", | ||
"main": "app.js", | ||
"private": true, | ||
"scripts": { | ||
"start": "electron .", | ||
"build": "electron-packager . $npm_package_publishName --app-version=$npm_package_version --platform=linux,win32 --arch=x64 --out=dist --ignore=dist,.idea --prune --overwrite --asar", | ||
"test": "xo" | ||
}, | ||
"dependencies": { | ||
"ini": "^1.3.4" | ||
}, | ||
"xo": { | ||
"space": 2, | ||
"envs": [ | ||
"node", | ||
"browser" | ||
], | ||
"ignores": [ | ||
"dist/**" | ||
] | ||
}, | ||
"devDependencies": { | ||
"electron-rebuild": "^1.2.0", | ||
"xo": "^0.16.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var ping_wrapper = {}; | ||
|
||
var create_process = require("child_process"); | ||
var os = require("os"); | ||
|
||
ping_wrapper.avg = function(addr, count, callback) { | ||
var avg = -1; | ||
var child; | ||
|
||
if(typeof count != "number") | ||
throw "count should be a number"; | ||
|
||
if(os.platform() != "win32") { | ||
child = create_process.exec("ping -c" + count.toString() + " " + addr, function (error, stdout, stderr) { | ||
if(error != null) | ||
callback(avg); | ||
var strs = stdout.split("\n"); | ||
avg = strs[strs.length - 2].substr(strs[strs.length - 2].search('= ') + 2); | ||
avg = Number(avg.substr(0, avg.length - 3).split('/')[1]); | ||
callback(avg); | ||
}); | ||
} | ||
else | ||
{ | ||
child = create_process.exec("ping -n" + count.toString() + " " + addr, function (error, stdout, stderr) { | ||
if(error != null) | ||
callback(avg); | ||
var strs = stdout.split("\r\n"); | ||
avg = strs[strs.length - 2].substr(strs[strs.length -2]).split(" = "); | ||
avg = avg[avg.length - 1]; | ||
avg = Number(avg.substr(0, avg.length - 2)); | ||
callback(avg); | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = ping_wrapper; |
Oops, something went wrong.