private void InitializeTextFinder() { var extension = Path.GetExtension(_filePath)?.ToLower(); switch (extension) { case ".pdf": _textFinder = new PdfTextFinder(_filePath, _password); break; case ".epub": _textFinder = new EpubTextFinder(_filePath, _password); break; default: throw new Exception(); } }