private IEnumerator GetAllPokemonAPICallCo(string URL)
    {
        WWW request = new WWW(URL);

        yield return(request);

        jsonResponse = RootObject2.CreateFromJSON(request.text);

        yield return(jsonResponse);

        pokemonList = jsonResponse.results;

        SortPokemonList();

        if (sorting)
        {
            yield return(null);
        }

        foreach (Result pokemon in pokemonList)
        {
            GameObject listItem = Instantiate(buttonListItem, new Vector2(0, 0), Quaternion.identity);
            listItem.transform.SetParent(contentWindow.transform, false);
            listItem.name = pokemon.name;
            listItem.GetComponent <ButtonListItemScript>().Setup(pokemon.name);
        }

        if (PlayerPrefs.HasKey("contentPosition"))
        {
            contentWindow.transform.position = new Vector2(contentWindow.transform.position.x, PlayerPrefs.GetFloat("contentPosition"));
        }
    }
Exemplo n.º 2
0
        private void lstServerPlayers_SelectedIndexChanged(object sender, EventArgs e)
        {
            RootObject2 rootobjectServer = DownloadHandlerBattlelog.DownloadServerPlayerInfo(rootObjects3[lstServer.SelectedIndex].message.SERVER_PLAYERS[lstServerPlayers.SelectedIndex].personaId);

            txtPlayerID.Text           = ServerPlayerIDs[lstServerPlayers.SelectedIndex];
            txtServerPlayerName.Text   = rootObjects3[lstServer.SelectedIndex].message.SERVER_PLAYERS[lstServerPlayers.SelectedIndex].persona.personaName;
            txtServerPlayerRankNr.Text = rootobjectServer.data.generalStats.rank;
            if (Convert.ToInt32(rootobjectServer.data.generalStats.rank) > 120)
            {
                txtServerPlayerRankName.Text = RankNames[120];
            }
            else
            {
                txtServerPlayerRankName.Text = RankNames[Convert.ToInt32(rootobjectServer.data.generalStats.rank)];
            }

            txtServerPlayerSkill.Text = rootobjectServer.data.generalStats.skill;
            //var timeSpan = TimeSpan.FromSeconds(Convert.ToDouble(rootobject2.data.generalStats.timePlayed));
            //txtServerPlayerTimePlayed.Text = string.Format("H : {0}    M : {1}", timeSpan.Hours, timeSpan.Minutes);
            txtServerPlayerTimePlayed.Text      = "WIP";
            txtServerPlayerScore.Text           = string.Format("{0:n0}", rootobjectServer.data.generalStats.score);
            txtServerPlayerLongestHeadshot.Text = rootobjectServer.data.generalStats.longestHeadshot.ToString();
            txtServerPlayerKDRatio.Text         = Math.Round(rootobjectServer.data.generalStats.kdRatio, 2).ToString();
            txtServerPlayerAccuracy.Text        = Math.Round(rootobjectServer.data.generalStats.accuracy, 2).ToString();
            picPrfile.ImageLocation             = "http://www.gravatar.com/avatar/" + rootObjects3[lstServer.SelectedIndex].message.SERVER_PLAYERS[lstServerPlayers.SelectedIndex].persona.user.gravatarMd5;
        }
        public List <Datum2> GetData2()
        {
            string      IEXTrading_API_PATH = BASE_URL + "campgrounds?api_key=dCgbntSNVGwM7mzqC4hGhL6EGtp1pmYJDmhyuGnj";
            string      datum2List          = "";
            RootObject2 datums2             = null;

            // Connect to the IEXTrading API and retrieve information
            httpClient.BaseAddress = new Uri(IEXTrading_API_PATH);
            HttpResponseMessage response = httpClient.GetAsync(IEXTrading_API_PATH).GetAwaiter().GetResult();

            // Read the Json objects in the API response
            if (response.IsSuccessStatusCode)
            {
                datum2List = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }

            // Parse the Json strings as C# objects
            if (!datum2List.Equals(""))
            {
                datums2 = JsonConvert.DeserializeObject <RootObject2>(datum2List);
                //datums = datums.GetRange(0, 50);
            }

            return(datums2.data);
        }
Exemplo n.º 4
0
 public IActionResult results2()
 {
     rootObject = GetAllResults2();
     if (_repository.getCount2())
     {
         bool areNewRecordsAdded = _repository.SaveMobileApps(rootObject);
     }
     return(View(rootObject));
 }
        static public RootObject2 DownloadServerPlayerInfo(string PlayerID)
        {
            WebClient            playerJSON  = new WebClient();
            string               json        = playerJSON.DownloadString("http://battlelog.battlefield.com/bf4/warsawdetailedstatspopulate/" + PlayerID + "/1/");
            JavaScriptSerializer ser         = new JavaScriptSerializer();
            RootObject2          rootobejct2 = ser.Deserialize <RootObject2>(json);

            return(rootobejct2);
        }
