ResourceType.java 883 字节
Newer Older
S
Skylot 已提交
1 2 3 4 5 6 7 8 9 10 11 12
package jadx.api;

public enum ResourceType {
	CODE(".dex", ".class"),
	MANIFEST("AndroidManifest.xml"),
	XML(".xml"), // TODO binary or not?
	ARSC(".arsc"), // TODO decompile !!!
	FONT(".ttf"),
	IMG(".png", ".gif", ".jpg"),
	LIB(".so"),
	UNKNOWN;

13
	private final String[] exts;
S
Skylot 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

	ResourceType(String... exts) {
		this.exts = exts;
	}

	public String[] getExts() {
		return exts;
	}

	public static ResourceType getFileType(String fileName) {
		for (ResourceType type : ResourceType.values()) {
			for (String ext : type.getExts()) {
				if (fileName.endsWith(ext)) {
					return type;
				}
			}
		}
		return UNKNOWN;
	}

	public static boolean isSupportedForUnpack(ResourceType type) {
		switch (type) {
			case CODE:
			case ARSC:
			case LIB:
			case FONT:
			case IMG:
			case UNKNOWN:
				return false;

			case MANIFEST:
45
			case XML:
S
Skylot 已提交
46 47 48 49 50
				return true;
		}
		return false;
	}
}