mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-09 00:59:44 +03:00
[FEATURE] Подкручены числа HWID
This commit is contained in:
parent
07761dd88b
commit
08696839dc
2 changed files with 14 additions and 8 deletions
|
@ -137,6 +137,7 @@ public HWID getHWID() {
|
|||
hwid.totalMemory = getTotalMemory();
|
||||
hwid.HWDiskSerial = getHWDisk();
|
||||
hwid.processorID = getProcessorID();
|
||||
hwid.macAddr = getMacAddr();
|
||||
printHardwareInformation();
|
||||
return hwid;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ public class OshiHWID implements HWID {
|
|||
public String HWDiskSerial;
|
||||
@LauncherAPI
|
||||
public String processorID;
|
||||
@LauncherAPI
|
||||
public String macAddr;
|
||||
|
||||
@Override
|
||||
public String getSerializeString() {
|
||||
|
@ -22,10 +24,11 @@ public String getSerializeString() {
|
|||
public int getLevel() //Уровень доверия, насколько уникальные значения
|
||||
{
|
||||
int result = 0;
|
||||
if (totalMemory != 0) result++;
|
||||
if (serialNumber != null && !serialNumber.equals("unknown")) result += 4;
|
||||
if (HWDiskSerial != null && !HWDiskSerial.equals("unknown")) result += 15;
|
||||
if (processorID != null && !processorID.equals("unknown")) result += 6;
|
||||
if (totalMemory != 0) result+=8;
|
||||
if (serialNumber != null && !serialNumber.equals("unknown")) result += 12;
|
||||
if (HWDiskSerial != null && !HWDiskSerial.equals("unknown")) result += 30;
|
||||
if (processorID != null && !processorID.equals("unknown")) result += 10;
|
||||
if (macAddr != null && !macAddr.equals("00:00:00:00:00:00")) result += 15;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -35,10 +38,12 @@ public int compare(HWID hwid) {
|
|||
{
|
||||
int rate = 0;
|
||||
OshiHWID oshi = (OshiHWID) hwid;
|
||||
if(Math.abs(oshi.totalMemory - totalMemory) < 1024*1024) rate+=10;
|
||||
if(oshi.HWDiskSerial.equals(HWDiskSerial)) rate+=50;
|
||||
if(oshi.processorID.equals(processorID)) rate+=26;
|
||||
if(Math.abs(oshi.totalMemory - totalMemory) < 1024*1024) rate+=5;
|
||||
if(oshi.totalMemory == totalMemory) rate+=15;
|
||||
if(oshi.HWDiskSerial.equals(HWDiskSerial)) rate+=45;
|
||||
if(oshi.processorID.equals(processorID)) rate+=18;
|
||||
if(oshi.serialNumber.equals(serialNumber)) rate+=15;
|
||||
if(oshi.macAddr.equals(macAddr)) rate+=19;
|
||||
return rate;
|
||||
}
|
||||
return 0;
|
||||
|
@ -46,6 +51,6 @@ public int compare(HWID hwid) {
|
|||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return getLevel() < 2;
|
||||
return getLevel() < 15;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue