91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

今天突然想統計一下代碼的行數,沒有想太多就動手寫了一個。寫完才發現是重復造輪子,網上已經有這樣的工具了。既然造了,那就共相互來,能用得上的,就用用。 開發環境VS2012,.net 2.0 代碼經過調整的,算是比較負責任。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?System.Text.Regularexpressions;
using?System.Diagnostics;

namespace?SourceCodeAnalysis
{
????public?partial?class?FrmLinesOfCodeStatistics?:?Form
????{
????????public?FrmLinesOfCodeStatistics()
????????{
????????????InitializeComponent();
????????}

????????private?void?btnDoStatistics_Click(object?sender?EventArgs?e)
????????{
????????????if?(!Directory.Exists(txtCodePath.Text))
????????????{
????????????????MessageBox.Show(“請選擇源文件夾路徑“);
????????????????return;
????????????}

????????????List?codeFileCounterList?=
????????????????GetAllFilesStatistics(txtCodePath.Text?cbSeacheSubFolder.Checked?txtSourceFileExtension.Text?cbNoEmptyLine.Checked?txtOutOfStatistics.Text);

????????????FillToGrid(codeFileCounterList?txtCodePath.Text);
????????}

????????private?void?FillToGrid(List?codeFileCounterList?string?sourceFoloder)
????????{
????????????dataGridView1.Rows.Clear();
????????????int?totalEmptyLines?=?0;
????????????int?totalCustomExclusionLines?=?0;
????????????int?totalCodeLines?=?0;
????????????int?totalTotalLine?=?0;
????????????foreach?(var?fileCounter?in?codeFileCounterList)
????????????{
????????????????int?rowid?=?dataGridView1.Rows.Add();
????????????????DataGridViewRow?row?=?dataGridView1.Rows[rowid];
????????????????row.Cells[0].Value?=?fileCounter.FilePath.Replace(sourceFoloder?““);
????????????????row.Cells[1].Value?=?fileCounter.BlankLine;
????????????????row.Cells[2].Value?=?fileCounter.CustomExclusionLine;
????????????????row.Cells[3].Value?=?fileCounter.CodeLine;
????????????????row.Cells[4].Value?=?fileCounter.TotalLine;
????????????????row.Tag?=?fileCounter;

????????????????totalEmptyLines?+=?fileCounter.BlankLine;
????????????????totalCustomExclusionLines?+=?fileCounter.CustomExclusionLine;
????????????????totalCodeLines?+=?fileCounter.CodeLine;
????????????????totalTotalLine?+=?fileCounter.TotalLine;
????????????}

????????????int?totalRowId?=?dataGridView1.Rows.Add();
????????????DataGridViewRow?totalRow?=?dataGridView1.Rows[totalRowId];
????????????totalRow.Cells[0].Value?=?“匯總:“;
????????????totalRow.Cells[1].Value?=?totalEmptyLines;
????????????totalRow.Cells[2].Value?=?totalCustomExclusionLines;
????????????totalRow.Cells[3].Value?=?totalCodeLines;
????????????totalRow.Cells[4].Value?=?totalTotalLine;
????????}

????????///?
????????///?獲取所有文件的統計信息
????????///?

????????///?源代碼文件目錄
????????///?是否獲取子文件夾的文件。true,獲取所有子文件夾的文件
????????///?要獲取的文件的擴展名。多個擴展名用“|”分割,如:*.txt|*.cs?。?““、“*““*.*“表示所有文件
????????///?不統計空行
????????///?用戶定義的

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????896??2013-05-24?22:26??SourceCodeAnalysis.sln

?????文件??????19456??2013-05-27?00:36??SourceCodeAnalysis\bin\Debug\SourceCodeAnalysis.exe

?????文件??????38400??2013-05-27?00:36??SourceCodeAnalysis\bin\Debug\SourceCodeAnalysis.pdb

?????文件??????11608??2013-05-27?00:44??SourceCodeAnalysis\bin\Debug\SourceCodeAnalysis.vshost.exe

?????文件??????13477??2013-05-27?00:36??SourceCodeAnalysis\FrmLinesOfCodeStatistics.cs

?????文件??????15620??2013-05-27?00:34??SourceCodeAnalysis\FrmLinesOfCodeStatistics.Designer.cs

?????文件???????7152??2013-05-27?00:34??SourceCodeAnalysis\FrmLinesOfCodeStatistics.resx

?????文件???????5482??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件????????218??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\GenerateResource.read.1.tlog

?????文件???????1026??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\GenerateResource.write.1.tlog

?????文件???????1295??2013-05-27?00:44??SourceCodeAnalysis\obj\x86\Debug\SourceCodeAnalysis.csproj.FileListAbsolute.txt

?????文件??????19456??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\SourceCodeAnalysis.exe

?????文件????????180??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\SourceCodeAnalysis.FrmLinesOfCodeStatistics.resources

?????文件??????38400??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug\SourceCodeAnalysis.pdb

?????文件????????180??2013-05-26?12:11??SourceCodeAnalysis\obj\x86\Debug\SourceCodeAnalysis.Properties.Resources.resources

?????文件???????4608??2013-05-26?12:05??SourceCodeAnalysis\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll

?????文件????????498??2013-05-24?22:27??SourceCodeAnalysis\Program.cs

?????文件???????1428??2013-05-24?22:25??SourceCodeAnalysis\Properties\AssemblyInfo.cs

?????文件???????2874??2013-05-26?12:05??SourceCodeAnalysis\Properties\Resources.Designer.cs

?????文件???????5612??2013-05-24?22:25??SourceCodeAnalysis\Properties\Resources.resx

?????文件???????1116??2013-05-26?12:05??SourceCodeAnalysis\Properties\Settings.Designer.cs

?????文件????????249??2013-05-24?22:25??SourceCodeAnalysis\Properties\Settings.settings

?????文件???????3607??2013-05-26?12:11??SourceCodeAnalysis\SourceCodeAnalysis.csproj

?????目錄??????????0??2013-05-26?12:05??SourceCodeAnalysis\obj\x86\Debug\TempPE

?????目錄??????????0??2013-05-27?00:36??SourceCodeAnalysis\obj\x86\Debug

?????目錄??????????0??2013-05-26?12:11??SourceCodeAnalysis\bin\Debug

?????目錄??????????0??2013-05-24?22:26??SourceCodeAnalysis\bin\Release

?????目錄??????????0??2013-05-24?22:25??SourceCodeAnalysis\obj\x86

?????目錄??????????0??2013-05-24?22:26??SourceCodeAnalysis\bin

?????目錄??????????0??2013-05-24?22:25??SourceCodeAnalysis\obj

............此處省略5個文件信息

評論

共有 條評論