use of mage.remote.Connection in project mage by magefree.
the class LoadTest method createSimpleConnection.
private Connection createSimpleConnection(String username) {
Connection con = new Connection();
con.setUsername(username);
con.setHost(TEST_SERVER);
con.setPort(TEST_PORT);
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(TEST_PROXY_TYPE);
con.setProxyType(proxyType);
return con;
}
use of mage.remote.Connection in project mage by magefree.
the class MagePaneMenuItem method main.
/**
* @param args the command line arguments
*/
public static void main(final String[] args) {
// Workaround for #451
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
LOGGER.info("Starting MAGE client version " + VERSION);
LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel());
LOGGER.info("Default charset: " + Charset.defaultCharset());
if (!Charset.defaultCharset().toString().equals("UTF-8")) {
LOGGER.warn("WARNING, bad charset. Some images will not be downloaded. You must:");
LOGGER.warn("* Open launcher -> settings -> java -> client java options");
LOGGER.warn("* Insert additional command at the the end: -Dfile.encoding=UTF-8");
}
startTime = System.currentTimeMillis();
Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOGGER.fatal(null, e));
SwingUtilities.invokeLater(() -> {
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.startsWith(LITE_MODE_ARG)) {
liteMode = true;
}
if (arg.startsWith(GRAY_MODE_ARG)) {
grayMode = true;
}
if (arg.startsWith(FILL_SCREEN_ARG)) {
fullscreenMode = true;
}
if (arg.startsWith(SKIP_DONE_SYMBOLS)) {
skipSmallSymbolGenerationForExisting = true;
}
if (arg.startsWith(USER_ARG)) {
startUser = args[i + 1];
i++;
}
if (arg.startsWith(PASSWORD_ARG)) {
startPassword = args[i + 1];
i++;
}
if (arg.startsWith(SERVER_ARG)) {
startServer = args[i + 1];
i++;
}
if (arg.startsWith(PORT_ARG)) {
startPort = Integer.valueOf(args[i + 1]);
i++;
}
if (arg.startsWith(DEBUG_ARG)) {
debugMode = true;
}
}
if (!liteMode) {
final SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null) {
Graphics2D g = splash.createGraphics();
if (g != null) {
renderSplashFrame(g);
}
splash.update();
}
}
try {
instance = new MageFrame();
} catch (Throwable e) {
logger.fatal("Critical error on start up, app will be closed: " + e.getMessage(), e);
System.exit(1);
}
// debug menu
instance.separatorDebug.setVisible(debugMode);
instance.btnDebug.setVisible(debugMode);
if (startUser != null) {
instance.currentConnection = new Connection();
instance.currentConnection.setUsername(startUser);
instance.currentConnection.setHost(startServer);
if (startPort > 0) {
instance.currentConnection.setPort(startPort);
} else {
instance.currentConnection.setPort(MagePreferences.getServerPortWithDefault(ClientDefaultSettings.port));
}
PreferencesDialog.setProxyInformation(instance.currentConnection);
instance.currentConnection.setPassword(startPassword);
}
instance.setVisible(true);
});
}
use of mage.remote.Connection in project mage by magefree.
the class ConnectDialog method btnConnectActionPerformed.
// GEN-LAST:event_btnCancelActionPerformed
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {
if (txtPassword.getPassword().length == 0) {
JOptionPane.showMessageDialog(rootPane, "Please provide a password");
return;
}
if (txtServer.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(rootPane, "Please provide a server address");
return;
}
if (txtPort.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(rootPane, "Please provide a port number");
return;
}
if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535) {
JOptionPane.showMessageDialog(rootPane, "Invalid port number");
txtPort.setText(ConsoleFrame.getPreferences().get("serverPort", Integer.toString(17171)));
return;
}
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
connection = new Connection();
connection.setHost(this.txtServer.getText());
connection.setPort(Integer.valueOf(this.txtPort.getText()));
connection.setAdminPassword(new String(txtPassword.getPassword()));
connection.setUsername("Admin");
connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem());
if (!this.cbProxyType.getSelectedItem().equals(ProxyType.NONE)) {
connection.setProxyHost(this.txtProxyServer.getText());
connection.setProxyPort(Integer.valueOf(this.txtProxyPort.getText()));
connection.setProxyUsername(this.txtProxyUserName.getText());
connection.setProxyPassword(new String(this.txtPasswordField.getPassword()));
}
logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort());
task = new ConnectTask();
task.execute();
}
use of mage.remote.Connection in project mage by magefree.
the class ResetPasswordDialog method btnSubmitNewPasswordActionPerformed.
// GEN-LAST:event_btnGetAuthTokenActionPerformed
private void btnSubmitNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_btnSubmitNewPasswordActionPerformed
if (this.txtEmail.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an email address.");
return;
}
if (this.txtAuthToken.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an auth token.");
return;
}
if (String.valueOf(this.txtPassword.getPassword()).trim().isEmpty()) {
MageFrame.getInstance().showError("Please enter a new password.");
return;
}
if (!Arrays.equals(this.txtPassword.getPassword(), this.txtPasswordConfirmation.getPassword())) {
MageFrame.getInstance().showError("Passwords don't match.");
return;
}
connection = new Connection();
connection.setHost(this.txtServer.getText().trim());
connection.setPort(Integer.valueOf(this.txtPort.getText().trim()));
PreferencesDialog.setProxyInformation(connection);
connection.setEmail(this.txtEmail.getText().trim());
connection.setAuthToken(this.txtAuthToken.getText().trim());
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
resetPasswordTask = new ResetPasswordTask();
resetPasswordTask.execute();
}
Aggregations