C#代码行数统计器(C/S框架网)
C#代码行数统计器(C/S框架网)闲来无事写了个小工具分享给大家。
C# Code:
private void btnCounting_Click(object sender, EventArgs e)
{
progress.Maximum = 0;
progress.Minimum = 0;
progress.Value = 0;
this.SetCountingButtonState(false);
//实例化一个统计器,使用策略模式
ICountStrategy strategy = new CountStrategy(checkBox1.Checked,
checkBox2.Checked, checkBox3.Checked, checkBox4.Checked);
_CodeCounter.SetStrategy(strategy); //设置统计策略
//开始统计
_CodeCounter.Start(txtFolder.Text);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
Free Download:
扫一扫加作者微信
C# Code:
/// <summary>
/// 统计策略接口
/// </summary>
public interface ICountStrategy
{
bool CurrentFileInCounting { get; }
int GetSourceCodeLines(string file);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
/// <summary>
/// 统计策略接口
/// </summary>
public interface ICountStrategy
{
bool CurrentFileInCounting { get; }
int GetSourceCodeLines(string file);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
C# Code:
private void btnCounting_Click(object sender, EventArgs e)
{
progress.Maximum = 0;
progress.Minimum = 0;
progress.Value = 0;
this.SetCountingButtonState(false);
//实例化一个统计器,使用策略模式
ICountStrategy strategy = new CountStrategy(checkBox1.Checked,
checkBox2.Checked, checkBox3.Checked, checkBox4.Checked);
_CodeCounter.SetStrategy(strategy); //设置统计策略
//开始统计
_CodeCounter.Start(txtFolder.Text);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
Free Download:
扫一扫加作者微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网