Exemplo n.º 1
0
 /// <summary>
 /// Performs work on data as add new bot, remove old bot, update bot.
 /// </summary>
 /// <param name="downloadedData"></param>
 private static void UpdateBotsData(DownloadedData downloadedData)
 {
     for (int i = 0; i < downloadedData.Bots.Count; i++)
     {
         //If the bot doesn't exist in the database - Add the bot
         if (!DoesBotAlreadyExist(downloadedData.Bots[i][0]))
         {
             if (debug)
             {
                 Core.WriteLine("Adding a new bot...", Core.LogType.Worker);
             }
             bots.AddBot(downloadedData.Bots[i][0], Int32.Parse(downloadedData.Bots[i][1]), long.Parse(downloadedData.Bots[i][2]));
         }
         else // If the bot does exist
         {
             //Update data to new data.
             if (debug)
             {
                 Core.WriteLine("Updating bot data...", Core.LogType.Worker);
             }
             bots.bot[i].timesSeen = Int32.Parse(downloadedData.Bots[i][1]);
             bots.bot[i].lastSeen  = long.Parse(downloadedData.Bots[i][2]);
         }
     }
 }