Exemplo n.º 6
0
 private void lstPlayers_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabCtrlMain.SelectedIndex == 6)
     {
         txtPlayerID.Text = FileHandler.RequestedPlayerID(lstPlayers.Items[lstPlayers.SelectedIndex].ToString()).ToString();
     }
     else if (radBF4stats.Checked)
     {
         try
         {
             UseBF4stats = true;
             ClearMainStatusTextBoxes();
             tabCtrlMain.Enabled = false;
             lstPlayers.Enabled  = false;
             SelectedName        = lstPlayers.Items[lstPlayers.SelectedIndex].ToString();
             rootobject          = DownloadHandlerBF4Stats.DownloadInfo(SelectedName);
             tabCtrlMain.Enabled = true;
             lstPlayers.Enabled  = true;
             UpdateMainStatsBF4stats();
         }
         catch (InvalidOperationException)
         {
             MessageBox.Show("Problem is statistics, switching to Battlelog basic", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             rootobject2         = DownloadHandlerBattlelog.DownloadInfo(SelectedName);
             tabCtrlMain.Enabled = true;
             lstPlayers.Enabled  = true;
             UpdateMainStatsBasicBattlelog();
         }
     }
     else
     {
         try
         {
             UseBF4stats = false;
             ClearMainStatusTextBoxes();
             tabCtrlMain.Enabled = false;
             lstPlayers.Enabled  = false;
             SelectedName        = lstPlayers.Items[lstPlayers.SelectedIndex].ToString();
             rootobject2         = DownloadHandlerBattlelog.DownloadInfo(SelectedName);
             rootobject          = DownloadHandlerBF4Stats.DownloadInfo(SelectedName);
             tabCtrlMain.Enabled = true;
             lstPlayers.Enabled  = true;
             UpdateMainStatsBattlelog();
         }
         catch (InvalidOperationException)
         {
             MessageBox.Show("Problem is statistics, switching to Battlelog basic", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             rootobject2         = DownloadHandlerBattlelog.DownloadInfo(SelectedName);
             tabCtrlMain.Enabled = true;
             lstPlayers.Enabled  = true;
             UpdateMainStatsBasicBattlelog();
         }
     }
 }
Exemplo n.º 7
0
        public static string GetAddressFromLatLng(string latLng)
        {
            //string[] tabLatLng = latLng.Split(',');
            //latLng = tabLatLng[0] + "." + tabLatLng[1] + "," + tabLatLng[2] + "." + tabLatLng[3];
            var url    = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + latLng + "&key=AIzaSyALhF417BMAZPVB1jUugfoV13sTgMZwmMI";
            var client = new WebClient();

            client.Encoding = Encoding.UTF8;
            var         json        = client.DownloadString(url);
            RootObject2 rootObject2 = JsonConvert.DeserializeObject <RootObject2>(json);

            return(rootObject2.results.ElementAt(0).formatted_address);
        }
Exemplo n.º 8
0
        public static string GetLatLngFromAddress(string adresse)
        {
            var url    = "https://maps.googleapis.com/maps/api/geocode/json?address=" + adresse + "&key=AIzaSyALhF417BMAZPVB1jUugfoV13sTgMZwmMI";
            var client = new WebClient();

            client.Encoding = Encoding.UTF8;
            var         json        = client.DownloadString(url);
            RootObject2 rootObject2 = JsonConvert.DeserializeObject <RootObject2>(json);

            string latLng = rootObject2.results.ElementAt(0).geometry.location.lat.ToString() + "," +
                            rootObject2.results.ElementAt(0).geometry.location.lng.ToString();

            string[] tabLatLng = latLng.Split(',');
            latLng = tabLatLng[0] + "." + tabLatLng[1] + "," + tabLatLng[2] + "." + tabLatLng[3];

            return(latLng);
        }
Exemplo n.º 9
0
        public RootObject2 GetAllResults2()
        {
            string CompaniesApi_End_Point = BASE_URL + "?API_KEY=qZEyjY0nTO9R8suzDCwQs06eVpyfFOkY7UVacerl";
            string companyList            = string.Empty;

            httpClient.BaseAddress = new Uri(CompaniesApi_End_Point);
            HttpResponseMessage response = httpClient.GetAsync(CompaniesApi_End_Point).GetAwaiter().GetResult();

            if (response.IsSuccessStatusCode)
            {
                companyList = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }
            if (!string.IsNullOrEmpty(companyList))
            {
                Console.WriteLine();
                rootObject = JsonConvert.DeserializeObject <RootObject2>(companyList);
            }
            return(rootObject);
        }
Exemplo n.º 10
0
        public static async Task <ObservableCollection <Suggestions> > GetFutureInfoAsync(string city)
        {
            var         data       = new ObservableCollection <Suggestions>();
            RootObject2 myWeather2 = await GetFutureWeatherByCity(city);

            foreach (var forecast in myWeather2.list)
            {
                data.Add(new Suggestions
                {
                    Temperature = forecast.main.temp.ToString(),
                    Pressure    = forecast.main.pressure.ToString(),
                    Humidity    = forecast.main.humidity.ToString(),
                    Description = forecast.weather[0].description,
                    Icon        = String.Format("ms-appx:///Assets/Weather/{0}.png", forecast.weather[0].icon),
                    Time        = forecast.dt_txt,
                });
            }
            return(data);
        }
        static public RootObject2 DownloadInfo(string Name)
        {
            string        PlayerID   = "";
            List <string> PlayerInfo = FileHandler.PlayerIDs();

            foreach (var Player in PlayerInfo)
            {
                string[] Splitted = Player.Split(',');
                if (Name == Splitted[0])
                {
                    PlayerID = Splitted[1];
                }
            }

            WebClient            playerJSON  = new WebClient();
            string               json        = playerJSON.DownloadString("http://battlelog.battlefield.com/bf4/warsawdetailedstatspopulate/" + PlayerID + "/1/");
            JavaScriptSerializer ser         = new JavaScriptSerializer();
            RootObject2          rootobejct2 = ser.Deserialize <RootObject2>(json);

            return(rootobejct2);
        }
Exemplo n.º 12
0
        public static void run()
        {
Start:
            Console.WriteLine("input");
            int     count  = 1;
            JObject jp     = getInfo();
            string  url    = "";
            string  answer = "";
            //--------------------------------
            string json         = jp.ToString();
            double contractsSum = 0;

            info = JsonConvert.DeserializeObject <RootObject>(json);

            foreach (Result r in info.results)
            {
                Console.WriteLine(info.results.Count.ToString());
                try
                {
                    foreach (Contract c in info.results[0].contracts)
                    {
                        contractsSum += c.amount;
                        //-------------------FOR OKPD----------------------
                        WebRequest   reqGet2 = WebRequest.Create("http://openapi.clearspending.ru/restapi/v3/contracts/get/?regnum=" + c.reg_num.ToString());
                        WebResponse  resp2   = reqGet2.GetResponse();
                        Stream       stream2 = resp2.GetResponseStream();
                        StreamReader sr2     = new StreamReader(stream2);
                        string       s       = sr2.ReadToEnd();
                        JObject      parsed2 = JObject.Parse(s);
                        string       json2   = parsed2.ToString();

                        info2  = JsonConvert.DeserializeObject <RootObject2>(json2);
                        url    = info2.contracts.data[0].printFormUrl;
                        answer = YES;
                        if (info2.contracts.data[0].products[0].OKPD.ToString() == null)
                        {
                            answer = "контракт не содержит в себе предметы, имеющие отношение к деятельности СМИ";
                        }
                    }
                }
                catch (Exception e)
                {
                }
                // Console.WriteLine("Учредитель " + r.name + " заключил контракт на сумму " + contractsSum + " " + answer + "\nссылка на заключение контракта " + url);
                //sendTweet("Учредитель " + r.name + " заключил контракт на сумму " + contractsSum + " " + answer + "\nссылка на заключение контракта " + url);

                string imagePath = string.Empty;
                imagePath = count.ToString() + ".png";

                // Tweet wtih image
                if (imagePath.Length > 0)
                {
                    using (var stream = new FileStream(imagePath, FileMode.Open))
                    {
                        var result = twitter.SendTweetWithMedia(new SendTweetWithMediaOptions
                        {
                            Status = "Учредитель " + r.name + " заключил контракт на сумму " + contractsSum + " " + answer + "\nссылка на заключение контракта " + url,
                            Images = new Dictionary <string, Stream> {
                                { "john", stream }
                            }
                        });
                    }
                }
                Thread.Sleep(10000);
            }
            //--------------------------------

            count++;
            Thread.Sleep(4 * 60 * 60 * 1000);
            goto Start;
        }