public DecompilerSettings getDecompilerSettings() { CommandLineOptions options = new CommandLineOptions(); JCommander jCommander = new JCommander(options); // TODO remove dependency on JCommander? String[] args = new String[Settings.values().length * 2]; int index = 0; for (TransformerSettings.Setting setting : Settings.values()) { args[index++] = "--" + setting.getParam(); args[index++] = String.valueOf(setting.isEnabled()); } jCommander.parse(args); DecompilerSettings settings = new DecompilerSettings(); settings.setFlattenSwitchBlocks(options.getFlattenSwitchBlocks()); settings.setForceExplicitImports(!options.getCollapseImports()); settings.setForceExplicitTypeArguments(options.getForceExplicitTypeArguments()); settings.setRetainRedundantCasts(options.getRetainRedundantCasts()); settings.setShowSyntheticMembers(options.getShowSyntheticMembers()); settings.setExcludeNestedTypes(options.getExcludeNestedTypes()); settings.setOutputDirectory(options.getOutputDirectory()); settings.setIncludeLineNumbersInBytecode(options.getIncludeLineNumbers()); settings.setRetainPointlessSwitches(options.getRetainPointlessSwitches()); settings.setUnicodeOutputEnabled(options.isUnicodeOutputEnabled()); settings.setMergeVariables(options.getMergeVariables()); settings.setShowDebugLineNumbers(options.getShowDebugLineNumbers()); settings.setSimplifyMemberReferences(options.getSimplifyMemberReferences()); settings.setDisableForEachTransforms(options.getDisableForEachTransforms()); settings.setTypeLoader(new InputTypeLoader()); if (options.isRawBytecode()) { settings.setLanguage(Languages.bytecode()); } else if (options.isBytecodeAst()) { settings.setLanguage( options.isUnoptimized() ? Languages.bytecodeAstUnoptimized() : Languages.bytecodeAst()); } return settings; }
public ComponentMenuRedstoneOutput(FlowComponent parent) { super(parent); textBoxes = new TextBoxNumberList(); textBoxes.addTextBox( textBox = new TextBoxNumber(TEXT_BOX_X, TEXT_BOX_Y, 2, true) { @Override public int getMaxNumber() { return 15; } @Override public void onNumberChanged() { DataWriter dw = getWriterForServerComponentPacket(); dw.writeBoolean(true); // header dw.writeData(getNumber(), DataBitHelper.MENU_REDSTONE_ANALOG); PacketHandler.sendDataToServer(dw); } }); textBox.setNumber(15); radioButtons = new RadioButtonList() { @Override public void updateSelectedOption(int selectedOption) { setSelectedOption(selectedOption); DataWriter dw = getWriterForServerComponentPacket(); dw.writeBoolean(false); // header dw.writeData(selectedOption, DataBitHelper.MENU_REDSTONE_OUTPUT_TYPE); PacketHandler.sendDataToServer(dw); } }; for (int i = 0; i < Settings.values().length; i++) { int ix = i % 2; int iy = i / 2; int x = RADIO_BUTTON_X + ix * RADIO_SPACING_X; int y = RADIO_BUTTON_Y + iy * RADIO_SPACING_Y; radioButtons.add(new RadioButton(x, y, Settings.values()[i].getName())); } }
public ProcyonDecompiler() { super("procyon-decompiler", "Procyon Decompiler"); for (Settings setting : Settings.values()) { settings.registerSetting(setting); } }
public Settings getSelectedSetting() { return Settings.values()[radioButtons.getSelectedOption()]; }