private void ProcessFile(string filename, Extractor item) { m_stderr.WriteLine("Processing " + filename); try { int flags = isys_docfilters.IGR_BODY_AND_META; if (m_html) { flags |= isys_docfilters.IGR_FORMAT_HTML; } item.Open(flags); // Extract the text and return it to stdout while (!item.getEOF()) { String t = item.GetText(4096); // Cleanup the text t = t.Replace('\u000E', '\n'); t = t.Replace('\r', '\n'); m_stdout.Write(t); } m_stdout.WriteLine(""); // Extract the HTML generated images into the current folder if (m_html) { SubFile image = item.GetFirstImage(); while (image != null) { m_stderr.WriteLine("Extracting image " + image.getName()); image.CopyTo(image.getName()); image.Close(); // Move onto the next image image = item.GetNextImage(); } } // Extract the sub files (if any) and process recursively if (m_subFiles) { SubFile child = item.GetFirstSubFile(); while (child != null) { ProcessFile(filename + ">" + child.getName(), child); // Move onto the next sub file child = item.GetNextSubFile(); } } } catch (Exception e) { m_stderr.WriteLine("Error Processing " + filename); m_stderr.WriteLine(" - " + e.ToString()); } finally { item.Close(); } }