本文整理汇总了Java中com.strobel.assembler.metadata.MetadataSystem类的典型用法代码示例。如果您正苦于以下问题:Java MetadataSystem类的具体用法?Java MetadataSystem怎么用?Java MetadataSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataSystem类属于com.strobel.assembler.metadata包,在下文中一共展示了MetadataSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: closeFile
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
public void closeFile() {
for (OpenFile co : hmap) {
int pos = house.indexOfTab(co.name);
if (pos >= 0)
house.remove(pos);
co.close();
}
final State oldState = state;
Model.this.state = null;
if (oldState != null) {
Closer.tryClose(oldState);
}
hmap.clear();
tree.setModel(new DefaultTreeModel(null));
metadataSystem = new MetadataSystem(typeLoader);
file = null;
treeExpansionState = null;
open = false;
mainWindow.onFileLoadEnded(file, open);
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:23,代码来源:Model.java
示例2: createMetadataSystem
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
MetadataSystem createMetadataSystem() {
return new MetadataSystem(loader) {
Set<String> loadedTypes = new HashSet<>();
@Override
protected TypeDefinition resolveType(String descriptor, boolean mightBePrimitive) {
if(missingClasses.contains(descriptor)) {
return null;
}
try {
if(loadedTypes.add(descriptor))
incStat("ClassLoadingEfficiency.Total");
if(classes.add(descriptor))
incStat("ClassLoadingEfficiency");
return super.resolveType(descriptor, mightBePrimitive);
} catch (Throwable t) {
addError(new ErrorMessage(null, descriptor, null, null, -1, t));
missingClasses.add(descriptor);
return null;
}
}
};
}
开发者ID:amaembo,项目名称:huntbugs,代码行数:24,代码来源:Context.java
示例3: doSaveClassDecompiled
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
private void doSaveClassDecompiled(File inFile, File outFile) throws Exception {
DecompilerSettings settings = cloneSettings();
LuytenTypeLoader typeLoader = new LuytenTypeLoader();
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
TypeReference type = metadataSystem.lookupType(inFile.getCanonicalPath());
DecompilationOptions decompilationOptions = new DecompilationOptions();
decompilationOptions.setSettings(settings);
decompilationOptions.setFullDecompilation(true);
boolean isUnicodeEnabled = decompilationOptions.getSettings().isUnicodeOutputEnabled();
TypeDefinition resolvedType = null;
if (type == null || ((resolvedType = type.resolve()) == null)) {
throw new Exception("Unable to resolve type.");
}
StringWriter stringwriter = new StringWriter();
PlainTextOutput plainTextOutput = new PlainTextOutput(stringwriter);
plainTextOutput.setUnicodeOutputEnabled(isUnicodeEnabled);
settings.getLanguage().decompileType(resolvedType, plainTextOutput, decompilationOptions);
String decompiledSource = stringwriter.toString();
System.out.println("[SaveAll]: " + inFile.getName() + " -> " + outFile.getName());
try (FileOutputStream fos = new FileOutputStream(outFile);
OutputStreamWriter writer = isUnicodeEnabled ? new OutputStreamWriter(fos, "UTF-8")
: new OutputStreamWriter(fos);
BufferedWriter bw = new BufferedWriter(writer);) {
bw.write(decompiledSource);
bw.flush();
}
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:31,代码来源:FileSaver.java
示例4: lookUp
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
private TypeDefinition lookUp(MetadataSystem ms, String className) {
TypeReference tr = ms.lookupType(className);
if(tr == null) {
missingClasses.add(className);
return null;
}
return ms.resolve(tr);
}
开发者ID:amaembo,项目名称:huntbugs,代码行数:9,代码来源:Context.java
示例5: analyzingClasses
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
private void analyzingClasses(Set<String> classes) {
MetadataSystem ms = createMetadataSystem();
classesCount.set(0);
for (String className : classes) {
if(classesCount.get() % options.classesPerFlush == 0)
ms = createMetadataSystem();
if (!fireEvent("Analyzing classes", className, classesCount.get(), classes.size()))
return;
analyzeClass(ms, className);
}
if (!fireEvent("Analyzing classes", null, classes.size(), classes.size()))
return;
}
开发者ID:amaembo,项目名称:huntbugs,代码行数:14,代码来源:Context.java
示例6: analyzeClass
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
void analyzeClass(MetadataSystem ms, String name) {
classesCount.incrementAndGet();
TypeDefinition type;
try {
type = lookUp(ms, name);
} catch (Throwable t) {
addError(new ErrorMessage(null, name, null, null, -1, t));
return;
}
if (type != null)
registry.analyzeClass(type);
}
开发者ID:amaembo,项目名称:huntbugs,代码行数:13,代码来源:Context.java
示例7: visitClass
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
@Override
public void visitClass(String className) {
String name = className.replace('/', '.');
try {
ctx.incStat("Detectors.Total");
if (addDetector(MetadataSystem.class.getClassLoader().loadClass(name))) {
ctx.incStat("Detectors");
if (external) {
ctx.incStat("Detectors from HuntBugs plugins");
}
}
} catch (ClassNotFoundException e) {
ctx.addError(new ErrorMessage(name, null, null, null, -1, e));
}
}
开发者ID:amaembo,项目名称:huntbugs,代码行数:16,代码来源:DetectorRegistry.java
示例8: decompileClassFile
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
/**
* Decompiles the given .class file and creates the specified output source file.
*
* @param classFilePath the .class file to be decompiled.
* @param outputDir The directory where decompiled .java files will be placed.
*/
@Override
public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir)
throws DecompilationException
{
Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir");
File classFile = classFilePath.toFile();
Checks.checkFileToBeRead(classFile, "Class file");
Checks.checkDirectoryToBeFilled(outputDir.toFile(), "Output directory");
log.info("Decompiling .class '" + classFilePath + "' to '" + outputDir + "' from: '" + rootDir + "'");
String name = classFilePath.normalize().toAbsolutePath().toString().substring(rootDir.toAbsolutePath().toString().length() + 1);
final String typeName = StringUtils.removeEnd(name, ".class");// .replace('/', '.');
DecompilationResult result = new DecompilationResult();
try
{
DecompilerSettings settings = getDefaultSettings(outputDir.toFile());
this.procyonConf.setDecompilerSettings(settings); // TODO: This is horrible mess.
ITypeLoader typeLoader = new CompositeTypeLoader(new ClasspathTypeLoader(rootDir.toString()), new ClasspathTypeLoader());
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
File outputFile = this.decompileType(settings, metadataSystem, typeName);
result.addDecompiled(Collections.singletonList(classFilePath.toString()), outputFile.getAbsolutePath());
}
catch (Throwable e)
{
DecompilationFailure failure = new DecompilationFailure("Error during decompilation of "
+ classFilePath.toString() + ":\n " + e.getMessage(), Collections.singletonList(name), e);
log.severe(failure.getMessage());
result.addFailure(failure);
}
return result;
}
开发者ID:windup,项目名称:windup,代码行数:42,代码来源:ProcyonDecompiler.java
示例9: refreshMetadataCache
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
/**
* The metadata cache can become huge over time. This simply flushes it periodically.
*/
private void refreshMetadataCache(final Queue<MetadataSystem> metadataSystemCache, final DecompilerSettings settings)
{
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));
}
}
开发者ID:windup,项目名称:windup,代码行数:12,代码来源:ProcyonDecompiler.java
示例10: DecompileExecutor
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
public DecompileExecutor(DecompilerSettings settings, MetadataSystem metadataSystem, String typeName)
{
this.settings = settings;
this.metadataSystem = metadataSystem;
this.typeName = typeName;
setDaemon(true);
}
开发者ID:windup,项目名称:windup,代码行数:8,代码来源:ProcyonDecompiler.java
示例11: setDecompilerReferences
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
public void setDecompilerReferences(MetadataSystem metadataSystem, DecompilerSettings settings,
DecompilationOptions decompilationOptions) {
this.metadataSystem = metadataSystem;
this.settings = settings;
this.decompilationOptions = decompilationOptions;
}
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:7,代码来源:OpenFile.java
示例12: getSourceTree
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的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
示例13: setDecompilerReferences
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的package包/类
public void setDecompilerReferences(MetadataSystem metadataSystem, DecompilerSettings settings,
DecompilationOptions decompilationOptions) {
this.metadataSystem = metadataSystem;
this.settings = settings;
this.decompilationOptions = decompilationOptions;
}
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:7,代码来源:OpenFile.java
示例14: getSourceTree
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的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
示例15: getSourceTree
import com.strobel.assembler.metadata.MetadataSystem; //导入依赖的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.assembler.metadata.MetadataSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论