diff --git a/CHANGELOG.md b/CHANGELOG.md index e87a1965f..e972e3cf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ### Added - FLA export - generating bin/*.dat files for movies and images +### Fixed +- [#2309] XML export/import - Decimal support + ## [21.0.5] - 2024-09-05 ### Fixed - [#2293] FLA export - stackoverflow on multilevel clips extraction, clipping @@ -3538,6 +3541,7 @@ Major version of SWF to XML export changed to 2. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#2309]: https://www.free-decompiler.com/flash/issues/2309 [#2293]: https://www.free-decompiler.com/flash/issues/2293 [#2294]: https://www.free-decompiler.com/flash/issues/2294 [#2300]: https://www.free-decompiler.com/flash/issues/2300 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java index 60ed1ec2f..db5a3527d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java @@ -45,6 +45,7 @@ import java.util.logging.Logger; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; +import macromedia.asc.util.Decimal128; /** * Exports SWF to XML. @@ -178,6 +179,16 @@ public class SwfXmlExporter { Object value = obj; String stringValue = Helper.escapeXmlExportString(value.toString()); + if (isListItem) { + writer.writeStartElement(name); + writer.writeCharacters(stringValue); + writer.writeEndElement(); + } else { + writer.writeAttribute(name, stringValue); + } + } else if (cls == Decimal128.class) { + Decimal128 value = (Decimal128) obj; + String stringValue = value.toActionScriptString(); if (isListItem) { writer.writeStartElement(name); writer.writeCharacters(stringValue); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java index 562647d8a..88814d38d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java @@ -180,7 +180,7 @@ public class SwfXmlImporter { CurvedEdgeRecord.class, EndShapeRecord.class, StraightEdgeRecord.class, StyleChangeRecord.class, BEVELFILTER.class, BLURFILTER.class, COLORMATRIXFILTER.class, CONVOLUTIONFILTER.class, DROPSHADOWFILTER.class, GLOWFILTER.class, GRADIENTBEVELFILTER.class, GRADIENTGLOWFILTER.class, - AVM2ConstantPool.class, Decimal128.class, Namespace.class, NamespaceSet.class, Multiname.class, MethodInfo.class, MetadataInfo.class, + AVM2ConstantPool.class, Namespace.class, NamespaceSet.class, Multiname.class, MethodInfo.class, MetadataInfo.class, ValueKind.class, InstanceInfo.class, Traits.class, TraitClass.class, TraitFunction.class, TraitMethodGetterSetter.class, TraitSlotConst.class, ClassInfo.class, ScriptInfo.class, MethodBody.class, ABCException.class, ABCVersion.class, Amf3Value.class, @@ -195,7 +195,7 @@ public class SwfXmlImporter { } objects.put(cls2.getSimpleName(), cls2); } - + swfObjects = objects; Map objectsParam = new HashMap<>(); @@ -526,6 +526,12 @@ public class SwfXmlImporter { return Float.parseFloat(stringValue); } else if (cls == Double.class || cls == double.class) { return Double.parseDouble(stringValue); + } else if (cls == Decimal128.class) { + String sdec = stringValue; + if (sdec.endsWith("m")) { + sdec = sdec.substring(0, sdec.length() - 1); + } + return new Decimal128(sdec); } else if (cls == Boolean.class || cls == boolean.class) { return Boolean.parseBoolean(stringValue); } else if (cls == Character.class || cls == char.class) {