Java Code Examples for ghidra.framework.options.Options#setLong()
The following examples show how to use
ghidra.framework.options.Options#setLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyListMergeManager.java From ghidra with Apache License 2.0 | 5 votes |
private void setValue(Options options, String propertyName, OptionType type, Object value) { switch (type) { case BOOLEAN_TYPE: options.setBoolean(propertyName, ((Boolean) value).booleanValue()); break; case DOUBLE_TYPE: options.setDouble(propertyName, ((Double) value).doubleValue()); break; case INT_TYPE: options.setInt(propertyName, ((Integer) value).intValue()); break; case LONG_TYPE: options.setLong(propertyName, ((Long) value).longValue()); break; case STRING_TYPE: options.setString(propertyName, (String) value); break; case DATE_TYPE: options.setDate(propertyName, (Date) value); break; case NO_TYPE: default: } }
Example 2
Source File: GhidraScript.java From ghidra with Apache License 2.0 | 4 votes |
/** * Private method, returns any error message that may have resulted from attempting to set * the given analysis option to the given analysis value. * * @param options the options for which analysisOption should be set to * analysisOptionValue * @param analysisOption the option to be changed * @param analysisOptionValue the value to be set for the option * @return a String description of any errors that occurred during setting of options; if * empty String is returned, no problems occurred. */ private String setAnalysisOption(Options options, String analysisOption, String analysisOptionValue) { String changeFailedMessage = ""; if (analysisOptionValue == null) { return changeFailedMessage + " " + analysisOption + " Can not set an analyzer option to null value."; } if (!options.contains(analysisOption)) { return changeFailedMessage + analysisOption + " could not be found for this program."; } OptionType optionType = options.getType(analysisOption); try { switch (optionType) { case INT_TYPE: options.setInt(analysisOption, Integer.valueOf(analysisOptionValue)); break; case LONG_TYPE: options.setLong(analysisOption, Long.valueOf(analysisOptionValue)); break; case STRING_TYPE: options.setString(analysisOption, analysisOptionValue); break; case DOUBLE_TYPE: options.setDouble(analysisOption, Double.valueOf(analysisOptionValue)); break; case FLOAT_TYPE: options.setFloat(analysisOption, Float.valueOf(analysisOptionValue)); break; case BOOLEAN_TYPE: // Tests if text actually equals "true" or "false String tempBool = analysisOptionValue.toLowerCase(); if (tempBool.equals("true") || tempBool.equals("false")) { options.setBoolean(analysisOption, Boolean.valueOf(tempBool)); } break; case ENUM_TYPE: setEnum(options, analysisOption, analysisOptionValue); break; case KEYSTROKE_TYPE: case FONT_TYPE: case DATE_TYPE: case BYTE_ARRAY_TYPE: case COLOR_TYPE: case CUSTOM_TYPE: case FILE_TYPE: changeFailedMessage += "Not allowed to change settings usings strings for type: " + optionType; case NO_TYPE: default: changeFailedMessage += "The option could not be found for this program."; } } catch (NumberFormatException numFormatExc) { changeFailedMessage += "Could not convert '" + analysisOptionValue + "' to a number of type " + optionType + "."; } catch (IllegalArgumentException e) { changeFailedMessage = "Error changing setting for option '" + analysisOption + "'. "; } return changeFailedMessage; }