예제 #1
0
 /// <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());
 }
예제 #2
0
 public EcobeeConnector()
 {
     if (_client == null)
     {
         _client = new HttpClient();
     }
     _serializerSettings = new JsonSerializerSettings()
     {
         ContractResolver = _resolver
     };
     credentials = EcobeeCredentials.LoadFromFile(API_FILE);
 }