public static void checkLastProcessList()
 {
     for (int i = 0; i < anPrecedentProcIds.Count; i++)
     {
         bool bWasFound = false;
         for (int j = 0; j < anProcIds.Count; j++)
         {
             if (anProcIds.ElementAt(j) == anPrecedentProcIds.ElementAt(i))
             {
                 bWasFound = true;
                 break;
             }
         }
         if (bWasFound == false)
         {
             if (apdPrecedentProcData.ElementAt(i).dtTimeStart.ToString() != "1/1/0001 12:00:00 AM")
             {
                 apdShownProcesses.Remove(apdShownProcesses.Find(apdPrecedentProcData.ElementAt(i).getId()));
                 TimeSpan dtTimeEnd = System.DateTime.Now.Subtract(apdPrecedentProcData.ElementAt(i).dtTimeStart);
                 FileController.saveApplicationExitTime(apdPrecedentProcData.ElementAt(i).getName(), dtTimeEnd);
             }
         }
     }
 }
        public static void getHistory()
        {
            string chromeHistoryFile = String.Empty;

            chromeHistoryFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data\Default\History";
            string duplicate = GlobalVariables.rootFolder + "History";

            //FILE COPY
            FileController.setFilePermission(duplicate);
            try { System.IO.File.Copy(chromeHistoryFile, duplicate, true); }
            catch (Exception e) {}

            //Console.WriteLine(chromeHistoryFile);
            if (File.Exists(duplicate))
            {
                using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + duplicate))
                {
                    connection.Open();

                    DataSet dataset = new DataSet();

                    SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from urls order by last_visit_time desc", connection);
                    adapter.Fill(dataset);

                    if (dataset != null && dataset.Tables.Count > 0 & dataset.Tables[0] != null)
                    {
                        DataTable dt = dataset.Tables[0];

                        allHistoryItems = new List <HistoryItem>();


                        foreach (DataRow historyRow in dt.Rows)
                        {
                            HistoryItem historyItem = new HistoryItem()
                            {
                                URL   = Convert.ToString(historyRow["url"]),
                                Title = Convert.ToString(historyRow["title"]),
                                Count = Convert.ToInt32(historyRow["visit_count"])
                            };

                            long utcMicroSeconds = Convert.ToInt64(historyRow["last_visit_time"]);

                            DateTime gmtTime = DateTime.FromFileTimeUtc(10 * utcMicroSeconds);

                            DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(gmtTime, TimeZoneInfo.Local);
                            historyItem.VisitedTime = localTime;

                            if (checkItem(historyItem) == true)
                            {
                                allHistoryItems.Add(historyItem);
                            }
                        }
                    }
                    //allShownHistoryItems = new List<HistoryItem>();
                    copyLastHistoryItems();
                    connection.Close();
                }
            }

            if (allHistoryItems != null && allHistoryItems.Count > 0)
            {
                //showHistory();
                FileController.saveHistory();
            }
        }