mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
refactor: removed outdated code with databases sync (cards db downloads from a server);
This commit is contained in:
parent
d6adc6d051
commit
ab515e60fe
7 changed files with 9 additions and 100 deletions
|
|
@ -818,9 +818,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
currentConnection.setPassword(password);
|
currentConnection.setPassword(password);
|
||||||
currentConnection.setHost(server);
|
currentConnection.setHost(server);
|
||||||
currentConnection.setPort(port);
|
currentConnection.setPort(port);
|
||||||
// force to redownload db on updates
|
|
||||||
boolean redownloadDatabase = (ExpansionRepository.instance.getSetByCode("GRN") == null || CardRepository.instance.findCard("Island") == null);
|
|
||||||
currentConnection.setForceDBComparison(redownloadDatabase);
|
|
||||||
String allMAC = "";
|
String allMAC = "";
|
||||||
try {
|
try {
|
||||||
allMAC = Connection.getMAC();
|
allMAC = Connection.getMAC();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="lblStatus" alignment="1" max="32767" attributes="0"/>
|
<Component id="lblStatus" alignment="1" max="32767" attributes="0"/>
|
||||||
<Component id="chkForceUpdateDB" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="chkAutoConnect" alignment="0" max="32767" attributes="0"/>
|
<Component id="chkAutoConnect" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="txtUserName" alignment="0" max="32767" attributes="0"/>
|
<Component id="txtUserName" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="panelFlag" alignment="0" max="32767" attributes="0"/>
|
<Component id="panelFlag" alignment="0" max="32767" attributes="0"/>
|
||||||
|
|
@ -97,7 +96,7 @@
|
||||||
<Component id="lblPassword" max="32767" attributes="0"/>
|
<Component id="lblPassword" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="filler2" max="32767" attributes="0"/>
|
<Component id="filler2" pref="52" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
|
@ -106,14 +105,12 @@
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="chkAutoConnect" min="-2" max="-2" attributes="0"/>
|
<Component id="chkAutoConnect" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="chkForceUpdateDB" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="jProxySettingsButton" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
|
<Component id="jProxySettingsButton" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
|
||||||
<Component id="btnWhatsNew" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
|
<Component id="btnWhatsNew" alignment="3" min="-2" pref="30" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
|
||||||
<Component id="lblStatus" min="-2" pref="24" max="-2" attributes="0"/>
|
<Component id="lblStatus" min="-2" pref="24" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||||
|
|
@ -180,15 +177,6 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkAutoConnectActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkAutoConnectActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="chkForceUpdateDB">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Force update of card database"/>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>If active the comparison of the server cards database to the client database will be enforced.<br>If not, the comparison will only done if the database version of the client is lower than the version of the server."/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkForceUpdateDBActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="jProxySettingsButton">
|
<Component class="javax.swing.JButton" name="jProxySettingsButton">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Proxy Settings..."/>
|
<Property name="text" type="java.lang.String" value="Proxy Settings..."/>
|
||||||
|
|
@ -441,6 +429,7 @@
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Other..."/>
|
<Property name="text" type="java.lang.String" value="Other..."/>
|
||||||
<Property name="toolTipText" type="java.lang.String" value="Choose server from full servers list"/>
|
<Property name="toolTipText" type="java.lang.String" value="Choose server from full servers list"/>
|
||||||
|
<Property name="enabled" type="boolean" value="false"/>
|
||||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
this.txtUserName.setText(MagePreferences.getUserName(serverAddress));
|
this.txtUserName.setText(MagePreferences.getUserName(serverAddress));
|
||||||
this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
|
this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
|
||||||
this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get(KEY_CONNECT_AUTO_CONNECT, "false")));
|
this.chkAutoConnect.setSelected(Boolean.parseBoolean(MageFrame.getPreferences().get(KEY_CONNECT_AUTO_CONNECT, "false")));
|
||||||
this.chkForceUpdateDB.setSelected(false); // has always to be set manually to force comparison
|
|
||||||
|
|
||||||
String selectedFlag = MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world");
|
String selectedFlag = MageFrame.getPreferences().get(KEY_CONNECT_FLAG, "world");
|
||||||
// set the selected country/flag
|
// set the selected country/flag
|
||||||
|
|
@ -223,7 +222,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
txtPassword = new javax.swing.JPasswordField();
|
txtPassword = new javax.swing.JPasswordField();
|
||||||
lblFlag = new javax.swing.JLabel();
|
lblFlag = new javax.swing.JLabel();
|
||||||
chkAutoConnect = new javax.swing.JCheckBox();
|
chkAutoConnect = new javax.swing.JCheckBox();
|
||||||
chkForceUpdateDB = new javax.swing.JCheckBox();
|
|
||||||
jProxySettingsButton = new javax.swing.JButton();
|
jProxySettingsButton = new javax.swing.JButton();
|
||||||
btnConnect = new javax.swing.JButton();
|
btnConnect = new javax.swing.JButton();
|
||||||
btnCancel = new javax.swing.JButton();
|
btnCancel = new javax.swing.JButton();
|
||||||
|
|
@ -277,14 +275,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chkForceUpdateDB.setText("Force update of card database");
|
|
||||||
chkForceUpdateDB.setToolTipText("<HTML>If active the comparison of the server cards database to the client database will be enforced.<br>If not, the comparison will only done if the database version of the client is lower than the version of the server.");
|
|
||||||
chkForceUpdateDB.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chkForceUpdateDBActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jProxySettingsButton.setText("Proxy Settings...");
|
jProxySettingsButton.setText("Proxy Settings...");
|
||||||
jProxySettingsButton.addActionListener(new java.awt.event.ActionListener() {
|
jProxySettingsButton.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
|
@ -409,6 +399,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
|
|
||||||
btnFindOther.setText("Other...");
|
btnFindOther.setText("Other...");
|
||||||
btnFindOther.setToolTipText("Choose server from full servers list");
|
btnFindOther.setToolTipText("Choose server from full servers list");
|
||||||
|
btnFindOther.setEnabled(false);
|
||||||
btnFindOther.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnFindOther.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnFindOther.addActionListener(new java.awt.event.ActionListener() {
|
btnFindOther.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
|
@ -535,7 +526,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(chkForceUpdateDB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(chkAutoConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(txtUserName)
|
.addComponent(txtUserName)
|
||||||
.addComponent(panelFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(panelFlag, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
|
@ -585,20 +575,18 @@ public class ConnectDialog extends MageDialog {
|
||||||
.addComponent(txtPassword)
|
.addComponent(txtPassword)
|
||||||
.addComponent(jLabel1))
|
.addComponent(jLabel1))
|
||||||
.addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
.addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||||
.addComponent(filler2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addComponent(filler2, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(panelFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(panelFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lblFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(lblFlag, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(chkAutoConnect)
|
.addComponent(chkAutoConnect)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(chkForceUpdateDB)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jProxySettingsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jProxySettingsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btnWhatsNew, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(btnWhatsNew, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addGap(29, 29, 29)
|
||||||
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||||
|
|
@ -654,11 +642,10 @@ public class ConnectDialog extends MageDialog {
|
||||||
connection.setPort(Integer.parseInt(this.txtPort.getText().trim()));
|
connection.setPort(Integer.parseInt(this.txtPort.getText().trim()));
|
||||||
connection.setUsername(this.txtUserName.getText().trim());
|
connection.setUsername(this.txtUserName.getText().trim());
|
||||||
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
|
connection.setPassword(String.valueOf(this.txtPassword.getPassword()).trim());
|
||||||
connection.setForceDBComparison(this.chkForceUpdateDB.isSelected() || RepositoryUtil.isDatabaseEmpty());
|
|
||||||
String allMAC = "";
|
String allMAC = "";
|
||||||
try {
|
try {
|
||||||
allMAC = Connection.getMAC();
|
allMAC = Connection.getMAC();
|
||||||
} catch (SocketException ex) {
|
} catch (SocketException ignore) {
|
||||||
}
|
}
|
||||||
connection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC);
|
connection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC);
|
||||||
MageFrame.getPreferences().put(KEY_CONNECT_FLAG, ((CountryItemEditor) cbFlag.getEditor()).getImageItem());
|
MageFrame.getPreferences().put(KEY_CONNECT_FLAG, ((CountryItemEditor) cbFlag.getEditor()).getImageItem());
|
||||||
|
|
@ -749,10 +736,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
PreferencesDialog.main(new String[]{PreferencesDialog.OPEN_CONNECTION_TAB});
|
PreferencesDialog.main(new String[]{PreferencesDialog.OPEN_CONNECTION_TAB});
|
||||||
}//GEN-LAST:event_jProxySettingsButtonActionPerformed
|
}//GEN-LAST:event_jProxySettingsButtonActionPerformed
|
||||||
|
|
||||||
private void chkForceUpdateDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkForceUpdateDBActionPerformed
|
|
||||||
// TODO add your handling code here:
|
|
||||||
}//GEN-LAST:event_chkForceUpdateDBActionPerformed
|
|
||||||
|
|
||||||
private void txtUserNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtUserNameActionPerformed
|
private void txtUserNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtUserNameActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_txtUserNameActionPerformed
|
}//GEN-LAST:event_txtUserNameActionPerformed
|
||||||
|
|
@ -907,7 +890,6 @@ public class ConnectDialog extends MageDialog {
|
||||||
private javax.swing.JButton btnWhatsNew;
|
private javax.swing.JButton btnWhatsNew;
|
||||||
private mage.client.util.gui.countryBox.CountryComboBox cbFlag;
|
private mage.client.util.gui.countryBox.CountryComboBox cbFlag;
|
||||||
private javax.swing.JCheckBox chkAutoConnect;
|
private javax.swing.JCheckBox chkAutoConnect;
|
||||||
private javax.swing.JCheckBox chkForceUpdateDB;
|
|
||||||
private javax.swing.Box.Filler filler1;
|
private javax.swing.Box.Filler filler1;
|
||||||
private javax.swing.Box.Filler filler2;
|
private javax.swing.Box.Filler filler2;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,6 @@ public interface MageServer {
|
||||||
|
|
||||||
Object serverGetPromotionMessages(String sessionId) throws MageException;
|
Object serverGetPromotionMessages(String sessionId) throws MageException;
|
||||||
|
|
||||||
// sync cards send sets db
|
|
||||||
@Deprecated // TODO: outdated, no more client/server sync, can be removed?
|
|
||||||
List<ExpansionInfo> syncGetMissingExpansionData(List<String> codes);
|
|
||||||
@Deprecated // TODO: outdated, no more client/server sync, can be removed?
|
|
||||||
List<CardInfo> syncGetMissingCardsData(List<String> classNames);
|
|
||||||
|
|
||||||
ServerState getServerState() throws MageException; // TODO: need stable update process, so rename it after few releases
|
ServerState getServerState() throws MageException; // TODO: need stable update process, so rename it after few releases
|
||||||
|
|
||||||
// TODO: miss session
|
// TODO: miss session
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class Connection {
|
||||||
private String proxyUsername;
|
private String proxyUsername;
|
||||||
private String proxyPassword;
|
private String proxyPassword;
|
||||||
private int clientCardDatabaseVersion;
|
private int clientCardDatabaseVersion;
|
||||||
private boolean forceDBComparison;
|
|
||||||
private String userIdStr;
|
private String userIdStr;
|
||||||
private int socketWriteTimeout;
|
private int socketWriteTimeout;
|
||||||
|
|
||||||
|
|
@ -261,15 +260,6 @@ public class Connection {
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated // TODO: server side cards do not supports now, so remove outdated code (db sync with server)
|
|
||||||
public boolean isForceDBComparison() {
|
|
||||||
return forceDBComparison;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForceDBComparison(boolean forceDBComparison) {
|
|
||||||
this.forceDBComparison = forceDBComparison;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSocketWriteTimeout() {
|
public int getSocketWriteTimeout() {
|
||||||
return socketWriteTimeout;
|
return socketWriteTimeout;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,6 @@ public class SessionImpl implements Session {
|
||||||
|
|
||||||
if (!connection.getUsername().equals("Admin")) {
|
if (!connection.getUsername().equals("Admin")) {
|
||||||
server.connectSetUserData(connection.getUsername(), sessionId, connection.getUserData(), client.getVersion().toString(), connection.getUserIdStr());
|
server.connectSetUserData(connection.getUsername(), sessionId, connection.getUserData(), client.getVersion().toString(), connection.getUserIdStr());
|
||||||
updateDatabase(connection.isForceDBComparison(), serverState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Logging: DONE");
|
logger.info("Logging: DONE");
|
||||||
|
|
@ -469,29 +468,6 @@ public class SessionImpl implements Session {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDatabase(boolean forceDBComparison, ServerState serverState) {
|
|
||||||
// download NEW cards/sets, but do not download data fixes (it's an old and rare feature from old clients, e.g. one client for different servers with different cards)
|
|
||||||
// use case: server gets new minor version with new cards, old client can get that cards too without donwload new version
|
|
||||||
|
|
||||||
// sets
|
|
||||||
long expansionDBVersion = ExpansionRepository.instance.getContentVersionFromDB();
|
|
||||||
if (forceDBComparison || serverState.getExpansionsContentVersion() > expansionDBVersion) {
|
|
||||||
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
|
||||||
List<ExpansionInfo> expansions = server.syncGetMissingExpansionData(setCodes);
|
|
||||||
logger.info("DB: updating sets... Found new: " + expansions.size());
|
|
||||||
ExpansionRepository.instance.saveSets(expansions, null, serverState.getExpansionsContentVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
// cards
|
|
||||||
long cardDBVersion = CardRepository.instance.getContentVersionFromDB();
|
|
||||||
if (forceDBComparison || serverState.getCardsContentVersion() > cardDBVersion) {
|
|
||||||
List<String> classNames = CardRepository.instance.getClassNames();
|
|
||||||
List<CardInfo> cards = server.syncGetMissingCardsData(classNames);
|
|
||||||
logger.info("DB: updating cards... Found new: " + cards.size());
|
|
||||||
CardRepository.instance.saveCards(cards, serverState.getCardsContentVersion());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleCannotConnectException(CannotConnectException ex) {
|
private void handleCannotConnectException(CannotConnectException ex) {
|
||||||
logger.warn("Cannot connect", ex);
|
logger.warn("Cannot connect", ex);
|
||||||
Throwable t = ex.getCause();
|
Throwable t = ex.getCause();
|
||||||
|
|
|
||||||
|
|
@ -1188,25 +1188,6 @@ public class MageServerImpl implements MageServer {
|
||||||
return action.negativeResult();
|
return action.negativeResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ExpansionInfo> syncGetMissingExpansionData(List<String> codes) {
|
|
||||||
List<ExpansionInfo> result = new ArrayList<>();
|
|
||||||
for (ExpansionInfo expansionInfo : ExpansionRepository.instance.getAll()) {
|
|
||||||
if (!codes.contains(expansionInfo.getCode())) {
|
|
||||||
result.add(expansionInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("Missing exp downloaded: " + result.size());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CardInfo> syncGetMissingCardsData(List<String> classNames) {
|
|
||||||
List<CardInfo> res = CardRepository.instance.getMissingCards(classNames);
|
|
||||||
logger.info("Missing cards downloaded: " + res.size());
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class GetPromotionMessagesAction extends ActionWithNullNegativeResult<Object> {
|
private static class GetPromotionMessagesAction extends ActionWithNullNegativeResult<Object> {
|
||||||
@Override
|
@Override
|
||||||
public Object execute() throws MageException {
|
public Object execute() throws MageException {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue