[Mono-docs-list] Sort the methods in MonoDoc
John Luke
jluke@cfl.rr.com
10 May 2003 21:59:16 -0400
--=-SKqUTzn2JsGKMWfAO/6s
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello,
Here is a patch to monodoc/browser/ecma-provider.cs to sort the methods
on the html side, hopefully matching the order they are displayed in the
treeview.
John Luke
--=-SKqUTzn2JsGKMWfAO/6s
Content-Disposition: attachment; filename=ecma-provider.diff
Content-Type: text/x-patch; name=ecma-provider.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
Index: ecma-provider.cs
===================================================================
RCS file: /mono/monodoc/browser/ecma-provider.cs,v
retrieving revision 1.39
diff -u -r1.39 ecma-provider.cs
--- ecma-provider.cs 17 Apr 2003 19:48:28 -0000 1.39
+++ ecma-provider.cs 11 May 2003 01:48:19 -0000
@@ -815,13 +815,21 @@
XmlNodeList methods = doc.SelectNodes (String.Format ("/Type/Members/Member[MemberType=\"{0}\"]", kind));
+ XmlNode [] nodes = new XmlNode [methods.Count];
+ MyXmlNameComparer xml_name_comparer = new MyXmlNameComparer ();
+
+ for (int i = 0; i < methods.Count; i++)
+ nodes [i] = methods [i];
+
+ Array.Sort(nodes, xml_name_comparer);
+
//
// First pull all the public methods
//
bool shown = false, found_protected = false;
StringBuilder nested = new StringBuilder ();
int pos = -1;
- foreach (XmlNode method in methods){
+ foreach (XmlNode method in nodes){
pos++;
XmlNode sig_node = method.SelectSingleNode ("MemberSignature[@Language='C#']");
@@ -862,7 +870,7 @@
// Repeat with protected
//
pos = -1;
- foreach (XmlNode method in methods){
+ foreach (XmlNode method in nodes){
pos++;
XmlNode sig_node = method.SelectSingleNode ("MemberSignature[@Language='C#']");
@@ -1197,4 +1205,15 @@
}
#endregion
+}
+
+class MyXmlNameComparer :IComparer {
+ public int Compare (object a, object b)
+ {
+ XmlNode ax = (XmlNode) a;
+ XmlNode bx = (XmlNode) b;
+
+ int result = String.Compare(ax.Attributes[0].Value, bx.Attributes[0].Value);
+ return result;
+ }
}
--=-SKqUTzn2JsGKMWfAO/6s--