Пример #1
0
        private void WriteLongReport(TextWriter writer)
        {
            var issueColumns = EnumerableExtensions.GetValues <AkaLinkData.IssueType>();
            var headings     =
                "In file,Short URL,Aka link,Target URL,Status,Reason,"
                + string.Join(",", issueColumns.Select(t => AkaLinkData.AvailableIssues[t].Description));

            writer.WriteLine(headings);
            foreach (var entry in LinkMap.FileIndex.Values)
            {
                foreach (var url in entry.ContainedAkaLinks)
                {
                    var linkData = LinkMap.LinkIndex[url];
                    var issues   = string.Join(",",
                                               issueColumns.Select(i => linkData.Issues.Contains(i)
                            ? AkaLinkData.AvailableIssues[i].Severity.ToString() : "0"));
                    writer.WriteLine(
                        $"{entry.FullPath.CsvEscape()}" +
                        $",{AkaLinkData.GetShortUrl(url).CsvEscape()}" +
                        $",{url.CsvEscape()}" +
                        $",{linkData.TargetUrl.CsvEscape()}" +
                        $",{linkData.Status.CsvEscape()}" +
                        $",{linkData.Reason.CsvEscape()}" +
                        $",{issues}"
                        );
                }
            }
        }
Пример #2
0
 private void WriteShortReport(TextWriter writer)
 {
     writer.WriteLine("In file,Short URL,Aka link");
     foreach (var entry in LinkMap.FileIndex.Values)
     {
         foreach (var url in entry.ContainedAkaLinks)
         {
             writer.WriteLine(
                 $"{entry.FullPath.CsvEscape()}" +
                 $",{AkaLinkData.GetShortUrl(url).CsvEscape()}" +
                 $",{url.CsvEscape()}"
                 );
         }
     }
 }