mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] compareMode в HWIDHandler
This commit is contained in:
parent
920a15a6b2
commit
7f61f21a0b
1 changed files with 17 additions and 2 deletions
|
@ -36,6 +36,11 @@ public class MysqlHWIDHandler extends HWIDHandler {
|
|||
|
||||
private String banMessage;
|
||||
|
||||
private boolean compareMode = false;
|
||||
//Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ?"
|
||||
private int compare = 50; //При наборе схожести в 50 очков
|
||||
private boolean oneCompareMode = false;
|
||||
|
||||
/*
|
||||
//Добавить поля hwid в базу с пользователями
|
||||
|
||||
|
@ -136,12 +141,22 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
|
|||
a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams));
|
||||
}
|
||||
ResultSet set = a.executeQuery();
|
||||
if (set.next()) {
|
||||
boolean isOne = false;
|
||||
while(set.next()) {
|
||||
if(!oneCompareMode) isOne = true;
|
||||
OshiHWID db_hwid = new OshiHWID();
|
||||
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
|
||||
db_hwid.processorID = set.getString(hwidFieldProcessorID);
|
||||
db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial);
|
||||
db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory));
|
||||
if(hwid.compare(db_hwid) < compare) continue;
|
||||
if(oneCompareMode) isOne = true;
|
||||
boolean isBanned = set.getBoolean(hwidFieldBanned);
|
||||
if (isBanned) {
|
||||
throw new HWIDException(banMessage);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if(isOne) {
|
||||
onUpdateInfo(hwid, username, c);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
|
Loading…
Reference in a new issue