private void _DirectoryMonitor_ScanProgress(object sender, ScanProgressEventArgs e) { List <RawFileData> newFileData = new List <RawFileData>(); foreach (string file in e.FoundFiles) { int lastSlash = file.LastIndexOf(@"\"); if (lastSlash == -1) { continue; } newFileData.Add(new RawFileData(-1, file, file.Substring(lastSlash + 1).ToLower(), 1, null, 0, false, false)); } foreach (string directory in e.FoundDirectories) { int lastSlash = directory.LastIndexOf(@"\"); if (lastSlash == -1) { continue; } newFileData.Add(new RawFileData(-1, directory, directory.Substring(lastSlash + 1).ToLower(), 0, null, 0, false, false)); } try { m_database.InsertTransacted <RawFileData>(DBCollisionAction.IGNORE, "FileCache", newFileData); } catch (Exception crap) { Settings.SessionLog += crap.Message + "\n"; Debug.WriteLine(crap.Message); } }