-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
16 changed files
with
316 additions
and
237 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
dist | ||
package-lock.json | ||
*.rcc | ||
*.rcc | ||
out/ | ||
build/ |
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,4 @@ | ||
import { app, BrowserWindow } from 'electron'; | ||
import Main from './src/Main'; | ||
|
||
Main.main(app, BrowserWindow); |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,41 +1,45 @@ | ||
{ | ||
"name": "nekiros_rcc_editor", | ||
"name": "nekirosrcceditor", | ||
"version": "1.0.0", | ||
"description": "edit qt .rcc files", | ||
"main": "main.js", | ||
"main": "build/App.js", | ||
"scripts": { | ||
"start": "electron .", | ||
"pack": "electron-builder --dir", | ||
"build": "electron-builder" | ||
"start": "electron-forge start", | ||
"compile": "tsc && copyfiles src/html/*.html src/css/*.css src/assets/* src/rcc/rcc.exe build", | ||
"package": "electron-forge package", | ||
"build": "npm run compile && electron-forge make" | ||
}, | ||
"author": "Nekiro", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"prettier": "^2.5.1" | ||
"@electron-forge/cli": "^6.0.0-beta.63", | ||
"@electron-forge/maker-squirrel": "^6.0.0-beta.63", | ||
"@tsconfig/recommended": "^1.0.1", | ||
"@types/electron": "^1.6.10", | ||
"@types/fs-extra": "^9.0.13", | ||
"electron": "^13.0.1", | ||
"prettier": "^2.5.1", | ||
"typescript": "^4.5.4" | ||
}, | ||
"dependencies": { | ||
"electron-squirrel-startup": "^1.0.0", | ||
"fs-extra": "^10.0.0" | ||
}, | ||
"build": { | ||
"appId": "com.electron.nekiros_rcc_editor", | ||
"icon": "./assets/icon.ico", | ||
"win": { | ||
"target": { | ||
"target": "nsis", | ||
"arch": [ | ||
"x64", | ||
"ia32" | ||
] | ||
"config": { | ||
"forge": { | ||
"packagerConfig": { | ||
"icon": "./build/src/assets/icon.ico", | ||
"extraResource": "./build/src/rcc", | ||
"asar": true | ||
}, | ||
"extraResources": [ | ||
"rcc" | ||
"makers": [ | ||
{ | ||
"name": "@electron-forge/maker-squirrel", | ||
"config": { | ||
"name": "NekirosRccEditor" | ||
} | ||
} | ||
] | ||
}, | ||
"nsis": { | ||
"oneClick": false, | ||
"allowToChangeInstallationDirectory": true | ||
} | ||
}, | ||
"dependencies": { | ||
"electron": "^13.0.1", | ||
"electron-builder": "^22.10.5", | ||
"fs-extra": "^10.0.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,107 @@ | ||
import { BrowserWindow, Menu, dialog, shell, app } from 'electron'; | ||
import { loadRcc, saveRcc, extractToPng } from './reader'; | ||
import path from 'path'; | ||
require('./ipc/main'); | ||
|
||
export default class Main { | ||
static mainWindow: Electron.BrowserWindow; | ||
static application: Electron.App; | ||
static BrowserWindow: any; | ||
|
||
private static onWindowAllClosed() { | ||
if (process.platform !== 'darwin') { | ||
Main.application.quit(); | ||
} | ||
} | ||
|
||
private static createWindow() { | ||
Main.mainWindow = new Main.BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
webPreferences: { | ||
nodeIntegration: true, | ||
contextIsolation: false, | ||
}, | ||
title: "Nekiro's Rcc Editor", | ||
show: false, | ||
}); | ||
|
||
const template = [ | ||
{ | ||
label: 'Load rcc', | ||
click: async () => { | ||
const result: Electron.OpenDialogReturnValue = | ||
await dialog.showOpenDialog(Main.mainWindow, { | ||
defaultPath: path.join( | ||
app.getPath('appData'), | ||
'../Local/Tibia/packages/Tibia/bin' | ||
), | ||
properties: ['openFile'], | ||
filters: [{ name: 'Rcc File Type', extensions: ['rcc'] }], | ||
}); | ||
|
||
if (!result.canceled) { | ||
loadRcc(result.filePaths.pop() ?? null); | ||
} | ||
}, | ||
}, | ||
{ | ||
label: 'Extract assets', | ||
click: async () => { | ||
const result: Electron.OpenDialogReturnValue = | ||
await dialog.showOpenDialog(Main.mainWindow, { | ||
properties: ['openDirectory', 'createDirectory'], | ||
}); | ||
|
||
if (!result.canceled) { | ||
extractToPng(result.filePaths.pop() ?? null); | ||
} | ||
}, | ||
}, | ||
{ | ||
label: 'Save rcc', | ||
click: () => saveRcc(), | ||
}, | ||
{ | ||
label: 'Save rcc as', | ||
click: async () => { | ||
const result = await dialog.showSaveDialog(Main.mainWindow, { | ||
filters: [{ name: 'Rcc File Type', extensions: ['rcc'] }], | ||
}); | ||
|
||
if (!result.canceled) { | ||
saveRcc(result.filePath); | ||
} | ||
}, | ||
}, | ||
{ | ||
label: 'Donate', | ||
click: () => shell.openExternal('https://github.com/sponsors/nekiro'), | ||
}, | ||
]; | ||
|
||
Menu.setApplicationMenu(Menu.buildFromTemplate(template)); | ||
} | ||
|
||
private static onReady() { | ||
// create window | ||
Main.createWindow(); | ||
|
||
// load layout | ||
Main.mainWindow.loadURL(`file://${__dirname}/html/index.html`); | ||
|
||
// show when its ready | ||
Main.mainWindow.webContents.once('did-finish-load', () => { | ||
Main.mainWindow.show(); | ||
}); | ||
|
||
//Main.mainWindow.webContents.openDevTools(); | ||
} | ||
|
||
static main(app: Electron.App, browserWindow: typeof BrowserWindow) { | ||
Main.BrowserWindow = browserWindow; | ||
Main.application = app; | ||
Main.application.on('window-all-closed', Main.onWindowAllClosed); | ||
Main.application.on('ready', Main.onReady); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.