Separated FFDec core library and the rest (GUI).

FFDec Library is now LGPLv3, others stay GPLv3.
Version changed to 3.0.0 for FFDec, 1.0.0 for FFDec Library.
This commit is contained in:
Jindra Petřík
2014-08-24 17:55:42 +02:00
parent 2479c59b03
commit 04922aaf69
1323 changed files with 53605 additions and 52175 deletions

View File

@@ -0,0 +1,84 @@
/*
* Copyright (C) 2014 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;
import com.jpexs.helpers.SwfHeaderStreamSearch;
import com.jpexs.helpers.streams.SeekableInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
*
* @author JPEXS
*/
public class BinarySWFBundle implements SWFBundle {
private final SWFSearch search;
public BinarySWFBundle(InputStream is, boolean noCheck, SearchMode searchMode) throws IOException {
search = new SWFSearch(new SwfHeaderStreamSearch(is), noCheck, searchMode);
search.process();
}
@Override
public int length() {
return search.length();
}
@Override
public Set<String> getKeys() {
Set<String> ret = new HashSet<>();
for (Long address : search.getAddresses()) {
ret.add("[" + address + "]");
}
return ret;
}
@Override
public SeekableInputStream getSWF(String key) {
if (!key.startsWith("[")) {
return null;
}
if (!key.endsWith("]")) {
return null;
}
key = key.substring(1, key.length() - 1);
try {
int address = Integer.parseInt(key);
return search.get(null, address);
} catch (IOException | NumberFormatException iex) {
return null;
}
}
@Override
public Map<String, SeekableInputStream> getAll() {
Map<String, SeekableInputStream> ret = new HashMap<>();
for (String key : getKeys()) {
ret.put(key, getSWF(key));
}
return ret;
}
@Override
public String getExtension() {
return "bin";
}