Mark Rocksim imported data files as legacy
This commit is contained in:
parent
34214dfaf1
commit
eaf0b2358a
@ -59,12 +59,13 @@ public class OpenRocketComponentSaver {
|
|||||||
*
|
*
|
||||||
* @param theMaterialList the list of materials to be included
|
* @param theMaterialList the list of materials to be included
|
||||||
* @param thePresetList the list of presets to be included
|
* @param thePresetList the list of presets to be included
|
||||||
|
* @param isLegacy true if the legacy format should be used
|
||||||
*
|
*
|
||||||
* @return ORC-compliant XML
|
* @return ORC-compliant XML
|
||||||
*
|
*
|
||||||
* @throws JAXBException
|
* @throws JAXBException
|
||||||
*/
|
*/
|
||||||
public String marshalToOpenRocketComponent(List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws
|
public String marshalToOpenRocketComponent(List<Material> theMaterialList, List<ComponentPreset> thePresetList, boolean isLegacy) throws
|
||||||
JAXBException {
|
JAXBException {
|
||||||
/** The context is thread-safe, but marshallers are not. Create a local one. */
|
/** The context is thread-safe, but marshallers are not. Create a local one. */
|
||||||
Marshaller marshaller = context.createMarshaller();
|
Marshaller marshaller = context.createMarshaller();
|
||||||
@ -97,9 +98,23 @@ public class OpenRocketComponentSaver {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
marshaller.marshal(toOpenRocketComponentDTO(theMaterialList, thePresetList), sw);
|
marshaller.marshal(toOpenRocketComponentDTO(theMaterialList, thePresetList, isLegacy), sw);
|
||||||
return sw.toString();
|
return sw.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method marshals a list of materials and ComponentPresets into an .orc formatted XML string.
|
||||||
|
*
|
||||||
|
* @param theMaterialList the list of materials to be included
|
||||||
|
* @param thePresetList the list of presets to be included
|
||||||
|
*
|
||||||
|
* @return ORC-compliant XML
|
||||||
|
*
|
||||||
|
* @throws JAXBException
|
||||||
|
*/
|
||||||
|
public String marshalToOpenRocketComponent(List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws
|
||||||
|
JAXBException {
|
||||||
|
return marshalToOpenRocketComponent(theMaterialList, thePresetList, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,8 +171,9 @@ public class OpenRocketComponentSaver {
|
|||||||
*
|
*
|
||||||
* @return a corresponding ORC representation
|
* @return a corresponding ORC representation
|
||||||
*/
|
*/
|
||||||
private OpenRocketComponentDTO toOpenRocketComponentDTO(List<Material> theMaterialList, List<ComponentPreset> thePresetList) {
|
private OpenRocketComponentDTO toOpenRocketComponentDTO(List<Material> theMaterialList, List<ComponentPreset> thePresetList, boolean isLegacy) {
|
||||||
OpenRocketComponentDTO rsd = new OpenRocketComponentDTO();
|
OpenRocketComponentDTO rsd = new OpenRocketComponentDTO();
|
||||||
|
rsd.setLegacy(isLegacy);
|
||||||
|
|
||||||
if (theMaterialList != null) {
|
if (theMaterialList != null) {
|
||||||
for (Material material : theMaterialList) {
|
for (Material material : theMaterialList) {
|
||||||
|
@ -51,7 +51,7 @@ public class RocksimComponentFileTranslator {
|
|||||||
|
|
||||||
MaterialHolder materialMap = loadAll(allPresets, new File(args[0]));
|
MaterialHolder materialMap = loadAll(allPresets, new File(args[0]));
|
||||||
LOGGER.println("\tMarshalling to XML");
|
LOGGER.println("\tMarshalling to XML");
|
||||||
String xml = new OpenRocketComponentSaver().marshalToOpenRocketComponent(new ArrayList<Material>(materialMap.values()), allPresets);
|
String xml = new OpenRocketComponentSaver().marshalToOpenRocketComponent(new ArrayList<Material>(materialMap.values()), allPresets, true);
|
||||||
|
|
||||||
// Try parsing the file
|
// Try parsing the file
|
||||||
LOGGER.println("\tValidating XML");
|
LOGGER.println("\tValidating XML");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user