private static void AddAssembly(XContainer parent, AssemblyEntry assembly, string frameworkName = null) { var assemblyElement = new XElement("assembly", frameworkName is null ? null : new XAttribute("fx", frameworkName), new XAttribute("fingerprint", assembly.Fingerprint.ToString("N")), new XAttribute("name", assembly.Identity.Name), new XAttribute("publicKeyToken", assembly.Identity.GetPublicKeyTokenString()), new XAttribute("version", assembly.Identity.Version.ToString()) ); if (assembly.PlatformSupportEntry is not null) { AddPlatformSupport(assemblyElement, assembly.PlatformSupportEntry); } if (assembly.PreviewRequirementEntry is not null) { AddPreviewRequirement(assemblyElement, assembly.PreviewRequirementEntry); } parent.Add(assemblyElement); foreach (var api in assembly.AllApis()) { var fingerprint = api.Fingerprint.ToString("N"); var syntaxElement = new XElement("syntax", new XAttribute("id", fingerprint)); assemblyElement.Add(syntaxElement); syntaxElement.Add(api.Syntax); if (api.ObsoletionEntry is not null) { AddObsoletion(assemblyElement, api.ObsoletionEntry, fingerprint); } if (api.PlatformSupportEntry is not null) { AddPlatformSupport(assemblyElement, api.PlatformSupportEntry, fingerprint); } if (api.PreviewRequirementEntry is not null) { AddPreviewRequirement(assemblyElement, api.PreviewRequirementEntry, fingerprint); } } }