コード例 #1
0
        public void GenerateTextReport(string fileName)
        {
            Client        lastClient = null;
            List <string> report     = new List <string>();

            for (int ii = 0; ii < _changes.Length; ii++)
            {
                Change change = _changes[ii];
                if (change.Client != lastClient)
                {
                    lastClient = change.Client;
                    report.Add("Client: " + lastClient.DisplayName);
                    report.Add("");

                    string[] strings = lastClient.getResolveIssues();
                    if (strings.Length > 0)
                    {
                        report.Add("Resolve issues:");
                        report.AddRange(strings);
                        report.Add("");
                    }

                    strings = BuildErrorReporter.generateErrorReport(lastClient);
                    if (strings.Length > 0)
                    {
                        report.AddRange(strings);
                        report.Add("");
                    }

                    strings = lastClient.getPossibleConflicts();
                    if (strings.Length > 0)
                    {
                        report.Add("Possible conflicts:");
                        report.AddRange(strings);
                        report.Add("");
                    }
                }
                report.Add("\tChange: " + change.Number);
                //report.Add("Short Description: " + change.ShortDescription);
                report.Add("\tDescription:\r\n" + stringListToFlatTextString(change.LongDescription, "\t\t"));
                report.Add("\t\tFile List:\r\n" + stringListToFlatTextString(change.FileList, "\t\t\t"));
                report.Add("");
            }
            if (_fileCount.Keys.Count > 0)
            {
                report.Add("All files:");
            }
            foreach (string file in _fileCount.Keys)
            {
                string line = "\t" + file;
                if (_fileCount[file] > 1)
                {
                    line = line + " (" + _fileCount[file] + ")";
                }
                report.Add(line);
            }
            System.IO.File.WriteAllLines(fileName, report.ToArray());
        }
コード例 #2
0
        public void GenerateHTMLReport(string fileName, DateTime start)
        {
            List <string> report = new List <string>();
            DateTime      now    = DateTime.Now;

            report.Add(htmlHeader);
            addDiv(ref report, "timeStamp", "Report generated at " + now.ToString() + " (" + Math.Ceiling((now - start).TotalSeconds) + " seconds)");

            foreach (Client root in _org.Keys)
            {
                addDiv(ref report, "enlistment", root.DisplayName);
                foreach (Client client in _org[root].Keys)
                {
                    addDiv(ref report, "depot", "Depot: " + client.DepotName);

                    string[] strings = client.getResolveIssues();
                    if (strings.Length > 0)
                    {
                        addDiv(ref report, "resolveIssueHeader error", "Resolve issues:");
                        for (int jj = 0; jj < strings.Length; jj++)
                        {
                            addDiv(ref report, "resolveIssue error", strings[jj]);
                        }
                    }

                    strings = BuildErrorReporter.generateErrorReport(client);
                    for (int jj = 0; jj < strings.Length; jj++)
                    {
                        addDiv(ref report, "buildIssue error", strings[jj]);
                    }

                    strings = client.getPossibleConflicts();
                    if (strings.Length > 0)
                    {
                        addDiv(ref report, "conflictHeader error", "Possible conflicts:");
                        for (int jj = 0; jj < strings.Length; jj++)
                        {
                            addDiv(ref report, "conflict error", strings[jj]);
                        }
                    }

                    foreach (Change change in _org[root][client])
                    {
                        addDiv(ref report, "shortChangeDescrip canWrap", change.ShortDescription);
                        if (change.LongDescription.Count > 1)
                        {
                            for (int jj = 0; jj < change.LongDescription.Count; jj++)
                            {
                                addDiv(ref report, "longChangeDescrip canWrap", change.LongDescription[jj]);
                            }
                        }
                        for (int jj = 0; jj < change.FileList.Count; jj++)
                        {
                            addDiv(ref report, "fileList", change.FileList[jj]);
                        }
                    }
                }
            }

            if (_fileCount.Keys.Count > 0)
            {
                addDiv(ref report, "allFileListHeader", "All files:");
                foreach (string file in _fileCount.Keys)
                {
                    string line = file;
                    if (_fileCount[file] > 1)
                    {
                        line += " (" + _fileCount[file] + ")";
                    }
                    addDiv(ref report, "allFileList", line);
                }
            }
            report.Add(htmlFooter);
            System.IO.File.WriteAllLines(fileName, report.ToArray());
        }