Friday 9 January 2015

C# : Dowloading android quiz game answers using simple script.


Lot of android games are based on quiz such as Logo Quiz, Think app, 4 pics 1 word etc. We sometime struggle to find the answers so we browse internet but there also the sites have a hell lot of pages , such as one page for each level, but as questions are randomly generated we might have to go through a lot of pages for searching a particular answer. So here there is a simple script so that you can download all the images(i.e answers) at once.

How to proceed ?

Few sites like game-solver.com have answers in form of picture. Each picture for each level is represented by number of the level such as 1.jpg for level 1 , 2.jpg for level 2 and so on. So in C# we can write a simple code which downloads all these images by just editing the URL all the time.

Software Requirements : Visual C# or Visual Studio or any C# compiler.

Code :

First go to any game solving site. game-solver.com is the best one I think.
First get the URL of the image to be downloaded by clicking on the image. Save the URL for use in the program. In this code I am downloading the images for the Think app.

http://game-solver.com/wp-content/uploads/2014/03/Think-Chapter-1.jpg

above is URL for the answers of the first level of the Think game. Note the image URL is like Think-Chapter-1.jpg for chapter 2 it would be like Think-Chapter-2.jpg and so on.

C# provides inbuilt facilities for interacting with web and performing operations such as downloading files etc.

Include files :


using System.Net;
using System.Web;


Segement for downloading :


webClient.DownloadFile("http://game-solver.com/wp-content/uploads/2013/05/Logo-Quiz-Game-Level-"+i+".jpg", @"E:\"+i+".jpg");
   // downloading URL                //Directory to download  

In the above code 1st string is downloading URL and the second string is the directory where you want to save the file.

Complete code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Web;

namespace downloadthink
{
    class Program
    {
        static void Main(string[] args)
        {
            WebClient webClient = new WebClient();
            double percentage = 0.0;
            for (int i = 1; i <= 13;i++ )
            {
           webClient.DownloadFile("http://game-solver.com/wp-content/uploads/2013/05/Logo-Quiz-Game-Level-"+i+".jpg", @"E:\"+i+".jpg");
            percentage = 100.0 / 13.0 * i;
            Console.WriteLine("<<<< "+percentage+"% >>>>");
            }
            Console.WriteLine("Downloaded Sucessfully");
        }
    }
}
After running the code check the directory and you will find all the images.