Esempio n. 1
0
        public CODPlayer getPlayer()
        {
            CODPlayer p = null;

            try
            {
                Task.Run(async() => { p = await PullData(); }).GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                Program.Main(null);
                return(null);
            }

            return(p);
        }
Esempio n. 2
0
        public async Task <CODPlayer> PullData()
        {
            using (HttpClient client = new HttpClient())
            {
                using (HttpResponseMessage response = await client.GetAsync("https://cod-api.theapinetwork.com/api/stats/" + game + "/" + username + "/" + platform + "?type=" + type + ""))
                {
                    using (HttpContent content = response.Content)
                    {
                        this.content = await content.ReadAsStringAsync();

                        this.data = JObject.Parse(this.content);
                        CODPlayer player = new CODPlayer();
                        Console.WriteLine(this.content);
                        return(player);
                    }
                }
            }
        }
Esempio n. 3
0
        public static void CallOfDuty()
        {
            Console.Clear();
            string type = "";

            Console.WriteLine("Enter game name (bo4, bo3, wwii, iw): ");
            string game = Console.ReadLine();

            Console.WriteLine("\nEnter platform (psn, xbl, steam, bnet): ");
            string platform = Console.ReadLine();

            Console.WriteLine("\nEnter username: "******"bo4")
            {
                Console.WriteLine("\nEnter gamemode type (multiplayer, blackout): ");
                type = Console.ReadLine();
            }
            CallOfDutyAPI player = new CallOfDutyAPI(game, username, platform, type);

            Console.ForegroundColor = ConsoleColor.White;
            CODPlayer p = player.getPlayer();

            if (p != null)
            {
                Console.WriteLine(p.ToString());
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n\nError, a field is incorrect!\n\n");
                Console.ForegroundColor = ConsoleColor.Gray;
            }

            Console.ReadLine();
        }