mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
SDN Scripts title & description hex decoding added
This commit is contained in:
@@ -7,7 +7,7 @@ package org.parabot.core;
|
||||
*/
|
||||
public class Configuration {
|
||||
public static final String LOGIN_SERVER = "http://www.parabot.org/community/api/login.php?username=%s&password=%s";
|
||||
public static final String SDN_SCRIPTS_JSON = "http://sdn.parabot.org/scripts.php?method=json&user=%s";
|
||||
public static final String SDN_SCRIPTS_JSON = "http://sdn.parabot.org/scripts.php?method=json&user=%s&type=hex";
|
||||
public static final String GET_SDN_SCRIPT = "http://sdn.parabot.org/getscript.php?user=%s&pass=%s&scriptid=%d";
|
||||
public static final String GET_SERVER_PROVIDERS_JSON = "http://sdn.parabot.org/providers/index.php?method=json";
|
||||
public static final String GET_SERVER_PROVIDER = "http://sdn.parabot.org/providers/provider.php?id=";
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.parabot.core.Configuration;
|
||||
import org.parabot.core.desc.ScriptDescription;
|
||||
import org.parabot.core.forum.AccountManager;
|
||||
import org.parabot.core.forum.AccountManagerAccess;
|
||||
import org.parabot.environment.api.utils.StringUtils;
|
||||
import org.parabot.environment.api.utils.WebUtil;
|
||||
import org.parabot.environment.scripts.executers.SDNScriptExecuter;
|
||||
|
||||
@@ -52,6 +53,11 @@ public class SDNScripts extends ScriptParser {
|
||||
double version = Double.parseDouble(String.valueOf(jsonObject.get("version")));
|
||||
String category = String.valueOf(jsonObject.get("category"));
|
||||
String description = String.valueOf(jsonObject.get("description"));
|
||||
|
||||
// convert hex encoded strings to normal strings
|
||||
|
||||
scriptName = StringUtils.convertHexToString(scriptName);
|
||||
description = StringUtils.convertHexToString(description);
|
||||
|
||||
final ScriptDescription desc = new ScriptDescription(jarName, scriptName,
|
||||
author, category, version, description,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.parabot.environment.api.utils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mkyong
|
||||
*
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
public static String convertHexToString(String hex) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder temp = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < hex.length() - 1; i += 2) {
|
||||
|
||||
// grab the hex in pairs
|
||||
String output = hex.substring(i, (i + 2));
|
||||
// convert hex to decimal
|
||||
int decimal = Integer.parseInt(output, 16);
|
||||
// convert the decimal to character
|
||||
sb.append((char) decimal);
|
||||
|
||||
temp.append(decimal);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user