-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
31 lines (30 loc) · 1.02 KB
/
index.ts
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
import findTitanfallLocation from "./tools/findTitanfallLocation";
import getReleases from './tools/getReleases';
import versionManager from "./tools/versionManager";
import R2Updater from "./tools/R2Updater";
import launch from "./tools/launch";
import EAChecker from './tools/EAChecker';
(async () => {
let location:string;
try {
location = await findTitanfallLocation();
} catch(e) {
console.log(`Titanfall 2 could not be found on your PC.`);
process.exit(1);
}
console.log('Downloading R2 Release list...');
const releases = await getReleases();
const latest = releases[0];
const latestVersion:number = +latest.name.replace ( /[^0-9]/g, '' );
const VM = versionManager(location);
const currentVersion:number = await VM.get();
if (currentVersion === latestVersion) {
await EAChecker();
await launch(location);
return;
}
await R2Updater(location, latest);
await VM.set(latestVersion);
await EAChecker();
await launch(location);
})()