xbonez
New Member
- Joined
- Nov 29, 2010
- Messages
- 1,182 (0.24/day)
- Location
- Philly, PA (US)
System Name | Winter |
---|---|
Processor | AMD Phenom II x4 965 BE @ 4.0Ghz |
Motherboard | MSI 790FX-GD70 |
Cooling | Corsair H50 Liquid Cooling |
Memory | 2 x 2Gb Gskill Ripjaws 1600Mhz (7-7-7-24@1.6V) |
Video Card(s) | Asus GTX 470 @ Stock (Zalman VF3000 cooler) |
Storage | 2 x Samsung Spinpoint F3 500GB (RAID 0) |
Display(s) | Hanns G 28" @ 1920x1200 |
Case | Antec 1200 |
Audio Device(s) | Onboard -- TosLink --> Z5500 |
Power Supply | Corsair 850TX 850W PSU |
Software | Win 7 64-bit Ultimate |
The other day, I finished working on a web development project which had code scattered across numerous PHP, JS, HTML, CS and JS files and I was curious as to how many lines of code I must have written.
That gave me the idea to write an application that can take in a project directory and calculate the total number of lines of code. I had been meaning to learn WPF for a while, so I wrote LOC Counter as a WPF application.
Without a doubt, a similar application already exists. The purpose of me coding LOC Counter wasn't so much to achieve a particular task as it was to learn. Developing LOC Counter taught me the following:
- WPF design principles - XAML code and Expression Blend
- Threading: Most of the work is done on a background thread keeping the UI thread unoccupied, which in turn, keeps the UI responsive.
- Use of AmCharts in WPF. AmCharts is an incredible and free charting library with support for WPF, Flash and HTML5/JS charts.
Being a WPF application, LOC Counter will have to be run in a windows environment with the .NET framework installed.
Counts all lines of code in a specific project directory
Begin by pointing the application to the root folder of your project. Once you click 'Start' the application reads through all files that contain source code and counts the number of lines of code.
File extensions whitelist
To ensure your final result is as accurate as possible, LOC Counter maintains a list of file extensions that contain source code.
You also have the option to include custom file extensions to the whitelist, and save the changes for future uses.
Code Distribution
Shows an interactive Pie chart of your code distribution across different file extensions.
Cancel Program Run
Because the bulk of the work is done by a background thread, the UI remains responsive for the user. At any point, you may hit the Stop button which will kill the background thread instantly and end the program run.
Turbo
For extremely large projects ( > 100K lines of code), you may select the 'Turbo' option. This option makes the program run a lot faster at the expense of reduced visual animations.
Winrar SFX
Video
http://youtu.be/iG1YQ1Nx_dc
http://youtu.be/iG1YQ1Nx_dc
Any comments, suggestions, possible feature additions etc., please let me know.
Last edited: