From d8f401cb22dee4262f0af2386f9c2cecc2adf1f9 Mon Sep 17 00:00:00 2001 From: Riccardo Azzolini Date: Fri, 25 Oct 2019 20:49:31 +0200 Subject: [PATCH] Remove zip file handling code and zip4j dependency .zip files were only used to cache compiled Java rules, and the new rule system has nothing to cache. --- .../java/it/cavallium/warppi/Platform.java | 4 -- desktop/pom.xml | 5 --- .../warppi/desktop/DesktopPlatform.java | 43 ------------------- hardware/pom.xml | 5 --- .../warppi/hardware/HardwarePlatform.java | 43 ------------------- .../cavallium/warppi/teavm/TeaVMPlatform.java | 10 ----- 6 files changed, 110 deletions(-) diff --git a/core/src/main/java/it/cavallium/warppi/Platform.java b/core/src/main/java/it/cavallium/warppi/Platform.java index 0644b554..2c9083c3 100644 --- a/core/src/main/java/it/cavallium/warppi/Platform.java +++ b/core/src/main/java/it/cavallium/warppi/Platform.java @@ -70,10 +70,6 @@ public interface Platform { */ List getRuleFilePaths() throws IOException; - void zip(String targetPath, String destinationFilePath, String password); - - void unzip(String targetZipFilePath, String destinationFolderPath, String password); - public interface Gpio { int valueOutput(); diff --git a/desktop/pom.xml b/desktop/pom.xml index 8e2bda89..ac174dbe 100644 --- a/desktop/pom.xml +++ b/desktop/pom.xml @@ -28,11 +28,6 @@ jansi 1.17.1 - - net.lingala.zip4j - zip4j - 1.3.2 - ar.com.hjg pngj diff --git a/desktop/src/main/java/it/cavallium/warppi/desktop/DesktopPlatform.java b/desktop/src/main/java/it/cavallium/warppi/desktop/DesktopPlatform.java index d6d78152..5072084f 100644 --- a/desktop/src/main/java/it/cavallium/warppi/desktop/DesktopPlatform.java +++ b/desktop/src/main/java/it/cavallium/warppi/desktop/DesktopPlatform.java @@ -19,9 +19,6 @@ import it.cavallium.warppi.gui.graphicengine.impl.jogl.JOGLEngine; import it.cavallium.warppi.gui.graphicengine.impl.swing.SwingEngine; import it.cavallium.warppi.util.CacheUtils; import it.cavallium.warppi.util.Error; -import net.lingala.zip4j.core.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import net.lingala.zip4j.util.Zip4jConstants; public class DesktopPlatform implements Platform { @@ -173,46 +170,6 @@ public class DesktopPlatform implements Platform { return paths; } - @Override - public void zip(final String targetPath, final String destinationFilePath, final String password) { - try { - final ZipParameters parameters = new ZipParameters(); - parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); - parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); - - if (password.length() > 0) { - parameters.setEncryptFiles(true); - parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES); - parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256); - parameters.setPassword(password); - } - - final ZipFile zipFile = new ZipFile(destinationFilePath); - - final File targetFile = new File(targetPath); - if (targetFile.isFile()) - zipFile.addFile(targetFile, parameters); - else if (targetFile.isDirectory()) - zipFile.addFolder(targetFile, parameters); - - } catch (final Exception e) { - e.printStackTrace(); - } - } - - @Override - public void unzip(final String targetZipFilePath, final String destinationFolderPath, final String password) { - try { - final ZipFile zipFile = new ZipFile(targetZipFilePath); - if (zipFile.isEncrypted()) - zipFile.setPassword(password); - zipFile.extractAll(destinationFolderPath); - - } catch (final Exception e) { - e.printStackTrace(); - } - } - @Override public void setRunningOnRaspberry(boolean b) { if (isRunningOnRaspberry()) { diff --git a/hardware/pom.xml b/hardware/pom.xml index e02183d3..020f2e37 100644 --- a/hardware/pom.xml +++ b/hardware/pom.xml @@ -30,11 +30,6 @@ pi4j-core 1.2-SNAPSHOT - - net.lingala.zip4j - zip4j - 1.3.2 - ar.com.hjg pngj diff --git a/hardware/src/main/java/it/cavallium/warppi/hardware/HardwarePlatform.java b/hardware/src/main/java/it/cavallium/warppi/hardware/HardwarePlatform.java index f133aa7a..4e3c78c8 100644 --- a/hardware/src/main/java/it/cavallium/warppi/hardware/HardwarePlatform.java +++ b/hardware/src/main/java/it/cavallium/warppi/hardware/HardwarePlatform.java @@ -15,9 +15,6 @@ import it.cavallium.warppi.gui.graphicengine.GraphicEngine; import it.cavallium.warppi.gui.graphicengine.impl.framebuffer.FBEngine; import it.cavallium.warppi.gui.graphicengine.impl.jogl.JOGLEngine; import it.cavallium.warppi.util.Error; -import net.lingala.zip4j.core.ZipFile; -import net.lingala.zip4j.model.ZipParameters; -import net.lingala.zip4j.util.Zip4jConstants; public class HardwarePlatform implements Platform { @@ -163,46 +160,6 @@ public class HardwarePlatform implements Platform { return paths; } - @Override - public void zip(final String targetPath, final String destinationFilePath, final String password) { - try { - final ZipParameters parameters = new ZipParameters(); - parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE); - parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL); - - if (password.length() > 0) { - parameters.setEncryptFiles(true); - parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES); - parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256); - parameters.setPassword(password); - } - - final ZipFile zipFile = new ZipFile(destinationFilePath); - - final File targetFile = new File(targetPath); - if (targetFile.isFile()) - zipFile.addFile(targetFile, parameters); - else if (targetFile.isDirectory()) - zipFile.addFolder(targetFile, parameters); - - } catch (final Exception e) { - e.printStackTrace(); - } - } - - @Override - public void unzip(final String targetZipFilePath, final String destinationFolderPath, final String password) { - try { - final ZipFile zipFile = new ZipFile(targetZipFilePath); - if (zipFile.isEncrypted()) - zipFile.setPassword(password); - zipFile.extractAll(destinationFolderPath); - - } catch (final Exception e) { - e.printStackTrace(); - } - } - @Override public void setRunningOnRaspberry(boolean b) { runningOnRaspberryOverride = b; diff --git a/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPlatform.java b/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPlatform.java index 2b28dbff..e47f6428 100644 --- a/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPlatform.java +++ b/teavm/src/main/java/it/cavallium/warppi/teavm/TeaVMPlatform.java @@ -157,16 +157,6 @@ public class TeaVMPlatform implements Platform { } } - @Override - public void zip(final String targetPath, final String destinationFilePath, final String password) { - throw new java.lang.UnsupportedOperationException("Not implemented."); - } - - @Override - public void unzip(final String targetZipFilePath, final String destinationFolderPath, final String password) { - throw new java.lang.UnsupportedOperationException("Not implemented."); - } - @Override public void setRunningOnRaspberry(boolean b) { }