A command-line C# application that analyzes text and CSV files in a directory, providing detailed statistics about file content.
- Word count
- Character count
- Line count
- Field/column count
- Batch Processing: Analyzes all supported files in a specified directory
- Extensible Architecture: Easy to add support for new file types
The project follows Object-Oriented Programming principles:
- Interface-based design (
IFileAnalysis) - Inheritance with abstract
FileAnalyzerbase class - Extension methods for clean file type checking
- Separation of concerns with dedicated analyzer classes for each file type
FileAnalyzerProject/
├── Main.cs # Entry point
├── FileAnalyzer.cs # Base analyzer class
├── TxtFileAnalyzer.cs # Text file analyzer implementation
├── CsvFileAnalyzer.cs # CSV file analyzer implementation
├── IFileAnalysis.cs # Analysis interface
├── AnalysisResults.cs # Results data structure
└── FileInfoExtension.cs # File type extension methods
- .NET 6.0 or higher
- C# compiler
- Clone the repository:
git clone https://github.com/yourusername/Text-Data-Analyzer.git
cd Text-Data-Analyzer- Build the project:
dotnet build- Run the application:
dotnet run- Run the application
- Enter the full path to the folder you want to analyze
- The application will process all
.txtand.csvfiles and display results
Welcome To Text File Analyzer :)
Please Enter The Entire Folder Path To Analyze
C:\MyDocuments
------------------------
File Name : sample.txt
------------------------
Number Of Words : 150
Number Of Lines : 25
Number Of Characters : 850
------------------------
File Name : data.csv
------------------------
Number Of Fields : 5
- Strategy Pattern: Different analyzers implement the same interface
- Extension Methods: Clean syntax for file type checking
| Class | Description |
|---|---|
IFileAnalysis |
Interface defining the contract for file analyzers |
FileAnalyzer |
Base class containing common functionality |
AnalysisResults |
Struct holding analysis results |
TxtFileAnalyzer |
Implements text file analysis |
CsvFileAnalyzer |
Implements CSV file analysis |
- Support for additional file formats (JSON, XML, etc.)
- More detailed CSV analysis (row count, data types)
- Export results to file
- GUI interface
- Unit tests
- Performance optimization for large files
Contributions are welcome! Please feel free to submit a Pull Request.
Feel free to ⭐ this repository if you found it helpful!