allow to create swf from code only / export SWF to "Java code", which generates the SWF

This commit is contained in:
honfika@gmail.com
2015-01-17 12:17:03 +01:00
parent 30a3bc1e3e
commit 07eaafdc55
64 changed files with 841 additions and 259 deletions

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.helpers;
import com.jpexs.decompiler.flash.AppResources;
@@ -179,6 +180,42 @@ public class Helper {
return ret.toString();
}
/**
* Escapes string by adding backslashes
*
* @param s String to escape
* @return Escaped string
*/
public static String escapeJavaString(String s) {
StringBuilder ret = new StringBuilder(s.length());
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\n') {
ret.append("\\n");
} else if (c == '\r') {
ret.append("\\r");
} else if (c == '\t') {
ret.append("\\t");
} else if (c == '\b') {
ret.append("\\b");
} else if (c == '\t') {
ret.append("\\t");
} else if (c == '\f') {
ret.append("\\f");
} else if (c == '\\') {
ret.append("\\\\");
} else if (c == '"') {
ret.append("\\\"");
} else if (c < 32) {
ret.append("\\u").append(padZeros(Integer.toHexString((int) c), 4));
} else {
ret.append(c);
}
}
return ret.toString();
}
public static String getValidHtmlId(String text) {
// ID and NAME tokens must begin with a letter ([A-Za-z]) and
// may be followed by any number of letters, digits ([0-9]),