 |
|
 |
Excellent program. Installed, compiled, built, and executed exactly as advertised. Werdna, you're a rock star ;^)
=============================
"When people do not realize
their own intellectual limits,
they do not enter into the
struggle to understand that
which they have failed to
comprehend."
-- Bruce Harvey
=============================
www.idbDeveloper.com
|
|
|
|
 |
|
 |
The utility assumes that files for a web project are in a sub-folder of wwwroot which is the default for Microsoft but not for many applications.
|
|
|
|
 |
|
 |
at line 406 :
System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control 'cmdCount' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.set_WindowText(String value)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.ButtonBase.set_Text(String value)
at WinCount.WinCountForm.CountStart() in E:\Gid\Programming\CSharp\WinCount[source code cnt]\WinCountForm.cs:line 406
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
 |
|
 |
your code has called into another function
|
|
|
|
 |
|
 |
another sample written by C#.
counting source code lines, comment lines, space lines.
Just select the project file, then you can get summary for all files included in this project.
Now support C#(.csproj), VB.Net(.vbproj), VC.Net(.vcproj), VC6 project file(DSW,DSP)
you can download it from [here]
enjoy it.
sun shaodi
|
|
|
|
 |
|
 |
The program is just showing total number of lines in the file (like "wc -l"). How do I show LOC?
|
|
|
|
 |
|
 |
If you click on "Options..." then you can check not to count blank lines and comment lines.
I'm not sure if the version here at CodeProject has this functionality, but you can download latest version from http://www.adersoftware.com/?page=winCount
|
|
|
|
 |
|
 |
I also added the following code to the CountStart() method to clear the file list if the Count button is pressed more than once:
files.Clear();
int count = Count(txtDirectory.Text, mask, root);
- Drew
|
|
|
|
 |
|
 |
Hello,
I added the following code to CountFile() method to skip comment and blank lines.
NOTE: The code below will still count the last line of a /* */ block. However, it suited my purposes well enough and I didn't want to spend more than the 5 minutes it took to make these changes.
Hope someone finds this useful.
bool bCountLine = true;
string strLine;
while ((strLine = reader.ReadLine()) != null)
{
if (false == bCountLine &&
strLine.IndexOf("*/") != -1)
{
bCountLine = true;
}
else if (strLine.Trim().IndexOf("/*") == 0)
bCountLine = false;
if (true == bCountLine &&
strLine.Trim().Length > 0 &&
strLine.Trim().IndexOf("//") != 0)
count++;
}
- Drew
|
|
|
|
 |
|
 |
I have added your suggestions to the program.
There are options now to skip blank lines and/or comment lines.
You can download the latest version from: http://www.adersoftware.com/?page=winCount
|
|
|
|
 |