// // Handles fields, but perhaps this is better done in DocFixer to pull the definitions // from the docs? // public static void ProcessField(Type t, XDocument xdoc, PropertyInfo pi) { var fieldAttr = pi.GetCustomAttributes(typeof(FieldAttribute), true); if (fieldAttr.Length == 0) { return; } var export = ((FieldAttribute)fieldAttr [0]).SymbolName; var field = xdoc.XPathSelectElement("Type/Members/Member[@MemberName='" + pi.Name + "']"); if (field == null) { if (!warnings_up_to_date.ContainsKey(t)) { Console.WriteLine("Warning: {0} document is not up-to-date with the latest assembly (could not find Field <Member MemberName='{1}')", t, pi.Name); warnings_up_to_date [t] = true; } return; } var returnType = field.XPathSelectElement("ReturnValue/ReturnType"); var summary = field.XPathSelectElement("Docs/summary"); var remarks = field.XPathSelectElement("Docs/remarks"); var example = field.XPathSelectElement("Docs/remarks/example"); if (mergeAppledocs) { if (returnType.Value == "MonoMac.Foundation.NSString" && export.EndsWith("Notification")) { var mdoc = docGenerator.GetAppleMemberDocs(ToCecilType(t), export); if (mdoc == null) { Console.WriteLine("Failed to load docs for {0} - {1}", t.Name, export); return; } var section = docGenerator.ExtractSection(mdoc); // // Make this pretty, the first paragraph we turn into the summary, // the rest we put in the remarks section // summary.Value = ""; summary.Add(section); var skipOne = summary.Nodes().Skip(2).ToArray(); remarks.Value = ""; remarks.Add(skipOne); foreach (var n in skipOne) { n.Remove(); } if (example != null) { remarks.Add(example); } } } }
// // Handles fields, but perhaps this is better done in DocFixer to pull the definitions // from the docs? // public static void ProcessField(Type t, XDocument xdoc, PropertyInfo pi, bool isNotification) { var fieldAttr = pi.GetCustomAttributes(typeof(FieldAttribute), true); if (fieldAttr.Length == 0) { return; } var export = ((FieldAttribute)fieldAttr [0]).SymbolName; var field = GetXmlNodeForMemberName(t, xdoc, pi.Name); if (field == null) { return; } var returnType = field.XPathSelectElement("ReturnValue/ReturnType"); var summary = field.XPathSelectElement("Docs/summary"); var remarks = field.XPathSelectElement("Docs/remarks"); var example = field.XPathSelectElement("Docs/remarks/example"); if (isNotification || (returnType.Value.EndsWith(".Foundation.NSString") && export.EndsWith("Notification"))) { if (mergeAppledocs) { var mdoc = docGenerator.GetAppleMemberDocs(ToCecilType(t), export); if (mdoc == null) { Console.WriteLine("Failed to load docs for {0} - {1}", t.Name, export); return; } var section = docGenerator.ExtractSection(mdoc); // // Make this pretty, the first paragraph we turn into the summary, // the rest we put in the remarks section // summary.RemoveAll(); summary.Add(section); var skipOne = summary.Nodes().Skip(2).ToArray(); remarks.RemoveAll(); remarks.Add(skipOne); foreach (var n in skipOne) { n.Remove(); } if (example != null) { remarks.Add(example); } } } else { var value = field.XPathSelectElement("Docs/value"); if (value != null && value.Value == "To be added.") { value.RemoveAll(); } //var since = pi.GetCustomAttributes (typeof (SinceAttribute), true); //if (since.Length != 0 && pi.PropertyType.IsClass) { // TODO: Could format the since value into the text // value.Value = "Value will be null when the constant is not available"; //} if (summary.Value == "To be added.") { summary.RemoveAll(); summary.Value = "Represents the value associated with the constant " + export; } } }