private DataRow CreateRow(AnalysisStatistics stats, string name) { DataRow row = QuoteItems.NewRow(); row["Language"] = name; row["Perfect"] = GetPrice("Perfect", stats.Perfect); row["InContextExact"] = GetPrice("InContextExact", stats.InContextExact); row["Exact"] = GetPrice("Exact", stats.Exact); row["Repetitions"] = GetPrice("Repetitions", stats.Repetitions); FuzzyCountData[] fuzzy = stats.Fuzzy; int columnIndex = 5; for (int k = fuzzy.Length - 1; k >= 0; k--) { AnalysisBand band = fuzzy[k].Band; row[columnIndex] = GetPrice(fuzzy[k]); columnIndex++; } row["New"] = GetPrice("New", stats.New); row["Total"] = CalculateRowTotal(row); return(row); }
private void AddItemRows(ProjectStatistics projectStats) { foreach (TargetLanguageStatistics languageStats in projectStats.TargetLanguageStatistics) { AnalysisStatistics stats = languageStats.AnalysisStatistics; string name = languageStats.TargetLanguage.DisplayName; DataRow row = CreateRow(stats, name); QuoteItems.Rows.Add(row); } QuoteItems.Rows.Add(CreateTotalsRow()); }
/// <summary> /// Retrieves the results of the analyze files tasks and generates a standard /// report in Microsoft Excel format as well as a report in a custom XML format. /// </summary> private void CreateReports(FileBasedProject project, string path) { #region "CreateStandardReport" project.SaveTaskReportAs(this.reportId, path + "/AnalyzeTaskReport.xls", ReportFormat.Excel); #endregion #region "Statistics" ProjectStatistics projectStats = project.GetProjectStatistics(); TargetLanguageStatistics[] targetStats = projectStats.TargetLanguageStatistics; AnalysisStatistics analysisStats = targetStats[0].AnalysisStatistics; #endregion #region "WriteData" string result = "Analysis result for all files:\n\n"; result += "\nPerfect matches\n"; result += "Segments: " + analysisStats.Perfect.Segments.ToString() + "\n"; result += "Words: " + analysisStats.Perfect.Words.ToString() + "\n"; result += "Characters: " + analysisStats.Perfect.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.Perfect.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.Perfect.Placeables.ToString() + "\n"; result += "\nContext matches\n"; result += "Segments: " + analysisStats.InContextExact.Segments.ToString() + "\n"; result += "Words: " + analysisStats.InContextExact.Words.ToString() + "\n"; result += "Characters: " + analysisStats.InContextExact.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.InContextExact.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.InContextExact.Placeables.ToString() + "\n"; #region "Exact" result += "\nExact matches\n"; result += "Segments: " + analysisStats.Exact.Segments.ToString() + "\n"; result += "Words: " + analysisStats.Exact.Words.ToString() + "\n"; result += "Characters: " + analysisStats.Exact.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.Exact.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.Exact.Placeables.ToString() + "\n"; #endregion #region "Fuzzy" for (int i = 0; i < analysisStats.Fuzzy.Length; i++) { string rangeMax = analysisStats.Fuzzy[i].Band.MaximumMatchValue.ToString(); string rangeMin = analysisStats.Fuzzy[i].Band.MinimumMatchValue.ToString(); result += "\nFuzzy matches " + rangeMax + "% to " + rangeMin + "%\n"; result += "Segments: " + analysisStats.Fuzzy[i].Segments.ToString() + "\n"; result += "Words: " + analysisStats.Fuzzy[i].Words.ToString() + "\n"; result += "Characters: " + analysisStats.Fuzzy[i].Characters.ToString() + "\n"; result += "Tags: " + analysisStats.Fuzzy[i].Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.Fuzzy[i].Placeables.ToString() + "\n"; } #endregion result += "\nRepetitions\n"; result += "Segments: " + analysisStats.Repetitions.Segments.ToString() + "\n"; result += "Words: " + analysisStats.Repetitions.Words.ToString() + "\n"; result += "Characters: " + analysisStats.Repetitions.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.Repetitions.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.Repetitions.Placeables.ToString() + "\n"; result += "\nNew segments\n"; result += "Segments: " + analysisStats.New.Segments.ToString() + "\n"; result += "Words: " + analysisStats.New.Words.ToString() + "\n"; result += "Characters: " + analysisStats.New.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.New.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.New.Placeables.ToString() + "\n"; result += "\nTotal\n"; result += "Segments: " + analysisStats.Total.Segments.ToString() + "\n"; result += "Words: " + analysisStats.Total.Words.ToString() + "\n"; result += "Characters: " + analysisStats.Total.Characters.ToString() + "\n"; result += "Tags: " + analysisStats.Total.Tags.ToString() + "\n"; result += "Placeables: " + analysisStats.Total.Placeables.ToString() + "\n"; Console.Write(result); #endregion }