StartUML4.0.1的使用方法

关于StartUML

StarUML是一款开放源码的UML开发工具,是由韩国公司主导开发出来的产品,可以直接到StarUML网站下载。StarUML是一个开源项目之一发展快、灵活、可扩展性强。

便捷下载连接(v4.0.1版软件):传送门

安装过程

安装完毕后打开小工具asar文件管理工具.exe(杀毒软件可能报危险,选择信任就行),将安装路径(默认路径为C:\Program Files\StarUML\resources)下的app.asar,拖入软件“asar文件解包”标签下的指定位置如下图:

然后依次打开左侧目录树的src/engine/license-manager.js,右侧编辑框中会显示文件内容如下图:

接着将下面的代码,完整复制下来,替换掉右侧(即打开的license-manager.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).
*
*/

const {EventEmitter} = require('events')
const fs = require('fs')
const path = require('path')
const crypto = require('crypto')
const UnregisteredDialog = require('../dialogs/unregistered-dialog')
const SK = 'DF9B72CC966FBE3A46F99858C5AEE'
const packageJSON = require('../../package.json')

// Check License When File Save
const LICENSE_CHECK_PROBABILITY = 0.3

var status = false
var licenseInfo = null

/**
 * Set Registration Status
 * This function is out of LicenseManager class for the security reason
 * (To disable changing License status by API)
 * @private
 * @param {boolean} newStat
 * @return {string}
 */
function setStatus (licenseManager, newStat) {
  if (status !== newStat) {
    status = newStat
    licenseManager.emit('statusChanged', status)
  }
}

/**
 * @private
 */
class LicenseManager extends EventEmitter {

  constructor () {
    super()
    this.projectManager = null
  }

  /**
   * Get Registration Status
   * @return {string}
   */
  getStatus () {
    return status
  }

  /**
  * Get License Infomation
  * @return {Object}
  */
  getLicenseInfo () {
    return licenseInfo
  }

  findLicense () {
    var licensePath = path.join(app.getUserPath(), '/license.key')
    if (!fs.existsSync(licensePath)) {
      licensePath = path.join(app.getAppPath(), '../license.key')
    }
    if (fs.existsSync(licensePath)) {
      return licensePath
    } else {
      return null
    }
  }

  /**
   * Check license validity
   *
   * @return {Promise}
   */
  validate () {
    return new Promise((resolve, reject) => {
      try {
        // Local check
        var file = this.findLicense()
        if (!file) {
          reject('License key not found')
        } else {
          var data = fs.readFileSync(file, 'utf8')
          licenseInfo = JSON.parse(data)
          /*if (licenseInfo.product !== packageJSON.config.product_id) {
            app.toast.error(`License key is for old version (${licenseInfo.product})`)
            reject(`License key is not for ${packageJSON.config.product_id}`)
          } else {*/
            var base = SK + licenseInfo.name +
            SK + licenseInfo.product + '-' + licenseInfo.licenseType +
            SK + licenseInfo.quantity +
            SK + licenseInfo.timestamp + SK
            var _key = crypto.createHash('sha1').update(base).digest('hex').toUpperCase()
            if (_key !== licenseInfo.licenseKey) {
              reject('Invalid license key')
            } else {
              // Server check
              $.post(app.config.validation_url, {licenseKey: licenseInfo.licenseKey})
                .done(data => {
                  resolve(data)
                })
                .fail(err => {
                  if (err && err.status === 499) { /* License key not exists */
                    reject(err)
                  } else {
                    // If server is not available, assume that license key is valid
                    resolve(licenseInfo)
                  }
                })
            }
          //}
        }
      } catch (err) {
        reject(err)
      }
    })
  }

  checkLicenseValidity () {
    this.validate().then(() => {
      setStatus(this, true)
    }, () => {
      setStatus(this, true)
      //UnregisteredDialog.showDialog()
    })
  }

  /**
   * 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, false)
          if (err.status === 499) { /* License key not exists */
            reject('invalid')
          } else {
            reject()
          }
        })
    })
  }

  htmlReady () {
    this.projectManager.on('projectSaved', (filename, project) => {
      var val = Math.floor(Math.random() * (1.0 / LICENSE_CHECK_PROBABILITY))
      if (val === 0) {
        this.checkLicenseValidity()
      }
    })
  }

  appReady () {
    this.checkLicenseValidity()
  }

}

module.exports = LicenseManager

完成上述操作步骤后就可以正常使用了

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值