HaveIBeenPwned / EmailAddressExtractor

A project to rapidly extract all email addresses from any files in a given path
BSD 3-Clause "New" or "Revised" License
68 stars 23 forks source link

Refactored ILineReader slightly #51

Closed GStefanowich closed 1 year ago

GStefanowich commented 1 year ago

Just like how I implemented Filters to automatically be found using Reflection, I changed implementations of ILineReader to be found using Reflection using the ExtensionTypesAttribute:

[ExtensionTypes(".odt")]
internal sealed class OpenDocumentXmlReader : CompressedXmlReader
{ /* Stuff */ }
[ExtensionTypes(".log", ".json", ".txt", ".sql", ".xml", ".sample", ".csv", ".tsv")]
internal sealed class PlainTextReader : ILineReader
{ /* Stuff */ }
[ExtensionTypes(".pdf")]
public sealed class PdfReader : ILineReader
{ /* Stuff */ }

Now line reader files are self-contained and modifying FileExtensionParsing.cs isn't necessary.

I also added documentation for creating Filters to the CONTRIBUTING.md file

I'll look into some of the Regex performance stuff when I have more time, but this was quick and just some cleanup stuff