安装asar
npm install -g asar
解压app.asar
进入到app.asar目录下执行当前命令。默认文件路径是C:\Program Files\StarUML\resources
asar extract app.asar app
修改源代码
解压之后当前文件夹下有一个新的目录app,真正的验证license的代码在app\src\engine\license-manager.js,我们把的这两个方法替换掉。
checkLicenseValidity () {
this.validate().then(() => {
setStatus(this, true)
}, () => {
//setStatus(this, false)
// UnregisteredDialog.showDialog()
setStatus(this, true)
})
}
/**
* Check the license key in server and store it as license.key file in local
*
* @param {string} licenseKey
*/
register (licenseKey) {
return new Promise((resolve, reject) => {
$.post(app.config.validation_url, {licenseKey: licenseKey})
.done(data => {
var file = path.join(app.getUserPath(), '/license.key')
fs.writeFileSync(file, JSON.stringify(data, 2))
licenseInfo = data
setStatus(this, true)
resolve(data)
})
.fail(err => {
setStatus(this, true)
//if (err.status === 499) { /* License key not exists */
// reject('invalid')
//} else {
// reject()
//}
})
})
}