|  |  |  | 
|---|
|  |  |  | public static final String SALT = "123456789qwertyu"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 系统激活状态 (默认未激活) | 
|---|
|  |  |  | public static boolean SYSTEM_ACTIVATION = Boolean.FALSE; | 
|---|
|  |  |  | //    public static boolean SYSTEM_ACTIVATION = Boolean.FALSE; | 
|---|
|  |  |  | public static boolean SYSTEM_ACTIVATION = Boolean.TRUE; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static String getActivationCode(String fileName){ | 
|---|
|  |  |  | public static String getActivationCode(String fileName) { | 
|---|
|  |  |  | StringBuilder activationCode = new StringBuilder(); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | FileReader f = new FileReader(fileName); | 
|---|
|  |  |  | 
|---|
|  |  |  | return activationCode.toString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static boolean saveActivationCode(String filePath, String code){ | 
|---|
|  |  |  | public static boolean saveActivationCode(String filePath, String code) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 防止文件建立或读取失败,用catch捕捉错误并打印,也可以throw | 
|---|
|  |  |  | File file = new File(filePath);// 相对路径,如果没有则要建立一个新的output。txt文件 | 
|---|
|  |  |  | 
|---|
|  |  |  | String timeStr = "2021-08-01 17:48:35"; | 
|---|
|  |  |  | Date exprTime = DateUtils.convert(timeStr); | 
|---|
|  |  |  | String code = AesUtils.encrypt(DateUtils.convert(exprTime, DateUtils.yyyyMMddHHmmss), SystemProperties.SALT); | 
|---|
|  |  |  | System.out.println("激活码:"+code); | 
|---|
|  |  |  | System.out.println("有效期至:"+timeStr); | 
|---|
|  |  |  | System.out.println("激活码:" + code); | 
|---|
|  |  |  | System.out.println("有效期至:" + timeStr); | 
|---|
|  |  |  | //        saveActivationCode(SysOsType.Windows.getActivationCodePath(), code); | 
|---|
|  |  |  | //        String activationCode = getActivationCode(OSinfo.getOSname().getActivationCodePath()); | 
|---|
|  |  |  | //        String decrypt = AesUtils.decrypt(activationCode, "123456789qwertyu"); | 
|---|