mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-17 18:01:59 +00:00
Add Symbol-Class export support for commandline
This commit is contained in:
@@ -15,8 +15,11 @@
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
import com.jpexs.decompiler.flash.EventListener;
|
||||
import com.jpexs.decompiler.flash.ReadOnlyTagList;
|
||||
import com.jpexs.decompiler.flash.RetryTask;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.SymbolClassExportSettings;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
|
||||
@@ -39,7 +42,7 @@ public class SymbolClassExporter {
|
||||
public class SymbolClassExporter {
|
||||
|
||||
public static final String SYMBOL_CLASS_EXPORT_FILENAME = "symbols.csv";
|
||||
|
||||
|
||||
public List<File> exportNames(AbortRetryIgnoreHandler handler, final String outdir, ReadOnlyTagList tags, SymbolClassExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
int count = 0;
|
||||
@@ -56,21 +59,23 @@ public class SymbolClassExporter {
|
||||
File foutdir = new File(outdir);
|
||||
Path.createDirectorySafe(foutdir);
|
||||
|
||||
final File file = new File(outdir + File.separator + SYMBOL_CLASS_EXPORT_FILENAME);
|
||||
try (Writer writer = new BufferedWriter(new Utf8OutputStreamWriter(new FileOutputStream(file)))) {
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof ExportAssetsTag) {
|
||||
ExportAssetsTag eat = (ExportAssetsTag) t;
|
||||
for (int i = 0; i < eat.tags.size(); i++) {
|
||||
writer.append(eat.tags.get(i) + ";" + eat.names.get(i) + Helper.newLine);
|
||||
}
|
||||
} else if (t instanceof SymbolClassTag) {
|
||||
SymbolClassTag sct = (SymbolClassTag) t;
|
||||
for (int i = 0; i < sct.tags.size(); i++) {
|
||||
final File file = new File(outdir + File.separator + SYMBOL_CLASS_EXPORT_FILENAME);
|
||||
new RetryTask(() -> {
|
||||
try (Writer writer = new BufferedWriter(new Utf8OutputStreamWriter(new FileOutputStream(file)))) {
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof ExportAssetsTag) {
|
||||
ExportAssetsTag eat = (ExportAssetsTag) t;
|
||||
for (int i = 0; i < eat.tags.size(); i++) {
|
||||
writer.append(eat.tags.get(i) + ";" + eat.names.get(i) + Helper.newLine);
|
||||
}
|
||||
} else if (t instanceof SymbolClassTag) {
|
||||
SymbolClassTag sct = (SymbolClassTag) t;
|
||||
for (int i = 0; i < sct.tags.size(); i++) {
|
||||
writer.append(sct.tags.get(i) + ";" + sct.names.get(i) + Helper.newLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
ret.add(file);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters.settings;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SymbolClassExportMode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dofera
|
||||
*/
|
||||
public class SymbolClassExportSettings {
|
||||
|
||||
public static final String EXPORT_FOLDER_NAME = "symbolClass";
|
||||
|
||||
public SymbolClassExportMode mode;
|
||||
|
||||
public SymbolClassExportSettings(SymbolClassExportMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user