mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-07 01:20:15 +00:00
Removed newcli.
Colorized old cli.
This commit is contained in:
@@ -16,40 +16,19 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.commands.Main;
|
||||
import java.net.URLDecoder;
|
||||
import org.fusesource.jansi.AnsiConsole;
|
||||
import picocli.CommandLine;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CommandlineInterface {
|
||||
|
||||
/**
|
||||
* To bypass wrong encoded unicode characters coming from EXE, it Launch5j
|
||||
* encodes characters using URLEncoder.
|
||||
*
|
||||
*/
|
||||
private static void decodeLaunch5jArgs(String[] args) {
|
||||
String encargs = System.getProperty("l5j.encargs");
|
||||
if ("true".equals(encargs) || "1".equals(encargs)) {
|
||||
for (int i = 0; i < args.length; ++i) {
|
||||
try {
|
||||
args[i] = URLDecoder.decode(args[i], "UTF-8");
|
||||
} catch (Exception e) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CommandlineInterface {
|
||||
|
||||
public static void main(String[] args) {
|
||||
decodeLaunch5jArgs(args);
|
||||
AnsiConsole.systemInstall();
|
||||
int exitCode = new CommandLine(new Main()).execute(args);
|
||||
AnsiConsole.systemUninstall();
|
||||
System.exit(exitCode);
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length == 0) {
|
||||
args = new String[] {"--help"};
|
||||
}
|
||||
Main.main(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli;
|
||||
|
||||
import com.jpexs.decompiler.flash.ApplicationInfo;
|
||||
import picocli.CommandLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class VersionProvider implements CommandLine.IVersionProvider {
|
||||
@Override
|
||||
public String[] getVersion() throws Exception {
|
||||
return new String[]{ApplicationInfo.applicationVerName};
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "abcmerge",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Merge all ABC tags in SWF file to one.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli abcmerge input.swf output.swf",
|
||||
}
|
||||
)
|
||||
public class AbcMerge implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "compress",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Compress SWF file.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli compress input.swf out_compressed.swf",
|
||||
"ffdec-cli compress --kind=lzma input.swf out_compressed.swf",
|
||||
}
|
||||
)
|
||||
public class Compress implements Runnable {
|
||||
@Option(
|
||||
names = "--kind",
|
||||
description = "Compression kind. @|bold Enum values|@: ${COMPLETION-CANDIDATES} default: zlib"
|
||||
)
|
||||
CompressionKind kind = CompressionKind.zlib;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import java.awt.Point;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "config",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "List available configuration options.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli config",
|
||||
}
|
||||
)
|
||||
public class Config implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "decompress",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Decompress SWF file.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli decompress input.swf out_decompressed.swf",
|
||||
}
|
||||
)
|
||||
public class Decompress implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "decrypt",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Decrypt HARMAN Air encrypted SWF file.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli decrypt input.swf out_decrypted.swf",
|
||||
}
|
||||
)
|
||||
public class Decrypt implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "deobfuscate",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Deobfuscate AS3 P-code.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli deobfuscate input.swf output.swf",
|
||||
"ffdec-cli deobfuscate --level=deadcode input.swf output.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class Deobfuscate implements Runnable {
|
||||
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Option(
|
||||
names = "--level",
|
||||
description = {
|
||||
"Deobfuscation level.",
|
||||
"@|bold Enum values|@: ${COMPLETION-CANDIDATES}. Default: traps"
|
||||
}
|
||||
)
|
||||
DeobfuscateLevel level = DeobfuscateLevel.traps;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DumpKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name="dump",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Dump specific data of SWF file to console.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli dump swf c:/files/input.swf",
|
||||
"ffdec-cli dump as3 c:/files/input.swf",
|
||||
}
|
||||
)
|
||||
public class Dump implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
description = "Kind of data to dump. @|bold Enum values|@: ${COMPLETION-CANDIDATES}"
|
||||
)
|
||||
DumpKind kind;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inputFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "enabledebugging",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Enable debugging for SWF file.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli enabledebugging input.swf output.swf",
|
||||
"ffdec-cli enabledebugging --inject-as3 input.swf output.swf",
|
||||
"ffdec-cli enabledebugging --inject-as3 --pcode input.swf output.swf",
|
||||
"ffdec-cli enabledebugging --generate-swd input.swf output.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class EnableDebugging implements Runnable {
|
||||
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@ArgGroup(exclusive = true)
|
||||
InjectAs3OrGenerateSwd injectAs3OrGenerateSwd;
|
||||
|
||||
@Option(names = "--pcode")
|
||||
boolean pcode = false;
|
||||
|
||||
static class InjectAs3OrGenerateSwd {
|
||||
@Option(
|
||||
names = "--inject-as3",
|
||||
description = "Inject debugfile and debugline instructions into the code to match decompiled/pcode source.",
|
||||
required = true
|
||||
)
|
||||
boolean injectAs3;
|
||||
|
||||
@Option(
|
||||
names = "--generate-swd",
|
||||
description = "Create SWD file needed for AS1/2 debugging. for <outfile.swf>, <outfile.swd> is generated",
|
||||
required = true
|
||||
)
|
||||
boolean generateSwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ConfigConverter;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ExportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ExportObjectFormat;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ExportObjectFormatConverter;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.OnErrorMode;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.Selection;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.SelectionConverter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(name = "export",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Export sources to a directory.",
|
||||
//descriptionHeading = "%n@|bold,underline Description|@:%n",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli export --zoom=2 --character-id=51,43 shape:png,shape:bmp c:/out/ c:/files/input.swf",
|
||||
"ffdec-cli export --frame=2-10 frame:svg c:/out/ c:/files/input.swf",
|
||||
"ffdec-cli export --embed --class=mypkg.Main,other.+ script c:/out/ c:/files/input.swf",
|
||||
"ffdec-cli export all c:/out/ c:/files/input.swf",
|
||||
}
|
||||
)
|
||||
public class Export implements Runnable {
|
||||
|
||||
@ParentCommand
|
||||
private Main parent;
|
||||
|
||||
@Option(names = "--frame",
|
||||
paramLabel = "<frameRanges>",
|
||||
converter = SelectionConverter.class,
|
||||
description = {
|
||||
"Selected frame(s) to export.",
|
||||
"@|bold Sample values|@: 1-5 or 2,4 or 2-5,7,9-"
|
||||
}
|
||||
)
|
||||
private Selection frames = new Selection();
|
||||
|
||||
@Option(names = "--character-id",
|
||||
paramLabel = "<characterIdRanges>",
|
||||
converter = SelectionConverter.class,
|
||||
description = {
|
||||
"Selected character id(s) to export.",
|
||||
"@|bold Sample values|@: 27 or 2-5 or 12,24 or 2-5,10,9-"
|
||||
}
|
||||
)
|
||||
private Selection characterIds = new Selection();
|
||||
|
||||
@Option(names = "--class",
|
||||
paramLabel = "<class>",
|
||||
split = ",",
|
||||
description = {
|
||||
"Selected scripts to export by classname (ActionScript 3 ONLY).",
|
||||
"@|bold Sample values|@:",
|
||||
"com.example.MyClass",
|
||||
"com.example.+ (all classes in package \"com.example\")",
|
||||
"com.++,net.company.MyClass (all classes in package \"com\" and all subpackages, class net.company.MyClass)",
|
||||
})
|
||||
private List<String> classes = new ArrayList<>();
|
||||
|
||||
@Option(names = "--embed",
|
||||
description = {
|
||||
"Enables exporting embedded assets via [Embed tag].",
|
||||
"For script:as exports."
|
||||
}
|
||||
)
|
||||
private boolean useEmbed = false;
|
||||
|
||||
@Option(
|
||||
names = "--on-error",
|
||||
description = {
|
||||
"Error handling mode.",
|
||||
"@|bold Possible values|@:",
|
||||
" @|bold abort|@ - stops exporting",
|
||||
" @|bold retry|@ - retries exporting (see --num-retries option)",
|
||||
" @|bold ignore|@ - ignores current file"
|
||||
}
|
||||
)
|
||||
private OnErrorMode onError = OnErrorMode.abort;
|
||||
|
||||
@Option(
|
||||
names = "--num-retries",
|
||||
description = "Number of retries for option --on-error=retry. Default is 3."
|
||||
)
|
||||
private int numRetries = 3;
|
||||
|
||||
@Option(
|
||||
names = "--timeout-method",
|
||||
description = "Decompilation timeout for a single method in AS3 or single action in AS1/2 in seconds"
|
||||
)
|
||||
Integer methodTimeout = null;
|
||||
|
||||
@Option(
|
||||
names = "--timeout-total",
|
||||
description = "Total export timeout in seconds"
|
||||
)
|
||||
Integer totalTimeout = null;
|
||||
|
||||
@Option(
|
||||
names = "--timeout-file",
|
||||
description = "Export timeout for a single AS3 class in seconds"
|
||||
)
|
||||
Integer fileTimeout = null;
|
||||
|
||||
@Option(
|
||||
names = "--stats",
|
||||
description = "Show export performance statistics"
|
||||
)
|
||||
boolean showStatistics = false;
|
||||
|
||||
@Option (
|
||||
names = "--zoom",
|
||||
paramLabel = "<N>",
|
||||
description = "Apply zoom level"
|
||||
)
|
||||
Double zoom;
|
||||
|
||||
@Parameters(index = "0",
|
||||
split = ",",
|
||||
arity = "1",
|
||||
converter = ExportObjectFormatConverter.class,
|
||||
paramLabel = "<type[:format]>",
|
||||
description = {"What objects to export.",
|
||||
"@|bold Available types and formats|@:",
|
||||
"script:as|pcode|pcodehex|hex",
|
||||
"shape:svg|png|canvas|bmp|svg",
|
||||
"morphshape:svg|canvas",
|
||||
"frame:png|gif|avi|svg|canvas|pdf|bmp",
|
||||
"sprite:png|gif|avi|svg|canvas|pdf|bmp",
|
||||
"button:png|svg|bmp",
|
||||
"image:png_gif_jpeg|png|jpeg|bmp|png_gif_jpeg_alpha",
|
||||
"text:plain|formatted|svg",
|
||||
"sound:mp3_wav_flv|mp3_wav|wav|flv",
|
||||
"font:ttf|woff",
|
||||
"font4:cff",
|
||||
"fla:cs5|cs5.5|cs6|cc",
|
||||
"xfl:cs5|cs5.5|cs6|cc",
|
||||
"all (=everything except fla and xfl)"
|
||||
})
|
||||
private List<ExportObjectFormat> objects;
|
||||
|
||||
@Parameters(index = "1", description = "Target directory", paramLabel = "OUT_DIR")
|
||||
private String outDirectory;
|
||||
|
||||
@Parameters(index = "2", description = "Input file or directory", paramLabel = "IN_DIR_OR_FILE")
|
||||
private String inFileOrDirectory;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "flashpaper2pdf",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Convert FlashPaper SWF file to PDF.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli flashpaper2pdf input.swf output.pdf",
|
||||
"ffdec-cli flashpaper2pdf --zoom=3 input.swf output.pdf",
|
||||
}
|
||||
)
|
||||
public class FlashPaper2Pdf implements Runnable {
|
||||
@Option (
|
||||
names = "--zoom",
|
||||
paramLabel = "<N>",
|
||||
description = "Specify image quality"
|
||||
)
|
||||
Double zoom;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DocFormat;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "generatedoc",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Generate documentation.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli generatedoc --type=as3.pcode.instructions --format=html --locale=en --out=docs.en.html",
|
||||
"ffdec-cli generatedoc --type=as3.pcode.instructions --format=html --locale=cs --out=docs.cs.html",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class GenerateDoc implements Runnable {
|
||||
|
||||
@Option(
|
||||
names = "--type",
|
||||
description = "can be currently only: as3.pcode.instructions for list of ActionScript3 AVM2 instructions",
|
||||
required = true
|
||||
)
|
||||
String type;
|
||||
|
||||
@Option(
|
||||
names = "--format",
|
||||
description = "Selects output format. Currently only html is supported."
|
||||
)
|
||||
DocFormat format = DocFormat.html;
|
||||
|
||||
@Option(
|
||||
names = "--locale",
|
||||
description = "Override default locale. Sample value: en"
|
||||
)
|
||||
String locale = null;
|
||||
|
||||
@Option(
|
||||
names = "--out",
|
||||
description = "File to write docs into. If ommited, it is written to stdout."
|
||||
)
|
||||
String outputFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import java.awt.Point;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "header",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Display and manipulate SWF header values.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli header input.swf",
|
||||
"ffdec-cli header --set gfx=true --set width=1200 --out-file=output.swf input.swf",
|
||||
"ffdec-cli header --set displayrect=[0,0,800px,600px] input.swf",
|
||||
}
|
||||
)
|
||||
public class Header implements Runnable {
|
||||
|
||||
@Option(
|
||||
names = "--set",
|
||||
paramLabel = "<key>=<value>",
|
||||
description = {"Set values of the SWF header.",
|
||||
"@|bold Available keys|@: version\n" +
|
||||
" gfx (true/false)\n" +
|
||||
" displayrect ([x1,y1,x2,y2])\n" +
|
||||
" width\n" +
|
||||
" height\n" +
|
||||
" framecount\n" +
|
||||
" framerate"},
|
||||
arity = "0..*"
|
||||
)
|
||||
Map<String, String> setValues;
|
||||
|
||||
@Option(
|
||||
names = "--out-file",
|
||||
description = "Output file to write modifications. If ommited, file is modified inplace."
|
||||
)
|
||||
String outFile = null;
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "import",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Bulk import items to the SWF.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli import sound input.swf output.swf c:/sounds/",
|
||||
"ffdec-cli import --update-bounds shape input.swf output.swf c:/shapes/",
|
||||
"ffdec-cli import symbolclass input.swf output.swf c:/data/sc.csv",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class Import implements Runnable {
|
||||
|
||||
@Option(
|
||||
names = "--air",
|
||||
description = "Use AIR (airglobal.swc) for AS3 compilation instead of playerglobal.swc"
|
||||
)
|
||||
boolean air = false;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "<itemKind>",
|
||||
description = {
|
||||
"Item kind to import.",
|
||||
"@|bold Enum values|@: ${COMPLETION-CANDIDATES}"
|
||||
}
|
||||
)
|
||||
ImportObject itemKind;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "2",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Parameters(
|
||||
index = "3",
|
||||
paramLabel = "DATA_DIR",
|
||||
description = "Data directory containing imported items. For symbolclass item kind, it is a file instead of directory."
|
||||
)
|
||||
String dataDirectory;
|
||||
|
||||
@Option(
|
||||
names = "--update-bounds",
|
||||
description = "For shape import: Update shape bounds (no fill)",
|
||||
order = 1
|
||||
)
|
||||
boolean updateShapeBounds;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "instancemetadata",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Instance metadata operations.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
sortSynopsis = false,
|
||||
subcommands = {
|
||||
InstanceMetadataGet.class,
|
||||
InstanceMetadataSet.class,
|
||||
InstanceMetadataRemove.class
|
||||
}
|
||||
)
|
||||
public class InstanceMetadata {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.InstanceMetadataFormat;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "get",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Get instance metadata.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli instancemetadata get --instance=myitem --key=subkey1 input.swf",
|
||||
"ffdec-cli instancemetadata get --instance=other --data-file=output.json input.swf",
|
||||
"ffdec-cli instancemetadata get --instance=third --data-file=output.bin --output-format=raw input.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class InstanceMetadataGet implements Runnable {
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--output-format",
|
||||
description = "Format of output. @|bold Enum values|@: ${COMPLETION-CANDIDATES} Default is jslike."
|
||||
)
|
||||
InstanceMetadataFormat outputFormat = InstanceMetadataFormat.jslike;
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--key",
|
||||
paramLabel = "<key>",
|
||||
description = "Name of subkey to display. When present, only value from subkey <key> is shown, whole object value otherwise."
|
||||
)
|
||||
String key;
|
||||
|
||||
@Option(
|
||||
names = "--instance",
|
||||
description = "Name of instance to fetch metadata from.",
|
||||
required = true
|
||||
)
|
||||
String instance;
|
||||
|
||||
@Option(
|
||||
names = "--data-file",
|
||||
description = "File to write the data to. If ommited, stdout is used."
|
||||
)
|
||||
String outFile = null;
|
||||
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.InstanceMetadataFormat;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "remove",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Remove instance metadata.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli instancemetadata remove --instance=myitem --key=subkey1 input.swf",
|
||||
"ffdec-cli instancemetadata remove --instance=other --out-file=output.swf input.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class InstanceMetadataRemove implements Runnable {
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--key",
|
||||
paramLabel = "<key>",
|
||||
description = {
|
||||
"Name of subkey to remove. When present, only the value from subkey <key> of the AMF object is removed.",
|
||||
"Otherwise all metadata are removed from the instance."
|
||||
}
|
||||
)
|
||||
String key;
|
||||
|
||||
@Option(
|
||||
names = "--instance",
|
||||
description = "Name of instance to remove data from.",
|
||||
required = true
|
||||
)
|
||||
String instance;
|
||||
|
||||
@Option(
|
||||
names = "--out-file",
|
||||
description = "Where to save resulting file. If ommited, original SWF file is overwritten."
|
||||
)
|
||||
String outFile = null;
|
||||
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.DeobfuscateLevel;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ImportObject;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.InstanceMetadataFormat;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "set",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Set instance metadata.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli instancemetadata set --instance=myitem --key=subkey1 --value=5 --out-file=output.swf input.swf",
|
||||
"ffdec-cli instancemetadata set --instance=other --data-file=input.bin --input-format=raw input.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class InstanceMetadataSet implements Runnable {
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--input-format",
|
||||
description = "Format of input data. @|bold Enum values|@: ${COMPLETION-CANDIDATES} Default is jslike."
|
||||
)
|
||||
InstanceMetadataFormat inputFormat = InstanceMetadataFormat.jslike;
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--key",
|
||||
paramLabel = "<key>",
|
||||
description = {
|
||||
"Name of subkey to use. When present, the value is set as object property with the <key> name.",
|
||||
"Otherwise the value is set directly to the instance without any subkeys."
|
||||
}
|
||||
)
|
||||
String key;
|
||||
|
||||
@ArgGroup(exclusive = true, multiplicity = "1")
|
||||
ValueOrDataFile valueOrDataFile;
|
||||
|
||||
|
||||
static class ValueOrDataFile {
|
||||
@Option(
|
||||
names = "--value",
|
||||
description = "Value to set."
|
||||
)
|
||||
String value = null;
|
||||
|
||||
@Option(
|
||||
names = "--data-file",
|
||||
description = "Value to set from file."
|
||||
)
|
||||
String dataFile = null;
|
||||
|
||||
}
|
||||
|
||||
@Option(
|
||||
names = "--instance",
|
||||
description = "Name of instance to replace metadata in.",
|
||||
required = true
|
||||
)
|
||||
String instance;
|
||||
|
||||
@Option(
|
||||
names = "--out-file",
|
||||
description = "Where to save resulting file. If ommited, original SWF file is overwritten."
|
||||
)
|
||||
String outFile = null;
|
||||
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "linkreport",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Generate linker report for the swffile.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli linkreport input.swf",
|
||||
"ffdec-cli linkreport --out-file=out.xml input.swf"
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class LinkReport implements Runnable {
|
||||
|
||||
@Option(
|
||||
names = "--out-file",
|
||||
paramLabel = "<outFile>",
|
||||
description = "Saves XML report to <outFile>. When ommited, the report is printed to stdout."
|
||||
)
|
||||
String outFile = null;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
import com.jpexs.decompiler.flash.ApplicationInfo;
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ConfigConverter;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.IVersionProvider;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.HelpCommand;
|
||||
import picocli.CommandLine.ScopeType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(name="ffdec-cli",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
subcommands = {
|
||||
HelpCommand.class,
|
||||
Export.class,
|
||||
Dump.class,
|
||||
Compress.class,
|
||||
Decompress.class,
|
||||
Decrypt.class,
|
||||
Swf2Xml.class,
|
||||
Xml2Swf.class,
|
||||
FlashPaper2Pdf.class,
|
||||
Replace.class,
|
||||
ReplaceAlpha.class,
|
||||
ReplaceCharacter.class,
|
||||
ReplaceCharacterId.class,
|
||||
Remove.class,
|
||||
RemoveCharacter.class,
|
||||
Import.class,
|
||||
Deobfuscate.class,
|
||||
EnableDebugging.class,
|
||||
GenerateDoc.class,
|
||||
InstanceMetadata.class,
|
||||
LinkReport.class,
|
||||
Swf2Swc.class,
|
||||
AbcMerge.class,
|
||||
Swf2Exe.class,
|
||||
Header.class,
|
||||
Config.class,
|
||||
Old.class
|
||||
},
|
||||
descriptionHeading = "%n@|bold,underline Description|@:%n",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
description = {"JPEXS Free Flash Decompiler commandline interface"},
|
||||
commandListHeading = "%n@|bold,underline Commands|@:%n"
|
||||
)
|
||||
public class Main {
|
||||
|
||||
@Option(names = "--config",
|
||||
paramLabel = "<key>=<value>[,<key>=<value>...]",
|
||||
converter = ConfigConverter.class,
|
||||
description = {
|
||||
"Set configuration values for this session.",
|
||||
"Use command 'config' to list available configuration settings. "
|
||||
},
|
||||
scope = ScopeType.INHERIT
|
||||
)
|
||||
private Map<String, String> configs = new HashMap<>();
|
||||
|
||||
@Option(
|
||||
names = "--charset",
|
||||
description = "Set desired character set for reading/writing SWF files with SWF version <= 5",
|
||||
scope = ScopeType.INHERIT
|
||||
)
|
||||
String charset = null;
|
||||
/*@Parameters(paramLabel = "FILE", description = "one or more files to open in GUI")
|
||||
private File[] files; */
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.legacy.CommandLineArgumentParser;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@CommandLine.Command(
|
||||
name = "old",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Old legacy commandline interface.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli old",
|
||||
"ffdec-cli old -export script -format script:pcode outdir/ file.swf"
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class Old implements Runnable {
|
||||
|
||||
@Parameters (
|
||||
index = "0",
|
||||
arity = "0..*"
|
||||
)
|
||||
String args[] = new String[]{};
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length == 0) {
|
||||
args = new String[] {"--help"};
|
||||
}
|
||||
try {
|
||||
CommandLineArgumentParser.parseArguments(args);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Old.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "remove",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Remove a tag from the SWF.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli remove --tag-index=12 --tag-index=13 input.swf output.swf",
|
||||
"ffdec-cli remove --tag-index=5 input.swf output.swf"
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class Remove implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Option(
|
||||
names = "--tag-index",
|
||||
description = "Index of tag on SWF timeline",
|
||||
paramLabel = "<tagIndex>",
|
||||
required = true,
|
||||
arity = "1..*"
|
||||
)
|
||||
List<Integer> tagIndices;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "removecharacter",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Remove a character tag from the SWF.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli removecharacter --character-id=12 --character-id=29 input.swf output.swf",
|
||||
"ffdec-cli removecharacter --character-id=13,57 input.swf output.swf",
|
||||
"ffdec-cli removecharacter --with-dependencies --character-id=130 input.swf output.swf",
|
||||
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class RemoveCharacter implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Option(
|
||||
names = "--with-dependencies",
|
||||
description = "Remove with dependencies"
|
||||
)
|
||||
boolean withDependencies;
|
||||
|
||||
@Option(
|
||||
names = "--character-id",
|
||||
split = ",",
|
||||
description = "Character id",
|
||||
paramLabel = "<characterId>",
|
||||
required = true,
|
||||
arity = "1..*"
|
||||
)
|
||||
List<Integer> characterIds;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "replace",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Replace the data of the specified items.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli replace --character-id=27 --update-bounds --data-file=char27.svg --character-id=43 --data-file=char43.jpg --format=lossless2 input.swf output.swf",
|
||||
"ffdec-cli replace --character-id=12 --data-file=data.bin input.swf output.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class Replace implements Runnable {
|
||||
|
||||
@Option(
|
||||
names = "--air",
|
||||
description = "Use AIR (airglobal.swc) for AS3 compilation instead of playerglobal.swc"
|
||||
)
|
||||
boolean air = false;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@ArgGroup(exclusive = false, multiplicity = "1..*")
|
||||
List<Item> items;
|
||||
|
||||
static class Item {
|
||||
|
||||
@ArgGroup(exclusive = true, multiplicity = "1", order = 0)
|
||||
CharacterIdOrScriptName characterIdOrScriptName;
|
||||
|
||||
@Option(
|
||||
names = "--update-bounds",
|
||||
description = "Update shape bounds (no fill)",
|
||||
order = 1
|
||||
)
|
||||
boolean updateShapeBounds;
|
||||
|
||||
@Option(
|
||||
names = "--format",
|
||||
description = {
|
||||
"Input format for images or shapes.",
|
||||
"@|bold Enum values|@: ${COMPLETION-CANDIDATES}"
|
||||
},
|
||||
order = 2
|
||||
)
|
||||
ReplaceFormat format = null;
|
||||
|
||||
@Option(
|
||||
names = "--body-id",
|
||||
description = "Method body index if the imported entity is an AS3 P-Code",
|
||||
order = 3
|
||||
)
|
||||
Integer bodyIndex = null;
|
||||
|
||||
@Option(
|
||||
names = {"--data-file"},
|
||||
description = "Imported data file",
|
||||
required = true,
|
||||
order = 4
|
||||
)
|
||||
String dataFile;
|
||||
}
|
||||
|
||||
static class CharacterIdOrScriptName {
|
||||
@Option(
|
||||
names = "--character-id",
|
||||
description = "Character id. -1 for main timeline sound stream.",
|
||||
required = true
|
||||
)
|
||||
int characterId;
|
||||
|
||||
@Option(
|
||||
names = "--script-name",
|
||||
description = "Name of the script",
|
||||
required = true
|
||||
)
|
||||
String scriptName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "replacealpha",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Replace the alpha channel of the specified JPEG3/4 tag.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli replacealpha --character-id=13 --data-file=alpha13.bin --character-id=32 --data-file=alpha32.bin input.swf output.swf",
|
||||
"ffdec-cli replacealpha --character-id=14 --data-file=data.bin input.swf output.swf",
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class ReplaceAlpha implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@ArgGroup(exclusive = false, multiplicity = "1..*")
|
||||
List<Item> items;
|
||||
|
||||
static class Item {
|
||||
|
||||
@Option(
|
||||
names = "--character-id",
|
||||
description = "Character id",
|
||||
required = true,
|
||||
order = 0
|
||||
)
|
||||
int characterId;
|
||||
|
||||
@Option(
|
||||
names = {"--data-file"},
|
||||
description = "Imported data file",
|
||||
required = true,
|
||||
order = 4
|
||||
)
|
||||
String dataFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "replacecharacter",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Replace a character tag with other character.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli replacecharacter --old-id=12 --new-id=15 --old-id=56 --new-id=49 input.swf output.swf",
|
||||
"ffdec-cli replacecharacter --old-id=7 --new-id=9 input.swf output.swf"
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class ReplaceCharacter implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@ArgGroup(exclusive = false, multiplicity = "1..*")
|
||||
List<Item> items;
|
||||
|
||||
static class Item {
|
||||
|
||||
@Option(
|
||||
names = "--old-id",
|
||||
description = "Old character id",
|
||||
required = true,
|
||||
order = 0
|
||||
)
|
||||
int oldCharacterId;
|
||||
|
||||
@Option(
|
||||
names = {"--new-id"},
|
||||
description = "New character id",
|
||||
required = true,
|
||||
order = 1
|
||||
)
|
||||
int newCharacterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ReplaceFormat;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "replacecharacterid",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Replace a character id with another.",
|
||||
optionListHeading = "%n@|bold,underline Options|@:%n",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Examples|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli replacecharacterid --old-id=12 --new-id=15 --old-id=56 --new-id=49 input.swf output.swf",
|
||||
"ffdec-cli replacecharacterid --old-id=7 --new-id=9 input.swf output.swf",
|
||||
"ffdec-cli replacecharacterid --pack input.swf output.swf",
|
||||
"ffdec-cli replacecharacterid --sort input.swf output.swf"
|
||||
},
|
||||
sortSynopsis = false
|
||||
)
|
||||
public class ReplaceCharacterId implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@ArgGroup(exclusive = true)
|
||||
PackOrSort packOrSort;
|
||||
|
||||
|
||||
static class PackOrSort {
|
||||
@Option(
|
||||
names = "--pack",
|
||||
description = "Removes the spaces between the character ids (1,4,3 => 1,3,2)",
|
||||
required = true
|
||||
)
|
||||
boolean pack;
|
||||
|
||||
@Option(
|
||||
names = "--sort",
|
||||
description = "Assigns increasing IDs to the character tags + pack (1,4,3 => 1,2,3)",
|
||||
required = true
|
||||
)
|
||||
boolean sort;
|
||||
}
|
||||
|
||||
|
||||
@ArgGroup(exclusive = false, multiplicity = "0..*")
|
||||
List<Item> items;
|
||||
|
||||
static class Item {
|
||||
|
||||
@Option(
|
||||
names = "--old-id",
|
||||
description = "Old character id",
|
||||
required = true,
|
||||
order = 0
|
||||
)
|
||||
int oldCharacterId;
|
||||
|
||||
@Option(
|
||||
names = {"--new-id"},
|
||||
description = "New character id",
|
||||
required = true,
|
||||
order = 1
|
||||
)
|
||||
int newCharacterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.ExeExportMode;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "swf2exe",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Export SWF to executable file.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli swf2exe --mode=wrapper input.swf output.exe",
|
||||
}
|
||||
)
|
||||
public class Swf2Exe implements Runnable {
|
||||
|
||||
|
||||
@Option(
|
||||
names = "--mode",
|
||||
description = "Export mode. @|bold Enum values|@: ${COMPLETION-CANDIDATES}",
|
||||
required = true
|
||||
)
|
||||
ExeExportMode mode;
|
||||
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "swf2swc",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Generate SWC file from SWF.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli swf2swc input.swf output.swc",
|
||||
}
|
||||
)
|
||||
public class Swf2Swc implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "swf2xml",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Convert SWF file to XML.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli swf2xml input.swf out.xml",
|
||||
}
|
||||
)
|
||||
public class Swf2Xml implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands;
|
||||
|
||||
import com.jpexs.decompiler.flash.cli.VersionProvider;
|
||||
import com.jpexs.decompiler.flash.cli.commands.types.CompressionKind;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Parameters;
|
||||
import picocli.CommandLine.ParentCommand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@Command(
|
||||
name = "xml2swf",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = VersionProvider.class,
|
||||
header = "Convert XML file to SWF.",
|
||||
parameterListHeading = "%n@|bold,underline Parameters|@:%n",
|
||||
synopsisHeading = "@|bold,underline Usage|@:",
|
||||
footerHeading = "%n@|bold,underline Example|@:%n",
|
||||
footer = {
|
||||
"ffdec-cli xml2swf input.swf out.xml",
|
||||
}
|
||||
)
|
||||
public class Xml2Swf implements Runnable {
|
||||
@Parameters(
|
||||
index = "0",
|
||||
paramLabel = "IN_FILE",
|
||||
description = "Input file"
|
||||
)
|
||||
String inFile;
|
||||
|
||||
@Parameters(
|
||||
index = "1",
|
||||
paramLabel = "OUT_FILE",
|
||||
description = "Output file"
|
||||
)
|
||||
String outFile;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum CompressionKind {
|
||||
zlib, lzma
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import picocli.CommandLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConfigConverter implements CommandLine.ITypeConverter<Map<String,String>>{
|
||||
|
||||
@Override
|
||||
public Map<String, String> convert(String value) throws Exception {
|
||||
String[] cfgs;
|
||||
if (value.contains(",")) {
|
||||
cfgs = value.split(",");
|
||||
} else {
|
||||
cfgs = new String[]{value};
|
||||
}
|
||||
|
||||
Map<String, String> ret = new HashMap<>();
|
||||
|
||||
for (String c : cfgs) {
|
||||
String[] cp = c.split("=");
|
||||
if (cp.length == 1) {
|
||||
cp = new String[]{cp[0], "1"};
|
||||
}
|
||||
ret.put(cp[0], cp[1]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum DeobfuscateLevel {
|
||||
deadcode, traps
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum DocFormat {
|
||||
html
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum DumpKind {
|
||||
swf, as2, as3
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ExeExportMode {
|
||||
wrapper, projector_win, projector_mac, projector_linux
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ButtonExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.Font4ExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FrameExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MorphShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MovieExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SpriteExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SymbolClassExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
|
||||
import com.jpexs.decompiler.flash.types.sound.SoundExportFormat;
|
||||
import com.jpexs.decompiler.flash.xfl.FLAVersion;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ExportObject {
|
||||
SCRIPT(ScriptExportMode.class),
|
||||
IMAGE(ImageExportMode.class),
|
||||
SHAPE(ShapeExportMode.class),
|
||||
MORPHSHAPE(MorphShapeExportMode.class),
|
||||
MOVIE(MovieExportMode.class),
|
||||
FONT(FontExportMode.class),
|
||||
FONT4(Font4ExportMode.class),
|
||||
FRAME(FrameExportMode.class),
|
||||
SPRITE(SpriteExportMode.class),
|
||||
BUTTON(ButtonExportMode.class),
|
||||
SOUND(SoundExportMode.class),
|
||||
BINARYDATA(BinaryDataExportMode.class),
|
||||
SYMBOLCLASS(SymbolClassExportMode.class),
|
||||
TEXT(TextExportMode.class),
|
||||
ALL(null),
|
||||
FLA(FLAVersion.class),
|
||||
XFL(FLAVersion.class);
|
||||
|
||||
private Class formatsEnum;
|
||||
|
||||
ExportObject(Class formatsEnum) {
|
||||
this.formatsEnum = formatsEnum;
|
||||
}
|
||||
|
||||
public List<Object> getAllowedFormats() {
|
||||
if (formatsEnum == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return Arrays.asList(formatsEnum.getEnumConstants());
|
||||
}
|
||||
public List<String> getAllowedFormatsAsStr() {
|
||||
if (formatsEnum == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> ret = new ArrayList<>();
|
||||
for (Object o : formatsEnum.getEnumConstants()) {
|
||||
ret.add(o.toString().toLowerCase());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ExportObjectFormat {
|
||||
public ExportObject object;
|
||||
public String format;
|
||||
|
||||
public ExportObjectFormat(ExportObject type, String format) {
|
||||
this.object = type;
|
||||
this.format = format;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import picocli.CommandLine;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ExportObjectFormatConverter implements CommandLine.ITypeConverter<ExportObjectFormat>{
|
||||
|
||||
@Override
|
||||
public ExportObjectFormat convert(String value) throws Exception {
|
||||
Pattern pat = Pattern.compile("^(?<type>[a-z0-9]+)(:(?<format>[a-z0-9]+))?$");
|
||||
Matcher mat = pat.matcher(value);
|
||||
if (!mat.matches()) {
|
||||
throw new CommandLine.TypeConversionException("Invalid value: must be 'type:format' or 'type' but was '" + value + "'");
|
||||
}
|
||||
String typeStr = mat.group("type");
|
||||
String formatStr = mat.group("format");
|
||||
ExportObject type = null;
|
||||
try {
|
||||
type = ExportObject.valueOf(typeStr.toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
List<String> ts = new ArrayList<>();
|
||||
for (ExportObject t : ExportObject.values()) {
|
||||
ts.add("'" + ts.toString().toLowerCase() + "'");
|
||||
}
|
||||
throw new CommandLine.TypeConversionException("Invalid type: must be one of " + String.join(", ", ts) + " but was '" + typeStr+ "'");
|
||||
}
|
||||
List<String> allowedFormats = type.getAllowedFormatsAsStr();
|
||||
if (!allowedFormats.isEmpty() && formatStr != null) {
|
||||
if (!allowedFormats.contains(formatStr)) {
|
||||
throw new CommandLine.TypeConversionException("Invalid format: for type '" + type + "' must format be one of '" + String.join("', '", allowedFormats) + "' but was " + formatStr);
|
||||
}
|
||||
}
|
||||
|
||||
return new ExportObjectFormat(type, formatStr);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ImportObject {
|
||||
symbolclass,movie,sound,shape,image,sprite,text,script
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum InstanceMetadataFormat {
|
||||
jslike, raw
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum OnErrorMode {
|
||||
abort, retry, ignore
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Range {
|
||||
|
||||
public Integer min;
|
||||
|
||||
public Integer max;
|
||||
|
||||
public Range(Integer min, Integer max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public boolean contains(int index) {
|
||||
int minimum = min == null ? Integer.MIN_VALUE : min;
|
||||
int maximum = max == null ? Integer.MAX_VALUE : max;
|
||||
|
||||
return index >= minimum && index <= maximum;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ReplaceFormat {
|
||||
lossless, lossless2, jpeg2, jpeg3, jpeg4
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Selection {
|
||||
|
||||
public List<Range> ranges;
|
||||
|
||||
public Selection() {
|
||||
this.ranges = new ArrayList<>();
|
||||
this.ranges.add(new Range(null, null));
|
||||
}
|
||||
|
||||
public Selection(List<Range> ranges) {
|
||||
this.ranges = ranges;
|
||||
}
|
||||
|
||||
public boolean contains(int index) {
|
||||
for (Range r : ranges) {
|
||||
if (r.contains(index)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.commands.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import picocli.CommandLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SelectionConverter implements CommandLine.ITypeConverter<Selection>{
|
||||
|
||||
@Override
|
||||
public Selection convert(String value) throws Exception {
|
||||
List<Range> ret = new ArrayList<>();
|
||||
|
||||
String[] ranges;
|
||||
if (value.contains(",")) {
|
||||
ranges = value.split(",");
|
||||
} else {
|
||||
ranges = new String[]{value};
|
||||
}
|
||||
for (String r : ranges) {
|
||||
Integer min = null;
|
||||
Integer max = null;
|
||||
if (r.contains("-")) {
|
||||
String[] ps = r.split("\\-");
|
||||
if (ps.length != 2) {
|
||||
throw new CommandLine.TypeConversionException("Invalid range: " + r);
|
||||
}
|
||||
try {
|
||||
if (!"".equals(ps[0])) {
|
||||
min = Integer.parseInt(ps[0]);
|
||||
}
|
||||
if (!"".equals(ps[1])) {
|
||||
max = Integer.parseInt(ps[1]);
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new CommandLine.TypeConversionException("Invalid range: " + r);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
min = Integer.parseInt(r);
|
||||
max = min;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new CommandLine.TypeConversionException("Invalid range: " + r);
|
||||
}
|
||||
}
|
||||
ret.add(new Range(min, max));
|
||||
}
|
||||
return new Selection(ret);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2023 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.legacy;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConsoleAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler {
|
||||
|
||||
int errorCount = 0;
|
||||
|
||||
int errorMode;
|
||||
|
||||
int retryCount;
|
||||
|
||||
public ConsoleAbortRetryIgnoreHandler(int errorMode, int retryCount) {
|
||||
this.errorMode = errorMode;
|
||||
this.retryCount = retryCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int handle(Throwable thrown) {
|
||||
if (errorMode != AbortRetryIgnoreHandler.UNDEFINED) {
|
||||
int result = errorMode;
|
||||
|
||||
if (errorMode == AbortRetryIgnoreHandler.RETRY && errorCount < retryCount) {
|
||||
errorCount++;
|
||||
} else {
|
||||
result = AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Scanner sc = new Scanner(System.in);
|
||||
if (thrown != null) {
|
||||
Logger.getLogger(ConsoleAbortRetryIgnoreHandler.class.getName()).log(Level.SEVERE, "Error occured", thrown);
|
||||
System.out.println("Error occured: " + thrown.getLocalizedMessage());
|
||||
}
|
||||
do {
|
||||
System.out.print("Select action: (A)bort, (R)Retry, (I)Ignore:");
|
||||
String n = sc.nextLine();
|
||||
switch (n.toLowerCase(Locale.ENGLISH)) {
|
||||
case "a":
|
||||
return AbortRetryIgnoreHandler.ABORT;
|
||||
case "r":
|
||||
return AbortRetryIgnoreHandler.RETRY;
|
||||
case "i":
|
||||
return AbortRetryIgnoreHandler.IGNORE;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbortRetryIgnoreHandler getNewInstance() {
|
||||
return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cli.legacy;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* FileInputStream to which can be passed /dev/stdin as special file for stdin
|
||||
* on Windows. On linux, standard /dev/stdin is used.
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class StdInAwareFileInputStream extends InputStream implements AutoCloseable {
|
||||
|
||||
public static final String STDIN_PATH = "/dev/stdin";
|
||||
|
||||
private InputStream is;
|
||||
|
||||
public StdInAwareFileInputStream(File file) throws FileNotFoundException {
|
||||
String absPath = file.getPath().replace("\\", "/");
|
||||
if (absPath.equals(STDIN_PATH) && !file.exists()) {
|
||||
is = System.in;
|
||||
} else {
|
||||
is = new FileInputStream(file);
|
||||
}
|
||||
}
|
||||
|
||||
public StdInAwareFileInputStream(String file) throws FileNotFoundException {
|
||||
this(new File(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return is.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
return is.skip(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() throws IOException {
|
||||
is.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
is.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return is.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b) throws IOException {
|
||||
return is.read(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
return is.read(b, off, len);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user