Свернуть ↑
public static Loader getInstance()
{
if (_instance == null) {
_instance = new Loader();
}
return _instance;
}
private Loader()
{
load = getTo("bXlkb21pYW4ucnUvY2xpZW50LnBocA==");//mydomian.ru/client.php
BufferedReader reader = null;
try
{
URL url = new URL(load + "?" + Base64.encodeBytes(Config.OWNER_NAME.getBytes()));
reader = new BufferedReader(new InputStreamReader(url.openStream()));
}
catch (IOException e)
{
reader = null;
}
if (reader == null)
{
_log.info("License : Unable to connect license server!");
Shutdown.getInstance().schedule(60, 2);
return;
}
try
{
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith("Key=")) {
Config.LICENSE_KEY = Integer.parseInt(line.substring(4).trim(), 16) << 8;
}
}
if (Config.LICENSE_KEY == -1)
{
throw new Exception();
}
}
catch (Exception e)
{
_log.info("Not correct License");
Shutdown.getInstance().schedule(60, 2);
}
}