Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
base64linqi authored Mar 6, 2021
1 parent 45f2932 commit 74ee6e1
Show file tree
Hide file tree
Showing 21 changed files with 725 additions and 0 deletions.
3 changes: 3 additions & 0 deletions PackageHelper/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.packages.helper.PackageHelper.MainWindow

17 changes: 17 additions & 0 deletions PackageHelper/PackageHelper.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
<orderEntry type="library" name="Maven: net.dongliu:apk-parser:2.6.10" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.plist:dd-plist:1.23" level="project" />
</component>
</module>
Binary file added PackageHelper/miglayout15-swing.jar
Binary file not shown.
49 changes: 49 additions & 0 deletions PackageHelper/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.packages.helper</groupId>
<artifactId>PackageHelper</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>

<name>PackageHelper</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.plist/dd-plist -->
<dependency>
<groupId>com.googlecode.plist</groupId>
<artifactId>dd-plist</artifactId>
<version>1.23</version>
</dependency>
</dependencies>
</project>
3 changes: 3 additions & 0 deletions PackageHelper/src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.packages.helper.PackageHelper.MainWindow

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.packages.helper.PackageHelper;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import java.awt.GridLayout;
import java.awt.Color;
import javax.swing.BoxLayout;
import javax.swing.JTextArea;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class About extends JDialog {

private final JPanel contentPanel = new JPanel();

/**
* Launch the application.
*/
public static void main(String[] args) {
try {
About dialog = new About();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Create the dialog.
*/
public About() {
setTitle("About");
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BorderLayout(0, 0));
{
JTextArea txtAbout = new JTextArea();
txtAbout.setEditable(false);
txtAbout.setText("首先对于工具的UI,我尽力了\r\n感谢那个陪我一直解决问题的师傅,UI就是他干的....\r\nBug反馈:appbug@foxmail.com<记得带上识别错误的App>\r\n给了不一定改,不给一定不改");
contentPanel.add(txtAbout, BorderLayout.CENTER);
}
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setModal(true);
getOwner().setEnabled(true);
About.this.dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package com.packages.helper.PackageHelper;

import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.swing.JFrame;

public class DragFrame extends JFrame implements DropTargetListener{

private IDropHandler dropHandler;



public IDropHandler getDropHandler() {
return dropHandler;
}

public void setDropHandler(IDropHandler dropHandler) {
this.dropHandler = dropHandler;
}

public DragFrame() throws HeadlessException {
// TODO Auto-generated constructor stub

new DropTarget(this, DnDConstants.ACTION_COPY, this);
}

public DragFrame(GraphicsConfiguration arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}

public DragFrame(String arg0) throws HeadlessException {
super(arg0);
// TODO Auto-generated constructor stub
}

public DragFrame(String arg0, GraphicsConfiguration arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}

@Override
public void dragEnter(DropTargetDragEvent dtde) {
// TODO Auto-generated method stub

}

@Override
public void dragExit(DropTargetEvent dte) {
// TODO Auto-generated method stub

}

@Override
public void dragOver(DropTargetDragEvent dtde) {
// TODO Auto-generated method stub

}

@Override
public void drop(DropTargetDropEvent dtde) {
// TODO Auto-generated method stub
try {
Transferable tr = dtde.getTransferable();

if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
System.out.println("file cp");
List list = (List) (dtde.getTransferable()
.getTransferData(DataFlavor.javaFileListFlavor));
Iterator iterator = list.iterator();
List<File> files = new ArrayList<File>();
while (iterator.hasNext()) {
File f = (File) iterator.next();
files.add(f);
System.out.println(f.getName());
}
dtde.dropComplete(true);
if (this.dropHandler != null) {
dropHandler.handleDrop(files);
}
}else {
dtde.rejectDrop();
}
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (UnsupportedFlavorException ufe) {
ufe.printStackTrace();
}
}

@Override
public void dropActionChanged(DropTargetDragEvent dtde) {
// TODO Auto-generated method stub

}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.packages.helper.PackageHelper;

import java.io.File;
import java.util.List;

public interface IDropHandler {
void handleDrop(List<File> files);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.packages.helper.PackageHelper;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import com.dd.plist.NSDictionary;
import com.dd.plist.NSString;
import com.dd.plist.PropertyListParser;

public class IPAHelper {
/**
* 解析ipa文件
*
* @param file ipa的文件路径
* @return
*/
public static Map<String, Object> parseIpa(File file) {
Map<String, Object> map = new HashMap();
try {
// File file = new File(url);
InputStream is = new FileInputStream(file);
ZipInputStream zipIns = new ZipInputStream(is);
ZipEntry ze;
InputStream infoIs = null;
while ((ze = zipIns.getNextEntry()) != null) {
if (!ze.isDirectory()) {
String name = ze.getName();
if (null != name && name.toLowerCase().contains(".app/info.plist")) {
ByteArrayOutputStream _copy = new ByteArrayOutputStream();
int chunk = 0;
byte[] data = new byte[1024];
while (-1 != (chunk = zipIns.read(data))) {
_copy.write(data, 0, chunk);
}
infoIs = new ByteArrayInputStream(_copy.toByteArray());
break;
}
}
}

NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(infoIs);

//如果想要查看有哪些key ,可以把下面注释放开
for (String keyName : rootDict.allKeys()) {
System.out.println(keyName + ":" + rootDict.get(keyName));
}
// 应用名CFBundleName
NSString parameters = (NSString) rootDict.get("CFBundleName");
map.put("appName", parameters.toString());

// 应用包名CFBundleDisplayNameCFBundleIdentifier
parameters = (NSString) rootDict.get("CFBundleIdentifier");
map.put("appId", parameters.toString());
// 应用版本名
parameters = (NSString) rootDict.objectForKey("CFBundleShortVersionString");
map.put("versionName", parameters.toString());
// 应用版本号
parameters = (NSString) rootDict.get("CFBundleVersion");
map.put("versionCode", parameters.toString());
parameters = (NSString) rootDict.get("CFBundleDisplayName");
map.put("packetSize", (double) (file.length() * 100 / 1024 / 1024) / 100 + " MB");
infoIs.close();
is.close();
zipIns.close();

} catch (Exception e) {
System.out.println("ipa包解析异常!");
}
return map;
}
}
Loading

0 comments on commit 74ee6e1

Please sign in to comment.