转自:http://www.chinapyg.com/thread-79022-1-1.html
首先,找到安装目录下的“LicenseManagerDomain.js”文件;
其次,按照如下图所示的代码内容更改上面的js文件:
也可以参照如下代码段:
/*
* Copyright (c) 2013-2014 Minkyu Lee. All rights reserved.
*
* NOTICE: All information contained herein is, and remains the
* property of Minkyu Lee. The intellectual and technical concepts
* contained herein are proprietary to Minkyu Lee and may be covered
* by Republic of Korea and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Minkyu Lee (niklaus.lee@gmail.com).
*
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, node: true */
/*global */
(function () {
"use strict";
var NodeRSA = require('node-rsa');
function validate(PK, name, product, licenseKey) {
var pk, decrypted;
// edit by 0xcb
return {
name: "0xcb",
product: "StarUML",
licenseType: "vip",
quantity: "bbs.chinapyg.com",
licenseKey: "later equals never!"
};
try {
pk = new NodeRSA(PK);
decrypted = pk.decrypt(licenseKey, 'utf8');
} catch (err) {
return false;
}
var terms = decrypted.trim().split("\n");
if (terms[0] === name && terms[1] === product) {
return {
name: name,
product: product,
licenseType: terms[2],
quantity: terms[3],
licenseKey: licenseKey
};
} else {
return false;
}
}
/**
* Initializes the domain with several commands.
* @param {DomainManager} domainManager The DomainManager for the server
*/
function init(domainManager) {
if (!domainManager.hasDomain("LicenseManager")) {
domainManager.registerDomain("LicenseManager", {major: 0, minor: 1});
}
domainManager.registerCommand(
"LicenseManager", // domain name
"validate", // command name
validate, // command handler function
false, // this command is synchronous in Node ("false" means synchronous")
"Validate License",
[
{
name: "PK",
type: "string",
description: "PK"
},
{
name: "name",
type: "string",
description: "name of license owner"
},
{
name: "product",
type: "string",
description: "product name"
},
{
name: "licenseKey",
type: "string",
description: "license key"
}
],
[
{
name: "result", // return values
type: "object",
description: "result"
}
]
);
}
exports.init = init;
}());
最后,打开安装好的StarUML,选择“help”->“enter license”。然后按上述代码中的name和licenseKey输入相应的内容,确定后便会提示注册成功。