static void Run(CommandLineOptions options) { Console.WriteLine("Diffing documentation sources to make sure they match the latest API"); // Load the XML doc files. var docSrc = LoadApiMembers(options.DocSrc, options.DocSrcPath); var apiRef = LoadApiMembers(options.ApiRef, string.Empty); // Diff them. var docsWithSummaries = from doc in docSrc where !string.IsNullOrEmpty((string)doc.MemberElement.Element("summary")) select doc; var docsThatArentNamespaces = from doc in docSrc where !doc.MemberElement.Attribute("name").Value.StartsWith("N:") select doc; var missingDocs = apiRef.Except(docsWithSummaries); var orphanedDocs = docsThatArentNamespaces.Except(apiRef); // Report missing docs for things that were found in the API but are not documented. int missingCount = missingDocs.Count(); if (missingCount > 0) { Console.WriteLine("warning: missing {0} doc {1} (see {2} for details)", missingCount, (missingCount == 1) ? "entry" : "entries", Path.GetFileName(options.LogMissingDocs)); Console.WriteLine("Logging missing doc details to {0}", Path.GetFullPath(options.LogMissingDocs)); var xml = new XDocument( new XElement("doc", new XElement("members", from member in missingDocs select member.MemberElement ) ) ); xml.Save(options.LogMissingDocs); } // Report any unwanted docs for APIs that do not exist. foreach (var orphaned in orphanedDocs) { Console.WriteLine("{0}: warning: orphaned docs: {1}", Path.GetFullPath(orphaned.FileName), orphaned.ApiName); } // Report any <see cref=""/> references to things that don't exist. ValidateReferences(docSrc, options.AmlSrc); }
static int Main(string[] args) { // Parse commandline options. var options = new CommandLineOptions(); var parser = new CommandLineParser(options); if (!parser.ParseCommandLine(args)) { return 1; } // Run the program logic. try { Run(options); } catch (Exception e) { Console.Error.WriteLine("Error: {0}\n\n{1}:\n{2}", e.Message, e.GetType(), e.StackTrace); return 1; } return 0; }