⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proguardgui.java

📁 proguard 3.5 java 混淆器 最新 免费 好用的 大家用用试一下吧 天行健-君子以自强不息 地势坤-君子以厚德载物
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        for (int index = 0; index < boilerplateKeep.length; index++)        {            if (boilerplateKeepCheckBoxes[index].isSelected())            {                keep.add(classSpecification(boilerplateKeep[index],                                            boilerplateKeepTextFields[index].getText()));            }        }        // Collect the additional keep options.        List additionalKeep = additionalKeepPanel.getClassSpecifications();        if (additionalKeep != null)        {            keep.addAll(additionalKeep);        }        // Put the list of keep options in the configuration.        if (keep.size() > 0)        {            configuration.keep = keep;        }        // Collect the boilerplate keep names options.        List keepNames = new ArrayList();        for (int index = 0; index < boilerplateKeepNames.length; index++)        {            if (boilerplateKeepNamesCheckBoxes[index].isSelected())            {                keepNames.add(classSpecification(boilerplateKeepNames[index],                                                 boilerplateKeepNamesTextFields[index].getText()));            }        }        // Collect the additional keep names options.        List additionalKeepNames = additionalKeepNamesPanel.getClassSpecifications();        if (additionalKeepNames != null)        {            keepNames.addAll(additionalKeepNames);        }        // Put the list of keep names options in the configuration.        if (keepNames.size() > 0)        {            configuration.keepNames = keepNames;        }        // Collect the boilerplate "no side effect methods" options.        List noSideEffectMethods = new ArrayList();        for (int index = 0; index < boilerplateNoSideEffectMethods.length; index++)        {            if (boilerplateNoSideEffectMethodCheckBoxes[index].isSelected())            {                noSideEffectMethods.add(boilerplateNoSideEffectMethods[index]);            }        }        // Collect the additional "no side effect methods" options.        List additionalNoSideEffectOptions = additionalNoSideEffectsPanel.getClassSpecifications();        if (additionalNoSideEffectOptions != null)        {            noSideEffectMethods.addAll(additionalNoSideEffectOptions);        }        // Put the list of "no side effect methods" options in the configuration.        if (noSideEffectMethods.size() > 0)        {            configuration.assumeNoSideEffects = noSideEffectMethods;        }        // Collect the "why are you keeping" options.        configuration.whyAreYouKeeping = whyAreYouKeepingPanel.getClassSpecifications();        // Get the other options.        configuration.shrink                           = shrinkCheckBox                          .isSelected();        configuration.printUsage                       = printUsageCheckBox                      .isSelected() ? new File(printUsageTextField                       .getText()) : null;        configuration.optimize                         = optimizeCheckBox                        .isSelected();        configuration.allowAccessModification          = allowAccessModificationCheckBox         .isSelected();        configuration.obfuscate                        = obfuscateCheckBox                       .isSelected();        configuration.printMapping                     = printMappingCheckBox                    .isSelected() ? new File(printMappingTextField                     .getText()) : null;        configuration.applyMapping                     = applyMappingCheckBox                    .isSelected() ? new File(applyMappingTextField                     .getText()) : null;        configuration.obfuscationDictionary            = obfuscationDictionaryCheckBox           .isSelected() ? new File(obfuscationDictionaryTextField            .getText()) : null;        configuration.overloadAggressively             = overloadAggressivelyCheckBox            .isSelected();        configuration.defaultPackage                   = defaultPackageCheckBox                  .isSelected() ?          defaultPackageTextField                   .getText()  : null;        configuration.useMixedCaseClassNames           = useMixedCaseClassNamesCheckBox          .isSelected();        configuration.keepAttributes                   = keepAttributesCheckBox                  .isSelected() ? ListUtil.commaSeparatedList(keepAttributesTextField.getText()) : null;        configuration.newSourceFileAttribute           = newSourceFileAttributeCheckBox          .isSelected() ?          newSourceFileAttributeTextField           .getText()  : null;        configuration.printSeeds                       = printSeedsCheckBox                      .isSelected() ? new File(printSeedsTextField                       .getText()) : null;        configuration.verbose                          = verboseCheckBox                         .isSelected();        configuration.note                             = noteCheckBox                            .isSelected();        configuration.warn                             = warnCheckBox                            .isSelected();        configuration.ignoreWarnings                   = ignoreWarningsCheckBox                  .isSelected();        configuration.skipNonPublicLibraryClasses      = skipNonPublicLibraryClassesCheckBox     .isSelected();        configuration.skipNonPublicLibraryClassMembers = skipNonPublicLibraryClassMembersCheckBox.isSelected();        return configuration;    }    /**     * Looks in the given list for a class specification that is identical to     * the given template. Returns true if it is found, and removes the matching     * class specification as a side effect.     */    private boolean findClassSpecification(ClassSpecification classSpecificationTemplate,                                           List                classSpecifications)    {        if (classSpecifications == null)        {            return false;        }        for (int index = 0; index < classSpecifications.size(); index++)        {            if (classSpecificationTemplate.equals(classSpecifications.get(index)))            {                // Remove the matching option as a side effect.                classSpecifications.remove(index);                return true;            }        }        return false;    }    /**     * Looks in the given list for class specifications that match the given     * template. Returns a comma-separated string of class file names from     * matching class specifications, and removes the matching class     * specifications as a side effect.     */    private String findMatchingClassSpecifications(ClassSpecification classSpecificationTemplate,                                                   List                classSpecifications)    {        if (classSpecifications == null)        {            return null;        }        StringBuffer buffer = null;        for (int index = 0; index < classSpecifications.size(); index++)        {            ClassSpecification listedClassSpecification =                (ClassSpecification)classSpecifications.get(index);            String className = listedClassSpecification.className;            classSpecificationTemplate.className = className;            if (classSpecificationTemplate.equals(listedClassSpecification))            {                if (buffer == null)                {                    buffer = new StringBuffer();                }                else                {                    buffer.append(',');                }                buffer.append(className == null ? "*" : ClassUtil.externalClassName(className));                // Remove the matching option as a side effect.                classSpecifications.remove(index--);            }        }        return buffer == null ? null : buffer.toString();    }    /**     * Adds class specifications to the given list, based on the given template     * and the comma-separated list of class names to be filled in.     * @deprecated Add a single class specification using     *             #classSpecification(ClassSpecification,String).     */    private void addClassSpecifications(List               classSpecifications,                                        ClassSpecification classSpecificationTemplate,                                        String             classNamesString)    {        List classNames = ListUtil.commaSeparatedList(classNamesString);        for (int index = 0; index < classNames.size(); index++)        {            String className = (String)classNames.get(index);            // Add a modified copy of the template to the list.            classSpecifications.add(classSpecification(classSpecificationTemplate, className));        }    }    /**     * Returns a class specification, based on the given template and the class     * name to be filled in.     */    private ClassSpecification classSpecification(ClassSpecification classSpecificationTemplate,                                                  String             className)    {        // Create a copy of the template.        ClassSpecification classSpecification =            (ClassSpecification)classSpecificationTemplate.clone();        // Set the class name in the copy.        classSpecification.className =            className.equals("") ||            className.equals("*") ?                null :                ClassUtil.internalClassName(className);        // Return the modified copy.        return classSpecification;    }    // Methods and internal classes related to actions.    /**     * Loads the given ProGuard configuration into the GUI.     */    private void loadConfiguration(File file)    {        // Set the default directory and file in the file choosers.        configurationChooser.setSelectedFile(file.getAbsoluteFile());        fileChooser.setCurrentDirectory(file.getAbsoluteFile().getParentFile());        try        {            // Parse the configuration file.            ConfigurationParser parser = new ConfigurationParser(file);            Configuration configuration = new Configuration();            try            {                parser.parse(configuration);                // Let the GUI reflect the configuration.                setProGuardConfiguration(configuration);            }            catch (ParseException ex)            {                JOptionPane.showMessageDialog(getContentPane(),                                              msg("cantParseConfigurationFile", file.getPath()),                                              msg("warning"),                                              JOptionPane.ERROR_MESSAGE);            }            finally            {                parser.close();            }        }        catch (IOException ex)        {            JOptionPane.showMessageDialog(getContentPane(),                                          msg("cantOpenConfigurationFile", file.getPath()),                                          msg("warning"),                                          JOptionPane.ERROR_MESSAGE);        }    }    /**     * Loads the given ProGuard configuration into the GUI.     */    private void loadConfiguration(URL url)    {        try        {            // Parse the configuration file.            ConfigurationParser parser = new ConfigurationParser(url);            Configuration configuration = new Configuration();            try            {                parser.parse(configuration);                // Let the GUI reflect the configuration.                setProGuardConfiguration(configuration);            }            catch (ParseException ex)            {                JOptionPane.showMessageDialog(getContentPane(),                                              msg("cantParseConfigurationFile", url),                                              msg("warning"),                                              JOptionPane.ERROR_MESSAGE);            }            finally

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -