MCPcopy Create free account
hub / github.com/GraxCode/zelixkiller / fixDesc

Method fixDesc

src/me/lpk/util/StringUtils.java:19–42  ·  view source on GitHub ↗

Given an obfuscated description, finds the new values for class names and updates the description. @param description @param oldNamestoClasses @return

(String description, Map<String, MappedClass> oldNamestoClasses)

Source from the content-addressed store, hash-verified

17 * @return
18 */
19 public static String fixDesc(String description, Map<String, MappedClass> oldNamestoClasses) {
20 if (description == null || description.length() == 0 || isPrimitive(description)) {
21 return description;
22 }
23 if (description.contains("L") && description.contains(";")) {
24 if (description.startsWith("(") || (description.startsWith("L") || description.startsWith("[")) && description.endsWith(";")) {
25 String regex = "(?<=[L])[^;]*(?=;)";
26 Pattern p = Pattern.compile(regex);
27 Matcher m = p.matcher(Pattern.quote(description));
28 for (int i = 0; i < m.groupCount(); i++) {
29 String found = m.group(i);
30 description = description.replace(found, fixDesc(found, oldNamestoClasses));
31 }
32 return description;
33 }
34 } else {
35 MappedClass mc = oldNamestoClasses.get(description);
36 if (mc == null) {
37 return description;
38 }
39 return mc.getNewName();
40 }
41 return description;
42 }
43
44 /**
45 * Unfixes descriptions. (Lknown/class/Name; --> Lobfu;)

Callers 7

mapDescMethod · 0.95
mapTypeMethod · 0.95
mapTypesMethod · 0.95
mapMethodDescMethod · 0.95
mapSignatureMethod · 0.95
mapMethod · 0.95
saveMethod · 0.95

Calls 5

isPrimitiveMethod · 0.95
containsMethod · 0.80
replaceMethod · 0.80
getNewNameMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected