Package com.strobel.assembler.metadata

Examples of com.strobel.assembler.metadata.MetadataSystem


    public static void decompile(final String internalName, final ITextOutput output, final DecompilerSettings settings) {
        VerifyArgument.notNull(internalName, "internalName");
        VerifyArgument.notNull(settings, "settings");

        final ITypeLoader typeLoader = settings.getTypeLoader() != null ? settings.getTypeLoader() : new ClasspathTypeLoader();
        final MetadataSystem metadataSystem = new MetadataSystem(typeLoader);

        final TypeReference type;

        if (internalName.length() == 1) {
            //
            // Hack to get around classes whose descriptors clash with primitive types.
            //

            final MetadataParser parser = new MetadataParser(IMetadataResolver.EMPTY);
            final TypeReference reference = parser.parseTypeDescriptor(internalName);

            type = metadataSystem.resolve(reference);
        }
        else {
            type = metadataSystem.lookupType(internalName);
        }

        final TypeDefinition resolvedType;

        if (type == null || (resolvedType = type.resolve()) == null) {
View Full Code Here


                System.err.println(ExceptionUtilities.getMessage(t));
                System.exit(-1);
            }
        }
        else {
            final MetadataSystem metadataSystem = new MetadataSystem(settings.getTypeLoader());

            for (final String typeName : typeNames) {
                try {
                    decompileType(metadataSystem, typeName, decompilationOptions, true);
                }
View Full Code Here

                new JarTypeLoader(jar),
                settings.getTypeLoader()
            )
        );

        final MetadataSystem metadataSystem = new MetadataSystem(settings.getTypeLoader());

        while (entries.hasMoreElements()) {
            final JarEntry entry = entries.nextElement();
            final String name = entry.getName();
View Full Code Here

      Closer.tryClose(oldState);
    }

    hmap.clear();
    tree.setModel(new DefaultTreeModel(null));
    metadataSystem = new MetadataSystem(typeLoader);
    file = null;
    treeExpansionState = null;
    open = false;
    mainWindow.onFileLoadEnded(file, open);
  }
View Full Code Here

      bar.setMinimum(0);
      bar.setMaximum(jfile.size());
      byte data[] = new byte[1024];
      DecompilerSettings settings = cloneSettings();
      LuytenTypeLoader typeLoader = new LuytenTypeLoader();
      MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
      ITypeLoader jarLoader = new JarTypeLoader(jfile);
      typeLoader.getTypeLoaders().add(jarLoader);

      DecompilationOptions decompilationOptions = new DecompilationOptions();
      decompilationOptions.setSettings(settings);
      decompilationOptions.setFullDecompilation(true);

      List<String> mass = null;
      JarEntryFilter jarEntryFilter = new JarEntryFilter(jfile);
      LuytenPreferences luytenPrefs = ConfigSaver.getLoadedInstance().getLuytenPreferences();
      if (luytenPrefs.isFilterOutInnerClassEntries()) {
        mass = jarEntryFilter.getEntriesWithoutInnerClasses();
      } else {
        mass = jarEntryFilter.getAllEntriesFromJar();
      }

      Enumeration<JarEntry> ent = jfile.entries();
      Set<JarEntry> history = new HashSet<JarEntry>();
      int tick = 0;
      while (ent.hasMoreElements() && !cancel) {
        bar.setValue(++tick);
        JarEntry entry = ent.nextElement();
        if (!mass.contains(entry.getName()))
          continue;
        label.setText("Extracting: " + entry.getName());
        bar.setVisible(true);
        if (entry.getName().endsWith(".class")) {
          JarEntry etn = new JarEntry(entry.getName().replace(".class", ".java"));
          label.setText("Extracting: " + etn.getName());
          //Duplicate
          if(history.add(etn)){
            out.putNextEntry(etn);
            try {
              String internalName = StringUtilities.removeRight(entry.getName(), ".class");
              TypeReference type = metadataSystem.lookupType(internalName);
              TypeDefinition resolvedType = null;
              if ((type == null) || ((resolvedType = type.resolve()) == null)) {
                throw new Exception("Unable to resolve type.");
              }
              Writer writer = new OutputStreamWriter(out);
View Full Code Here

  }

  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);
View Full Code Here

      getTranslator( TranslationDirection.Obfuscating ),
      getTranslator( TranslationDirection.Deobfuscating )
    ) );
   
    // decompile it!
    TypeDefinition resolvedType = new MetadataSystem( m_settings.getTypeLoader() ).lookupType( lookupClassName ).resolve();
    DecompilerContext context = new DecompilerContext();
    context.setCurrentType( resolvedType );
    context.setSettings( m_settings );
    AstBuilder builder = new AstBuilder( context );
    builder.addType( resolvedType );
View Full Code Here

TOP

Related Classes of com.strobel.assembler.metadata.MetadataSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.