windows+mac "exe" export with adobe projector

This commit is contained in:
honfika@gmail.com
2015-06-18 08:35:15 +02:00
parent ad9497cb46
commit 2ef4e759c0
5 changed files with 108 additions and 37 deletions

View File

@@ -795,14 +795,18 @@ public final class SWF implements SWFContainerItem, Timelined {
}
os.write(data);
} else if (compression == SWFCompression.ZLIB) {
try (DeflaterOutputStream dos = new DeflaterOutputStream(os)) {
Helper.copyStream(is, dos, Long.MAX_VALUE);
DeflaterOutputStream dos = new DeflaterOutputStream(os);
try {
Helper.copyStream(is, dos);
} finally {
dos.finish();
}
} else {
Helper.copyStream(is, os, Long.MAX_VALUE);
Helper.copyStream(is, os);
}
}
@Override
public boolean isModified() {
for (Tag tag : tags) {
if (tag.isModified()) {

View File

@@ -879,26 +879,56 @@ public class Configuration {
}
public static File getPlayerSWC() {
String a = getLatestPlayerGlobalUrl();
String b = getLatestProjectorUrlWin();
String c = getLatestProjectorUrlMac();
String d = getLatestProjectorUrlLinux();
File libsdir = getFlashLibPath();
if (libsdir != null && libsdir.exists()) {
File[] libs = libsdir.listFiles(new FilenameFilter() {
File libsDir = getFlashLibPath();
if (libsDir != null && libsDir.exists()) {
File[] libs = libsDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().startsWith("playerglobal");
}
});
List<String> libnames = new ArrayList<>();
List<String> libNames = new ArrayList<>();
for (File f : libs) {
libnames.add(f.getName());
libNames.add(f.getName());
}
Collections.sort(libnames);
if (!libnames.isEmpty()) {
return new File(libsdir.getAbsolutePath() + File.separator + libnames.get(libnames.size() - 1));
Collections.sort(libNames);
if (!libNames.isEmpty()) {
return new File(libsDir.getAbsolutePath() + File.separator + libNames.get(libNames.size() - 1));
} else {
return null;
}
}
return null;
}
public static File getProjectorFile(ExeExportMode exportMode) {
File projectoDir = getProjectorPath();
if (projectoDir != null && projectoDir.exists()) {
File[] projectors = projectoDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
switch (exportMode) {
case PROJECTOR_WIN:
return name.toLowerCase().endsWith(".exe");
case PROJECTOR_MAC:
return name.toLowerCase().endsWith(".dmg");
case PROJECTOR_LINUX:
return name.toLowerCase().endsWith(".gz");
}
return false;
}
});
List<String> projectorNames = new ArrayList<>();
for (File f : projectors) {
projectorNames.add(f.getName());
}
Collections.sort(projectorNames);
if (!projectorNames.isEmpty()) {
return new File(projectoDir.getAbsolutePath() + File.separator + projectorNames.get(projectorNames.size() - 1));
} else {
return null;
}

View File

@@ -22,6 +22,5 @@ package com.jpexs.decompiler.flash.exporters.modes;
*/
public enum ExeExportMode {
WRAPPER, PROJECTOR_WIN, PROJECTOR_MAC/*, PROJECTOR_LINUX*/
WRAPPER, PROJECTOR_WIN, PROJECTOR_MAC, PROJECTOR_LINUX
}

View File

@@ -655,6 +655,19 @@ public class Helper {
return baos.toByteArray();
}
public static void copyStream(InputStream is, OutputStream os) {
try {
final int bufSize = 4096;
byte[] buf = new byte[bufSize];
int cnt = 0;
while ((cnt = is.read(buf)) > 0) {
os.write(buf, 0, cnt);
}
} catch (IOException ex) {
// ignore
}
}
public static void copyStream(InputStream is, OutputStream os, long maxLength) {
try {
final int bufSize = 4096;