1
0
mirror of https://github.com/mgerb/ps-launcher synced 2026-01-11 19:02:50 +00:00
This commit is contained in:
2017-10-16 23:05:44 -05:00
commit 3f49700225
24 changed files with 6120 additions and 0 deletions

3
app/pages/Home/Home.scss Normal file
View File

@@ -0,0 +1,3 @@
.Home {
padding: 10px;
}

68
app/pages/Home/Home.tsx Normal file
View File

@@ -0,0 +1,68 @@
import * as _ from 'lodash';
import fs from 'fs';
import { exec } from 'child_process';
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import './Home.scss';
interface Props extends RouteComponentProps<any> {}
interface State {
path: string;
}
export default class Home extends React.Component<Props, State> {
constructor() {
super();
this.state = {
path: '',
};
}
onFolderSelect(e: React.ChangeEvent<HTMLInputElement>) {
const path: string = _.get(e, `target.files[0].path`);
if (path) {
this.setState({ path });
}
}
async startGame() {
const { path } = this.state;
// set the realm list
await this.setRealmList();
// launch wow
exec(`"${path}/WoW.exe"`, (err, output) => {
console.log(err);
console.log(output);
});
}
setRealmList(): Promise<any> {
const { path } = this.state;
return new Promise((resolve, reject) => {
fs.writeFile(`${path}/realmlist.wtf`, 'set realmlist logon.elysium-project.org', err => {
err ? reject(err) : resolve();
});
});
}
render() {
const { path } = this.state;
return (
<div className="Home">
<div>{path}</div>
{/* hacky way of adding webkitdirectory to the input */}
<input type="file" {...{ webkitdirectory: 'true' }} onChange={this.onFolderSelect.bind(this)} />
<div>
<button onClick={this.startGame.bind(this)}>Start</button>
</div>
</div>
);
}
}

View File

@@ -0,0 +1,5 @@
.NotFound {
font-size: 20px;
text-align: center;
padding-top: 200px;
}

View File

@@ -0,0 +1,18 @@
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import './NotFound.scss';
interface Props extends RouteComponentProps<any> {}
interface State {}
export default class NotFound extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
}
render() {
return <div className="NotFound">404 Not Found</div>;
}
}