Click here to Skip to main content
15,896,207 members
Articles / Programming Languages / C#

Visual FoxPro Lines of Code Analysis

Rate me:
Please Sign up or sign in to vote.
4.64/5 (5 votes)
5 Jan 2012CPOL2 min read 77.6K   2.3K   14  
Lines of Code Counter in C# that analyze FoxPro Projects (PJX)
using System;
using System.Data;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace VFPLOCCounter
{
	public partial class ReportForm : Form
	{
		private DataTable rptTable;

		public ReportForm()
		{
			InitializeComponent();
		}

		private void ReportForm_Load(object sender, EventArgs e)
		{
			foreach (DataRow r in rptTable.Rows)
			{
				DataRow newRow = ResultData.resultsTable.NewRow();
				newRow ["fileName"] = r ["fileName"].ToString();
				newRow ["fileType"] = r ["fileType"].ToString();
				newRow ["totalLines"] = Convert.ToInt64(r ["totalLines"].ToString());
				newRow["numberMethods"] = Convert.ToInt64(r["numberMethods"].ToString());
				
				newRow["codeLines"] = Convert.ToInt64(r["codeLines"].ToString());
				newRow["commentLines"] = Convert.ToInt64(r["commentLines"].ToString());
				newRow["blankLines"] = Convert.ToInt64(r["blankLines"].ToString());

				newRow["codePercent"] = Convert.ToDecimal(r["codePercent"].ToString());
				newRow["commentPercent"] = Convert.ToDecimal(r["commentPercent"].ToString());
				newRow["blankPercent"] = Convert.ToDecimal(r["blankPercent"].ToString());

				newRow["projectName"] = r["projectName"].ToString();
				newRow["projectPath"] = r["projectPath"].ToString();
				

				ResultData.resultsTable.Rows.Add(newRow);
			}
			rvResults.RefreshReport();
		}
		/// <summary>
		/// ReportTable is the dataTable to view in the report body
		/// </summary>
		public DataTable ReportTable
		{
			set { rptTable = value;}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
I develop software for a leading healthcare system in Northern Illinois.

Comments and Discussions