mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-29 22:04:25 +02:00
fix ResConfig parse three digit region
This commit is contained in:
parent
f6ad9d1ba8
commit
ff57e605ae
@ -2126,13 +2126,14 @@
|
||||
return false;
|
||||
}
|
||||
Matcher matcher = PATTERN_REGION.matcher(qualifier);
|
||||
if(!matcher.matches()){
|
||||
if(!matcher.matches() && !isRegionNumber(qualifier)){
|
||||
return false;
|
||||
}
|
||||
this.mConfig.setRegion(qualifier);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private boolean isEmpty(){
|
||||
if(!mEmpty){
|
||||
mEmpty = isEmpty(mQualifiers);
|
||||
@ -2172,6 +2173,25 @@
|
||||
}
|
||||
return qualifier.split("-");
|
||||
}
|
||||
private static boolean isRegionNumber(String qualifier){
|
||||
if(qualifier==null || qualifier.length()==0){
|
||||
return false;
|
||||
}
|
||||
return qualifier.length() == 3 && isAllDigit(qualifier);
|
||||
}
|
||||
private static boolean isAllDigit(String qualifier){
|
||||
if(qualifier == null || qualifier.length()==0){
|
||||
return false;
|
||||
}
|
||||
char[] chars = qualifier.toCharArray();
|
||||
for(int i = 0; i < chars.length; i++){
|
||||
char ch = chars[i];
|
||||
if(ch > '9' || ch < '0'){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static final Pattern PATTERN_PREFIX_NUMBER = Pattern.compile("^([mcnv]+)([0-9]+)$");
|
||||
private static final Pattern PATTERN_DP = Pattern.compile("^([swh]+)([0-9]+)dp$");
|
||||
|
Loading…
x
Reference in New Issue
Block a user