當前位置: 首頁>>代碼示例>>Java>>正文


Java AstBuilder類代碼示例

本文整理匯總了Java中com.strobel.decompiler.languages.java.ast.AstBuilder的典型用法代碼示例。如果您正苦於以下問題:Java AstBuilder類的具體用法?Java AstBuilder怎麽用?Java AstBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AstBuilder類屬於com.strobel.decompiler.languages.java.ast包,在下文中一共展示了AstBuilder類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSourceTree

import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className) {
	
	// we don't know if this class name is obfuscated or deobfuscated
	// we need to tell the decompiler the deobfuscated name so it doesn't get freaked out
	// the decompiler only sees classes after deobfuscation, so we need to load it by the deobfuscated name if there is one
	
	// first, assume class name is deobf
	String deobfClassName = className;
	
	// if it wasn't actually deobf, then we can find a mapping for it and get the deobf name
	ClassMapping classMapping = m_mappings.getClassByObf(className);
	if (classMapping != null && classMapping.getDeobfName() != null) {
		deobfClassName = classMapping.getDeobfName();
	}
	
	// set the type loader
	TranslatingTypeLoader loader = new TranslatingTypeLoader(
		m_jar,
		m_jarIndex,
		getTranslator(TranslationDirection.Obfuscating),
		getTranslator(TranslationDirection.Deobfuscating)
	); 
	m_settings.setTypeLoader(loader);

	// see if procyon can find the type
	TypeReference type = new MetadataSystem(loader).lookupType(deobfClassName);
	if (type == null) {
		throw new Error(String.format("Unable to find type: %s (deobf: %s)\nTried class names: %s",
			className, deobfClassName, loader.getClassNamesToTry(deobfClassName)
		));
	}
	TypeDefinition resolvedType = type.resolve();
	
	// decompile it!
	DecompilerContext context = new DecompilerContext();
	context.setCurrentType(resolvedType);
	context.setSettings(m_settings);
	AstBuilder builder = new AstBuilder(context);
	builder.addType(resolvedType);
	builder.runTransformations(null);
	return builder.getCompilationUnit();
}
 
開發者ID:cccssw,項目名稱:enigma-vk,代碼行數:43,代碼來源:Deobfuscator.java

示例2: getSourceTree

import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className) {

        // we don't know if this class name is obfuscated or deobfuscated
        // we need to tell the decompiler the deobfuscated name so it doesn't get freaked out
        // the decompiler only sees classes after deobfuscation, so we need to load it by the deobfuscated name if there is one

        // first, assume class name is deobf
        String deobfClassName = className;

        // if it wasn't actually deobf, then we can find a mapping for it and get the deobf name
        ClassMapping classMapping = this.mappings.getClassByObf(className);
        if (classMapping != null && classMapping.getDeobfName() != null) {
            deobfClassName = classMapping.getDeobfName();
        }

        // set the type loader
        TranslatingTypeLoader loader = new TranslatingTypeLoader(
                this.jar,
                this.jarIndex,
                getTranslator(TranslationDirection.Obfuscating),
                getTranslator(TranslationDirection.Deobfuscating)
        );
        this.settings.setTypeLoader(loader);

        // see if procyon can find the type
        TypeReference type = new MetadataSystem(loader).lookupType(deobfClassName);
        if (type == null) {
            throw new Error(String.format("Unable to find type: %s (deobf: %s)\nTried class names: %s",
                    className, deobfClassName, loader.getClassNamesToTry(deobfClassName)
            ));
        }
        TypeDefinition resolvedType = type.resolve();

        // decompile it!
        DecompilerContext context = new DecompilerContext();
        context.setCurrentType(resolvedType);
        context.setSettings(this.settings);
        AstBuilder builder = new AstBuilder(context);
        builder.addType(resolvedType);
        builder.runTransformations(null);
        return builder.getCompilationUnit();
    }
 
開發者ID:OpenModLoader,項目名稱:Enigma,代碼行數:43,代碼來源:Deobfuscator.java

示例3: getSourceTree

import com.strobel.decompiler.languages.java.ast.AstBuilder; //導入依賴的package包/類
public CompilationUnit getSourceTree(String className)
{
	
	// we don't know if this class name is obfuscated or deobfuscated
	// we need to tell the decompiler the deobfuscated name so it doesn't
	// get freaked out
	// the decompiler only sees classes after deobfuscation, so we need to
	// load it by the deobfuscated name if there is one
	
	// first, assume class name is deobf
	String deobfClassName = className;
	
	// if it wasn't actually deobf, then we can find a mapping for it and
	// get the deobf name
	ClassMapping classMapping = m_mappings.getClassByObf(className);
	if(classMapping != null && classMapping.getDeobfName() != null)
		deobfClassName = classMapping.getDeobfName();
	
	// set the type loader
	TranslatingTypeLoader loader =
		new TranslatingTypeLoader(m_jar, m_jarIndex,
			getTranslator(TranslationDirection.Obfuscating),
			getTranslator(TranslationDirection.Deobfuscating));
	m_settings.setTypeLoader(loader);
	
	// see if procyon can find the type
	TypeReference type =
		new MetadataSystem(loader).lookupType(deobfClassName);
	if(type == null)
		throw new Error(String.format(
			"Unable to find type: %s (deobf: %s)\nTried class names: %s",
			className, deobfClassName,
			loader.getClassNamesToTry(deobfClassName)));
	TypeDefinition resolvedType = type.resolve();
	
	// decompile it!
	DecompilerContext context = new DecompilerContext();
	context.setCurrentType(resolvedType);
	context.setSettings(m_settings);
	AstBuilder builder = new AstBuilder(context);
	builder.addType(resolvedType);
	builder.runTransformations(null);
	return builder.getCompilationUnit();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-Enigma,代碼行數:45,代碼來源:Deobfuscator.java


注:本文中的com.strobel.decompiler.languages.java.ast.AstBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。