/// <summary> /// Loads the credentials from the provided file and returns a new EcobeeCredentials /// </summary> /// <param name="file">File to load from</param> /// <returns>Credentials object</returns> public static EcobeeCredentials LoadFromFile(string file) { if (File.Exists(file)) { string contents = File.ReadAllText(file); EcobeeCredentials creds = JsonConvert.DeserializeObject <EcobeeCredentials>(contents); return(creds); } return(new EcobeeCredentials()); }
public EcobeeConnector() { if (_client == null) { _client = new HttpClient(); } _serializerSettings = new JsonSerializerSettings() { ContractResolver = _resolver }; credentials = EcobeeCredentials.LoadFromFile(API_FILE); }