Esempio n. 1
0
        static async Task getAHDataThread(int index, String realm)
        {
            try
            {
                AHFileRoot fileRoot = await getAPIAHRootFileData("auction/data/" + realm + "?locale=en_US&apikey=k7rsncmwup6nttk6vzeg6knyw4jrjjzj");

                String       ahRootDataPath = (fileRoot.files[0].url).Substring(55);
                AHRootObject ahData         = await getAPIAHRootData(ahRootDataPath);

                insertData(ahData, realm);
                Console.WriteLine(DateTime.Now + " SUCCESS!! I've succesfully updated " + realm + "'s auction data!");
                ahData.Dispose();
            }catch (Exception e)
            {
                Console.WriteLine(DateTime.Now + " It looks like there was an error updating " + realm + ". It will attempt to update on the next data collection attempt.\n" + e.Message);
            }
        }
Esempio n. 2
0
        static async Task <AHFileRoot> getAPIAHRootFileData(String path)
        {
            AHFileRoot          ahFileRoot = null;
            HttpResponseMessage response   = await ahFileClient.GetAsync(path);

            String responseData = "";

            if (response.IsSuccessStatusCode)
            {
                responseData = await response.Content.ReadAsStringAsync();
            }

            JObject ahRootData = JObject.Parse(responseData);

            ahFileRoot = JsonConvert.DeserializeObject <AHFileRoot>(responseData);

            return(ahFileRoot);
        }