private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) { Console.WriteLine("The Elapsed event was raised at {0}|{1}|", e.SignalTime, e.SignalTime.Hour + ":" + e.SignalTime.Minute); var time = DBManager.IsTime(e.SignalTime.Hour + ":" + e.SignalTime.Minute); foreach (var elem in time) { var tElem = elem.Split('|'); if (DateValue.isScaning) { lTime.Add(elem); } else { DateValue.countCheckFile = 0; DateValue.countFile = 0; DateValue.countVirusFile = 0; DateValue.isScaning = true; DateValue.isSearchFile = true; DateValue.path = tElem[1]; DateValue.dateStart = DateTime.Now.ToString("MM.dd.yyyy H:mm"); DateValue.idReport = DBManager.GetNextIdReport(); new Thread(SearchFile.SearchFileDirectory).Start(new object[] { tElem[1], (Operation)int.Parse(tElem[2]) }); } } if (time.Length == 0) { if (lTime.Count > 0) { var tElem = lTime[0].Split('|'); DateValue.countCheckFile = 0; DateValue.countFile = 0; DateValue.countVirusFile = 0; DateValue.isScaning = true; DateValue.isSearchFile = true; DateValue.path = tElem[1]; DateValue.dateStart = DateTime.Now.ToString("MM.dd.yyyy H:mm"); DateValue.idReport = DBManager.GetNextIdReport(); new Thread(SearchFile.SearchFileDirectory).Start(new object[] { tElem[1], (Operation)int.Parse(tElem[2]) }); lTime.RemoveAt(0); } } }
public bool StartScaning(string path, DateValue.Operation oper) { if (DateValue.isScaning) { return(false); } else { DateValue.countCheckFile = 0; DateValue.countFile = 0; DateValue.countVirusFile = 0; DateValue.isScaning = true; DateValue.isSearchFile = true; DateValue.path = path; DateValue.dateStart = DateTime.Now.ToString("MM.dd.yyyy H:mm"); DateValue.idReport = DBManager.GetNextIdReport(); new Thread(SearchFile.SearchFileDirectory).Start(new object[] { path, oper }); return(true); } }