public LineCountSummary(string projName, int iconIndex)
 {
     m_fileLineCountInfo       = new List <LineCountInfo>();
     m_lineCountSummaryDetails = new LineCountDetails();
     m_projectName             = projName;
     m_iconIndex = iconIndex;
 }
 public void Add(LineCountDetails details)
 {
     m_totalLines   += details.m_totalLines;
     m_codeLines    += details.m_codeLines;
     m_doccmtLines  += details.m_doccmtLines;
     m_normcmtLines += details.m_normcmtLines;
     m_blankLines   += details.m_blankLines;
 }
        public LineCountInfo(string fileName, int iconIndex)
        {
            m_fileName  = fileName;
            m_fileType  = Path.GetExtension(fileName);
            m_iconIndex = iconIndex;
            m_sumMode   = "Generic";

            m_lineCountInfoDetails = new LineCountDetails();
        }
        /// <summary>
        /// Performs a complete counting and summation of all lines
        /// in all projects and files.
        /// </summary>
        private void SumSolution()
        {
            try
            {
                // Clean the list
                lvSummary.Items.Clear();
                lvFileList.Items.Clear();
                lvFileList.Groups.Clear();

                // Configure progress bars
                tsprgTotal.Minimum = 0;
                tsprgTotal.Step    = 1;
                tsprgTask.Minimum  = 0;
                tsprgTask.Step     = 1;

                // Skip if there are no projects
                if (m_summaryList == null || (m_summaryList != null && m_summaryList.Count == 1))
                {
                    MessageBox.Show("There are no projects loaded to summarize.", "Line Counter");
                    return;
                }

                // Get all projects summary
                LineCountSummary allProjects = m_summaryList[0];
                allProjects.LineCountSummaryDetails.Reset();
                AddSummaryListItem(allProjects, lvSummary.Groups["lvgAllProj"]);

                tsprgTotal.Maximum = m_summaryList.Count;
                tsprgTotal.Value   = 0;
                for (int s = 1; s < m_summaryList.Count; s++)
                {
                    tsprgTotal.PerformStep();

                    LineCountSummary summary = m_summaryList[s];
                    summary.LineCountSummaryDetails.Reset();
                    AddSummaryListItem(summary, lvSummary.Groups["lvgEachProj"]);

                    tsprgTask.Maximum = summary.FileLineCountInfo.Count;
                    tsprgTask.Value   = 0;
                    for (int i = 0; i < summary.FileLineCountInfo.Count; i++)
                    {
                        tsprgTask.PerformStep();

                        LineCountInfo info = summary.FileLineCountInfo[i];
                        if (m_countableTypes.Contains(info.FileType))
                        {
                            info.LineCountInfoDetails.Reset();
                                                        #if IMPR2
                            foreach (CountingAlgorithmDescriptor desc in countingAlgorithms)
                            {
                                if (desc.CanCountLines(info))
                                {
                                    desc.GetAlgorithm().CountLines(info);
                                    break;
                                }
                            }
                                                        #else
                            try
                            {
                                CountLines counter = m_countAlgorithms[info.FileType];
                                counter(info);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.WriteLine(ex.StackTrace);
                            }
                                                        #endif
                            info.LineCountInfoDetails.Summarize();

                            allProjects.LineCountSummaryDetails.Add(info.LineCountInfoDetails);
                            summary.LineCountSummaryDetails.Add(info.LineCountInfoDetails);

                            tstxtLinesCounted.Text = allProjects.LineCountSummaryDetails.TotalLines.ToString();

                            AddFileListItem(info);
                        }
                    }

                    summary.LineCountSummaryDetails.Summarize();
                    LineCountDetails details = summary.LineCountSummaryDetails;
                    summary.LinkedListViewItem.SubItems[1].Text = details.TotalLines.ToString();
                    summary.LinkedListViewItem.SubItems[2].Text = details.CodeLines.ToString();
                    summary.LinkedListViewItem.SubItems[3].Text = details.CommentLines.ToString();
                    summary.LinkedListViewItem.SubItems[4].Text = details.BlankLines.ToString();
                    summary.LinkedListViewItem.SubItems[5].Text = details.NetLines.ToString();
                    details = null;
                }

                allProjects.LineCountSummaryDetails.Summarize();
                LineCountDetails totals = allProjects.LineCountSummaryDetails;
                allProjects.LinkedListViewItem.SubItems[1].Text = totals.TotalLines.ToString();
                allProjects.LinkedListViewItem.SubItems[2].Text = totals.CodeLines.ToString();
                allProjects.LinkedListViewItem.SubItems[3].Text = totals.CommentLines.ToString();
                allProjects.LinkedListViewItem.SubItems[4].Text = totals.BlankLines.ToString();
                allProjects.LinkedListViewItem.SubItems[5].Text = totals.NetLines.ToString();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }

            tsprgTotal.Value = tsprgTotal.Maximum;
        }
		public LineCountInfo(string fileName, int iconIndex)
		{
			m_fileName = fileName;
			m_fileType = Path.GetExtension(fileName);
			m_iconIndex = iconIndex;
			m_sumMode = "Generic";

			m_lineCountInfoDetails = new LineCountDetails();
		}
		public LineCountSummary(string projName, int iconIndex)
		{
			m_fileLineCountInfo = new List<LineCountInfo>();
			m_lineCountSummaryDetails = new LineCountDetails();
			m_projectName = projName;
			m_iconIndex = iconIndex;
		}
		public void Add(LineCountDetails details)
		{
			m_totalLines += details.m_totalLines;
			m_codeLines += details.m_codeLines;
			m_doccmtLines += details.m_doccmtLines;
			m_normcmtLines += details.m_normcmtLines;
			m_blankLines += details.m_blankLines;
		}