当前位置: 首页>>代码示例>>Java>>正文


Java Constants类代码示例

本文整理汇总了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);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:17,代码来源:MappingsConverter.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:19,代码来源:Gui.java

示例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();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:20,代码来源:Gui.java

示例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();
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:22,代码来源:Gui.java

示例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();
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:23,代码来源:Gui.java

示例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);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:27,代码来源:ClassIdentity.java

示例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();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:21,代码来源:Gui.java

示例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();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:22,代码来源:Gui.java

示例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);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:29,代码来源:ClassIdentity.java

示例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);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:28,代码来源:JarClassIterator.java

示例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);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:32,代码来源:ProgressDialog.java

示例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);
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:28,代码来源:JarClassIterator.java

示例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);
    }
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:32,代码来源:ProgressDialog.java

示例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);
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:41,代码来源:CrashDialog.java

示例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);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:32,代码来源:JarClassIterator.java


注:本文中的cuchaz.enigma.Constants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。