private static void ProcessProjectContent(FileInfo projectFile, IMarkdownBuilder markdown) { XDocument content; try { using (Stream fileContent = projectFile.OpenRead()) { content = XDocument.Load(fileContent); } if (content.Root == null) { markdown.Italic("Invalid content of project file."); return; } } catch (Exception e) { markdown.Italic("Invalid content of project file: " + e.Message); return; } XNamespace defaultNamespace = content.Root.GetDefaultNamespace(); ISet <string> references = new HashSet <string>(); int problemCount = 0; foreach (XElement projectReferenceElement in content.Descendants(defaultNamespace + "ProjectReference")) { XElement projectElement = projectReferenceElement.Element(defaultNamespace + "Project"); XElement projectNameElement = projectReferenceElement.Element(defaultNamespace + "Name"); if (projectNameElement == null) { markdown.CodeBlock("xml", projectReferenceElement.ToString()); continue; } string projectName = projectNameElement.Value; if (projectElement == null) { markdown.Italic(projectName + " doesn't have GUID."); markdown.WriteLine(); continue; } string projectId = projectElement.Value; if (references.Contains(projectId)) { markdown.WriteLine(projectName); problemCount++; } references.Add(projectId); } markdown.Italic($"{problemCount} problem(s) found in {references.Count} reference(s)."); }
public Item Finish() { Item result = Item.AsMarkdown(markdown.ToString()); markdown = null; return(result); }
public static IMarkdownBuilder AddRequiredServices(this IMarkdownBuilder builder) { // Hosting doesn't add IHttpContextAccessor by default builder.Services.AddHttpContextAccessor(); // Add Detection Options builder.Services.AddOptions(); builder.Services.TryAddSingleton(provider => provider.GetRequiredService <IOptions <DetectionOptions> >().Value); return(builder); }
public static IMarkdownBuilder AddMarkerService(this IMarkdownBuilder builder) { builder.Services.TryAddSingleton <MarkdownMarkerService>(); return(builder); }
public static IMarkdownBuilder AddCoreServices(this IMarkdownBuilder builder) { // Add basic core to services return(builder); }
public static IMarkdownBuilder AddMarkdownPages(this IMarkdownBuilder builder) { return(builder); }
public bool Start(InputModel inputModel) { containError = false; markdown = new MarkdownBuilder(); return(false); }