mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 21:10:46 +00:00
base class for ParseException, avm2.ConstantPool renamed to AVM2ConstantPool
This commit is contained in:
@@ -25,7 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.localregs.GetLocal0Ins;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnVoidIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PushScopeIns;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.types.ABCException;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
|
||||
@@ -790,7 +790,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
setDecompiledEditMode(false);
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
//reload();
|
||||
} catch (ParseException ex) {
|
||||
} catch (AVM2ParseException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.gui.abc;
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
@@ -220,7 +220,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
((Tag) abc.parentTag).setModified(true);
|
||||
} catch (IOException ex) {
|
||||
} catch (InterruptedException ex) {
|
||||
} catch (ParseException ex) {
|
||||
} catch (AVM2ParseException ex) {
|
||||
View.showMessageDialog(this, (ex.text + " on line " + ex.line));
|
||||
selectLine((int) ex.line);
|
||||
return false;
|
||||
|
||||
@@ -1,103 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 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.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
public class ConstantsListModel implements ListModel {
|
||||
|
||||
private final ConstantPool constants;
|
||||
public static final int TYPE_UINT = 0;
|
||||
public static final int TYPE_INT = 1;
|
||||
public static final int TYPE_DOUBLE = 2;
|
||||
public static final int TYPE_DECIMAL = 3;
|
||||
public static final int TYPE_STRING = 4;
|
||||
public static final int TYPE_NAMESPACE = 5;
|
||||
public static final int TYPE_NAMESPACESET = 6;
|
||||
public static final int TYPE_MULTINAME = 7;
|
||||
private int type = TYPE_INT;
|
||||
|
||||
public ConstantsListModel(ConstantPool constants, int type) {
|
||||
this.type = type;
|
||||
this.constants = constants;
|
||||
}
|
||||
|
||||
private int makeUp(int i) {
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
switch (type) {
|
||||
case TYPE_UINT:
|
||||
return makeUp(constants.getUIntCount() - 1);
|
||||
case TYPE_INT:
|
||||
return makeUp(constants.getIntCount() - 1);
|
||||
case TYPE_DOUBLE:
|
||||
return makeUp(constants.getDoubleCount() - 1);
|
||||
case TYPE_DECIMAL:
|
||||
return makeUp(constants.getDecimalCount() - 1);
|
||||
case TYPE_STRING:
|
||||
return makeUp(constants.getStringCount() - 1);
|
||||
case TYPE_NAMESPACE:
|
||||
return makeUp(constants.getNamespaceCount() - 1);
|
||||
case TYPE_NAMESPACESET:
|
||||
return makeUp(constants.getNamespaceSetCount() - 1);
|
||||
case TYPE_MULTINAME:
|
||||
return makeUp(constants.getMultinameCount() - 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
switch (type) {
|
||||
case TYPE_UINT:
|
||||
return "" + (index + 1) + ":" + constants.getUInt(index + 1);
|
||||
case TYPE_INT:
|
||||
return "" + (index + 1) + ":" + constants.getInt(index + 1);
|
||||
case TYPE_DOUBLE:
|
||||
return "" + (index + 1) + ":" + constants.getDouble(index + 1);
|
||||
case TYPE_DECIMAL:
|
||||
return "" + (index + 1) + ":" + constants.getDecimal(index + 1);
|
||||
case TYPE_STRING:
|
||||
return "" + (index + 1) + ":" + Helper.escapeString(constants.getString(index + 1));
|
||||
case TYPE_NAMESPACE:
|
||||
return "" + (index + 1) + ":" + constants.getNamespace(index + 1).getNameWithKind(constants);
|
||||
case TYPE_NAMESPACESET:
|
||||
return "" + (index + 1) + ":" + constants.getNamespaceSet(index + 1).toString(constants);
|
||||
case TYPE_MULTINAME:
|
||||
return "" + (index + 1) + ":" + constants.getMultiname(index + 1).toString(constants, new ArrayList<String>());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2014 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.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
public class ConstantsListModel implements ListModel {
|
||||
|
||||
private final AVM2ConstantPool constants;
|
||||
public static final int TYPE_UINT = 0;
|
||||
public static final int TYPE_INT = 1;
|
||||
public static final int TYPE_DOUBLE = 2;
|
||||
public static final int TYPE_DECIMAL = 3;
|
||||
public static final int TYPE_STRING = 4;
|
||||
public static final int TYPE_NAMESPACE = 5;
|
||||
public static final int TYPE_NAMESPACESET = 6;
|
||||
public static final int TYPE_MULTINAME = 7;
|
||||
private int type = TYPE_INT;
|
||||
|
||||
public ConstantsListModel(AVM2ConstantPool constants, int type) {
|
||||
this.type = type;
|
||||
this.constants = constants;
|
||||
}
|
||||
|
||||
private int makeUp(int i) {
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
switch (type) {
|
||||
case TYPE_UINT:
|
||||
return makeUp(constants.getUIntCount() - 1);
|
||||
case TYPE_INT:
|
||||
return makeUp(constants.getIntCount() - 1);
|
||||
case TYPE_DOUBLE:
|
||||
return makeUp(constants.getDoubleCount() - 1);
|
||||
case TYPE_DECIMAL:
|
||||
return makeUp(constants.getDecimalCount() - 1);
|
||||
case TYPE_STRING:
|
||||
return makeUp(constants.getStringCount() - 1);
|
||||
case TYPE_NAMESPACE:
|
||||
return makeUp(constants.getNamespaceCount() - 1);
|
||||
case TYPE_NAMESPACESET:
|
||||
return makeUp(constants.getNamespaceSetCount() - 1);
|
||||
case TYPE_MULTINAME:
|
||||
return makeUp(constants.getMultinameCount() - 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
switch (type) {
|
||||
case TYPE_UINT:
|
||||
return "" + (index + 1) + ":" + constants.getUInt(index + 1);
|
||||
case TYPE_INT:
|
||||
return "" + (index + 1) + ":" + constants.getInt(index + 1);
|
||||
case TYPE_DOUBLE:
|
||||
return "" + (index + 1) + ":" + constants.getDouble(index + 1);
|
||||
case TYPE_DECIMAL:
|
||||
return "" + (index + 1) + ":" + constants.getDecimal(index + 1);
|
||||
case TYPE_STRING:
|
||||
return "" + (index + 1) + ":" + Helper.escapeString(constants.getString(index + 1));
|
||||
case TYPE_NAMESPACE:
|
||||
return "" + (index + 1) + ":" + constants.getNamespace(index + 1).getNameWithKind(constants);
|
||||
case TYPE_NAMESPACESET:
|
||||
return "" + (index + 1) + ":" + constants.getNamespaceSet(index + 1).toString(constants);
|
||||
case TYPE_MULTINAME:
|
||||
return "" + (index + 1) + ":" + constants.getMultiname(index + 1).toString(constants, new ArrayList<String>());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser;
|
||||
import com.jpexs.decompiler.flash.abc.types.ValueKind;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
|
||||
@@ -116,7 +116,7 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail {
|
||||
if (!ASM3Parser.parseSlotConst(new StringReader(slotConstEditor.getText()), abc.constants, trait)) {
|
||||
return false;
|
||||
}
|
||||
} catch (ParseException ex) {
|
||||
} catch (AVM2ParseException ex) {
|
||||
View.showMessageDialog(slotConstEditor, ex.text, AppStrings.translate("error.slotconst.typevalue"), JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
|
||||
Reference in New Issue
Block a user