private void loadFiles() { this.Enabled = false; lblStatus.Text = "Загружаю список файлов"; // Load all supported files from the chosen dretory this.Enabled = true; Utils.fList = new List <xTextFile>(); try { foreach (string file in Directory.EnumerateFiles(Utils.WorkDirPath, "*.*", (chkSubdirectories.Checked) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) .Where(s => s.EndsWith(".doc") || s.EndsWith(".docx") || s.EndsWith(".odt") || s.EndsWith(".pdf") || s.EndsWith(".txt") || s.EndsWith(".xlsx") || s.EndsWith(".rtf") || s.EndsWith(".htm") || s.EndsWith(".html"))) { Utils.fList.Add(new xTextFile(file)); } olvFiles.SetObjects(Utils.fList); lblStatus.Text = "Готов"; } catch (UnauthorizedAccessException unaex) { Utils.ErrLog(unaex); Utils.msgCriticalError("Недостаточно прав для обработки данной директори, запустите программу с правами администратора, или выберите другую папку"); } }