public static FromFile ( string filename = null ) : |
||
filename | string | |
Résultat |
private CompanionAppService() { Credentials = CompanionAppCredentials.FromFile(); // Need to work out our current state. //If we're missing username and password then we need to log in again if (string.IsNullOrEmpty(Credentials.email) || string.IsNullOrEmpty(Credentials.password)) { CurrentState = State.NEEDS_LOGIN; } else if (string.IsNullOrEmpty(Credentials.machineId) || string.IsNullOrEmpty(Credentials.machineToken)) { CurrentState = State.NEEDS_LOGIN; } else { // Looks like we're ready but test it to find out CurrentState = State.READY; try { Profile(); } catch (EliteDangerousCompanionAppException ex) { Logging.Warn("Failed to obtain profile: " + ex.ToString()); } } }
/// <summary> /// Log out of the companion API and remove local credentials /// </summary> public void Logout() { // Remove everything other than the local email address Credentials = CompanionAppCredentials.FromFile(); Credentials.machineToken = null; Credentials.machineId = null; Credentials.appId = null; Credentials.password = null; Credentials.ToFile(); CurrentState = State.NEEDS_LOGIN; }