Beispiel #1
0
 private bool CheckLastUpdateWithCurrent(ExportMethodEnum ExportMethod)
 {
     using (HttpClient client = new HttpClient())
     {
         string url      = SWGoH.MongoDBRepo.BuildApiUrl("Guild", "&q={\"Name\":\"" + Name + "\"}", "&s={\"LastSwGohUpdated\":-1}", "&l=1", "&f={\"LastSwGohUpdated\": 1}");
         string response = client.GetStringAsync(url).Result;
         if (response != "" && response != "[  ]")
         {
             List <GuildDto> result = JsonConvert.DeserializeObject <List <GuildDto> >(response);
             if (result.Count == 1)
             {
                 GuildDto Found = result[0];
                 if (LastSwGohUpdated.CompareTo(Found.LastSwGohUpdated) == 0)
                 {
                     SWGoH.Log.ConsoleMessage("No need to update!!!!");
                     return(false);
                 }
                 return(true);
             }
             else
             {
                 return(true);
             }
         }
     }
     return(true);
 }
Beispiel #2
0
        private bool CheckLastUpdateWithCurrent(ExportMethodEnum ExportMethod)
        {
            using (HttpClient client = new HttpClient())
            {
                var    queryData = string.Concat("q={\"Name\":\"", Name, "\"}");
                var    orderby   = "s={\"LastSwGohUpdated\":-1}";
                var    limit     = "l=1";
                string apikey    = "JmQkm6eGcaYwn_EqePgpNm57-0LcgA0O";

                string url      = string.Format("https://api.mlab.com/api/1/databases/triplezero/collections/Guild/?{0}&{1}&{2}&apiKey={3}", queryData, orderby, limit, apikey);
                string response = client.GetStringAsync(url).Result;
                if (response != "")
                {
                    List <GuildDto> result = JsonConvert.DeserializeObject <List <GuildDto> >(response);
                    if (result.Count == 1)
                    {
                        GuildDto Found = result[0];
                        if (LastSwGohUpdated.CompareTo(Found.LastSwGohUpdated) == 0)
                        {
                            ConsoleMessage("No need to update!!!!");
                            return(false);
                        }
                        return(true);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            return(true);
        }