summaryrefslogtreecommitdiff
path: root/src/main/manaplus/manaplus.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/manaplus/manaplus.ts')
-rw-r--r--src/main/manaplus/manaplus.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/manaplus/manaplus.ts b/src/main/manaplus/manaplus.ts
index 22e4ffd..b69190d 100644
--- a/src/main/manaplus/manaplus.ts
+++ b/src/main/manaplus/manaplus.ts
@@ -3,7 +3,7 @@ import { ManaPlusAppWindows } from './ManaApp/windows';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs-extra';
-import { app } from 'electron';
+import { app, ipcMain } from 'electron';
import { Status } from '../status';
let ManaPlusInstance:ManaPlusApp;
@@ -27,6 +27,8 @@ export namespace ManaPlus{
return await ManaPlusInstance.update();
}
+
+
export async function start(server: any,port: any,engine: any,username: any,password: any){
let params:string[];
try {
@@ -51,8 +53,20 @@ export namespace ManaPlus{
ManaPlusInstance.run(params);
}
+
}
+ipcMain.on('getScreenshots', (event:any, arg:string)=> {
+ const screenshotsDir = path.normalize(app.getPath('userData')+`/screenshots/${arg}/`);
+ fs.readdir(screenshotsDir, (err, dir) => {
+ let screenshots:string[]=[];
+ for (var i = 0, path; path = dir[i]; i++) {
+ screenshots.push(path);
+ }
+ event.sender.send('getScreenshots', {dir:screenshotsDir, screenshots:screenshots.reverse().slice(0, 24)});
+ });
+});
+
function wasInitilized(){
return typeof(ManaPlusInstance) !== "undefined" && typeof(ManaPlusInstance) !== "undefined";
}