mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
script fix
This commit is contained in:
parent
7e5900095c
commit
7d0c8f7ece
2 changed files with 274 additions and 274 deletions
|
|
@ -1,273 +1,273 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ConsoleFrame.java
|
* ConsoleFrame.java
|
||||||
*
|
*
|
||||||
* Created on May 13, 2011, 2:39:10 PM
|
* Created on May 13, 2011, 2:39:10 PM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.server.console;
|
package mage.server.console;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import mage.interfaces.MageClient;
|
import mage.interfaces.MageClient;
|
||||||
import mage.interfaces.callback.ClientCallback;
|
import mage.interfaces.callback.ClientCallback;
|
||||||
import mage.remote.Connection;
|
import mage.remote.Connection;
|
||||||
import mage.remote.Session;
|
import mage.remote.Session;
|
||||||
import mage.utils.MageVersion;
|
import mage.utils.MageVersion;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger(ConsoleFrame.class);
|
private final static Logger logger = Logger.getLogger(ConsoleFrame.class);
|
||||||
|
|
||||||
private static Session session;
|
private static Session session;
|
||||||
private ConnectDialog connectDialog;
|
private ConnectDialog connectDialog;
|
||||||
private static Preferences prefs = Preferences.userNodeForPackage(ConsoleFrame.class);
|
private static Preferences prefs = Preferences.userNodeForPackage(ConsoleFrame.class);
|
||||||
private final static MageVersion version = new MageVersion(0, 7, 6, "");
|
private final static MageVersion version = new MageVersion(, , , "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the session
|
* @return the session
|
||||||
*/
|
*/
|
||||||
public static Session getSession() {
|
public static Session getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Preferences getPreferences() {
|
public static Preferences getPreferences() {
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MageVersion getVersion() {
|
public MageVersion getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates new form ConsoleFrame */
|
/** Creates new form ConsoleFrame */
|
||||||
public ConsoleFrame() {
|
public ConsoleFrame() {
|
||||||
initComponents();
|
initComponents();
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||||
session = new Session(this);
|
session = new Session(this);
|
||||||
connectDialog = new ConnectDialog();
|
connectDialog = new ConnectDialog();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal("", ex);
|
logger.fatal("", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean connect(Connection connection) {
|
public boolean connect(Connection connection) {
|
||||||
if (session.connect(connection)) {
|
if (session.connect(connection)) {
|
||||||
this.consolePanel1.start();
|
this.consolePanel1.start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusText(String status) {
|
public void setStatusText(String status) {
|
||||||
this.lblStatus.setText(status);
|
this.lblStatus.setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableButtons() {
|
public void enableButtons() {
|
||||||
btnConnect.setEnabled(true);
|
btnConnect.setEnabled(true);
|
||||||
btnConnect.setText("Disconnect");
|
btnConnect.setText("Disconnect");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableButtons() {
|
public void disableButtons() {
|
||||||
btnConnect.setEnabled(true);
|
btnConnect.setEnabled(true);
|
||||||
btnConnect.setText("Connect");
|
btnConnect.setText("Connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
* always regenerated by the Form Editor.
|
* always regenerated by the Form Editor.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
jToolBar1 = new javax.swing.JToolBar();
|
jToolBar1 = new javax.swing.JToolBar();
|
||||||
btnConnect = new javax.swing.JButton();
|
btnConnect = new javax.swing.JButton();
|
||||||
lblStatus = new javax.swing.JLabel();
|
lblStatus = new javax.swing.JLabel();
|
||||||
consolePanel1 = new mage.server.console.ConsolePanel();
|
consolePanel1 = new mage.server.console.ConsolePanel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
jToolBar1.setFloatable(false);
|
jToolBar1.setFloatable(false);
|
||||||
jToolBar1.setRollover(true);
|
jToolBar1.setRollover(true);
|
||||||
|
|
||||||
btnConnect.setText("Connect");
|
btnConnect.setText("Connect");
|
||||||
btnConnect.setFocusable(false);
|
btnConnect.setFocusable(false);
|
||||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
btnConnectActionPerformed(evt);
|
btnConnectActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(btnConnect);
|
jToolBar1.add(btnConnect);
|
||||||
|
|
||||||
lblStatus.setText("Not Connected");
|
lblStatus.setText("Not Connected");
|
||||||
jToolBar1.add(Box.createHorizontalGlue());
|
jToolBar1.add(Box.createHorizontalGlue());
|
||||||
jToolBar1.add(lblStatus);
|
jToolBar1.add(lblStatus);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)
|
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)
|
||||||
.addComponent(consolePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)
|
.addComponent(consolePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
.addComponent(consolePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE))
|
.addComponent(consolePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
|
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
|
||||||
if (session.isConnected()) {
|
if (session.isConnected()) {
|
||||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
this.consolePanel1.stop();
|
this.consolePanel1.stop();
|
||||||
session.disconnect(false);
|
session.disconnect(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
connectDialog.showDialog(this);
|
connectDialog.showDialog(this);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnConnectActionPerformed
|
}//GEN-LAST:event_btnConnectActionPerformed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
new ConsoleFrame().setVisible(true);
|
new ConsoleFrame().setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConsoleFrame getFrame() {
|
private ConsoleFrame getFrame() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton btnConnect;
|
private javax.swing.JButton btnConnect;
|
||||||
private mage.server.console.ConsolePanel consolePanel1;
|
private mage.server.console.ConsolePanel consolePanel1;
|
||||||
private javax.swing.JToolBar jToolBar1;
|
private javax.swing.JToolBar jToolBar1;
|
||||||
private javax.swing.JLabel lblStatus;
|
private javax.swing.JLabel lblStatus;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connected(final String message) {
|
public void connected(final String message) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
setStatusText(message);
|
setStatusText(message);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
setStatusText(message);
|
setStatusText(message);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected() {
|
public void disconnected() {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
consolePanel1.stop();
|
consolePanel1.stop();
|
||||||
setStatusText("Not connected");
|
setStatusText("Not connected");
|
||||||
disableButtons();
|
disableButtons();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
consolePanel1.stop();
|
consolePanel1.stop();
|
||||||
setStatusText("Not connected");
|
setStatusText("Not connected");
|
||||||
disableButtons();
|
disableButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMessage(final String message) {
|
public void showMessage(final String message) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
JOptionPane.showMessageDialog(this, message);
|
JOptionPane.showMessageDialog(this, message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
JOptionPane.showMessageDialog(getFrame(), message);
|
JOptionPane.showMessageDialog(getFrame(), message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(final String message) {
|
public void showError(final String message) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
JOptionPane.showMessageDialog(getFrame(), message, "Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(getFrame(), message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processCallback(ClientCallback callback) {
|
public void processCallback(ClientCallback callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ print "Enter new version: ";
|
||||||
my $version = <STDIN>;
|
my $version = <STDIN>;
|
||||||
chomp $version;
|
chomp $version;
|
||||||
|
|
||||||
#find(\&finded, "..");
|
find(\&finded, "..");
|
||||||
update_version_in_java("../Mage.CLient/src/main/java/mage/client/MageFrame.java");
|
update_version_in_java("../Mage.CLient/src/main/java/mage/client/MageFrame.java");
|
||||||
update_version_in_java("../Mage.Server/src/main/java/mage/server/Main.java");
|
update_version_in_java("../Mage.Server/src/main/java/mage/server/Main.java");
|
||||||
update_version_in_java("../Mage.Server.Console/src/main/java/mage/server/console/ConsoleFrame.java");
|
update_version_in_java("../Mage.Server.Console/src/main/java/mage/server/console/ConsoleFrame.java");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue