Пример #1
0
        private static CO2Savings GetCO2Statistics()
        {
            try {
                CO2Savings co2savings = new CO2Savings();
                string hash = Crypto.GetHMACbase64(Credential.SecretKey,Credential.PublicKey, true);

                string uri = string.Format("https://my.greenqloud.com/qloudsync/metrics/?username={0}&hashValue={1}", Credential.Username, hash);
                JObject data = JSONHelper.GetInfo (uri);
                if(data != null && data ["trulygreen"] != null){
                    foreach(JToken o in data ["trulygreen"]){
                        if((string)o["id"] == "co2_savings_total")
                            co2savings.Saved = (string) o["value"] ;
                    }
                }
                return co2savings;
            } catch {
                return null;
            }
        }
Пример #2
0
 static void UpdateVariables()
 {
     versionAvailable = GetVersionAvaliable ();
     savings = GetCO2Statistics ();
     usedup = GetSQTotalUsed ();
 }