public static void AssembleDataset(Database database) { int marker = 0; do { if ((numberOfTweetsToFetch - marker) < insertSize) { insertSize = (numberOfTweetsToFetch - marker); } Task <List <Status> > statuses = TwitterStuff.GetTwitterData(searchQuery, insertSize, maxID, sinceID); statuses.Wait(); var listOfTweets = statuses.Result; maxID = listOfTweets.Min(status => status.StatusID) - 1; try { database.Insert(listOfTweets); marker += listOfTweets.Count; } catch { Console.WriteLine("SQL INSERT failed. Try again? Press any key..."); Console.ReadKey(); } } while (marker < numberOfTweetsToFetch); }
static void Main(string[] args) { database = new Database(); while (quit == false) { Console.Clear(); Console.WriteLine("Press:\n 1 Get tweets menu\n 2 TEST SQL\n 3 test\n Q Quit"); ConsoleKeyInfo choice = Console.ReadKey(); Console.WriteLine(); switch (choice.KeyChar) { case '1': GetTweetsUI(); break; case '2': Console.WriteLine("Max Query Size: {0}", database.GetMaxQuerySize()); break; case '3': Controlpanel.Init(); break; case '4': TwitterStuff.GetRawData("dkpol"); break; case 'q': quit = true; Console.WriteLine("Quitting..."); System.Threading.Thread.Sleep(500); break; } } }