Archived
0

implement connect to Elite Dangerous Companion

This commit is contained in:
Mo
2015-07-19 00:35:38 +03:00
committed by iMoHax
parent 5109fe89d5
commit 37e147055f
14 changed files with 53269 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
package ru.trader.edce;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class EDSessionDemo {
private final static Logger LOG = LoggerFactory.getLogger(EDSessionDemo.class);
private static String readLine(String format, Object... args) throws IOException {
if (System.console() != null) {
return System.console().readLine(format, args);
}
System.out.print(String.format(format, args));
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
return reader.readLine();
}
public static void main(String args[]) throws Exception {
LOG.info("Test ED Companion connect");
EDSession edSession = new EDSession("frontier@mail.ru","elite");
if (edSession.getLastStatus() == ED_SESSION_STATUS.OK){
LOG.info("Check get profile");
edSession.readProfile(s ->{});
}
if (edSession.getLastStatus() == ED_SESSION_STATUS.LOGIN_REQUIRED) {
edSession.login();
if (edSession.getLastStatus() == ED_SESSION_STATUS.VERIFICATION_REQUIRED) {
LOG.info("Check verification");
String code = readLine("Verify code:");
edSession.submitVerifyCode(code);
edSession.login();
}
if (edSession.getLastStatus() == ED_SESSION_STATUS.OK) {
LOG.info("Check get profile");
edSession.readProfile(s -> {});
}
}
edSession.close();
}
}