2018-11-28 13:52:20 +03:00
|
|
|
package ru.gravit.launcher;
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
|
|
public class OshiHWID implements HWID {
|
|
|
|
public static Gson gson = new Gson();
|
2018-12-03 13:44:23 +03:00
|
|
|
@LauncherAPI
|
2018-11-28 13:52:20 +03:00
|
|
|
public long totalMemory = 0;
|
2018-12-03 13:44:23 +03:00
|
|
|
@LauncherAPI
|
2018-11-28 13:52:20 +03:00
|
|
|
public String serialNumber;
|
2018-12-03 13:44:23 +03:00
|
|
|
@LauncherAPI
|
2018-11-28 13:52:20 +03:00
|
|
|
public String HWDiskSerial;
|
2018-12-03 13:44:23 +03:00
|
|
|
@LauncherAPI
|
|
|
|
public String processorID;
|
2018-11-28 13:52:20 +03:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getSerializeString() {
|
|
|
|
return gson.toJson(this);
|
|
|
|
}
|
2018-12-03 13:44:23 +03:00
|
|
|
@Override
|
2018-11-28 13:52:20 +03:00
|
|
|
public int getLevel() //Уровень доверия, насколько уникальные значения
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
if(totalMemory != 0) result++;
|
2018-12-03 13:44:23 +03:00
|
|
|
if(serialNumber != null && !serialNumber.equals("unknown")) result+=4;
|
|
|
|
if(HWDiskSerial != null && !HWDiskSerial.equals("unknown")) result+=15;
|
|
|
|
if(processorID != null && !processorID.equals("unknown")) result+=6;
|
2018-11-28 13:52:20 +03:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public boolean isNull() {
|
|
|
|
return getLevel() < 2;
|
|
|
|
}
|
|
|
|
}
|