Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncord committed Aug 24, 2016
1 parent bf22fa1 commit f4ee624
Show file tree
Hide file tree
Showing 22 changed files with 27,136 additions and 0 deletions.
37 changes: 37 additions & 0 deletions app.js
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;
});
});
29 changes: 29 additions & 0 deletions package.json
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"
}
}
37 changes: 37 additions & 0 deletions ping_wrapper.js
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;
Loading

0 comments on commit f4ee624

Please sign in to comment.