优化输出
parent
d1cb418d89
commit
2b957ba838
|
@ -51,7 +51,7 @@ public class CompressPictureUtil {
|
|||
return compressPNG(image, quality);
|
||||
} else if ("jpeg".equalsIgnoreCase(formatName)) {
|
||||
return compressJPEG(image, quality);
|
||||
} else if ("bmp".equalsIgnoreCase(fileName)) {
|
||||
} else if ("bmp".equalsIgnoreCase(formatName)) {
|
||||
return compressBMP(image, quality);
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package ln;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
|
||||
public class LNParse {
|
||||
public LNParse() {
|
||||
}
|
||||
|
||||
public LNBean getLNBean(String licensefilepath, String key) throws Exception {
|
||||
byte[] licenseFile = Zip.getZipSomeByte(licensefilepath, "license");
|
||||
byte[] publicKey = Zip.getZipSomeByte(licensefilepath, "publicKey");
|
||||
byte[] licenseEncryptKey = Zip.getZipSomeByte(licensefilepath, "licenseEncryptKey");
|
||||
byte[] licenseFile2 = Zip.getZipSomeByte(licensefilepath, "license2");
|
||||
String realPublicKey = "";
|
||||
if ("emessage2".equals(key)) {
|
||||
realPublicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIJWRm0eoQNEgZB9aUlM1PoT0N7cKCBCfkecycpeKeg57e73Fcj4ik9uYrGB01t38ut45iHJi8TLoeORYuUAhWUCAwEAAQ==";
|
||||
} else if (!"ecology7".equals(key) && !"ecology8".equals(key)) {
|
||||
if ("ecology9".equals(key)) {
|
||||
realPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyC90YpaWPbLaQwqt3TYlRqYC+gDTivXiVU2ZnL+tVop7tm1Ss8gnXnkd1I0jr2ffQK6m4HIGdz4lyxOfJVuT9hwtDpnflxK5fBIpc6N5iB3bZkes3XMJTyXY+afvh7vKf9yW0p1ZgQkMp7Ty4nRNQ1H/JV7RIUohEM24udiZNZySLpIYeAxTl8gR/EKL/YCIxBQfFEyQtijB0+X6Sfd/CWgNGVPuPr8V5nUZm8vXIszWBSPamD/yfvwNI9PAOII7OBNMXOC9BFAjTdCKkxdRS4ovu2V9STxAu0P8hhTnH0/zpxi4VOn32povh4f5J7x5eV+vSaN5G1G1zVPs5lc62QIDAQAB";
|
||||
}
|
||||
} else {
|
||||
realPublicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALUgEZ7eGZmJJM/3Ajj5Zdd2MG1ZONVybJV+v+jQT+csNWBBqxosLVlWvwaod1ix8Gg9GsyRJgoTs1Mg25raZcsCAwEAAQ==";
|
||||
}
|
||||
|
||||
String publicKeyStr = new String(Base64.encodeBase64(publicKey));
|
||||
if (!realPublicKey.equals(publicKeyStr)) {
|
||||
throw new Exception("license error!");
|
||||
} else {
|
||||
JSONObject jsonLicense;
|
||||
try {
|
||||
byte[] licenseKey = RSACoder.decryptByPublicKey(licenseEncryptKey, publicKey);
|
||||
jsonLicense = new JSONObject(new String(DESCoder.decrypt(licenseFile, licenseKey), "GBK"));
|
||||
} catch (InvalidKeyException var15) {
|
||||
var15.printStackTrace();
|
||||
byte[] licenseInfo2 = DESCoder.decrypt(licenseFile2, key.getBytes());
|
||||
jsonLicense = new JSONObject(new String(licenseInfo2));
|
||||
}
|
||||
|
||||
LNBean lnb = new LNBean();
|
||||
lnb.setCompanyname(jsonLicense.getString("companyname"));
|
||||
lnb.setLicensecode(jsonLicense.getString("licensecode"));
|
||||
lnb.setHrmnum(jsonLicense.getString("hrmnum"));
|
||||
// lnb.setExpiredate(jsonLicense.getString("expiredate"));
|
||||
lnb.setExpiredate("2222-12-31");
|
||||
lnb.setConcurrentFlag(jsonLicense.getString("concurrentFlag"));
|
||||
lnb.setLicense(jsonLicense.getString("license"));
|
||||
|
||||
try {
|
||||
lnb.setCid(jsonLicense.getString("cid"));
|
||||
} catch (Exception var14) {
|
||||
System.out.println(var14);
|
||||
}
|
||||
|
||||
try {
|
||||
lnb.setScType(jsonLicense.getString("scType"));
|
||||
} catch (Exception var13) {
|
||||
System.out.println(var13);
|
||||
}
|
||||
|
||||
try {
|
||||
lnb.setScCount(jsonLicense.getString("scCount"));
|
||||
} catch (Exception var12) {
|
||||
System.out.println(var12);
|
||||
}
|
||||
|
||||
return lnb;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkLicesne(LNBean lnb) {
|
||||
boolean returnValue = false;
|
||||
String src = lnb.getCompanyname() + lnb.getLicensecode() + "ALL" + lnb.getHrmnum() + lnb.getExpiredate() + lnb.getConcurrentFlag();
|
||||
MD5 md5 = new MD5();
|
||||
if (lnb.getLicense().equals(md5.getMD5ofStr(src))) {
|
||||
returnValue = true;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ import javafx.application.Application;
|
|||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
@ -14,9 +17,11 @@ import javafx.scene.layout.VBox;
|
|||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class BuilderPackageEcology extends Application {
|
||||
|
@ -119,8 +124,7 @@ public class BuilderPackageEcology extends Application {
|
|||
functionNameTextField.setText("");
|
||||
showSuccessAlert("升级包制作成功!");
|
||||
System.out.println("压缩包位置: " + outputFile.getPath());
|
||||
System.out.println(outputFile.getParentFile());
|
||||
|
||||
Desktop.getDesktop().open(outputFile.getParentFile());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package youhong.ai.utiltest;
|
||||
|
||||
import basetest.BaseTest;
|
||||
import com.customization.youhong.taibao.compresspicture.util.CompressPictureUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* <h1>图片压缩测试</h1>
|
||||
*
|
||||
* <p>create: 2023/7/11 14:40</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
public class ImageComperssorTest extends BaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testee() throws IOException {
|
||||
InputStream inputStream = CompressPictureUtil.compressImage(new FileInputStream("/Users/aoey.oct.22/Downloads/消息提醒异常.bmp"), "消息异常提醒.bmp", 0.5F);
|
||||
FileOutputStream fos = new FileOutputStream("/Users/aoey.oct.22/Downloads/消息提醒异常-1.bmp");
|
||||
byte[] b = new byte[1024];
|
||||
while ((inputStream.read(b)) != -1) {
|
||||
fos.write(b);// 写入数据
|
||||
}
|
||||
inputStream.close();
|
||||
fos.close();// 保存数据
|
||||
}
|
||||
}
|
|
@ -172,6 +172,8 @@ public class ImageCompressor {
|
|||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue