mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 21:50:54 +00:00
A fix ?
This commit is contained in:
@@ -1,75 +1,75 @@
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker;
|
||||
|
||||
import com.jpacker.encoders.BasicEncoder;
|
||||
import com.jpacker.encoders.Encoder;
|
||||
import com.jpacker.encoders.HighAsciiEncoder;
|
||||
import com.jpacker.encoders.MidEncoder;
|
||||
import com.jpacker.encoders.NormalEncoder;
|
||||
import com.jpacker.encoders.NumericEncoder;
|
||||
|
||||
/**
|
||||
* Enum of encoding levels
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*
|
||||
*/
|
||||
public enum JPackerEncoding {
|
||||
|
||||
/**
|
||||
* No encoding
|
||||
*/
|
||||
NONE(0, "", null),
|
||||
/**
|
||||
* Base<sub>10</sub> : [0-9]
|
||||
*/
|
||||
NUMERIC(10, "String", new NumericEncoder()),
|
||||
/**
|
||||
* Base<sub>36</sub> : [0-z]
|
||||
*/
|
||||
MID(36, "function(c){return c.toString(a)}", new MidEncoder()),
|
||||
/**
|
||||
* Base<sub>52</sub> : [a-Z]
|
||||
*/
|
||||
BASIC(52, "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>25?String.fromCharCode(c+39):String.fromCharCode(c+97));", new BasicEncoder()),
|
||||
/**
|
||||
* Base<sub>62</sub> : [0-Z]
|
||||
*/
|
||||
NORMAL(62, "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))}", new NormalEncoder()),
|
||||
/**
|
||||
* Base<sub>95</sub> : [¡-ÿ]
|
||||
*/
|
||||
HIGH_ASCII(95, "function(c){return(c<a?\"\":e(c/a))String.fromCharCode(c%a+161)}", new HighAsciiEncoder());
|
||||
private final int encodingBase;
|
||||
private final String encode;
|
||||
private Encoder encoder;
|
||||
|
||||
JPackerEncoding(int encodingBase, String encode, Encoder encoder) {
|
||||
this.encodingBase = encodingBase;
|
||||
this.encode = encode;
|
||||
this.encoder = encoder;
|
||||
}
|
||||
|
||||
public int getEncodingBase() {
|
||||
return encodingBase;
|
||||
}
|
||||
|
||||
public String getEncode() {
|
||||
return encode;
|
||||
}
|
||||
|
||||
public Encoder getEncoder() {
|
||||
return encoder;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker;
|
||||
|
||||
import com.jpacker.encoders.BasicEncoder;
|
||||
import com.jpacker.encoders.Encoder;
|
||||
import com.jpacker.encoders.HighAsciiEncoder;
|
||||
import com.jpacker.encoders.MidEncoder;
|
||||
import com.jpacker.encoders.NormalEncoder;
|
||||
import com.jpacker.encoders.NumericEncoder;
|
||||
|
||||
/**
|
||||
* Enum of encoding levels
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*
|
||||
*/
|
||||
public enum JPackerEncoding {
|
||||
|
||||
/**
|
||||
* No encoding
|
||||
*/
|
||||
NONE(0, "", null),
|
||||
/**
|
||||
* Base<sub>10</sub> : [0-9]
|
||||
*/
|
||||
NUMERIC(10, "String", new NumericEncoder()),
|
||||
/**
|
||||
* Base<sub>36</sub> : [0-z]
|
||||
*/
|
||||
MID(36, "function(c){return c.toString(a)}", new MidEncoder()),
|
||||
/**
|
||||
* Base<sub>52</sub> : [a-Z]
|
||||
*/
|
||||
BASIC(52, "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>25?String.fromCharCode(c+39):String.fromCharCode(c+97));", new BasicEncoder()),
|
||||
/**
|
||||
* Base<sub>62</sub> : [0-Z]
|
||||
*/
|
||||
NORMAL(62, "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))}", new NormalEncoder()),
|
||||
/**
|
||||
* Base<sub>95</sub> : [¡-ÿ]
|
||||
*/
|
||||
HIGH_ASCII(95, "function(c){return(c<a?\"\":e(c/a))String.fromCharCode(c%a+161)}", new HighAsciiEncoder());
|
||||
private final int encodingBase;
|
||||
private final String encode;
|
||||
private Encoder encoder;
|
||||
|
||||
JPackerEncoding(int encodingBase, String encode, Encoder encoder) {
|
||||
this.encodingBase = encodingBase;
|
||||
this.encode = encode;
|
||||
this.encoder = encoder;
|
||||
}
|
||||
|
||||
public int getEncodingBase() {
|
||||
return encodingBase;
|
||||
}
|
||||
|
||||
public String getEncode() {
|
||||
return encode;
|
||||
}
|
||||
|
||||
public Encoder getEncoder() {
|
||||
return encoder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.encoders;
|
||||
|
||||
/**
|
||||
* Basic (base52) encoder: [a-Z]
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*
|
||||
*/
|
||||
public class BasicEncoder implements Encoder {
|
||||
|
||||
@Override
|
||||
public String encode(int c) {
|
||||
return (c < 52 ? "" : encode(c / 52)) + (((c = c % 52)) > 25 ? String.valueOf((char) (c + 39)) : String.valueOf((char) (c + 97)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.encoders;
|
||||
|
||||
/**
|
||||
* Basic (base52) encoder: [a-Z]
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*
|
||||
*/
|
||||
public class BasicEncoder implements Encoder {
|
||||
|
||||
@Override
|
||||
public String encode(int c) {
|
||||
return (c < 52 ? "" : encode(c / 52)) + (((c = c % 52)) > 25 ? String.valueOf((char) (c + 39)) : String.valueOf((char) (c + 97)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import com.jpacker.JPackerPattern;
|
||||
|
||||
/**
|
||||
* Abstract class for {@link Evaluator} objects. Its purpose is to provide the
|
||||
* implementation of a getter and setter of a {@link JPackerPattern} object.
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
public abstract class AbstractEvaluator implements Evaluator {
|
||||
|
||||
private JPackerPattern jpattern;
|
||||
|
||||
/**
|
||||
* Gets the {@link JPackerPattern} object
|
||||
*
|
||||
* @return The {@link JPackerPattern} object
|
||||
*/
|
||||
@Override
|
||||
public JPackerPattern getJPattern() {
|
||||
return jpattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link JPackerPattern} object for this {@link Evaluator} object
|
||||
*
|
||||
* @param jpattern
|
||||
* The {@link JPackerPattern} object to set
|
||||
*/
|
||||
@Override
|
||||
public void setJPattern(JPackerPattern jpattern) {
|
||||
this.jpattern = jpattern;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import com.jpacker.JPackerPattern;
|
||||
|
||||
/**
|
||||
* Abstract class for {@link Evaluator} objects. Its purpose is to provide the
|
||||
* implementation of a getter and setter of a {@link JPackerPattern} object.
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
public abstract class AbstractEvaluator implements Evaluator {
|
||||
|
||||
private JPackerPattern jpattern;
|
||||
|
||||
/**
|
||||
* Gets the {@link JPackerPattern} object
|
||||
*
|
||||
* @return The {@link JPackerPattern} object
|
||||
*/
|
||||
@Override
|
||||
public JPackerPattern getJPattern() {
|
||||
return jpattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link JPackerPattern} object for this {@link Evaluator} object
|
||||
*
|
||||
* @param jpattern
|
||||
* The {@link JPackerPattern} object to set
|
||||
*/
|
||||
@Override
|
||||
public void setJPattern(JPackerPattern jpattern) {
|
||||
this.jpattern = jpattern;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* An {@link Evaluator} implementation for replacement {@link String} objects
|
||||
* such as "$1" or "$2". Must be a simple group reference (i.e.: NOT
|
||||
* "Hello $3 $2")
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
public class IntegerEvaluator extends AbstractEvaluator implements Evaluator {
|
||||
|
||||
private int replacement;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param replacement
|
||||
* If replacement String is "$1" then 1 would be the replacement
|
||||
* parameter
|
||||
*/
|
||||
public IntegerEvaluator(int replacement) {
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluate(Matcher matcher, int offset) {
|
||||
return matcher.group(replacement + offset);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* An {@link Evaluator} implementation for replacement {@link String} objects
|
||||
* such as "$1" or "$2". Must be a simple group reference (i.e.: NOT
|
||||
* "Hello $3 $2")
|
||||
*
|
||||
* @author Pablo Santiago <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
public class IntegerEvaluator extends AbstractEvaluator implements Evaluator {
|
||||
|
||||
private int replacement;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param replacement
|
||||
* If replacement String is "$1" then 1 would be the replacement
|
||||
* parameter
|
||||
*/
|
||||
public IntegerEvaluator(int replacement) {
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluate(Matcher matcher, int offset) {
|
||||
return matcher.group(replacement + offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class StringEvaluator extends AbstractEvaluator implements Evaluator {
|
||||
|
||||
private String replacement;
|
||||
|
||||
public StringEvaluator(String replacement) {
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replacement function for complicated lookups (e.g. Hello $3 $2)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String evaluate(Matcher matcher, int offset) {
|
||||
int length = getJPattern().getLength();
|
||||
String result = replacement;
|
||||
while (length-- > 0) {
|
||||
String mg = matcher.group(offset + length);
|
||||
result = result.replace("$" + length, mg == null ? "" : mg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Packer version 3.0 (final)
|
||||
* Copyright 2004-2007, Dean Edwards
|
||||
* Web: {@link http://dean.edwards.name/}
|
||||
*
|
||||
* This software is licensed under the MIT license
|
||||
* Web: {@link http://www.opensource.org/licenses/mit-license}
|
||||
*
|
||||
* Ported to Java by Pablo Santiago based on C# version by Jesse Hansen, <twindagger2k @ msn.com>
|
||||
* Web: {@link http://jpacker.googlecode.com/}
|
||||
* Email: <pablo.santiago @ gmail.com>
|
||||
*/
|
||||
package com.jpacker.evaluators;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class StringEvaluator extends AbstractEvaluator implements Evaluator {
|
||||
|
||||
private String replacement;
|
||||
|
||||
public StringEvaluator(String replacement) {
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replacement function for complicated lookups (e.g. Hello $3 $2)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String evaluate(Matcher matcher, int offset) {
|
||||
int length = getJPattern().getLength();
|
||||
String result = replacement;
|
||||
while (length-- > 0) {
|
||||
String mg = matcher.group(offset + length);
|
||||
result = result.replace("$" + length, mg == null ? "" : mg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user