熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

用Java實現KeyFile

2022-06-13   來源: Java核心技術 

  KeyFile的實現是這樣

  /**

  * KeyFile<br/>

  * Date: <br/>

  * Time: ::<br/>

  *

  * @author vhly[FR]

  */

  public class KeyFile {

  /*

  <KeyType type=>

  <LicenseKey keyVersion=>

  <ExpireDate value=/>

  <EMail value=/>

  <MachinelInfo value=Java/>

  <UserName value=vhly FR/>

  <ProductName value=Smart Development Environment Enterprise Edition for IntelliJ/>

  <ProductVersion value=/>

  <ProductBuild value=/>

  <ProductRegisterDate value=/>

  <SerialNumber value=/>

  <VerifyKey value=NTQRANjE+NzxOUA/PkIzNEdBOEEPgPUBbCATUFDPzycXRWalxfXNlhiFHVpYZIEZhmdXFZtIkVeeCcHFyctLFRnhGZaJzfWsiUGlzdxfSNrfXQjVnBcydVgPDUPzEMMNUAQEQQXfQ=/>

  <Evaluation value=false/>

  <Type value=/>

  </LicenseKey>

  </KeyType>

  */

  private int keyType;

  private String keyVersion;

  private Date expiredDate;

  private String email;

  private String machinelInfo;

  private String userName;

  private String productName;

  private String productVersion;

  private String productBuild;

  private Date registerDate;

  private String serialNumber;

  private String verifyKey;

  private boolean evaluation;

  private String upgradeSN;

  private String tagValue;

  private int type;

  public String toXML(){

  String ret = null;

  StringBuffer ** = new StringBuffer();

  **append(<?xml version=\\ encoding=\UTF\?>\n);

  **append(<KeyType type=\+getKeyType()+\>\n);

  **append(<LicenseKey keyVersion=\\>\n);

  **append(<ExpireDate value=\+getExpiredDate()getTime()+\/>\n);

  **append(<EMail value=\+getEmail()+\/>\n);

  **append(<MachinelInfo value=\Java\/>\n);

  **append(<UserName value=\+getUserName()+\/>\n);

  **append(<ProductName value=\+getProductName()+\/>\n);

  **append(<ProductVersion value=\+getProductVersion()+\/>\n);

  **append(<ProductBuild value=\+getProductBuild()+\/>\n);

  **append(<ProductRegisterDate value=\+getRegisterDate()getTime()+\/>\n);

  **append(<SerialNumber value=\+getSerialNumber()+\/>\n);

  **append(<VerifyKey value=\+getVerifyKeyResult()+\/>\n);

  **append(<Evaluation value=\+isEvaluation()+\/>\n);

  **append(<Type value=\\/>\n);

  **append(</LicenseKey>\n);

  **append(</KeyType>\n);

  ret = **toString();

  ** = null;

  return ret;

  }

  public KeyFile() {

  keyType = ;

  keyVersion = ;

  Calendar cl = CalendargetInstance();

  cladd(CalendarYEAR);

  long d = clgetTime()getTime();

  d /= ;

  d *= ;

  expiredDate = new Date(d);

  email = ;

  machinelInfo = Java;

  userName = qqyang;

  productName = Visual Paradigm for UML Enterprise Edition;

  productVersion = ;

  productBuild = ;

  d = new Date()getTime();

  d /= ;

  d *= ;

  registerDate = new Date(d);

  serialNumber = LongtoString(SystemcurrentTimeMillis());

  evaluation = false;

  upgradeSN = ;

  tagValue = ;

  type = ;

  }

  public final String getVerifyKeyResult(){

  String ret;

  StringBuffer ** = new StringBuffer();

  **append(getSerialNumber());

  **append(getExpiredDate()getTime());

  **append(getEmail());

  **append(getMachinelInfo());

  **append(getUserName());

  **append(getProductName());

  **append(getProductVersion());

  **append();

  **append(getRegisterDate()getTime());

  **append(getType());

  String s;

  s = isEvaluation() ? true : false;

  **append(s);

  **append(tagValue);

  ret = **toString();

  ** = null;

  ret = eyji(ret);

  return ret;

  }


From:http://tw.wingwit.com/Article/program/Java/hx/201311/25762.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.