private string oldIndexDirPath() { EventLogFile log = new EventLogFile(); System.Diagnostics.EventLogEntryCollection ELEC = log.ReadAllEntry(); for (int i = ELEC.Count - 1; i >= 0; i--) { if ((ELEC[i].Message).StartsWith("created@")) { return((ELEC[i].Message).Replace("created@", string.Empty)); } } return(string.Empty); }
public bool verfiyIndex() { try { EventLogFile log = new EventLogFile(); //log.DeleteLog(); //log.RemoveSource(); if (!indexExist()) { if (!log.VerifyLog("indexLog")) { log.CreateLog(); } return(true); } else { string message = "There was Another Indexing Operation performed Before. Do you want to Delete current Index files and perform a new indexing Operation?"; string caption = "Index Files Exist"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); if (result == DialogResult.Yes) { if (Directory.Exists(oldIndexDirPath())) { Directory.Delete(oldIndexDirPath(), true); } return(true); } return(false); } } catch (Exception ee) { MessageBox.Show(ee.Message); return(false); } }