|
@@ -13,8 +13,10 @@ import org.w3c.dom.Document;
|
|
import org.w3c.dom.Node;
|
|
import org.w3c.dom.Node;
|
|
|
|
|
|
import javax.validation.constraints.Size;
|
|
import javax.validation.constraints.Size;
|
|
|
|
+import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.io.InputStreamReader;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -26,6 +28,7 @@ public class AuthLicenseUtil {
|
|
|
|
|
|
public static JSONObject readLicense(){
|
|
public static JSONObject readLicense(){
|
|
try {
|
|
try {
|
|
|
|
+ createLicense();
|
|
if (FileUtil.exist(licensePath + File.separator + "results" + File.separator + "encryption_info.xml")) {
|
|
if (FileUtil.exist(licensePath + File.separator + "results" + File.separator + "encryption_info.xml")) {
|
|
String xml = FileUtils.readFile((licensePath + File.separator + "results" + File.separator + "encryption_info.xml"));
|
|
String xml = FileUtils.readFile((licensePath + File.separator + "results" + File.separator + "encryption_info.xml"));
|
|
return XML.toJSONObject(xml);
|
|
return XML.toJSONObject(xml);
|
|
@@ -33,39 +36,35 @@ public class AuthLicenseUtil {
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error("readLicense-error:",e);
|
|
log.error("readLicense-error:",e);
|
|
}
|
|
}
|
|
-
|
|
|
|
- return createLicense();
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
- public static JSONObject createLicense() {
|
|
|
|
- File file = new File(licensePath);
|
|
|
|
- if(!file.exists()){
|
|
|
|
- file.mkdirs();
|
|
|
|
- }
|
|
|
|
- File caches = new File(licensePath + File.separator+ "caches");
|
|
|
|
- FileUtil.del(caches);
|
|
|
|
- File results = new File(licensePath + File.separator+ "results");
|
|
|
|
- FileUtil.del(results);
|
|
|
|
|
|
+ public static void createLicense() {
|
|
|
|
+ new Thread() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ File file = new File(licensePath);
|
|
|
|
+ if(!file.exists()){
|
|
|
|
+ file.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ File caches = new File(licensePath + File.separator+ "caches");
|
|
|
|
+ FileUtil.del(caches);
|
|
|
|
+ File results = new File(licensePath + File.separator+ "results");
|
|
|
|
+ FileUtil.del(results);
|
|
|
|
|
|
- JSONObject licenseDataJson = new JSONObject();
|
|
|
|
- licenseDataJson.put("split_type", "SPLIT_V23");
|
|
|
|
- licenseDataJson.put("skybox_type", "SKYBOX_V5");
|
|
|
|
- FileUtils.writeFile(licensePath + File.separator + "data.json", licenseDataJson.toString());
|
|
|
|
- ShellUtil.execCmd(String.format(cmd,licensePath));
|
|
|
|
- int count = 10;
|
|
|
|
- try {
|
|
|
|
- for (int i = count; i > 0; i--) {
|
|
|
|
- if (FileUtil.exist(licensePath + File.separator + "results" + File.separator + "encryption_info.xml")) {
|
|
|
|
- String xml = FileUtils.readFile((licensePath + File.separator + "results" + File.separator + "encryption_info.xml"));
|
|
|
|
- return XML.toJSONObject(xml);
|
|
|
|
|
|
+ JSONObject licenseDataJson = new JSONObject();
|
|
|
|
+ licenseDataJson.put("split_type", "SPLIT_V23");
|
|
|
|
+ licenseDataJson.put("skybox_type", "SKYBOX_V5");
|
|
|
|
+ FileUtils.writeFile(licensePath + File.separator + "data.json", licenseDataJson.toString());
|
|
|
|
+ ShellUtil.execCmd(String.format(cmd,licensePath));
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e) {
|
|
|
|
+ log.error("createLicense-error:",e);
|
|
}
|
|
}
|
|
- Thread.sleep(1000);
|
|
|
|
}
|
|
}
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("createLicense-error:",e);
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
|
|
+ }.start();
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|