本文整理汇总了Java中cuchaz.enigma.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于cuchaz.enigma包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canMigrate
import cuchaz.enigma.Constants; //导入依赖的package包/类
private static boolean canMigrate(Type oldObfType, ClassMatches classMatches) {
// non classes can be migrated
if (!oldObfType.hasClass()) {
return true;
}
// non obfuscated classes can be migrated
ClassEntry classEntry = oldObfType.getClassEntry();
if (!classEntry.getPackageName().equals(Constants.NonePackage)) {
return true;
}
// obfuscated classes with mappings can be migrated
return classMatches.getUniqueMatches().containsKey(classEntry);
}
示例2: onFinishOpenJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onFinishOpenJar(String jarName) {
// update gui
m_frame.setTitle(Constants.Name + " - " + jarName);
m_classesPanel.removeAll();
m_classesPanel.add(m_splitClasses);
setSource(null);
// update menu
m_closeJarMenu.setEnabled(true);
m_openMappingsMenu.setEnabled(true);
m_saveMappingsMenu.setEnabled(false);
m_saveMappingsAsMenu.setEnabled(true);
m_closeMappingsMenu.setEnabled(true);
m_exportSourceMenu.setEnabled(true);
m_exportJarMenu.setEnabled(true);
redraw();
}
示例3: onCloseJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onCloseJar() {
// update gui
m_frame.setTitle(Constants.Name);
setObfClasses(null);
setDeobfClasses(null);
setSource(null);
m_classesPanel.removeAll();
// update menu
m_closeJarMenu.setEnabled(false);
m_openMappingsMenu.setEnabled(false);
m_saveMappingsMenu.setEnabled(false);
m_saveMappingsAsMenu.setEnabled(false);
m_closeMappingsMenu.setEnabled(false);
m_exportSourceMenu.setEnabled(false);
m_exportJarMenu.setEnabled(false);
redraw();
}
示例4: onFinishOpenJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onFinishOpenJar(String jarName) {
// update gui
this.frame.setTitle(Constants.NAME + " - " + jarName);
this.classesPanel.removeAll();
this.classesPanel.add(m_splitClasses);
setSource(null);
// update menu
this.menuBar.closeJarMenu.setEnabled(true);
this.menuBar.openOldMappingsMenu.setEnabled(true);
this.menuBar.openMappingsMenu.setEnabled(true);
this.menuBar.saveMappingsMenu.setEnabled(false);
this.menuBar.saveMappingsAsMenu.setEnabled(true);
this.menuBar.saveMappingsOldMenu.setEnabled(true);
this.menuBar.saveMappingsSrgMenu.setEnabled(true);
this.menuBar.closeMappingsMenu.setEnabled(true);
this.menuBar.exportSourceMenu.setEnabled(true);
this.menuBar.exportJarMenu.setEnabled(true);
redraw();
}
示例5: onCloseJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onCloseJar() {
// update gui
this.frame.setTitle(Constants.NAME);
setObfClasses(null);
setDeobfClasses(null);
setSource(null);
this.classesPanel.removeAll();
// update menu
this.menuBar.closeJarMenu.setEnabled(false);
this.menuBar.openOldMappingsMenu.setEnabled(false);
this.menuBar.openMappingsMenu.setEnabled(false);
this.menuBar.saveMappingsMenu.setEnabled(false);
this.menuBar.saveMappingsAsMenu.setEnabled(false);
this.menuBar.saveMappingsOldMenu.setEnabled(false);
this.menuBar.saveMappingsSrgMenu.setEnabled(false);
this.menuBar.closeMappingsMenu.setEnabled(false);
this.menuBar.exportSourceMenu.setEnabled(false);
this.menuBar.exportJarMenu.setEnabled(false);
redraw();
}
示例6: replace
import cuchaz.enigma.Constants; //导入依赖的package包/类
@Override
public String replace(String className)
{
// classes not in the none package can be passed through
ClassEntry classEntry = new ClassEntry(className);
if(!classEntry.getPackageName().equals(Constants.NonePackage))
return className;
// is this class ourself?
if(className.equals(m_classEntry.getName()))
return "CSelf";
// try the namer
if(m_namer != null)
{
String newName = m_namer.getName(className);
if(newName != null)
return newName;
}
// otherwise, use local naming
if(!m_classNames.containsKey(className))
m_classNames.put(className, getNewClassName());
return m_classNames.get(className);
}
示例7: onFinishOpenJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onFinishOpenJar(String jarName)
{
// update gui
m_frame.setTitle(Constants.Name + " - " + jarName);
m_classesPanel.removeAll();
m_classesPanel.add(m_splitClasses);
setSource(null);
// update menu
m_closeJarMenu.setEnabled(true);
m_openMappingsMenu.setEnabled(true);
m_saveMappingsMenu.setEnabled(false);
m_saveMappingsAsMenu.setEnabled(true);
m_closeMappingsMenu.setEnabled(true);
m_exportSourceMenu.setEnabled(true);
mntmExportSource.setEnabled(true);
m_exportJarMenu.setEnabled(true);
redraw();
}
示例8: onCloseJar
import cuchaz.enigma.Constants; //导入依赖的package包/类
public void onCloseJar()
{
// update gui
m_frame.setTitle(Constants.Name);
setObfClasses(null);
setDeobfClasses(null);
setSource(null);
m_classesPanel.removeAll();
// update menu
m_closeJarMenu.setEnabled(false);
m_openMappingsMenu.setEnabled(false);
m_saveMappingsMenu.setEnabled(false);
m_saveMappingsAsMenu.setEnabled(false);
m_closeMappingsMenu.setEnabled(false);
m_exportSourceMenu.setEnabled(false);
mntmExportSource.setEnabled(false);
m_exportJarMenu.setEnabled(false);
redraw();
}
示例9: replace
import cuchaz.enigma.Constants; //导入依赖的package包/类
@Override
public String replace(String className) {
// classes not in the none package can be passed through
ClassEntry classEntry = new ClassEntry(className);
if (!classEntry.getPackageName().equals(Constants.NonePackage)) {
return className;
}
// is this class ourself?
if (className.equals(m_classEntry.getName())) {
return "CSelf";
}
// try the namer
if (m_namer != null) {
String newName = m_namer.getName(className);
if (newName != null) {
return newName;
}
}
// otherwise, use local naming
if (!m_classNames.containsKey(className)) {
m_classNames.put(className, getNewClassName());
}
return m_classNames.get(className);
}
示例10: getClass
import cuchaz.enigma.Constants; //导入依赖的package包/类
private static CtClass getClass(JarFile jar, JarEntry entry) throws IOException, NotFoundException {
// read the class into a buffer
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[Constants.KiB];
int totalNumBytesRead = 0;
InputStream in = jar.getInputStream(entry);
while (in.available() > 0) {
int numBytesRead = in.read(buf);
if (numBytesRead < 0) {
break;
}
bos.write(buf, 0, numBytesRead);
// sanity checking
totalNumBytesRead += numBytesRead;
if (totalNumBytesRead > Constants.MiB) {
throw new Error("Class file " + entry.getName() + " larger than 1 MiB! Something is wrong!");
}
}
// get a javassist handle for the class
String className = Descriptor.toJavaName(getClassEntry(entry).getName());
ClassPool classPool = new ClassPool();
classPool.appendSystemPath();
classPool.insertClassPath(new ByteArrayClassPath(className, bos.toByteArray()));
return classPool.get(className);
}
示例11: ProgressDialog
import cuchaz.enigma.Constants; //导入依赖的package包/类
public ProgressDialog(JFrame parent) {
// init frame
m_frame = new JFrame(Constants.Name + " - Operation in progress");
final Container pane = m_frame.getContentPane();
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEFT);
pane.setLayout(layout);
m_title = new JLabel();
pane.add(m_title);
// set up the progress bar
JPanel panel = new JPanel();
pane.add(panel);
panel.setLayout(new BorderLayout());
m_text = GuiTricks.unboldLabel(new JLabel());
m_progress = new JProgressBar();
m_text.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
panel.add(m_text, BorderLayout.NORTH);
panel.add(m_progress, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(360, 50));
// show the frame
pane.doLayout();
m_frame.setSize(400, 120);
m_frame.setResizable(false);
m_frame.setLocationRelativeTo(parent);
m_frame.setVisible(true);
m_frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
示例12: getClass
import cuchaz.enigma.Constants; //导入依赖的package包/类
private static CtClass getClass(JarFile jar, JarEntry entry) throws IOException, NotFoundException {
// read the class into a buffer
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[Constants.KiB];
int totalNumBytesRead = 0;
InputStream in = jar.getInputStream(entry);
while (in.available() > 0) {
int numBytesRead = in.read(buf);
if (numBytesRead < 0) {
break;
}
bos.write(buf, 0, numBytesRead);
// sanity checking
totalNumBytesRead += numBytesRead;
if (totalNumBytesRead > Constants.MiB) {
throw new Error("Class file " + entry.getName() + " larger than 1 MiB! Something is wrong!");
}
}
// get a javassist handle for the class
String className = Descriptor.toJavaName(getClassEntry(entry).getName());
ClassPool classPool = new ClassPool();
classPool.appendSystemPath();
classPool.insertClassPath(new ByteArrayClassPath(className, bos.toByteArray()));
return classPool.get(className);
}
示例13: ProgressDialog
import cuchaz.enigma.Constants; //导入依赖的package包/类
public ProgressDialog(JFrame parent) {
// init frame
this.frame = new JFrame(Constants.NAME + " - Operation in progress");
final Container pane = this.frame.getContentPane();
FlowLayout layout = new FlowLayout();
layout.setAlignment(FlowLayout.LEFT);
pane.setLayout(layout);
this.labelTitle = new JLabel();
pane.add(this.labelTitle);
// set up the progress bar
JPanel panel = new JPanel();
pane.add(panel);
panel.setLayout(new BorderLayout());
this.labelText = Utils.unboldLabel(new JLabel());
this.progress = new JProgressBar();
this.labelText.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
panel.add(this.labelText, BorderLayout.NORTH);
panel.add(this.progress, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(360, 50));
// show the frame
pane.doLayout();
this.frame.setSize(400, 120);
this.frame.setResizable(false);
this.frame.setLocationRelativeTo(parent);
this.frame.setVisible(true);
this.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
示例14: CrashDialog
import cuchaz.enigma.Constants; //导入依赖的package包/类
private CrashDialog(JFrame parent) {
// init frame
m_frame = new JFrame(Constants.NAME + " - Crash Report");
final Container pane = m_frame.getContentPane();
pane.setLayout(new BorderLayout());
JLabel label = new JLabel(Constants.NAME + " has crashed! =(");
label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
pane.add(label, BorderLayout.NORTH);
// report panel
m_text = new JTextArea();
m_text.setTabSize(2);
pane.add(new JScrollPane(m_text), BorderLayout.CENTER);
// buttons panel
JPanel buttonsPanel = new JPanel();
FlowLayout buttonsLayout = new FlowLayout();
buttonsLayout.setAlignment(FlowLayout.RIGHT);
buttonsPanel.setLayout(buttonsLayout);
buttonsPanel.add(Utils.unboldLabel(new JLabel("If you choose exit, you will lose any unsaved work.")));
JButton ignoreButton = new JButton("Ignore");
ignoreButton.addActionListener(event -> {
// close (hide) the dialog
m_frame.setVisible(false);
});
buttonsPanel.add(ignoreButton);
JButton exitButton = new JButton("Exit");
exitButton.addActionListener(event -> {
// exit enigma
System.exit(1);
});
buttonsPanel.add(exitButton);
pane.add(buttonsPanel, BorderLayout.SOUTH);
// show the frame
m_frame.setSize(600, 400);
m_frame.setLocationRelativeTo(parent);
m_frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
示例15: getClass
import cuchaz.enigma.Constants; //导入依赖的package包/类
private static CtClass getClass(JarFile jar, JarEntry entry)
throws IOException, NotFoundException
{
// read the class into a buffer
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[Constants.KiB];
int totalNumBytesRead = 0;
InputStream in = jar.getInputStream(entry);
while(in.available() > 0)
{
int numBytesRead = in.read(buf);
if(numBytesRead < 0)
break;
bos.write(buf, 0, numBytesRead);
// sanity checking
totalNumBytesRead += numBytesRead;
if(totalNumBytesRead > Constants.MiB)
throw new Error("Class file " + entry.getName()
+ " larger than 1 MiB! Something is wrong!");
}
// get a javassist handle for the class
String className =
Descriptor.toJavaName(getClassEntry(entry).getName());
ClassPool classPool = new ClassPool();
classPool.appendSystemPath();
classPool.insertClassPath(new ByteArrayClassPath(className, bos
.toByteArray()));
return classPool.get(className);
}