[submodule "external/reference-assemblies"]
path = external/binary-reference-assemblies
url = git://github.com/mono/reference-assemblies.git
-[submodule "external/Lucene.Net.Light"]
- path = external/Lucene.Net.Light
- url = git://github.com/mono/Lucene.Net.Light.git
[submodule "external/nunit-lite"]
path = external/nunit-lite
url = git://github.com/mono/NUnitLite.git
[submodule "external/xunit-binaries"]
path = external/xunit-binaries
url = git://github.com/mono/xunit-binaries.git
+[submodule "external/api-doc-tools"]
+ path = external/api-doc-tools
+ url = git://github.com/mono/api-doc-tools.git
+++ /dev/null
-Subproject commit 85978b7eb94738f516824341213d5e94060f5284
--- /dev/null
+Subproject commit d03e819838c6241f92f90655cb448cc47c9e8791
# also activate legacy mode to compile old monodoc.dll api
LOCAL_MCS_FLAGS = /nowarn:618,612,672,809,414,649 /define:LEGACY_MODE
-JAY_FLAGS = -ct
-
IMAGES = \
Resources/images/bc_bg.png \
Resources/images/bc_separator.png \
Resources/images/reference.png \
Resources/images/treebg.png
-IMAGE_RESOURCE_COMMAND = $(foreach file,$(IMAGES),/resource:$(file),$(notdir $(file)))
+IMAGE_RESOURCE_COMMAND = $(foreach file,$(IMAGES),/resource:../../../external/api-doc-tools/monodoc/$(file),$(notdir $(file)))
RESOURCE_FILES = \
- ../../docs/monodoc.xml \
Resources/base.css \
Resources/ecmaspec-html-css.xsl \
Resources/ecmaspec-html.xsl \
Resources/mono-ecma-impl.xsl \
Resources/mono-ecma.css \
Resources/mono-ecma.xsl \
- Resources/toc-html.xsl \
- $(IMAGES)
+ Resources/toc-html.xsl
+
+RESOURCE_COMMAND = $(foreach file,$(RESOURCE_FILES),/resource:../../../external/api-doc-tools/monodoc/$(file),$(notdir $(file)))
+
EXTRA_DISTFILES = \
- jay.sh \
monodoc.dll.config.in \
- $(RESOURCE_FILES) \
- Monodoc.Ecma/EcmaUrlParser.jay \
- Test/monodoc_test/monodoc.xml \
- Test/monodoc_test/trees/tree-from-2-10.tree \
- Test/monodoc_test/trees/tree-from-3-0-old.tree \
- Test/monodoc_test/trees/tree-from-3-0.tree
LIB_REFS = ICSharpCode.SharpZipLib System System.Core System.Xml System.Xml.Linq System.Configuration
LIB_MCS_FLAGS = \
/unsafe \
/nowarn:169,164,162,168,219,618,612 \
/resource:../../docs/monodoc.xml,monodoc.xml \
- /resource:Resources/base.css,base.css \
- /resource:Resources/ecmaspec-html-css.xsl,ecmaspec-html-css.xsl \
- /resource:Resources/ecmaspec-html.xsl,ecmaspec-html.xsl \
- /resource:Resources/ecmaspec.css,ecmaspec.css \
- /resource:Resources/helper.js,helper.js \
- /resource:Resources/home.html,home.html \
- /resource:Resources/Lminus.gif,Lminus.gif \
- /resource:Resources/Lplus.gif,Lplus.gif \
- /resource:Resources/creativecommons.png,creativecommons.png \
- /resource:Resources/mdoc-html-format.xsl,mdoc-html-format.xsl \
- /resource:Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl \
- /resource:Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl \
- /resource:Resources/mdoc-sections.xsl,mdoc-sections.xsl \
- /resource:Resources/mono-ecma-css.xsl,mono-ecma-css.xsl \
- /resource:Resources/mono-ecma-impl.xsl,mono-ecma-impl.xsl \
- /resource:Resources/mono-ecma.css,mono-ecma.css \
- /resource:Resources/mono-ecma.xsl,mono-ecma.xsl \
- /resource:Resources/toc-html.xsl,toc-html.xsl \
+ $(RESOURCE_COMMAND) \
$(IMAGE_RESOURCE_COMMAND)
CLEAN_FILES += $(the_lib).config
TEST_MCS_FLAGS =
TEST_LIB_REFS = System System.Core System.Xml
-DOC_SOURCE_DIRS = \
- ../../docs \
- ../../../docs
-
-DOC_SOURCES = $(foreach dir,$(DOC_SOURCE_DIRS),$(wildcard $(dir)/*.source $(dir)/*.tree $(dir)/*.zip))
-
include ../../build/library.make
-$(the_lib): Makefile $(RESOURCE_FILES)
+all-local: $(the_lib).config
-all-local: $(the_lib).config Monodoc.Ecma/EcmaUrlParser.cs
-
-test-local: setup-doc-sources
-
-dist-local: Monodoc.Ecma/EcmaUrlParser.cs
-
-$(the_lib).config: Makefile monodoc.dll.config.in
+$(the_lib).config: monodoc.dll.config.in
sed 's,@monodoc_refdir@,$(mono_libdir)/monodoc,g' monodoc.dll.config.in > $@
-Monodoc.Ecma/EcmaUrlParser.cs: Monodoc.Ecma/EcmaUrlParser.jay $(topdir)/jay/skeleton.cs jay.sh
- $(topdir)/$(thisdir)/jay.sh $(topdir) $< $@ $(JAY_FLAGS)
-
-parser.exe: Monodoc.Ecma/EcmaUrlParser.cs Monodoc.Ecma/EcmaUrlTokenizer.cs Monodoc.Ecma/EcmaUrlParserDriver.cs Monodoc.Ecma/EcmaDesc.cs
- mcs /out:$@ /debug $^
-
-setup-doc-sources: $(DOC_SOURCES)
- mkdir -p ./Test/monodoc_test/sources/
- cp $(DOC_SOURCES) ./Test/monodoc_test/sources/
+++ /dev/null
-using System;
-using System.IO;
-using System.Reflection;
-using System.Xml;
-
-namespace Mono.Documentation {
- public class ManifestResourceResolver : XmlUrlResolver {
- private string[] dirs;
-
- public ManifestResourceResolver (params string[] dirs)
- {
- this.dirs = (string[]) dirs.Clone ();
- }
-
- public override Uri ResolveUri (Uri baseUri, string relativeUri)
- {
- if (Array.IndexOf (
- Assembly.GetExecutingAssembly ().GetManifestResourceNames (),
- relativeUri) >= 0)
- return new Uri ("x-resource:///" + relativeUri);
- foreach (var dir in dirs) {
- if (File.Exists (Path.Combine (dir, relativeUri)))
- return base.ResolveUri (new Uri ("file://" + new DirectoryInfo (dir).FullName + "/"),
- relativeUri);
- }
- return base.ResolveUri (baseUri, relativeUri);
- }
-
- public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
- {
- if (ofObjectToReturn == null)
- ofObjectToReturn = typeof(Stream);
- if (ofObjectToReturn != typeof(Stream))
- throw new XmlException ("This object type is not supported.");
- if (absoluteUri.Scheme != "x-resource")
- return base.GetEntity (absoluteUri, role, ofObjectToReturn);
- return Assembly.GetExecutingAssembly().GetManifestResourceStream (
- absoluteUri.Segments [1]);
- }
- }
-}
-
+++ /dev/null
-using System;
-using System.Collections;
-using System.IO;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Web;
-using System.Xml;
-
-namespace Mono.Documentation {
-
- public delegate XmlDocument DocLoader (string escapedTypeName);
-
- public static class XmlDocUtils
- {
- public static XmlNodeList GetMemberGenericParameters (XmlNode member)
- {
- return member.SelectNodes ("Docs/typeparam");
- }
-
- public static XmlNodeList GetTypeGenericParameters (XmlNode member)
- {
- return member.SelectNodes ("/Type/TypeParameters/TypeParameter");
- }
-
- public static string ToTypeName (string type, XmlNode member)
- {
- return ToTypeName (type, GetTypeGenericParameters (member),
- GetMemberGenericParameters (member));
- }
-
- public static string ToTypeName (string type, XmlNodeList typeGenParams, XmlNodeList memberGenParams)
- {
- type = type.Replace ("&", "@").Replace ("<", "{").Replace (">", "}");
- for (int i = 0; i < typeGenParams.Count; ++i) {
- string name = typeGenParams [i].InnerText;
- type = Regex.Replace (type, @"\b" + name + @"\b", "`" + i);
- }
- for (int i = 0; i < memberGenParams.Count; ++i) {
- string name = memberGenParams [i].Attributes ["name"].Value;
- type = Regex.Replace (type, @"\b" + name + @"\b", "``" + i);
- }
- return type;
- }
-
- public static string ToEscapedTypeName (string name)
- {
- return GetCountedName (name, "`");
- }
-
- private static string GetCountedName (string name, string escape)
- {
- int lt = name.IndexOf ("<");
- if (lt == -1)
- return name;
- StringBuilder type = new StringBuilder (name.Length);
- int start = 0;
- do {
- type.Append (name.Substring (start, lt - start));
- type.Append (escape);
- type.Append (GetGenericCount (name, lt, out start));
- } while ((lt = name.IndexOf ('<', start)) >= 0);
- if (start < name.Length)
- type.Append (name.Substring (start));
- return type.ToString ().Replace ("+", ".");
- }
-
- private static int GetGenericCount (string name, int start, out int end)
- {
- int n = 1;
- bool r = true;
- int i = start;
- int depth = 1;
- for ( ++i; r && i < name.Length; ++i) {
- switch (name [i]) {
- case ',': if (depth == 1) ++n; break;
- case '<': ++depth; break;
- case '>': --depth; if (depth == 0) r = false; break;
- }
- }
- end = i;
- return n;
- }
-
- public static string ToEscapedMemberName (string member)
- {
- // Explicitly implemented interface members contain '.'s in the member
- // name, e.g. System.Collections.Generic.IEnumerable<A>.GetEnumerator.
- // CSC does a s/\./#/g for these.
- member = member.Replace (".", "#");
- if (member [member.Length-1] == '>') {
- int i = member.LastIndexOf ("<");
- int ignore;
- return member.Substring (0, i).Replace ("<", "{").Replace (">", "}") +
- "``" + GetGenericCount (member, i, out ignore);
- }
- return member.Replace ("<", "{").Replace (">", "}");
- }
-
- public static void AddExtensionMethods (XmlDocument typexml, ArrayList/*<XmlNode>*/ extensions, DocLoader loader)
- {
- // if no members (enum, delegate) don't add extensions
- XmlNode m = typexml.SelectSingleNode ("/Type/Members");
- if (m == null)
- return;
-
- // static classes can't be targets:
- if (typexml.SelectSingleNode (
- "/Type/TypeSignature[@Language='C#']/@Value")
- .Value.IndexOf (" static ") >= 0)
- return;
-
- foreach (string s in GetSupportedTypes (typexml, loader)) {
- foreach (XmlNode extension in extensions) {
- bool add = false;
- foreach (XmlNode target in extension.SelectNodes ("Targets/Target")) {
- if (target.Attributes ["Type"].Value == s) {
- add = true;
- break;
- }
- }
- if (!add) {
- continue;
- }
- foreach (XmlNode c in extension.SelectNodes ("Member")) {
- XmlNode cm = typexml.ImportNode (c, true);
- m.AppendChild (cm);
- }
- }
- }
- }
-
- private static IEnumerable GetSupportedTypes (XmlDocument type, DocLoader loader)
- {
- yield return "System.Object";
- yield return GetEscapedPath (type, "Type/@FullName");
-
- Hashtable h = new Hashtable ();
- GetInterfaces (h, type, loader);
-
- string s = GetEscapedPath (type, "Type/Base/BaseTypeName");
- if (s != null) {
- yield return s;
- XmlDocument d;
- string p = s;
- while (s != null && (d = loader (s)) != null) {
- GetInterfaces (h, d, loader);
- s = GetEscapedPath (d, "Type/Base/BaseTypeName");
- if (p == s)
- break;
- yield return s;
- }
- }
-
- foreach (object o in h.Keys)
- yield return o.ToString ();
- }
-
- private static string GetEscapedPath (XmlDocument d, string path)
- {
- XmlNode n = d.SelectSingleNode (path);
- if (n == null)
- return null;
- return "T:" + ToEscapedTypeName (n.InnerText);
- }
-
- private static void GetInterfaces (Hashtable ifaces, XmlDocument doc, DocLoader loader)
- {
- foreach (XmlNode n in doc.SelectNodes ("Type/Interfaces/Interface/InterfaceName")) {
- string t = ToEscapedTypeName (n.InnerText);
- string tk = "T:" + t;
- if (!ifaces.ContainsKey (tk)) {
- ifaces.Add (tk, null);
- try {
- XmlDocument d = loader (t);
- if (d != null)
- GetInterfaces (ifaces, d, loader);
- }
- catch (FileNotFoundException e) {
- // ignore; interface documentation couldn't be found.
- }
- }
- }
- }
-
- // Turns e.g. sources/netdocs into sources/cache/netdocs
- public static string GetCacheDirectory (string assembledBase)
- {
- return Path.Combine (
- Path.Combine (Path.GetDirectoryName (assembledBase), "cache"),
- Path.GetFileName (assembledBase));
- }
-
- public static string GetCachedFileName (string cacheDir, string url)
- {
- return Path.Combine (cacheDir,
- Uri.EscapeUriString (url).Replace ('/', '+').Replace ("*", "%2a"));
- }
- }
-}
-
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Collections.Generic;
-
-namespace Mono.Utilities
-{
- public class LRUCache<TKey, TValue>
- {
- [ThreadStatic]
- static LRUCache<TKey, TValue> deflt;
-
- public static LRUCache<TKey, TValue> Default {
- get {
- return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
- }
- }
-
- int capacity;
- LinkedList<ListValueEntry<TKey, TValue>> list;
- Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
- LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
-
- public LRUCache (int capacity)
- {
- this.capacity = capacity;
- this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
- this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
- this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
- }
-
- public void Put (TKey key, TValue value)
- {
- if (Get(key) == null) {
- this.openNode.Value.ItemKey = key;
- this.openNode.Value.ItemValue = value;
- this.list.AddFirst (this.openNode);
- this.lookup.Add (key, this.openNode);
-
- if (this.list.Count > this.capacity) {
- // last node is to be removed and saved for the next addition to the cache
- this.openNode = this.list.Last;
-
- // remove from list & dictionary
- this.list.RemoveLast();
- this.lookup.Remove(this.openNode.Value.ItemKey);
- } else {
- // still filling the cache, create a new open node for the next time
- this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue>(default(TKey), default(TValue)));
- }
- }
- }
-
- public TValue Get (TKey key)
- {
- LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
- if (!this.lookup.TryGetValue (key, out node))
- return default (TValue);
- this.list.Remove (node);
- this.list.AddFirst (node);
- return node.Value.ItemValue;
- }
-
- class ListValueEntry<K, V> where K : TKey
- where V : TValue
- {
- internal V ItemValue;
- internal K ItemKey;
-
- internal ListValueEntry(K key, V value)
- {
- this.ItemKey = key;
- this.ItemValue = value;
- }
- }
- }
-}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Collections.Generic;
-
-namespace Mono.Utilities
-{
- public class LRUCache<TKey, TValue>
- {
- [ThreadStatic]
- static LRUCache<TKey, TValue> deflt;
-
- public static LRUCache<TKey, TValue> Default {
- get {
- return deflt != null ? deflt : (deflt = new LRUCache<TKey, TValue> (5));
- }
- }
-
- int capacity;
- LinkedList<ListValueEntry<TKey, TValue>> list;
- Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
- LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
-
- public LRUCache (int capacity)
- {
- this.capacity = capacity;
- this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
- this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> (capacity + 1);
- this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue> (default(TKey), default(TValue)));
- }
-
- public void Put (TKey key, TValue value)
- {
- if (Get(key) == null) {
- this.openNode.Value.Itemkey = key;
- this.openNode.Value.Itemvalue = value;
- this.list.AddFirst (this.openNode);
- this.lookup.Add (key, this.openNode);
-
- if (this.list.Count > this.capacity) {
- // last node is to be removed and saved for the next addition to the cache
- this.openNode = this.list.Last;
-
- // remove from list & dictionary
- this.list.RemoveLast();
- this.lookup.Remove(this.openNode.Value.Itemkey);
- } else {
- // still filling the cache, create a new open node for the next time
- this.openNode = new LinkedListNode<ListValueEntry<Tkey, Tvalue>>(new ListValueEntry<Tkey, Tvalue>(default(Tkey), default(Tvalue)));
- }
- }
- }
-
- public TValue Get (TKey key)
- {
- LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
- if (!this.lookup.TryGetValue (key, out node))
- return default (TValue);
- this.list.Remove (node);
- this.list.AddFirst (node);
- return node.Value.ItemValue;
- }
-
- class ListValueEntry<K, V> where K : TKey
- where V : TValue
- {
- internal V ItemValue;
- internal K ItemKey;
-
- internal ListValueEntry(K key, V value)
- {
- this.ItemKey = key;
- this.ItemValue = value;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Text.RegularExpressions;
-using System.Collections;
-
-namespace Mono.Utilities {
- public class Colorizer {
- //
- // Syntax coloring
- //
-
- static string keywords_cs =
- "(\\babstract\\b|\\bevent\\b|\\bnew\\b|\\bstruct\\b|\\bas\\b|\\bexplicit\\b|\\bnull\\b|\\bswitch\\b|\\bbase\\b|\\bextern\\b|"
- +
- "\\bobject\\b|\\bthis\\b|\\bbool\\b|\\bfalse\\b|\\boperator\\b|\\bthrow\\b|\\bbreak\\b|\\bfinally\\b|\\bout\\b|\\btrue\\b|"
- +
- "\\bbyte\\b|\\bfixed\\b|\\boverride\\b|\\btry\\b|\\bcase\\b|\\bfloat\\b|\\bparams\\b|\\btypeof\\b|\\bcatch\\b|\\bfor\\b|"
- +
- "\\bprivate\\b|\\buint\\b|\\bchar\\b|\\bforeach\\b|\\bprotected\\b|\\bulong\\b|\\bchecked\\b|\\bgoto\\b|\\bpublic\\b|"
- +
- "\\bunchecked\\b|\\bclass\\b|\\bif\\b|\\breadonly\\b|\\bunsafe\\b|\\bconst\\b|\\bimplicit\\b|\\bref\\b|\\bushort\\b|"
- +
- "\\bcontinue\\b|\\bin\\b|\\breturn\\b|\\busing\\b|\\bdecimal\\b|\\bint\\b|\\bsbyte\\b|\\bvirtual\\b|\\bdefault\\b|"
- +
- "\\binterface\\b|\\bsealed\\b|\\bvolatile\\b|\\bdelegate\\b|\\binternal\\b|\\bshort\\b|\\bvoid\\b|\\bdo\\b|\\bis\\b|"
- +
- "\\bsizeof\\b|\\bwhile\\b|\\bdouble\\b|\\block\\b|\\bstackalloc\\b|\\belse\\b|\\blong\\b|\\bstatic\\b|\\benum\\b|"
- + "\\bnamespace\\b|\\bstring\\b)";
-
-#if false
-// currently not in use
- static string keywords_vb =
- "(\\bAddHandler\\b|\\bAddressOf\\b|\\bAlias\\b|\\bAnd\\b|\\bAndAlso\\b|\\bAnsi\\b|\\bAs\\b|\\bAssembly\\b|"
- +
- "\\bAuto\\b|\\bBoolean\\b|\\bByRef\\b|\\bByte\\b|\\bByVal\\b|\\bCall\\b|\\bCase\\b|\\bCatch\\b|"
- +
- "\\bCBool\\b|\\bCByte\\b|\\bCChar\\b|\\bCDate\\b|\\bCDec\\b|\\bCDbl\\b|\\bChar\\b|\\bCInt\\b|"
- +
- "\\bClass\\b|\\bCLng\\b|\\bCObj\\b|\\bConst\\b|\\bCShort\\b|\\bCSng\\b|\\bCStr\\b|\\bCType\\b|"
- +
- "\\bDate\\b|\\bDecimal\\b|\\bDeclare\\b|\\bDefault\\b|\\bDelegate\\b|\\bDim\\b|\\bDirectCast\\b|\\bDo\\b|"
- +
- "\\bDouble\\b|\\bEach\\b|\\bElse\\b|\\bElseIf\\b|\\bEnd\\b|\\bEnum\\b|\\bErase\\b|\\bError\\b|"
- +
- "\\bEvent\\b|\\bExit\\b|\\bFalse\\b|\\bFinally\\b|\\bFor\\b|\\bFriend\\b|\\bFunction\\b|\\bGet\\b|"
- +
- "\\bGetType\\b|\\bGoSub\\b|\\bGoTo\\b|\\bHandles\\b|\\bIf\\b|\\bImplements\\b|\\bImports\\b|\\bIn\\b|"
- +
- "\\bInherits\\b|\\bInteger\\b|\\bInterface\\b|\\bIs\\b|\\bLet\\b|\\bLib\\b|\\bLike\\b|\\bLong\\b|"
- +
- "\\bLoop\\b|\\bMe\\b|\\bMod\\b|\\bModule\\b|\\bMustInherit\\b|\\bMustOverride\\b|\\bMyBase\\b|\\bMyClass\\b|"
- +
- "\\bNamespace\\b|\\bNew\\b|\\bNext\\b|\\bNot\\b|\\bNothing\\b|\\bNotInheritable\\b|\\bNotOverridable\\b|\\bObject\\b|"
- +
- "\\bOn\\b|\\bOption\\b|\\bOptional\\b|\\bOr\\b|\\bOrElse\\b|\\bOverloads\\b|\\bOverridable\\b|\\bOverrides\\b|"
- +
- "\\bParamArray\\b|\\bPreserve\\b|\\bPrivate\\b|\\bProperty\\b|\\bProtected\\b|\\bPublic\\b|\\bRaiseEvent\\b|\\bReadOnly\\b|"
- +
- "\\bReDim\\b|\\bREM\\b|\\bRemoveHandler\\b|\\bResume\\b|\\bReturn\\b|\\bSelect\\b|\\bSet\\b|\\bShadows\\b|"
- +
- "\\bShared\\b|\\bShort\\b|\\bSingle\\b|\\bStatic\\b|\\bStep\\b|\\bStop\\b|\\bString\\b|\\bStructure\\b|"
- +
- "\\bSub\\b|\\bSyncLock\\b|\\bThen\\b|\\bThrow\\b|\\bTo\\b|\\bTrue\\b|\\bTry\\b|\\bTypeOf\\b|"
- +
- "\\bUnicode\\b|\\bUntil\\b|\\bVariant\\b|\\bWhen\\b|\\bWhile\\b|\\bWith\\b|\\bWithEvents\\b|\\bWriteOnly\\b|\\bXor\\b)";
-#endif
-
- public static string Colorize(string text, string lang)
- {
- lang = lang.Trim().ToLower();
- switch (lang) {
- case "xml":
- return ColorizeXml(text);
- case "cs": case "c#": case "csharp":
- return ColorizeCs(text);
- case "vb":
- return ColorizeVb(text);
- }
- return Escape (text);
- }
-
- static string ColorizeXml(string text)
- {
- // Order is highly important.
-
- // s/ / /g must be first, as later substitutions add required spaces
- text = text.Replace(" ", " ");
-
- // Find & mark XML elements
- Regex re = new Regex("<\\s*(\\/?)\\s*([\\s\\S]*?)\\s*(\\/?)\\s*>");
- text = re.Replace(text, "{blue:<$1}{maroon:$2}{blue:$3>}");
-
- // Colorize attribute strings; must be done before colorizing marked XML
- // elements so that we don't clobber the colorized XML tags.
- re = new Regex ("([\"'])(.*?)\\1");
- text = re.Replace (text,
- "$1<font color=\"purple\">$2</font>$1");
-
- // Colorize marked XML elements
- re = new Regex("\\{(\\w*):([\\s\\S]*?)\\}");
- //text = re.Replace(text, "<span style='color:$1'>$2</span>");
- text = re.Replace(text, "<font color=\"$1\">$2</font>");
-
- // Standard Structure
- text = text.Replace("\t", " ");
- re = new Regex("\r\n|\r|\n");
- text = re.Replace(text, "<br/>");
-
- return text;
- }
-
- static string ColorizeCs(string text)
- {
- text = text.Replace(" ", " ");
-
- text = text.Replace("<", "<");
- text = text.Replace(">", ">");
-
- Regex re = new Regex("\"((((?!\").)|\\\")*?)\"");
-
- text =
- re.Replace(text,
- "<font color=\"purple\">\"$1\"</font>");
- //"<span style='color:purple'>\"$1\"</span>");
-
- re = new
- Regex
- ("//(((.(?!\"</font>))|\"(((?!\").)*)\"</font>)*)(\r|\n|\r\n)");
- //("//(((.(?!\"</span>))|\"(((?!\").)*)\"</span>)*)(\r|\n|\r\n)");
- text =
- re.Replace(text,
- "<font color=\"green\">//$1</font><br/>");
- // "<span style='color:green'>//$1</span><br/>");
-
- re = new Regex(keywords_cs);
- text = re.Replace(text, "<font color=\"blue\">$1</font>");
- //text = re.Replace(text, "<span style='color:blue'>$1</span>");
-
- text = text.Replace("\t", " ");
- text = text.Replace("\n", "<br/>");
-
- return text;
- }
-
- static string ColorizeVb(string text) {
- text = text.Replace(" ", " ");
-
- /* Regex re = new Regex ("\"((((?!\").)|\\\")*?)\"");
- text = re.Replace (text,"<span style='color:purple'>\"$1\"</span>");
-
- re = new Regex ("'(((.(?!\"\\<\\/span\\>))|\"(((?!\").)*)\"\\<\\/span\\>)*)(\r|\n|\r\n)");
- text = re.Replace (text,"<span style='color:green'>//$1</span><br/>");
-
- re = new Regex (keywords_vb);
- text = re.Replace (text,"<span style='color:blue'>$1</span>");
- */
- text = text.Replace("\t", " ");
- text = text.Replace("\n", "<br/>");
- return text;
- }
-
- static string Escape(string text)
- {
- text = text.Replace("&", "&");
- text = text.Replace(" ", " ");
- text = text.Replace("<", "<");
- text = text.Replace(">", ">");
- text = text.Replace("\n", "<br/>");
- return text;
- }
- }
-}
+++ /dev/null
-/EcmaUrlParser.cs
+++ /dev/null
-using System;
-using System.Linq;
-using System.Text;
-using System.Collections.Generic;
-
-namespace Monodoc.Ecma
-{
- /* Some properties might not be filled/meaningful depending on kind
- * like a namespace EcmaUrl won't have a valid TypeName
- */
- public class EcmaDesc : IEquatable<EcmaDesc>
- {
- public enum Kind
- {
- Type,
- Constructor,
- Method,
- Namespace,
- Field,
- Property,
- Event,
- Operator
- }
-
- public enum Mod
- {
- Normal,
- Pointer,
- Ref,
- Out
- }
-
- public enum Format
- {
- WithArgs,
- WithoutArgs
- }
-
- public Kind DescKind {
- get;
- set;
- }
-
- public Mod DescModifier {
- get;
- set;
- }
-
- public string Namespace {
- get;
- set;
- }
-
- public string TypeName {
- get;
- set;
- }
-
- public string MemberName {
- get;
- set;
- }
-
- public EcmaDesc NestedType {
- get;
- set;
- }
-
- /* A list of the array dimensions attached to this type.
- * The list count corresponds to the number of recursive
- * array definition (jagged arrays) the value of the
- * corresponding list item is the number of dimension
- * attached to that array definition instance
- */
- public IList<int> ArrayDimensions {
- get;
- set;
- }
-
- /* Depending on the form of the url, we might not have the type
- * of the argument but only how many the type/member has i.e.
- * when such number is specified with a backtick
- */
- public IList<EcmaDesc> GenericTypeArguments {
- get;
- set;
- }
-
- /* The GenericTypeArguments list may be null, in which case, this
- * is an easier/safer way to check the count.
- */
- public int GenericTypeArgumentsCount {
- get { return GenericTypeArguments != null ? GenericTypeArguments.Count : 0; }
- }
-
- /* This property tells if the above collections only correct value
- * is the number of item in it to represent generic arguments
- */
- public bool GenericTypeArgumentsIsNumeric {
- get {
- return GenericTypeArguments != null && GenericTypeArguments.FirstOrDefault () == null;
- }
- }
-
- public IList<EcmaDesc> GenericMemberArguments {
- get;
- set;
- }
-
- /* The GenericMemberArguments list may be null, in which case, this
- * is an easier/safer way to check the count.
- */
- public int GenericMemberArgumentsCount {
- get { return GenericMemberArguments != null ? GenericMemberArguments.Count : 0; }
- }
-
- public bool GenericMemberArgumentsIsNumeric {
- get {
- return GenericMemberArguments != null && GenericMemberArguments.FirstOrDefault () == null;
- }
- }
-
- public IList<EcmaDesc> MemberArguments {
- get;
- set;
- }
-
- /* The GenericTypeArguments list may be null, in which case, this
- * is an easier/safer way to check the count.
- */
- public int MemberArgumentsCount {
- get { return MemberArguments != null ? MemberArguments.Count : 0; }
- }
-
- /* This indicates that we actually want an inner part of the ecmadesc
- * i.e. in case of T: we could want the members (*), ctor (C), methods (M), ...
- */
- public char Etc {
- get;
- set;
- }
-
- public bool IsEtc {
- get {
- return Etc != (char)0;
- }
- }
-
- /* EtcFilter is only valid in some case of IsEtc when the inner part needs
- * to be further filtered e.g. in case we want a listing of the type overloads
- * Equals
- */
- public string EtcFilter {
- get;
- set;
- }
-
- /* When a member is an explicit implementation of an interface member, we register
- * the member EcmaDesc with its interface parent here
- */
- public EcmaDesc ExplicitImplMember {
- get;
- set;
- }
-
- // Returns the TypeName and the generic/inner type information if existing
- public string ToCompleteTypeName (char innerTypeSeparator = '.')
- {
- var result = TypeName;
- if (GenericTypeArguments != null)
- result += FormatGenericArgs (GenericTypeArguments);
- if (NestedType != null)
- result += innerTypeSeparator + NestedType.ToCompleteTypeName ();
- if (ArrayDimensions != null && ArrayDimensions.Count > 0)
- result += ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat);
-
- return result;
- }
-
- // Returns the member name with its generic types if existing
- public string ToCompleteMemberName (Format format)
- {
- /* We special process two cases:
- * - Explicit member implementation which append a full type specification
- * - Conversion operator which are exposed as normal method but have specific captioning in the end
- */
- if (ExplicitImplMember != null) {
- var impl = ExplicitImplMember;
- return impl.FormattedNamespace + impl.ToCompleteTypeName () + "." + impl.ToCompleteMemberName (format);
- } else if (format == Format.WithArgs && DescKind == Kind.Operator && MemberName.EndsWith ("Conversion")) {
- var type1 = MemberArguments[0].FormattedNamespace + MemberArguments[0].ToCompleteTypeName () + ModToString (MemberArguments[0]);
- var type2 = MemberArguments[1].FormattedNamespace + MemberArguments[1].ToCompleteTypeName () + ModToString (MemberArguments[1]);
- return type1 + " to " + type2;
- }
-
- var result = IsEtc && !string.IsNullOrEmpty (EtcFilter) ? EtcFilter : MemberName;
-
- // Temporary hack for monodoc produced inner type ctor
- //if (DescKind == Kind.Constructor && NestedType != null)
- //result = ToCompleteTypeName ();
-
- if (GenericMemberArguments != null)
- result += FormatGenericArgs (GenericMemberArguments);
-
- if (format == Format.WithArgs) {
- result += '(';
- if (MemberArguments != null && MemberArguments.Count > 0) {
- var args = MemberArguments.Select (a => FormatNamespace (a) + a.ToCompleteTypeName ('+') + ModToString (a));
- result += string.Join (",", args);
- }
- result += ')';
- }
-
- return result;
- }
-
- public string ToEcmaCref ()
- {
- var sb = new StringBuilder ();
- // Cref type
- sb.Append (DescKind.ToString ()[0]);
- sb.Append (":");
- // Create the rest
- ConstructCRef (sb);
-
- return sb.ToString ();
- }
-
- void ConstructCRef (StringBuilder sb, bool skipLeadingDot = false)
- {
- if (string.IsNullOrEmpty (Namespace))
- skipLeadingDot = true;
-
- sb.Append (Namespace);
- if (DescKind == Kind.Namespace)
- return;
-
- if (!skipLeadingDot)
- sb.Append ('.');
-
- sb.Append (TypeName);
- AppendGenericArguments (sb, GenericTypeArguments, GenericTypeArgumentsIsNumeric, GenericTypeArgumentsCount);
-
- if (NestedType != null) {
- sb.Append ('+');
- NestedType.ConstructCRef (sb, skipLeadingDot: true);
- }
- if (ArrayDimensions != null && ArrayDimensions.Count > 0) {
- for (int i = 0; i < ArrayDimensions.Count; i++) {
- sb.Append ('[');
- sb.Append (new string (',', ArrayDimensions[i] - 1));
- sb.Append (']');
- }
- }
- if (DescKind == Kind.Type)
- return;
-
- if (ExplicitImplMember != null) {
- sb.Append ('$');
- ExplicitImplMember.DescKind = this.DescKind;
- ExplicitImplMember.ConstructCRef (sb, skipLeadingDot: false);
- return;
- }
-
- sb.Append (".");
- sb.Append (MemberName);
-
- AppendGenericArguments (sb, GenericMemberArguments, GenericMemberArgumentsIsNumeric, GenericMemberArgumentsCount);
-
- if (MemberArguments != null && MemberArgumentsCount > 0) {
- sb.Append ("(");
- int i=0;
- foreach (var a in MemberArguments) {
- if (i > 0) {
- sb.Append(",");
- }
- a.ConstructCRef (sb);
- i++;
- }
- sb.Append (")");
- }
- }
-
- void AppendGenericArguments (StringBuilder sb, IEnumerable<EcmaDesc> arguments, bool isNumeric, int argumentsCount)
- {
- if (arguments != null && isNumeric) {
- sb.AppendFormat ("`{0}", argumentsCount);
- } else if (arguments != null) {
- sb.Append ('<');
- int i=0;
- foreach (var t in arguments) {
- if (i > 0) {
- sb.Append (",");
- }
- t.ConstructCRef (sb);
-
- i++;
- }
- sb.Append ('>');
- }
- }
-
- public override string ToString ()
- {
- return string.Format ("({8}) {0}::{1}{2}{3}{7} {4}{5}{6} {9} {10}",
- Namespace,
- TypeName,
- FormatGenericArgsFull (GenericTypeArguments),
- NestedType != null ? "+" + NestedType.ToString () : string.Empty,
- MemberName ?? string.Empty,
- FormatGenericArgsFull (GenericMemberArguments),
- MemberArguments != null ? "(" + string.Join (",", MemberArguments.Select (m => m.ToString ())) + ")" : string.Empty,
- ArrayDimensions != null && ArrayDimensions.Count > 0 ? ArrayDimensions.Select (dim => "[" + new string (',', dim - 1) + "]").Aggregate (string.Concat) : string.Empty,
- DescKind.ToString ()[0],
- Etc != 0 ? '(' + Etc.ToString () + ')' : string.Empty,
- ExplicitImplMember != null ? "$" + ExplicitImplMember.ToString () : string.Empty);
-
- }
-
- public override bool Equals (object other)
- {
- var otherDesc = other as EcmaDesc;
- return otherDesc != null && Equals (otherDesc);
- }
-
- public bool Equals (EcmaDesc other)
- {
- if (other == null)
- return false;
-
- if (NestedType == null ^ other.NestedType == null
- || ArrayDimensions == null ^ other.ArrayDimensions == null
- || GenericTypeArguments == null ^ other.GenericTypeArguments == null
- || GenericMemberArguments == null ^ other.GenericMemberArguments == null
- || MemberArguments == null ^ other.MemberArguments == null
- || ExplicitImplMember == null ^ other.ExplicitImplMember == null)
- return false;
-
- return other != null
- && DescKind == other.DescKind
- && TypeName == other.TypeName
- && Namespace == other.Namespace
- && MemberName == other.MemberName
- && (NestedType == null || NestedType.Equals (other.NestedType))
- && (ArrayDimensions == null || ArrayDimensions.SequenceEqual (other.ArrayDimensions))
- && (GenericTypeArguments == null || GenericTypeArguments.SequenceEqual (other.GenericTypeArguments))
- && (GenericMemberArguments == null || GenericMemberArguments.SequenceEqual (other.GenericMemberArguments))
- && (MemberArguments == null || MemberArguments.SequenceEqual (other.MemberArguments))
- && Etc == other.Etc
- && EtcFilter == other.EtcFilter
- && (ExplicitImplMember == null || ExplicitImplMember.Equals (other.ExplicitImplMember));
- }
-
- public override int GetHashCode ()
- {
- return DescKind.GetHashCode ()
- ^ TypeName.GetHashCode ()
- ^ Namespace.GetHashCode ()
- ^ MemberName.GetHashCode ();
- }
-
- bool What (bool input)
- {
- if (!input)
- throw new Exception ("Not equal");
- return input;
- }
-
- bool WhatT (bool input)
- {
- if (input)
- throw new Exception ("Not equal");
- return input;
- }
-
- string FormatNamespace (EcmaDesc desc)
- {
- return string.IsNullOrEmpty (desc.Namespace) ? string.Empty : desc.Namespace + ".";
- }
-
- string FormatGenericArgs (IEnumerable<EcmaDesc> args)
- {
- if (args == null || !args.Any ())
- return string.Empty;
- // If we only have the number of generic arguments, use ` notation
- if (args.First () == null)
- return "`" + args.Count ();
-
- IEnumerable<string> argsList = args.Select (t => FormatNamespace (t) + t.ToCompleteTypeName ());
-
- return "<" + string.Join (",", argsList) + ">";
- }
-
- string FormatGenericArgsFull (IEnumerable<EcmaDesc> genericArgs)
- {
- return genericArgs != null ? "<" + string.Join (",", genericArgs.Select (t => t.ToString ())) + ">" : string.Empty;
- }
-
- string ModToString (EcmaDesc desc)
- {
- switch (desc.DescModifier) {
- case Mod.Pointer:
- return "*";
- case Mod.Ref:
- return "&";
- case Mod.Out:
- return "@";
- default:
- return string.Empty;
- }
- }
-
- string FormattedNamespace {
- get {
- return !string.IsNullOrEmpty (Namespace) ? Namespace + "." : string.Empty;
- }
- }
- }
-}
+++ /dev/null
-%{
-using System.Text;
-using System.IO;
-using System;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace Monodoc.Ecma
-{
- public class EcmaUrlParser
- {
- int yacc_verbose_flag = 0;
-
- public void IsValid (string input)
- {
- var lexer = new EcmaUrlTokenizer (input);
- this.yyparse (lexer);
- }
-
- public EcmaDesc Parse (string input)
- {
- var lexer = new EcmaUrlTokenizer (input);
- return (EcmaDesc)this.yyparse (lexer);
- }
-
- public bool TryParse (string input, out EcmaDesc desc)
- {
- desc = null;
- try {
- desc = Parse (input);
- } catch {
- return false;
- }
- return true;
- }
-
- EcmaDesc SetEcmaDescType (object result, EcmaDesc.Kind kind)
- {
- var desc = result as EcmaDesc;
- desc.DescKind = kind;
- return desc;
- }
-
- List<T> SafeReverse<T> (List<T> input)
- {
- if (input == null)
- return null;
- input.Reverse ();
- return input;
- }
-%}
-
-%token ERROR
-%token IDENTIFIER
-%token DIGIT
-%token DOT
-%token COMMA
-%token COLON
-%token INNER_TYPE_SEPARATOR
-%token OP_GENERICS_LT
-%token OP_GENERICS_GT
-%token OP_GENERICS_BACKTICK
-%token OP_OPEN_PAREN
-%token OP_CLOSE_PAREN
-%token OP_ARRAY_OPEN
-%token OP_ARRAY_CLOSE
-%token SLASH_SEPARATOR
-%token STAR
-%token REF_ARG
-%token OUT_ARG
-%token EXPLICIT_IMPL_SEP
-
-%start expression
-
-%%
-
-expression
- : 'T' COLON type_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Type); }
- | 'N' COLON namespace_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Namespace); }
- | 'M' COLON method_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Method); }
- | 'F' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Field); }
- | 'C' COLON constructor_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Constructor); }
- | 'P' COLON property_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Property); }
- | 'E' COLON simple_member_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Event); }
- | 'O' COLON operator_expression { $$ = SetEcmaDescType ($3, EcmaDesc.Kind.Operator); }
-
-/* i.e. id.id.id or id */
-dot_expression
- : IDENTIFIER { $$ = new List<string> { (string)$1 }; }
- | IDENTIFIER DOT dot_expression { ((ICollection<string>)$3).Add ((string)$1); $$ = $3; }
-
-namespace_expression
- : dot_expression { $$ = new EcmaDesc { Namespace = string.Join (".", ((IEnumerable<string>)$1).Reverse ()) }; }
-
-type_expression
- : dot_expression type_expression_suffix {
- var dotExpr = ((List<string>)$1);
- dotExpr.Reverse ();
- var desc = $2 as EcmaDesc;
- desc.DescKind = EcmaDesc.Kind.Type;
- desc.Namespace = string.Join (".", dotExpr.Take (dotExpr.Count - 1));
- desc.TypeName = dotExpr.Last ();
- $$ = desc;
- }
-
-/* To be used in types with no namespaces attached to them like an inner type*/
-reduced_type_expression
- : IDENTIFIER type_expression_suffix {
- var desc = $2 as EcmaDesc;
- desc.DescKind = EcmaDesc.Kind.Type;
- desc.TypeName = $1 as string;
- $$ = desc;
- }
-
-type_expression_suffix
- : opt_generic_type_suffix opt_inner_type_description opt_array_definition opt_etc {
- bool nestedDescHasEtc = $2 != null && ((EcmaDesc)$2).IsEtc;
- EcmaDesc nestedType = (EcmaDesc)$2;
- $$ = new EcmaDesc {
- GenericTypeArguments = $1 as List<EcmaDesc>,
- NestedType = nestedType,
- ArrayDimensions = SafeReverse ($3 as List<int>),
- Etc = $4 != null ? ((Tuple<char, string>)$4).Item1 : nestedDescHasEtc ? nestedType.Etc : (char)0,
- EtcFilter = $4 != null ? ((Tuple<char, string>)$4).Item2 : nestedDescHasEtc ? nestedType.EtcFilter : null
- };
- if (nestedDescHasEtc) {
- nestedType.Etc = (char)0;
- nestedType.EtcFilter = null;
- }
- }
-
-opt_inner_type_description
- : /* empty */ { $$ = null; }
- | INNER_TYPE_SEPARATOR reduced_type_expression { $$ = $2; }
-
-opt_generic_type_suffix
- : /* empty */ { $$ = null; }
- | OP_GENERICS_BACKTICK DIGIT { $$ = Enumerable.Repeat<EcmaDesc> (null, (int)$2).ToList (); }
- | OP_GENERICS_LT generic_type_arg_list OP_GENERICS_GT { $$ = $2; }
-
-generic_type_arg_list
- : type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
- | generic_type_arg_list COMMA type_expression { ((List<EcmaDesc>)$1).Add ((EcmaDesc)$3); $$ = $1; }
-
-opt_array_definition
- : /* empty */ { $$ = null; }
- | OP_ARRAY_OPEN opt_array_definition_list OP_ARRAY_CLOSE opt_array_definition {
- var dims = ((IList<int>)$4) ?? new List<int> (2);
- dims.Add ((int)$2);
- $$ = dims;
- }
-
-opt_array_definition_list
- : /* empty */ { $$ = 1; }
- | COMMA opt_array_definition_list { $$ = ((int)$2) + 1; }
-
-opt_etc
- : /* empty */ { $$ = null; }
- | SLASH_SEPARATOR etc_identifier { $$ = Tuple.Create<char, string> (((string)$2)[0], null); }
- | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR reduced_member_expression { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4); }
-/* | SLASH_SEPARATOR etc_identifier SLASH_SEPARATOR IDENTIFIER opt_generic_type_suffix { $$ = Tuple.Create<char, string> (((string)$2)[0], (string)$4 + ($5 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$5).Select (t => t.ToCompleteTypeName ())) + ">")); } */
-
-etc_identifier
- : STAR { $$ = "*"; }
- | IDENTIFIER { $$ = $1; }
-
-method_expression
- : type_expression DOT IDENTIFIER opt_generic_type_suffix opt_arg_list_suffix {
- var desc = $1 as EcmaDesc;
- desc.MemberName = $3 as string;
- desc.GenericMemberArguments = $4 as List<EcmaDesc>;
- desc.MemberArguments = SafeReverse ($5 as List<EcmaDesc>);
- $$ = desc;
- }
- | dot_expression opt_generic_type_suffix opt_arg_list_suffix {
- var dotExpr = ((List<string>)$1);
- $$ = new EcmaDesc {
- Namespace = string.Join (".", dotExpr.Skip (2).DefaultIfEmpty (string.Empty).Reverse ()),
- TypeName = dotExpr.Skip (1).First (),
- MemberName = dotExpr.First (),
- GenericMemberArguments = $2 as List<EcmaDesc>,
- MemberArguments = SafeReverse ($3 as List<EcmaDesc>)
- };
- }
- | type_expression EXPLICIT_IMPL_SEP method_expression {
- var desc = $1 as EcmaDesc;
- desc.ExplicitImplMember = $3 as EcmaDesc;
- $$ = desc;
- }
-
-/* To be used with members that may have no type/namespace attached */
-reduced_member_expression
- : IDENTIFIER opt_generic_type_suffix { $$ = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">"); }
- | IDENTIFIER opt_generic_type_suffix DOT reduced_member_expression {
- var existing = $4 as string;
- var expr = (string)$1 + ($2 == null ? string.Empty : "<" + string.Join (",", ((IEnumerable<EcmaDesc>)$2).Select (t => t.ToCompleteTypeName ())) + ">");
- $$ = expr + "." + existing;
- }
-
-arg_type_expression
- : type_expression opt_arg_type_suffix { var desc = (EcmaDesc)$1; desc.DescModifier = (EcmaDesc.Mod)$2; $$ = desc; }
-
-opt_arg_type_suffix
- : /* empty */ { $$ = EcmaDesc.Mod.Normal; }
- | STAR { $$ = EcmaDesc.Mod.Pointer; }
- | REF_ARG { $$ = EcmaDesc.Mod.Ref; }
- | OUT_ARG { $$ = EcmaDesc.Mod.Out; }
-
-type_expression_list
- : /* empty */ { $$ = null; }
- | arg_type_expression { $$ = new List<EcmaDesc> () { (EcmaDesc)$1 }; }
- | arg_type_expression COMMA type_expression_list { ((List<EcmaDesc>)$3).Add ((EcmaDesc)$1); $$ = $3; }
-
-simple_member_expression
- : dot_expression {
- var dotExpr = ((List<string>)$1);
- dotExpr.Reverse ();
-
- $$ = new EcmaDesc {
- Namespace = dotExpr.Count > 2 ? string.Join (".", dotExpr.Take (dotExpr.Count - 2)) : string.Empty,
- TypeName = dotExpr.Count > 1 ? dotExpr[dotExpr.Count - 2] : string.Empty,
- MemberName = dotExpr[dotExpr.Count - 1]
- };
- }
- | type_expression DOT IDENTIFIER {
- var desc = $1 as EcmaDesc;
- desc.MemberName = $3 as string;
- $$ = desc;
- }
- | type_expression EXPLICIT_IMPL_SEP simple_member_expression {
- var desc = $1 as EcmaDesc;
- desc.ExplicitImplMember = $3 as EcmaDesc;
- $$ = desc;
- }
-
-constructor_expression
- : method_expression { $$ = $1; }
-
-operator_expression
- : method_expression { $$ = $1; }
-
-property_expression
- : simple_member_expression opt_property_indexer {
- var desc = $1 as EcmaDesc;
- (desc.ExplicitImplMember ?? desc).MemberArguments = SafeReverse ($2 as List<EcmaDesc>);
- $$ = desc;
- }
-
-opt_property_indexer
- : opt_arg_list_suffix { $$ = $1; }
-
-/*simple_member_expression opt_arg_list_suffix { $$ = CopyFromEcmaDesc (new EcmaDesc {
- MemberArguments = SafeReverse ($2 as List<EcmaDesc>)
- }, (EcmaDesc)$1);
- }*/
-
-opt_arg_list_suffix
- : /* empty */ { $$ = null; }
- | OP_OPEN_PAREN type_expression_list OP_CLOSE_PAREN { $$ = $2; }
-
-%%
-
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-
-namespace Monodoc.Ecma
-{
- public class EcmaUrlParserDriver
- {
- public static void Main (string[] args)
- {
- var input = new StringReader (args[0]);
- var lexer = new EcmaUrlTokenizer (input);
- var parser = new EcmaUrlParser ();
-
- Console.WriteLine (parser.yyparse (lexer));
- }
- }
-}
+++ /dev/null
-using System;
-using System.Text;
-using System.Globalization;
-
-namespace Monodoc.Ecma
-{
- public class EcmaUrlTokenizer : yyParser.yyInput
- {
- const char EndOfStream = (char)0;
- string input;
- object val;
- int current_token;
- int current_pos;
- int real_current_pos;
- int identCount = 0;
-
- public EcmaUrlTokenizer (string input)
- {
- this.input = input;
- }
-
- static bool is_identifier_start_character (char c)
- {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || Char.IsLetter (c);
- }
-
- static bool is_identifier_part_character (char c)
- {
- if (c >= 'a' && c <= 'z')
- return true;
-
- if (c >= 'A' && c <= 'Z')
- return true;
-
- if (c == '_' || (c >= '0' && c <= '9'))
- return true;
-
- if (c < 0x80)
- return false;
-
- return Char.IsLetter (c) || Char.GetUnicodeCategory (c) == UnicodeCategory.ConnectorPunctuation;
- }
-
- public bool advance ()
- {
- return Peek () != EndOfStream;
- }
-
- public Object Value {
- get {
- return val;
- }
- }
-
- public Object value ()
- {
- return val;
- }
-
- public int token ()
- {
- int token = xtoken ();
- //Console.WriteLine ("Current token {0} with value {1}", token, val == null ? "(none)" : val.ToString ());
- if (token == Token.ERROR) {
- throw new Exception (string.Format ("Error at position {0} parsing url '{0}'", current_pos, input));
- }
- current_token = token;
- return token;
- }
-
- int xtoken ()
- {
- char next = Read ();
- while (char.IsWhiteSpace (next))
- next = Read ();
- current_pos++;
- val = null;
-
- switch (next) {
- case ',':
- return Token.COMMA;
- case '.':
- return Token.DOT;
- case '{':
- case '<':
- return Token.OP_GENERICS_LT;
- case '}':
- case '>':
- return Token.OP_GENERICS_GT;
- case '`':
- return Token.OP_GENERICS_BACKTICK;
- case '(':
- return Token.OP_OPEN_PAREN;
- case ')':
- return Token.OP_CLOSE_PAREN;
- case '+':
- return Token.INNER_TYPE_SEPARATOR;
- case ':':
- return Token.COLON;
- case '/':
- return Token.SLASH_SEPARATOR;
- case '[':
- return Token.OP_ARRAY_OPEN;
- case ']':
- return Token.OP_ARRAY_CLOSE;
- case '*':
- return Token.STAR;
- case '&':
- return Token.REF_ARG;
- case '@':
- return Token.OUT_ARG;
- case '$':
- return Token.EXPLICIT_IMPL_SEP;
- default:
- return TokenizeIdentifierOrNumber (next);
- }
- }
-
- int TokenizeIdentifierOrNumber (char current)
- {
- // We must first return the expression type which is a uppercase letter and a colon
- if (current_pos < 2) {
- val = null;
- return (int)current;
- }
-
- if (is_identifier_start_character (current) || current == '*') {
- unsafe {
- // identifier length is artificially limited to 1024 bytes by implementations
- char* pIdent = stackalloc char[512];
- *pIdent = current;
- identCount = 1;
-
- char peek;
- while ((peek = Peek ()) != EndOfStream && is_identifier_part_character (peek)) {
- *(pIdent + identCount) = Read ();
- ++current_pos;
- ++identCount;
- }
-
- val = new string ((char*)pIdent, 0, identCount);
- return Token.IDENTIFIER;
- }
- } else if (char.IsDigit (current)) {
- val = current - '0';
- return Token.DIGIT;
- } else {
- val = null;
- return Token.ERROR;
- }
- }
-
- char Read ()
- {
- try {
- return input[real_current_pos++];
- } catch {
- return EndOfStream;
- }
- }
-
- char Peek ()
- {
- try {
- return input[real_current_pos];
- } catch {
- return EndOfStream;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-using Mono.Utilities;
-using Lucene.Net.Index;
-
-namespace Monodoc
-{
- public enum SortType {
- Caption,
- Element
- }
-
- //
- // The HelpSource class keeps track of the archived data, and its
- // tree
- //
- public
-#if LEGACY_MODE
- partial
-#endif
- class HelpSource
- {
- static int id;
-
- //
- // The unique ID for this HelpSource.
- //
- int source_id;
-
- // The name of the HelpSource, used by all the file (.tree, .zip, ...) used by it
- string name;
- // The full directory path where the HelpSource files are located
- string basePath;
-
- // The tree of this help source
- Tree tree;
- string treeFilePath;
- RootTree rootTree;
-
- IDocCache cache;
- IDocStorage storage;
-
- public HelpSource (string base_filename, bool create)
- {
- this.name = Path.GetFileName (base_filename);
- this.basePath = Path.GetDirectoryName (base_filename);
- this.treeFilePath = base_filename + ".tree";
- this.storage = new Monodoc.Storage.ZipStorage (base_filename + ".zip");
- this.cache = DocCacheHelper.GetDefaultCache (Name);
-
- tree = create ? new Tree (this, string.Empty, string.Empty) : new Tree (this, treeFilePath);
-
- source_id = id++;
- }
-
- public HelpSource ()
- {
- tree = new Tree (this, "Blah", "Blah");
- source_id = id++;
- this.cache = new Caches.NullCache ();
- }
-
- public int SourceID {
- get {
- return source_id;
- }
- }
-
- public string Name {
- get {
- return name;
- }
- }
-
- /* This gives the full path of the source/ directory */
- public string BaseFilePath {
- get {
- return basePath;
- }
- }
-
- public TraceLevel TraceLevel {
- get;
- set;
- }
-
- public string BaseDir {
- get {
- return basePath;
- }
- }
-
- public Tree Tree {
- get {
- return tree;
- }
- }
-
- public RootTree RootTree {
- get {
- return rootTree;
- }
- set {
- rootTree = value;
- }
- }
-
- public IDocCache Cache {
- get {
- return cache;
- }
- }
-
- public IDocStorage Storage {
- get {
- return storage;
- }
- protected set {
- storage = value;
- }
- }
-
- // A HelpSource may have a common prefix to its URL, give it here
- protected virtual string UriPrefix {
- get {
- return "dummy:";
- }
- }
-
- public virtual SortType SortType {
- get {
- return SortType.Caption;
- }
- }
-
- /// <summary>
- /// Returns a stream from the packaged help source archive
- /// </summary>
- public virtual Stream GetHelpStream (string id)
- {
- return storage.Retrieve (id);
- }
-
- public virtual Stream GetCachedHelpStream (string id)
- {
- if (string.IsNullOrEmpty (id))
- throw new ArgumentNullException ("id");
- if (!cache.CanCache (DocEntity.Text))
- return GetHelpStream (id);
- if (!cache.IsCached (id))
- cache.CacheText (id, GetHelpStream (id));
- return cache.GetCachedStream (id);
- }
-
- public XmlReader GetHelpXml (string id)
- {
- var url = "monodoc:///" + SourceID + "@" + Uri.EscapeDataString (id) + "@";
- var stream = cache.IsCached (id) ? cache.GetCachedStream (id) : storage.Retrieve (id);
-
- return stream == null ? null : new XmlTextReader (url, stream);
- }
-
- public virtual XmlDocument GetHelpXmlWithChanges (string id)
- {
- XmlDocument doc = new XmlDocument ();
- if (!storage.SupportRevision) {
- doc.Load (GetHelpXml (id));
- } else {
- var revManager = storage.RevisionManager;
- doc.Load (revManager.RetrieveLatestRevision (id));
- }
- return doc;
- }
-
- public virtual string GetCachedText (string id)
- {
- if (!cache.CanCache (DocEntity.Text))
- return GetText (id);
- if (!cache.IsCached (id))
- cache.CacheText (id, GetText (id));
- return cache.GetCachedString (id);
- }
-
- public virtual string GetText (string id)
- {
- return new StreamReader (GetHelpStream (id)).ReadToEnd ();
- }
-
- // Tells if the result for the provided id is generated dynamically
- // by the help source
- public virtual bool IsGeneratedContent (string id)
- {
- return false;
- }
-
- // Tells if the content of the provided id is meant to be returned raw
- public virtual bool IsRawContent (string id)
- {
- return false;
- }
-
- // Tells if provided id refers to a multi-content-type document if it's case
- // tells the ids it's formed of
- public virtual bool IsMultiPart (string id, out IEnumerable<string> parts)
- {
- parts = null;
- return false;
- }
-
- /// <summary>
- /// Saves the tree and the archive
- /// </summary>
- public void Save ()
- {
- tree.Save (treeFilePath);
- storage.Dispose ();
- }
-
- public virtual void RenderPreviewDocs (XmlNode newNode, XmlWriter writer)
- {
- throw new NotImplementedException ();
- }
-
- public virtual string GetPublicUrl (Node node)
- {
- return node.GetInternalUrl ();
- }
-
- public virtual bool CanHandleUrl (string url)
- {
- return url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase);
- }
-
- public virtual string GetInternalIdForUrl (string url, out Node node, out Dictionary<string, string> context)
- {
- context = null;
- node = MatchNode (url);
- return node == null ? null : url.Substring (UriPrefix.Length);
- }
-
- public virtual Node MatchNode (string url)
- {
- Node current = null;
-
- var matchCache = LRUCache<string, Node>.Default;
- if ((current = matchCache.Get (url)) != null)
- return current;
-
- current = Tree.RootNode;
- var strippedUrl = url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? url.Substring (UriPrefix.Length) : url;
- var searchNode = new Node () { Element = strippedUrl };
-
- do {
- int index = current.ChildNodes.BinarySearch (searchNode, NodeElementComparer.Instance);
- if (index >= 0) {
- Node n = current.ChildNodes[index];
- matchCache.Put (url, n);
- return n;
- }
- index = ~index;
- if (index == current.ChildNodes.Count) {
- return SlowMatchNode (Tree.RootNode, matchCache, strippedUrl);
- }
-
- if (index == 0)
- return null;
-
- current = current.ChildNodes [index - 1];
- } while (true);
-
- return null;
- }
-
- /* That slow path is mainly here to handle ecmaspec type of url which are composed of hard to sort numbers
- * because they don't have the same amount of digit. We could use a regex to harmonise the various number
- * parts but then it would be quite specific. Since in the case of ecmaspec the tree is well-formed enough
- * the "Slow" match should still be fast enough
- */
- Node SlowMatchNode (Node current, LRUCache<string, Node> matchCache, string url)
- {
- //Console.WriteLine ("Entering slow path for {0} starting from {1}", url, current.Element);
- while (current != null) {
- bool stop = true;
- foreach (Node n in current.ChildNodes) {
- var element = n.Element.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (UriPrefix.Length) : n.Element;
- if (url.Equals (element, StringComparison.Ordinal)) {
- matchCache.Put (url, n);
- return n;
- } else if (url.StartsWith (element + ".", StringComparison.OrdinalIgnoreCase) && !n.IsLeaf) {
- current = n;
- stop = false;
- break;
- }
- }
- if (stop)
- current = null;
- }
-
- return null;
- }
-
- class NodeElementComparer : IComparer<Node>
- {
- public static NodeElementComparer Instance = new NodeElementComparer ();
-
- public int Compare (Node n1, Node n2)
- {
- return string.Compare (Cleanup (n1), Cleanup (n2), StringComparison.Ordinal);
- }
-
- string Cleanup (Node n)
- {
- var prefix = n.Tree != null && n.Tree.HelpSource != null ? n.Tree.HelpSource.UriPrefix : string.Empty;
- var element = n.Element.StartsWith (prefix, StringComparison.OrdinalIgnoreCase) ? n.Element.Substring (prefix.Length) : n.Element;
- if (char.IsDigit (element, 0)) {
- var count = element.TakeWhile (char.IsDigit).Count ();
- element = element.PadLeft (Math.Max (0, 3 - count) + element.Length, '0');
- }
- //Console.WriteLine ("Cleaned up {0} to {1}", n.Element, element);
- return element;
- }
- }
-
- public virtual DocumentType GetDocumentTypeForId (string id)
- {
- return DocumentType.PlainText;
- }
-
- public virtual Stream GetImage (string url)
- {
- Stream result = null;
- storage.TryRetrieve (url, out result);
- return result;
- }
-
- //
- // Populates the index.
- //
- public virtual void PopulateIndex (IndexMaker index_maker)
- {
- }
-
- //
- // Create different Documents for adding to Lucene search index
- // The default action is do nothing. Subclasses should add the docs
- //
- public virtual void PopulateSearchableIndex (IndexWriter writer)
- {
-
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-using Mono.Utilities;
-using Lucene.Net.Index;
-
-#if LEGACY_MODE
-
-namespace Monodoc
-{
- using Generators;
-
- public partial class HelpSource
- {
- static HtmlGenerator htmlGenerator = new HtmlGenerator (null);
-
- [Obsolete]
- public static bool use_css;
- [Obsolete]
- public static bool FullHtml = true;
- [Obsolete]
- public static bool UseWebdocCache;
-
- [Obsolete ("Use Monodoc.Providers.HtmlGenerator.InlineCss")]
- public string InlineCss {
- get { return Monodoc.Generators.HtmlGenerator.InlineCss; }
- }
-
- [Obsolete]
- public string InlineJavaScript {
- get { return null; }
- }
-
- [Obsolete ("Use RenderUrl")]
- public string GetText (string url, out Node node)
- {
- return rootTree.RenderUrl (url, htmlGenerator, out node, this);
- }
-
- [Obsolete ("Use RenderUrl")]
- public string RenderNamespaceLookup (string url, out Node node)
- {
- return rootTree.RenderUrl (url, htmlGenerator, out node, this);
- }
- }
-}
-
-#endif
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Xml;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Monodoc
-{
- public
-#if LEGACY_MODE
- partial
-#endif
- class Node : IComparable<Node>, IComparable
- {
- readonly Tree parentTree;
- string caption, element, pubUrl;
- public bool Documented;
- bool loaded;
- Node parent;
- List<Node> nodes;
-#if LEGACY_MODE
- ArrayList legacyNodes;
-#endif
- Dictionary<string, Node> childrenLookup;
- bool elementSort;
- /* Address has three types of value,
- * _ 0 is for no on-disk representation
- * _ >0 is a valid address that is loaded immediately
- * _ <0 is a valid negated address to indicate lazy loading
- */
- int address;
-
-#if LEGACY_MODE
- [Obsolete ("Tree inheriting Node is being phased out. Use the `Tree.RootNode' property instead")]
- public Node (string caption, string element)
- {
- this.parentTree = (Tree) this;
- this.caption = caption;
- this.element = element;
- parent = null;
- }
-#endif
-
- public Node (Node parent, string caption, string element) : this (parent.Tree, caption, element)
- {
- this.parent = parent;
- }
-
- internal Node (Tree tree, string caption, string element)
- {
- this.parentTree = tree;
- this.caption = caption;
- this.element = element;
- this.elementSort = parentTree.HelpSource != null && parentTree.HelpSource.SortType == SortType.Element;
- }
-
- /// <summary>
- /// Creates a node from an on-disk representation
- /// </summary>
- internal Node (Node parent, int address) : this (parent.parentTree, address)
- {
- this.parent = parent;
- }
-
- internal Node (Tree tree, int address)
- {
- this.address = address;
- this.parentTree = tree;
- this.elementSort = parentTree.HelpSource != null && parentTree.HelpSource.SortType == SortType.Element;
- if (address > 0)
- LoadNode ();
- }
-
- /* This is solely used for MatchNode to check for equality */
- internal Node ()
- {
- }
-
- void LoadNode ()
- {
- parentTree.InflateNode (this);
- if (parent != null)
- parent.RegisterFullNode (this);
- }
-
- public void AddNode (Node n)
- {
- nodes.Add (n);
- n.parent = this;
- n.Documented = true;
- RegisterFullNode (n);
- }
-
- public void DeleteNode (Node n)
- {
- nodes.Remove (n);
- if (!string.IsNullOrEmpty (n.element))
- childrenLookup.Remove (n.element);
- }
-
- // When a child node is inflated, it calls this method
- // so that we can add it to our lookup for quick search
- void RegisterFullNode (Node child)
- {
- if (childrenLookup == null)
- childrenLookup = new Dictionary<string, Node> ();
- if (!string.IsNullOrEmpty (child.element))
- childrenLookup[child.element] = child;
- }
-
- [Obsolete ("Use ChildNodes")]
- public ArrayList Nodes {
- get {
- if (legacyNodes == null)
- legacyNodes = new ArrayList (ChildNodes as ICollection);
- return legacyNodes;
- }
- }
-
- public IList<Node> ChildNodes {
- get {
- EnsureLoaded ();
- return nodes != null ? nodes : new List<Node> ();
- }
- }
-
- public string Element {
- get {
- EnsureLoaded ();
- return element;
- }
- set {
- element = value;
- }
- }
-
- public string Caption {
- get {
- EnsureLoaded ();
- return caption;
- }
- internal set {
- caption = value;
- }
- }
-
- public Node Parent {
- get {
- return parent;
- }
- }
-
- public Tree Tree {
- get {
- return parentTree;
- }
- }
-
- internal int Address {
- get {
- return address;
- }
-#if LEGACY_MODE
- set {
- address = value;
- }
-#endif
- }
-
- /// <summary>
- /// Creates a new node, in the locator entry point, and with
- /// a user visible caption of @caption
- /// </summary>
- public Node CreateNode (string c_caption, string c_element)
- {
- EnsureNodes ();
- if (string.IsNullOrEmpty (c_caption))
- throw new ArgumentNullException ("c_caption");
- if (string.IsNullOrEmpty (c_element))
- throw new ArgumentNullException ("c_element");
-
- Node t = new Node (this, c_caption, c_element);
- nodes.Add (t);
- childrenLookup[c_element] = t;
-
- return t;
- }
-
- public Node GetOrCreateNode (string c_caption, string c_element)
- {
- if (nodes == null)
- return CreateNode (c_caption, c_element);
- if (childrenLookup.Count != nodes.Count || (nodes.Count == 0 && childrenLookup.Count != nodes.Capacity))
- UpdateLookup ();
-
- Node result;
- if (!childrenLookup.TryGetValue (c_element, out result))
- result = CreateNode (c_caption, c_element);
- return result;
- }
-
- public void EnsureNodes ()
- {
- if (nodes == null) {
- nodes = new List<Node> ();
- childrenLookup = new Dictionary<string, Node> ();
- }
- }
-
- public void EnsureLoaded ()
- {
- if (address < 0 && !loaded) {
- LoadNode ();
- loaded = true;
- }
- }
-
- void UpdateLookup ()
- {
- foreach (var node in nodes)
- childrenLookup[node.Element] = node;
- }
-
- public bool IsLeaf {
- get {
- return nodes == null || nodes.Count == 0;
- }
- }
-
- void EncodeInt (BinaryWriter writer, int value)
- {
- do {
- int high = (value >> 7) & 0x01ffffff;
- byte b = (byte)(value & 0x7f);
-
- if (high != 0) {
- b = (byte)(b | 0x80);
- }
-
- writer.Write(b);
- value = high;
- } while(value != 0);
- }
-
- int DecodeInt (BinaryReader reader)
- {
- int ret = 0;
- int shift = 0;
- byte b;
-
- do {
- b = reader.ReadByte();
-
- ret = ret | ((b & 0x7f) << shift);
- shift += 7;
- } while ((b & 0x80) == 0x80);
-
- return ret;
- }
-
- internal void Deserialize (BinaryReader reader)
- {
- int count = DecodeInt (reader);
- element = reader.ReadString ();
- caption = reader.ReadString ();
-
- if (count == 0)
- return;
-
- nodes = new List<Node> (count);
- for (int i = 0; i < count; i++) {
- int child_address = DecodeInt (reader);
-
- Node t = new Node (this, -child_address);
- nodes.Add (t);
- }
-
- if (parentTree.ForceResort)
- nodes.Sort ();
- }
-
- internal void Serialize (FileStream output, BinaryWriter writer)
- {
- if (nodes != null)
- foreach (Node child in nodes)
- child.Serialize (output, writer);
-
- address = (int) output.Position;
- EncodeInt (writer, nodes == null ? 0 : (int) nodes.Count);
- writer.Write (element);
- writer.Write (caption);
-
- if (nodes != null)
- foreach (Node child in nodes)
- EncodeInt (writer, child.address);
- }
-
- public void Sort ()
- {
- if (nodes != null)
- nodes.Sort ();
- }
-
- internal string GetInternalUrl ()
- {
- EnsureLoaded ();
- if (element.IndexOf (":") != -1 || parent == null)
- return element;
-
- var parentUrl = parent.GetInternalUrl ();
- return parentUrl.EndsWith ("/") ? parentUrl + element : parentUrl + "/" + element;
- }
-
- public string PublicUrl {
- get {
- if (pubUrl != null)
- return pubUrl;
- return pubUrl = parentTree.HelpSource != null ? parentTree.HelpSource.GetPublicUrl (this) : GetInternalUrl ();
- }
- }
-
- int IComparable.CompareTo (object obj)
- {
- Node other = obj as Node;
- if (other == null)
- return -1;
- return CompareToInternal (other);
- }
-
- int IComparable<Node>.CompareTo (Node obj)
- {
- return CompareToInternal (obj);
- }
-
- int CompareToInternal (Node other)
- {
- EnsureLoaded ();
- other.EnsureLoaded ();
-
- var cap1 = elementSort ? element : caption;
- var cap2 = elementSort ? other.element : other.caption;
-
- /* Some node (notably from ecmaspec) have number prepended to them
- * which we need to sort better by padding them to the same number
- * of digits
- */
- if (char.IsDigit (cap1[0]) && char.IsDigit (cap2[0])) {
- int c1 = cap1.TakeWhile (char.IsDigit).Count ();
- int c2 = cap2.TakeWhile (char.IsDigit).Count ();
-
- if (c1 != c2) {
- cap1 = cap1.PadLeft (cap1.Length + Math.Max (0, c2 - c1), '0');
- cap2 = cap2.PadLeft (cap2.Length + Math.Max (0, c1 - c2), '0');
- }
- }
-
- return string.Compare (cap1, cap2, StringComparison.Ordinal);
- }
- }
-
- internal static class IListExtensions
- {
- // TODO: if the backing store ever change from List<T>, we need to tune these methods to have a fallback mechanism
- public static int BinarySearch<T> (this IList<T> ilist, T item)
- {
- var list = ilist as List<T>;
- if (list == null)
- throw new NotSupportedException ();
- return list.BinarySearch (item);
- }
-
- public static int BinarySearch<T> (this IList<T> ilist, T item, IComparer<T> comparer)
- {
- var list = ilist as List<T>;
- if (list == null)
- throw new NotSupportedException ();
- return list.BinarySearch (item, comparer);
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Xml;
-using System.Collections.Generic;
-
-#if LEGACY_MODE
-
-namespace Monodoc
-{
- public partial class Node
- {
- [Obsolete ("Use `Tree' instead of 'tree'")]
- public Tree tree {
- get {
- return this.Tree;
- }
- }
-
- [Obsolete ("Use TreeDumper")]
- public static void PrintTree (Tree t)
- {
- TreeDumper.PrintTree (t.RootNode);
- }
-
-
- }
-}
-
-#endif
+++ /dev/null
-using System;
-
-namespace Monodoc
-{
- public abstract class Provider
- {
- //
- // This code is used to "tag" all the different sources
- //
- static short serial;
-
- public int Code { get; set; }
-
- public Provider ()
- {
- Code = serial++;
- }
-
- public abstract void PopulateTree (Tree tree);
-
- //
- // Called at shutdown time after the tree has been populated to perform
- // any fixups or final tasks.
- //
- public abstract void CloseTree (HelpSource hs, Tree tree);
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Configuration;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Xml;
-
-using Monodoc.Providers;
-using Lucene.Net.Analysis.Standard;
-using Lucene.Net.Index;
-
-namespace Monodoc
-{
- public
-#if LEGACY_MODE
- partial
-#endif
- class RootTree : Tree
- {
- public const int MonodocVersion = 2;
- const string RootNamespace = "root:/";
- string basedir;
- static List<string> uncompiledHelpSourcePaths = new List<string>();
- HashSet<string> loadedSourceFiles = new HashSet<string>();
- List<HelpSource> helpSources = new List<HelpSource>();
- Dictionary<string, Node> nameToNode = new Dictionary<string, Node>();
- Dictionary<string, HelpSource> nameToHelpSource = new Dictionary<string, HelpSource>();
-
- public IList<HelpSource> HelpSources {
- get {
- return this.helpSources.AsReadOnly();
- }
- }
-
- public DateTime LastHelpSourceTime {
- get;
- set;
- }
-
- static bool IsUnix {
- get {
- int platform = (int)Environment.OSVersion.Platform;
- return platform == 4 || platform == 128 || platform == 6;
- }
- }
-
- RootTree () : base (null, "Mono Documentation", "root:")
- {
- base.RootNode.EnsureNodes();
- this.LastHelpSourceTime = DateTime.Now;
- }
-
- public static void AddUncompiledSource (string path)
- {
- uncompiledHelpSourcePaths.Add (path);
- }
-
- public static RootTree LoadTree ()
- {
- return RootTree.LoadTree (RootTree.ProbeBaseDirectories ());
- }
-
- static string ProbeBaseDirectories ()
- {
- string result = ".";
- try {
- result = Config.Get ("docPath") ?? ".";
- } catch {}
-
- return result;
- }
-
- public static RootTree LoadTree (string basedir, bool includeExternal = true)
- {
- if (string.IsNullOrEmpty (basedir))
- throw new ArgumentNullException ("basedir");
- if (!Directory.Exists (basedir))
- throw new ArgumentException ("basedir", string.Format ("Base documentation directory at '{0}' doesn't exist", basedir));
-
- XmlDocument xmlDocument = new XmlDocument ();
- string filename = Path.Combine (basedir, "monodoc.xml");
- xmlDocument.Load (filename);
- IEnumerable<string> sourceFiles = Directory.EnumerateFiles (Path.Combine (basedir, "sources"), "*.source");
- if (includeExternal)
- sourceFiles = sourceFiles.Concat (RootTree.ProbeExternalDirectorySources ());
- return RootTree.LoadTree (basedir, xmlDocument, sourceFiles);
- }
-
- static IEnumerable<string> ProbeExternalDirectorySources ()
- {
- IEnumerable<string> enumerable = Enumerable.Empty<string> ();
- try {
- string path = Config.Get ("docExternalPath");
- enumerable = enumerable.Concat (System.IO.Directory.EnumerateFiles (path, "*.source"));
- }
- catch {}
-
- if (Directory.Exists ("/Library/Frameworks/Mono.framework/External/monodoc"))
- enumerable = enumerable.Concat (Directory.EnumerateFiles ("/Library/Frameworks/Mono.framework/External/monodoc", "*.source"));
-
- var windowsPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData), "monodoc");
- if (Directory.Exists (windowsPath))
- enumerable = enumerable.Concat (Directory.EnumerateFiles (windowsPath, "*.source"));
-
- return enumerable;
- }
-
- public static RootTree LoadTree (string indexDir, XmlDocument docTree, IEnumerable<string> sourceFiles)
- {
- if (docTree == null) {
- docTree = new XmlDocument ();
- using (Stream manifestResourceStream = typeof (RootTree).Assembly.GetManifestResourceStream ("monodoc.xml")) {
- docTree.Load (manifestResourceStream);
- }
- }
-
- sourceFiles = (sourceFiles ?? new string[0]);
- RootTree rootTree = new RootTree ();
- rootTree.basedir = indexDir;
- XmlNodeList xml_node_list = docTree.SelectNodes ("/node/node");
- rootTree.nameToNode["root"] = rootTree.RootNode;
- rootTree.nameToNode["libraries"] = rootTree.RootNode;
- rootTree.Populate (rootTree.RootNode, xml_node_list);
-
- if (rootTree.LookupEntryPoint ("various") == null) {
- Console.Error.WriteLine ("No 'various' doc node! Check monodoc.xml!");
- Node rootNode = rootTree.RootNode;
- }
-
- foreach (string current in sourceFiles)
- rootTree.AddSourceFile (current);
-
- foreach (string path in uncompiledHelpSourcePaths) {
- var hs = new Providers.EcmaUncompiledHelpSource (path);
- hs.RootTree = rootTree;
- rootTree.helpSources.Add (hs);
- string epath = "extra-help-source-" + hs.Name;
- Node hsn = rootTree.RootNode.CreateNode (hs.Name, RootNamespace + epath);
- rootTree.nameToHelpSource [epath] = hs;
- hsn.EnsureNodes ();
- foreach (Node n in hs.Tree.RootNode.ChildNodes)
- hsn.AddNode (n);
- }
-
- RootTree.PurgeNode (rootTree.RootNode);
- rootTree.RootNode.Sort ();
- return rootTree;
- }
-
- public void AddSource (string sourcesDir)
- {
- IEnumerable<string> enumerable = Directory.EnumerateFiles (sourcesDir, "*.source");
- foreach (string current in enumerable)
- if (!this.AddSourceFile (current))
- Console.Error.WriteLine ("Error: Could not load source file {0}", current);
- }
-
- public bool AddSourceFile (string sourceFile)
- {
- if (this.loadedSourceFiles.Contains (sourceFile))
- return false;
-
- Node node = this.LookupEntryPoint ("various") ?? base.RootNode;
- XmlDocument xmlDocument = new XmlDocument ();
- try {
- xmlDocument.Load (sourceFile);
- } catch {
- bool result = false;
- return result;
- }
-
- XmlNodeList extra_nodes = xmlDocument.SelectNodes ("/monodoc/node");
- if (extra_nodes.Count > 0)
- this.Populate (node, extra_nodes);
-
- XmlNodeList sources = xmlDocument.SelectNodes ("/monodoc/source");
- if (sources == null) {
- Console.Error.WriteLine ("Error: No <source> section found in the {0} file", sourceFile);
- return false;
- }
-
- loadedSourceFiles.Add (sourceFile);
- foreach (XmlNode xmlNode in sources) {
- XmlAttribute a = xmlNode.Attributes["provider"];
- if (a == null) {
- Console.Error.WriteLine ("Error: no provider in <source>");
- continue;
- }
- string provider = a.InnerText;
- a = xmlNode.Attributes["basefile"];
- if (a == null) {
- Console.Error.WriteLine ("Error: no basefile in <source>");
- continue;
- }
- string basefile = a.InnerText;
- a = xmlNode.Attributes["path"];
- if (a == null) {
- Console.Error.WriteLine ("Error: no path in <source>");
- continue;
- }
- string path = a.InnerText;
- string basefilepath = Path.Combine (Path.GetDirectoryName (sourceFile), basefile);
- HelpSource helpSource = RootTree.GetHelpSource (provider, basefilepath);
- if (helpSource != null) {
- helpSource.RootTree = this;
- this.helpSources.Add (helpSource);
- this.nameToHelpSource[path] = helpSource;
- Node node2 = this.LookupEntryPoint (path);
- if (node2 == null) {
- Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
- node2 = node;
- }
- foreach (Node current in helpSource.Tree.RootNode.ChildNodes) {
- node2.AddNode (current);
- }
- node2.Sort ();
- }
- }
- return true;
- }
-
- static bool PurgeNode (Node node)
- {
- bool result = false;
- if (!node.Documented)
- {
- List<Node> list = new List<Node> ();
- foreach (Node current in node.ChildNodes)
- {
- bool flag = RootTree.PurgeNode (current);
- if (flag)
- {
- list.Add (current);
- }
- }
- result = (node.ChildNodes.Count == list.Count);
- foreach (Node current2 in list)
- {
- node.DeleteNode (current2);
- }
- }
- return result;
- }
-
- public static string[] GetSupportedFormats ()
- {
- return new string[]
- {
- "ecma",
- "ecmaspec",
- "error",
- "man",
- "xhtml"
- };
- }
-
- public static HelpSource GetHelpSource (string provider, string basefilepath)
- {
- HelpSource result;
- try {
- switch (provider) {
- case "xhtml":
- case "hb":
- result = new XhtmlHelpSource (basefilepath, false);
- break;
- case "man":
- result = new ManHelpSource (basefilepath, false);
- break;
- case "error":
- result = new ErrorHelpSource (basefilepath, false);
- break;
- case "ecmaspec":
- result = new EcmaSpecHelpSource (basefilepath, false);
- break;
- case "ecma":
- result = new EcmaHelpSource (basefilepath, false);
- break;
- default:
- Console.Error.WriteLine ("Error: Unknown provider specified: {0}", provider);
- result = null;
- break;
- }
- } catch (FileNotFoundException) {
- Console.Error.WriteLine ("Error: did not find one of the files in sources/" + basefilepath);
- result = null;
- }
- return result;
- }
-
- public static Provider GetProvider (string provider, params string[] basefilepaths)
- {
- switch (provider) {
- case "ecma":
- return new EcmaProvider (basefilepaths[0]);
- case "ecmaspec":
- return new EcmaSpecProvider (basefilepaths[0]);
- case "error":
- return new ErrorProvider (basefilepaths[0]);
- case "man":
- return new ManProvider (basefilepaths);
- case "xhml":
- case "hb":
- return new XhtmlProvider (basefilepaths[0]);
- }
-
- throw new NotSupportedException (provider);
- }
-
- void Populate (Node parent, XmlNodeList xml_node_list)
- {
- foreach (XmlNode xmlNode in xml_node_list) {
- XmlAttribute e = xmlNode.Attributes["parent"];
- Node parent2 = null;
- if (e != null && this.nameToNode.TryGetValue (e.InnerText, out parent2)) {
- xmlNode.Attributes.Remove (e);
- Populate (parent2, xmlNode.SelectNodes ("."));
- continue;
- }
- e = xmlNode.Attributes["label"];
- if (e == null) {
- Console.Error.WriteLine ("`label' attribute missing in <node>");
- continue;
- }
- string label = e.InnerText;
- e = xmlNode.Attributes["name"];
- if (e == null) {
- Console.Error.WriteLine ("`name' attribute missing in <node>");
- continue;
- }
- string name = e.InnerText;
- Node orCreateNode = parent.GetOrCreateNode (label, RootNamespace + name);
- orCreateNode.EnsureNodes ();
- this.nameToNode[name] = orCreateNode;
- XmlNodeList xmlNodeList = xmlNode.SelectNodes ("./node");
- if (xmlNodeList != null) {
- this.Populate (orCreateNode, xmlNodeList);
- }
- }
- }
-
- public Node LookupEntryPoint (string name)
- {
- Node result = null;
- if (!this.nameToNode.TryGetValue (name, out result))
- result = null;
- return result;
- }
-
- public TOutput RenderUrl<TOutput> (string url, IDocGenerator<TOutput> generator, HelpSource hintSource = null)
- {
- Node dummy;
- return RenderUrl<TOutput> (url, generator, out dummy, hintSource);
- }
-
- public TOutput RenderUrl<TOutput> (string url, IDocGenerator<TOutput> generator, out Node node, HelpSource hintSource = null)
- {
- node = null;
- string internalId = null;
- Dictionary<string, string> context = null;
- HelpSource hs = GetHelpSourceAndIdForUrl (url, hintSource, out internalId, out context, out node);
- return generator.Generate (hs, internalId, context);
- }
-
- public HelpSource GetHelpSourceAndIdForUrl (string url, out string internalId, out Dictionary<string, string> context)
- {
- Node dummy;
- return GetHelpSourceAndIdForUrl (url, out internalId, out context, out dummy);
- }
-
- public HelpSource GetHelpSourceAndIdForUrl (string url, out string internalId, out Dictionary<string, string> context, out Node node)
- {
- return GetHelpSourceAndIdForUrl (url, null, out internalId, out context, out node);
- }
-
- public HelpSource GetHelpSourceAndIdForUrl (string url, HelpSource hintSource, out string internalId, out Dictionary<string, string> context, out Node node)
- {
- node = null;
- internalId = null;
- context = null;
-
- if (url == "root:") {
- context = new Dictionary<string, string> { {"specialpage", "master-root"} };
- internalId = url;
- node = null;
- // We return the first help source available since the generator will simply fetch this RootTree instance through it
- return helpSources.FirstOrDefault ();
- }
- if (url.StartsWith (RootNamespace, StringComparison.OrdinalIgnoreCase)) {
- context = new Dictionary<string, string> { {"specialpage", "root"} };
- return GetHelpSourceAndIdFromName (url.Substring (RootNamespace.Length), out internalId, out node);
- }
-
- HelpSource helpSource = hintSource;
- if (helpSource == null || string.IsNullOrEmpty (internalId = helpSource.GetInternalIdForUrl (url, out node, out context))) {
- helpSource = null;
- foreach (var hs in helpSources.Where (h => h.CanHandleUrl (url))) {
- if (!string.IsNullOrEmpty (internalId = hs.GetInternalIdForUrl (url, out node, out context))) {
- helpSource = hs;
- break;
- }
- }
- }
-
- return helpSource;
- }
-
- public HelpSource GetHelpSourceAndIdFromName (string name, out string internalId, out Node node)
- {
- internalId = "root:";
- node = LookupEntryPoint (name);
-
- return node == null ? null : node.ChildNodes.Select (n => n.Tree.HelpSource).FirstOrDefault (hs => hs != null);
- }
-
- public HelpSource GetHelpSourceFromId (int id)
- {
- return (id < 0 || id >= this.helpSources.Count) ? null : this.helpSources[id];
- }
-
- public Stream GetImage (string url)
- {
- if (url.StartsWith ("source-id:", StringComparison.OrdinalIgnoreCase)) {
- string text = url.Substring (10);
- int num = text.IndexOf (":");
- string text2 = text.Substring (0, num);
- int id = 0;
- if (!int.TryParse (text2, out id)) {
- Console.Error.WriteLine ("Failed to parse source-id url: {0} `{1}'", url, text2);
- return null;
- }
- HelpSource helpSourceFromId = this.GetHelpSourceFromId (id);
- return helpSourceFromId.GetImage (text.Substring (num + 1));
- }
- Assembly assembly = Assembly.GetAssembly (typeof (RootTree));
- return assembly.GetManifestResourceStream (url);
- }
-
- public IndexReader GetIndex ()
- {
- var paths = GetIndexesPathPrefixes ().Select (bp => Path.Combine (bp, "monodoc.index"));
- var p = paths.FirstOrDefault (File.Exists);
- return p == null ? (IndexReader)null : IndexReader.Load (p);
- }
-
- public static void MakeIndex ()
- {
- RootTree rootTree = RootTree.LoadTree ();
- rootTree.GenerateIndex ();
- }
-
- public bool GenerateIndex ()
- {
- IndexMaker indexMaker = new IndexMaker ();
- foreach (HelpSource current in this.helpSources)
- current.PopulateIndex (indexMaker);
-
- var paths = GetIndexesPathPrefixes ().Select (bp => Path.Combine (bp, "monodoc.index"));
- bool successful = false;
-
- foreach (var path in paths) {
- try {
- indexMaker.Save (path);
- successful = true;
- if (RootTree.IsUnix)
- RootTree.chmod (path, 420);
- } catch (UnauthorizedAccessException) {
- }
- }
- if (!successful) {
- Console.WriteLine ("You don't have permissions to write on any of [" + string.Join (", ", paths) + "]");
- return false;
- }
-
- Console.WriteLine ("Documentation index updated");
- return true;
- }
-
- public SearchableIndex GetSearchIndex ()
- {
- var paths = GetIndexesPathPrefixes ().Select (bp => Path.Combine (bp, "search_index"));
- var p = paths.FirstOrDefault (Directory.Exists);
- return p == null ? (SearchableIndex)null : SearchableIndex.Load (p);
- }
-
- public static void MakeSearchIndex ()
- {
- RootTree rootTree = RootTree.LoadTree ();
- rootTree.GenerateSearchIndex ();
- }
-
- public bool GenerateSearchIndex ()
- {
- Console.WriteLine ("Loading the monodoc tree...");
- IndexWriter indexWriter = null;
- var analyzer = new StandardAnalyzer (Lucene.Net.Util.Version.LUCENE_CURRENT);
- var paths = GetIndexesPathPrefixes ().Select (bp => Path.Combine (bp, "search_index"));
- bool successful = false;
-
- foreach (var path in paths) {
- try {
- if (!Directory.Exists (path))
- Directory.CreateDirectory (path);
- var directory = Lucene.Net.Store.FSDirectory.Open (path);
- indexWriter = new IndexWriter (directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
- successful = true;
- } catch (UnauthorizedAccessException) {}
- }
- if (!successful) {
- Console.WriteLine ("You don't have permissions to write on any of [" + string.Join (", ", paths) + "]");
- return false;
- }
- Console.WriteLine ("Collecting and adding documents...");
- foreach (HelpSource current in this.helpSources) {
- current.PopulateSearchableIndex (indexWriter);
- }
- Console.WriteLine ("Closing...");
- indexWriter.Optimize ();
- indexWriter.Close ();
- return true;
- }
-
- [DllImport ("libc")]
- static extern int chmod (string filename, int mode);
-
- IEnumerable<string> GetIndexesPathPrefixes ()
- {
- yield return basedir;
- yield return Config.Get ("docPath");
- var indexDirectory = Config.Get ("monodocIndexDirectory");
- if (!string.IsNullOrEmpty (indexDirectory))
- yield return indexDirectory;
- yield return Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "monodoc");
- }
-
- [Obsolete]
- public string GetTitle (string url)
- {
- return "Mono Documentation";
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-using Mono.Utilities;
-using Lucene.Net.Index;
-
-#if LEGACY_MODE
-
-namespace Monodoc
-{
- using Generators;
-
- public partial class RootTree
- {
- static IDocGenerator<string> rawGenerator = new RawGenerator ();
- static HtmlGenerator htmlGenerator = new HtmlGenerator (null);
-
- [Obsolete ("Use RawGenerator directly")]
- public XmlDocument GetHelpXml (string id)
- {
- var rendered = RenderUrl (id, rawGenerator);
- if (rendered == null)
- return null;
- var doc = new XmlDocument ();
- doc.LoadXml (RenderUrl (id, rawGenerator));
- return doc;
- }
-
- [Obsolete ("Use the RenderUrl variant accepting a generator")]
- public string RenderUrl (string url, out Node n)
- {
- return RenderUrl (url, htmlGenerator, out n);
- }
-
- [Obsolete ("Use GenerateIndex")]
- public static void MakeIndex (RootTree root)
- {
- root.GenerateIndex ();
- }
-
- [Obsolete ("Use GenerateSearchIndex")]
- public static void MakeSearchIndex (RootTree root)
- {
- root.GenerateSearchIndex ();
- }
- }
-}
-
-#endif
+++ /dev/null
-//
-//
-// SearchableDocument.cs: Abstracts our model of document from the Lucene Document
-//
-// Author: Mario Sopena
-//
-using Lucene.Net.Documents;
-
-namespace Monodoc
-{
- struct SearchableDocument
- {
- public string Title {
- get; set;
- }
-
- public string Url {
- get; set;
- }
-
- public string FullTitle {
- get; set;
- }
-
- public string HotText {
- get; set;
- }
-
- public string Text {
- get; set;
- }
-
- public string Examples {
- get; set;
- }
-
- public SearchableDocument Reset ()
- {
- Title = Url = FullTitle = HotText = Text = Examples = null;
- return this;
- }
-
- public Document LuceneDoc {
- get {
- Document doc = new Document ();
- doc.Add (UnIndexed ("title", Title));
- doc.Add (UnIndexed ("url", Url));
- doc.Add (UnIndexed ("fulltitle", FullTitle ?? string.Empty));
- doc.Add (UnStored ("hottext", HotText));
- doc.Add (UnStored ("text", Text));
- doc.Add (UnStored ("examples", Examples));
- return doc;
- }
- }
-
- static Field UnIndexed(System.String name, System.String value_Renamed)
- {
- return new Field(name, value_Renamed, Field.Store.YES, Field.Index.NO);
- }
-
- static Field UnStored(System.String name, System.String value_Renamed)
- {
- return new Field(name, value_Renamed, Field.Store.NO, Field.Index.ANALYZED);
- }
- }
-}
+++ /dev/null
-//
-//
-// SearchableIndex.cs: Index that uses Lucene to search through the docs
-//
-// Author: Mario Sopena
-//
-
-using System;
-using System.IO;
-using System.Collections.Generic;
-// Lucene imports
-using Lucene.Net.Index;
-using Lucene.Net.Documents;
-using Lucene.Net.Analysis;
-using Lucene.Net.Analysis.Standard;
-using Lucene.Net.Search;
-using Lucene.Net.QueryParsers;
-using Lucene.Net.Store;
-
-namespace Monodoc
-{
- public class SearchableIndex
- {
- const int maxSearchCount = 30;
-
- IndexSearcher searcher;
- string dir;
-
- public string Dir {
- get {
- if (dir == null)
- dir = "search_index";
- return dir;
- }
- set { dir = value; }
- }
-
- public static SearchableIndex Load (string dir)
- {
- SearchableIndex s = new SearchableIndex ();
- s.dir = dir;
- try {
- //s.searcher = new IndexSearcher (dir);
- // TODO: parametrize that depending if we run on the desktop (low footprint) or the server (use RAMDirectory for instance)
- s.searcher = new IndexSearcher (FSDirectory.Open (dir));
- } catch (IOException) {
- Console.WriteLine ("Index nonexistent or in bad format");
- return null;
- }
- return s;
- }
-
- public Result Search (string term)
- {
- return Search (term, maxSearchCount);
- }
-
- public Result Search (string term, int count)
- {
- return Search (term, count, 0);
- }
-
- public Result Search (string term, int count, int start) {
- try {
- term = term.ToLower ();
- Term htTerm = new Term ("hottext", term);
- Query qq1 = new FuzzyQuery (htTerm);
- Query qq2 = new TermQuery (htTerm);
- qq2.Boost = 10f;
- Query qq3 = new PrefixQuery (htTerm);
- qq3.Boost = 10f;
- DisjunctionMaxQuery q1 = new DisjunctionMaxQuery (0f);
- q1.Add (qq1);
- q1.Add (qq2);
- q1.Add (qq3);
- Query q2 = new TermQuery (new Term ("text", term));
- q2.Boost = 3f;
- Query q3 = new TermQuery (new Term ("examples", term));
- q3.Boost = 3f;
- DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
-
- q.Add (q1);
- q.Add (q2);
- q.Add (q3);
-
- TopDocs top = SearchInternal (q, count, start);
- Result r = new Result (term, searcher, top.ScoreDocs);
- return r;
- } catch (IOException) {
- Console.WriteLine ("No index in {0}", dir);
- return null;
- }
- }
-
- TopDocs SearchInternal (Query q, int count, int start)
- {
- // Easy path that doesn't involve creating a Collector ourselves
- // watch for Lucene.NET improvement on that (like searcher.SearchAfter)
- if (start == 0)
- return searcher.Search (q, count);
-
- var weight = searcher.CreateWeight (q); // TODO: reuse weight instead of query
- var collector = TopScoreDocCollector.Create (start + count + 1, false);
- searcher.Search (q, collector);
-
- return collector.TopDocs (start, count);
- }
-
- public Result FastSearch (string term, int number)
- {
- try {
- term = term.ToLower ();
- Query q1 = new TermQuery (new Term ("hottext", term));
- Query q2 = new PrefixQuery (new Term ("hottext", term));
- q2.Boost = 0.5f;
- DisjunctionMaxQuery q = new DisjunctionMaxQuery (0f);
- q.Add (q1);
- q.Add (q2);
- TopDocs top = searcher.Search (q, number);
- return new Result (term, searcher, top.ScoreDocs);
- } catch (IOException) {
- Console.WriteLine ("No index in {0}", dir);
- return null;
- }
- }
- }
-
- //
- // An object representing the search term with the results
- //
- public class Result {
- string term;
- Searcher searcher;
- ScoreDoc[] docs;
-
- public string Term {
- get { return term;}
- }
-
- public int Count {
- get { return docs.Length; }
- }
-
- public Document this [int i] {
- get { return searcher.Doc (docs[i].Doc); }
- }
-
- public string GetTitle (int i)
- {
- Document d = this[i];
- return d == null ? string.Empty : d.Get ("title");
- }
-
- public string GetUrl (int i)
- {
- Document d = this[i];
- return d == null ? string.Empty : d.Get ("url");
- }
-
- public string GetFullTitle (int i)
- {
- Document d = this[i];
- return d == null ? string.Empty : d.Get ("fulltitle");
- }
-
- public float Score (int i)
- {
- return docs[i].Score;
- }
-
- public Result (string Term, Searcher searcher, ScoreDoc[] docs)
- {
- this.term = Term;
- this.searcher = searcher;
- this.docs = docs;
- }
- }
-}
-
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Xml;
-using System.Collections.Generic;
-
-namespace Monodoc
-{
- /// <summary>
- /// This tree is populated by the documentation providers, or populated
- /// from a binary encoding of the tree. The format of the tree is designed
- /// to minimize the need to load it in full.
- /// </summary>
-
- /* Ideally this class should also be abstracted to let user have something
- * else than a file as a backing store, a database for instance
- */
- public class Tree
-#if LEGACY_MODE
- : Node
-#endif
- {
- public const long CurrentVersionNumber = 1;
- const int VersionNumberKey = -(int)'v';
- public readonly HelpSource HelpSource;
-
- FileStream InputStream;
- BinaryReader InputReader;
-
-#if !LEGACY_MODE
- // This is the node which contains all the other node of the tree
- Node rootNode;
-#endif
-
- /// <summary>
- /// Load from file constructor
- /// </summary>
- public Tree (HelpSource hs, string filename)
-#if LEGACY_MODE
- : base (null, null)
-#endif
- {
- HelpSource = hs;
- Encoding utf8 = new UTF8Encoding (false, true);
-
- if (!File.Exists (filename)){
- throw new FileNotFoundException ();
- }
-
- InputStream = File.OpenRead (filename);
- InputReader = new BinaryReader (InputStream, utf8);
- byte [] sig = InputReader.ReadBytes (4);
-
- if (!GoodSig (sig))
- throw new Exception ("Invalid file format");
-
- InputStream.Position = 4;
- // Try to read old version information
- if (InputReader.ReadInt32 () == VersionNumberKey)
- VersionNumber = InputReader.ReadInt64 ();
- else {
- // We try to see if there is a version number at the end of the file
- InputStream.Seek (-(4 + 8), SeekOrigin.End); // VersionNumberKey + long
- try {
- if (InputReader.ReadInt32 () == VersionNumberKey)
- VersionNumber = InputReader.ReadInt64 ();
- } catch {}
- // We set the stream back at the beginning of the node definition list
- InputStream.Position = 4;
- }
-
- var position = InputReader.ReadInt32 ();
-#if !LEGACY_MODE
- rootNode = new Node (this, position);
-#else
- Address = position;
-#endif
- InflateNode (RootNode);
- }
-
- /// <summary>
- /// Tree creation and merged tree constructor
- /// </summary>
- public Tree (HelpSource hs, string caption, string url)
-#if !LEGACY_MODE
- : this (hs, null, caption, url)
- {
- }
-#else
- : base (caption, url)
- {
- HelpSource = hs;
- }
-#endif
-
-
- public Tree (HelpSource hs, Node parent, string caption, string element)
-#if LEGACY_MODE
- : base (parent, caption, element)
-#endif
- {
- HelpSource = hs;
-#if !LEGACY_MODE
- rootNode = parent == null ? new Node (this, caption, element) : new Node (parent, caption, element);
-#endif
- }
-
- /// <summary>
- /// Saves the tree into the specified file using the help file format.
- /// </summary>
- public void Save (string file)
- {
- Encoding utf8 = new UTF8Encoding (false, true);
- using (FileStream output = File.OpenWrite (file)){
- // Skip over the pointer to the first node.
- output.Position = 4 + 4;
-
- using (BinaryWriter writer = new BinaryWriter (output, utf8)) {
- // Recursively dump
- RootNode.Serialize (output, writer);
- // We want to generate 2.10 compatible files so we write the version number at the end
- writer.Write (VersionNumberKey);
- writer.Write (CurrentVersionNumber);
-
- output.Position = 0;
- writer.Write (new byte [] { (byte) 'M', (byte) 'o', (byte) 'H', (byte) 'P' });
- writer.Write (RootNode.Address);
- }
- }
- }
-
- public Node RootNode {
- get {
-#if LEGACY_MODE
- return this;
-#else
- return rootNode;
-#endif
- }
- }
-
- public long VersionNumber {
- get;
- private set;
- }
-
- static bool GoodSig (byte [] sig)
- {
- if (sig.Length != 4)
- return false;
- return sig [0] == (byte) 'M'
- && sig [1] == (byte) 'o'
- && sig [2] == (byte) 'H'
- && sig [3] == (byte) 'P';
- }
-
- public void InflateNode (Node baseNode)
- {
- var address = baseNode.Address;
- if (address < 0)
- address = -address;
-
- InputStream.Position = address;
- baseNode.Deserialize (InputReader);
- }
-
- // Nodes use this value to know if they should manually re-sort their child
- // if they come from an older generator version
- internal bool ForceResort {
- get {
- return VersionNumber == 0;
- }
- }
- }
-
- public static class TreeDumper
- {
- static int indent;
-
- static void Indent ()
- {
- for (int i = 0; i < indent; i++)
- Console.Write (" ");
- }
-
- public static void PrintTree (Node node)
- {
- Indent ();
- Console.WriteLine ("{0},{1}\t[PublicUrl: {2}]", node.Element, node.Caption, node.PublicUrl);
- if (node.ChildNodes.Count == 0)
- return;
-
- indent++;
- foreach (Node n in node.ChildNodes)
- PrintTree (n);
- indent--;
- }
-
- public static string ExportToTocXml (Node root, string title, string desc)
- {
- if (root == null)
- throw new ArgumentNullException ("root");
- // Return a toc index of sub-nodes
- StringBuilder buf = new StringBuilder ();
- var writer = XmlWriter.Create (buf);
- writer.WriteStartElement ("toc");
- writer.WriteAttributeString ("title", title ?? string.Empty);
- writer.WriteElementString ("description", desc ?? string.Empty);
- writer.WriteStartElement ("list");
- foreach (Node n in root.ChildNodes) {
- writer.WriteStartElement ("item");
- writer.WriteAttributeString ("url", n.Element);
- writer.WriteValue (n.Caption);
- writer.WriteEndElement ();
- }
- writer.WriteEndElement ();
- writer.WriteEndElement ();
- writer.Flush ();
- writer.Close ();
-
- return buf.ToString ();
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Monodoc
-{
- public static class TypeUtils
- {
- public static bool GetNamespaceAndType (string url, out string ns, out string type)
- {
- int nsidx = -1;
- int numLt = 0;
- for (int i = 0; i < url.Length; ++i) {
- char c = url [i];
- switch (c) {
- case '<':
- case '{':
- ++numLt;
- break;
- case '>':
- case '}':
- --numLt;
- break;
- case '.':
- if (numLt == 0)
- nsidx = i;
- break;
- }
- }
-
- if (nsidx == -1) {
- ns = null;
- type = null;
- return false;
- }
- ns = url.Substring (0, nsidx);
- type = url.Substring (nsidx + 1);
-
- return true;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.IO;
-using System.Configuration;
-using System.Collections.Specialized;
-using Monodoc.Caches;
-
-namespace Monodoc
-{
- public enum DocEntity
- {
- Text,
- Blob
- }
-
- public interface IDocCache : IDisposable
- {
- bool IsCached (string id);
- bool CanCache (DocEntity entity);
-
- Stream GetCachedStream (string id);
- string GetCachedString (string id);
-
- void CacheText (string id, string content);
- void CacheText (string id, Stream stream);
-
- void CacheBlob (string id, byte[] data);
- void CacheBlob (string id, Stream stream);
- }
-
- public static class DocCacheHelper
- {
- static string cacheBaseDirectory;
-
- static DocCacheHelper ()
- {
- try {
- var cacheConfig = Config.Get ("cache");
- if (cacheConfig == null) return;
- var cacheValues = cacheConfig.Split (',');
- if (cacheValues.Length == 2 && cacheValues[0].Equals ("file", StringComparison.Ordinal))
- cacheBaseDirectory = cacheValues[1].Replace ("~", Environment.GetFolderPath (Environment.SpecialFolder.Personal));
- } catch {}
- }
-
- // Use configuration option to query for cache directory, if it doesn't exist we instantiate a nullcache
- public static IDocCache GetDefaultCache (string name)
- {
- if (cacheBaseDirectory == null)
- return new NullCache ();
-
- return new FileCache (Path.Combine (cacheBaseDirectory, name));
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-
-namespace Monodoc.Caches
-{
- public class FileCache : IDocCache
- {
- string baseCacheDir;
-
- public FileCache (string baseCacheDir)
- {
- this.baseCacheDir = baseCacheDir;
- if (!Directory.Exists (baseCacheDir))
- Directory.CreateDirectory (baseCacheDir);
- }
-
- public bool IsCached (string id)
- {
- return File.Exists (MakePath (id));
- }
-
- public bool CanCache (DocEntity entity)
- {
- return true;
- }
-
- public Stream GetCachedStream (string id)
- {
- return File.OpenRead (MakePath (id));
- }
-
- public string GetCachedString (string id)
- {
- return File.ReadAllText (MakePath (id));
- }
-
- public void CacheText (string id, string content)
- {
- File.WriteAllText (MakePath (id), content);
- }
-
- public void CacheText (string id, Stream stream)
- {
- using (var file = File.OpenWrite (MakePath (id)))
- stream.CopyTo (file);
- }
-
- public void CacheBlob (string id, byte[] data)
- {
- File.WriteAllBytes (MakePath (id), data);
- }
-
- public void CacheBlob (string id, Stream stream)
- {
- using (var file = File.OpenWrite (MakePath (id)))
- stream.CopyTo (file);
- }
-
- string MakePath (string id)
- {
- id = id.Replace (Path.DirectorySeparatorChar, '_');
- return Path.Combine (baseCacheDir, id);
- }
-
- public void Dispose ()
- {
- if (!Directory.Exists (baseCacheDir))
- return;
-
- try {
- Directory.Delete (baseCacheDir, true);
- } catch {}
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-
-namespace Monodoc.Caches
-{
- // This is basically a no-cache implementation
- public class NullCache : IDocCache
- {
- public bool IsCached (string id)
- {
- return false;
- }
-
- public bool CanCache (DocEntity entity)
- {
- return false;
- }
-
- public Stream GetCachedStream (string id)
- {
- return null;
- }
-
- public string GetCachedString (string id)
- {
- return null;
- }
-
- public void CacheText (string id, string content)
- {
-
- }
-
- public void CacheText (string id, Stream stream)
- {
-
- }
-
- public void CacheBlob (string id, byte[] data)
- {
-
- }
-
- public void CacheBlob (string id, Stream stream)
- {
-
- }
-
- public void Dispose ()
- {
-
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Monodoc
-{
- // All type of documents that a generator may find as input
- public enum DocumentType {
- EcmaXml, // Our main monodoc format
- EcmaSpecXml,
- Man,
- AddinXml,
- MonoBook, // This is mostly XHTML already, just need a tiny bit of processing
- Html,
- TocXml, // Used by help source displaying some kind of toc of the content they host
- PlainText,
- ErrorXml
- }
-
- /* This interface defines a set of transformation engine
- * that convert multiple documentation source to a single output format
- */
- public interface IDocGenerator<TOutput>
- {
- /* This method is responsible for finding out the documentation type
- * for the given ID and use the right engine internally
- * The id can be accompanied by a context dictionary giving away extra
- * informtion to the renderer
- */
- TOutput Generate (HelpSource hs, string internalId, Dictionary<string, string> context);
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Collections.Generic;
-
-using Monodoc;
-
-namespace Monodoc.Generators
-{
- using Html;
-
- interface IHtmlExporter
- {
- string CssCode { get; }
- string Export (Stream input, Dictionary<string, string> extras);
- string Export (string input, Dictionary<string, string> extras);
- }
-
- public class HtmlGenerator : IDocGenerator<string>
- {
- const string cachePrefix = "htmlcached#";
-
- static string css_code;
-
- IDocCache defaultCache;
- static Dictionary<DocumentType, IHtmlExporter> converters;
-
- static HtmlGenerator ()
- {
- converters = new Dictionary<DocumentType, IHtmlExporter> {
- { DocumentType.EcmaXml, new Ecma2Html () },
- { DocumentType.Man, new Man2Html () },
- { DocumentType.TocXml, new Toc2Html () },
- { DocumentType.EcmaSpecXml, new Ecmaspec2Html () },
- { DocumentType.ErrorXml, new Error2Html () },
- { DocumentType.Html, new Idem () },
- { DocumentType.MonoBook, new MonoBook2Html () },
- { DocumentType.AddinXml, new Addin2Html () },
- { DocumentType.PlainText, new Idem () },
- };
- }
-
- public HtmlGenerator (IDocCache defaultCache)
- {
- this.defaultCache = defaultCache;
- }
-
- public string Generate (HelpSource hs, string id, Dictionary<string, string> context)
- {
- string specialPage = null;
- if (context != null && context.TryGetValue ("specialpage", out specialPage) && specialPage == "master-root")
- return GenerateMasterRootPage (hs != null ? hs.RootTree : null);
-
- if (id == "root:" && hs == null)
- return MakeEmptySummary ();
-
- if (hs == null || string.IsNullOrEmpty (id))
- return MakeHtmlError (string.Format ("Your request has found no candidate provider [hs=\"{0}\", id=\"{1}\"]",
- hs == null ? "(null)" : hs.Name, id ?? "(null)"));
-
- var cache = defaultCache ?? hs.Cache;
- if (cache != null && cache.IsCached (MakeCacheKey (hs, id, null)))
- return cache.GetCachedString (MakeCacheKey (hs, id, null));
-
- IEnumerable<string> parts;
- if (hs.IsMultiPart (id, out parts))
- return GenerateMultiPart (hs, parts, id, context);
-
- if (hs.IsRawContent (id))
- return hs.GetText (id) ?? string.Empty;
-
- DocumentType type = hs.GetDocumentTypeForId (id);
- if (cache != null && context != null && cache.IsCached (MakeCacheKey (hs, id, context)))
- return cache.GetCachedString (MakeCacheKey (hs, id, context));
-
- IHtmlExporter exporter;
- if (!converters.TryGetValue (type, out exporter))
- return MakeHtmlError (string.Format ("Input type '{0}' not supported",
- type.ToString ()));
- var result = hs.IsGeneratedContent (id) ?
- exporter.Export (hs.GetCachedText (id), context) :
- exporter.Export (hs.GetCachedHelpStream (id), context);
-
- if (cache != null)
- cache.CacheText (MakeCacheKey (hs, id, context), result);
- return result;
- }
-
- string GenerateMultiPart (HelpSource hs, IEnumerable<string> ids, string originalId, Dictionary<string, string> context)
- {
- var sb = new StringBuilder ();
- foreach (var id in ids)
- sb.AppendLine (Generate (hs, id, context));
-
- var cache = defaultCache ?? hs.Cache;
- if (cache != null)
- cache.CacheText (MakeCacheKey (hs, originalId, null), sb.ToString ());
- return sb.ToString ();
- }
-
- string GenerateMasterRootPage (RootTree rootTree)
- {
- if (rootTree == null)
- return string.Empty;
- var assembly = System.Reflection.Assembly.GetAssembly (typeof (HtmlGenerator));
- var hpStream = assembly.GetManifestResourceStream ("home.html");
- var home = new StreamReader (hpStream).ReadToEnd ();
- var links = string.Join (Environment.NewLine,
- rootTree.RootNode.ChildNodes.Select (n => string.Format ("<li><a href=\"{0}\">{1}</a></li>", n.Element, n.Caption)));
- return home.Replace ("@@API_DOCS@@", links);
- }
-
- public static string InlineCss {
- get {
- if (css_code != null)
- return css_code;
-
- System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly (typeof (HtmlGenerator));
- Stream str_css = assembly.GetManifestResourceStream ("base.css");
- StringBuilder sb = new StringBuilder ((new StreamReader (str_css)).ReadToEnd());
- sb.Replace ("@@FONT_FAMILY@@", "Sans Serif");
- sb.Replace ("@@FONT_SIZE@@", "100%");
- css_code = sb.ToString () + converters.Values
- .Select (c => c.CssCode)
- .Where (css => !string.IsNullOrEmpty (css))
- .DefaultIfEmpty (string.Empty)
- .Aggregate (string.Concat);
- return css_code;
- }
- set {
- css_code = value;
- }
- }
-
- string MakeHtmlError (string error)
- {
- return string.Format ("<html><head></head><body><p><em>Error:</em> {0}</p></body></html>", error);
- }
-
- string MakeEmptySummary ()
- {
- return @"<html><head></head><body><p><em>This node doesn't have a summary available</p></body></html>";
- }
-
- string MakeCacheKey (HelpSource hs, string page, IDictionary<string,string> extraParams)
- {
- var key = cachePrefix + hs.SourceID + page;
- if (extraParams != null && extraParams.Count > 0) {
- var paramPart = string.Join ("-", extraParams.Select (kvp => kvp.Key + kvp.Value));
- key += '_' + paramPart;
- }
- return key;
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Collections.Generic;
-
-using Monodoc;
-
-namespace Monodoc.Generators
-{
- /// <summary>
- /// This generators returns the raw content of the HelpSource without any transformation
- /// </summary>
- public class RawGenerator : IDocGenerator<string>
- {
- public string Generate (HelpSource hs, string id, Dictionary<string, string> context)
- {
- if (hs == null || string.IsNullOrEmpty (id))
- return null;
-
- IEnumerable<string> parts;
- if (hs.IsMultiPart (id, out parts))
- return GenerateMultiPart (hs, parts, id, context);
-
- if (hs.IsRawContent (id))
- return hs.GetText (id) ?? string.Empty;
-
- var result = hs.IsGeneratedContent (id) ? hs.GetCachedText (id) : new StreamReader (hs.GetCachedHelpStream (id)).ReadToEnd ();
-
- return result;
- }
-
- string GenerateMultiPart (HelpSource hs, IEnumerable<string> ids, string originalId, Dictionary<string, string> context)
- {
- var sb = new StringBuilder ();
- foreach (var id in ids)
- sb.AppendLine (Generate (hs, id, context));
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-using System.Collections.Generic;
-
-namespace Monodoc.Generators.Html
-{
- public class Addin2Html : IHtmlExporter
- {
- public string CssCode {
- get {
- return string.Empty;
- }
- }
-
- public string Export (Stream stream, Dictionary<string, string> extraArgs)
- {
- using (var reader = new StreamReader (stream))
- return Htmlize (GetAddin (reader, extraArgs["AddinID"]),
- extraArgs["show"],
- extraArgs["AddinID"],
- extraArgs["FileID"],
- extraArgs["NodeID"]);
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- return Htmlize (GetAddin (new StringReader (input), extraArgs["AddinID"]),
- extraArgs["show"],
- extraArgs["AddinID"],
- extraArgs["FileID"],
- extraArgs["NodeID"]);
- }
-
- XmlElement GetAddin (TextReader reader, string addinId)
- {
- XmlDocument doc = new XmlDocument ();
- doc.Load (reader);
- XmlElement addin = (XmlElement) doc.SelectSingleNode ("Addins/Addin[@fullId='" + addinId + "']");
- return addin != null ? addin : null;
- }
-
- public string Htmlize (XmlElement addin, string urlType, string addinId, string fileId, string path)
- {
- if (urlType == Monodoc.Providers.AddinsHelpSource.AddinPrefix)
- return GetAddinTextFromUrl (addin, addinId, fileId);
- else if (urlType == Monodoc.Providers.AddinsHelpSource.ExtensionPrefix)
- return GetExtensionTextFromUrl (addin, addinId, fileId, path);
- else if (urlType == Monodoc.Providers.AddinsHelpSource.ExtensionNodePrefix)
- return GetExtensionNodeTextFromUrl (addin, addinId, fileId, path);
-
- return null;
- }
-
- protected string GetAddinTextFromUrl (XmlElement addin, string addinId, string fileId)
- {
- if (addin == null)
- return "<html>Add-in not found: " + addinId + "</html>";
-
- StringBuilder sb = new StringBuilder ("<html>");
- sb.Append ("<h1>").Append (addin.GetAttribute ("name")).Append ("</h1>");
- XmlElement docs = (XmlElement) addin.SelectSingleNode ("Description");
- if (docs != null)
- sb.Append (docs.InnerText);
-
- sb.Append ("<p><table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
- sb.AppendFormat ("<tr><td><b>Id</b></td><td>{0}</td></tr>", addin.GetAttribute ("addinId"));
- sb.AppendFormat ("<tr><td><b>Namespace</b></td><td>{0}</td></tr>", addin.GetAttribute ("namespace"));
- sb.AppendFormat ("<tr><td><b>Version</b></td><td>{0}</td></tr>", addin.GetAttribute ("version"));
- sb.Append ("</table></p>");
- sb.Append ("<p><b>Extension Points</b>:</p>");
- sb.Append ("<ul>");
-
- foreach (XmlElement ep in addin.SelectNodes ("ExtensionPoint")) {
- sb.AppendFormat ("<li><a href=\"extension-point:{0}#{1}#{2}\">{3}</li>", fileId, addinId, ep.GetAttribute ("path"), ep.GetAttribute ("name"));
- }
- sb.Append ("</ul>");
-
- sb.Append ("</html>");
- return sb.ToString ();
- }
-
- protected string GetExtensionTextFromUrl (XmlElement addin, string addinId, string fileId, string path)
- {
- if (addin == null)
- return "<html>Add-in not found: " + addinId + "</html>";
-
- XmlElement ext = (XmlElement) addin.SelectSingleNode ("ExtensionPoint[@path='" + path + "']");
- if (ext == null)
- return "<html>Extension point not found: " + path + "</html>";
-
- StringBuilder sb = new StringBuilder ("<html>");
- sb.Append ("<h1>").Append (ext.GetAttribute ("name")).Append ("</h1>");
-
- path = path.Replace ("/", " <b>/</b> ");
- sb.Append ("<p><b>Path</b>: ").Append (path).Append ("</p>");
- XmlElement desc = (XmlElement) ext.SelectSingleNode ("Description");
- if (desc != null)
- sb.Append (desc.InnerText);
-
- sb.Append ("<p><b>Extension Nodes</b>:</p>");
- sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
-
- foreach (XmlElement en in ext.SelectNodes ("ExtensionNode")) {
- string nid = en.GetAttribute ("id");
- string nname = en.GetAttribute ("name");
- string sdesc = "";
- desc = (XmlElement) en.SelectSingleNode ("Description");
- if (desc != null)
- sdesc = desc.InnerText;
-
- sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
- }
- sb.Append ("</table>");
-
- sb.Append ("</html>");
- return sb.ToString ();
- }
-
- protected string GetExtensionNodeTextFromUrl (XmlElement addin, string addinId, string fileId, string nodeId)
- {
- if (addin == null)
- return "<html>Add-in not found: " + addinId + "</html>";
-
- XmlElement node = (XmlElement) addin.SelectSingleNode ("ExtensionNodeType[@id='" + nodeId + "']");
- if (node == null)
- return "<html>Extension point not found: " + nodeId + "</html>";
-
- StringBuilder sb = new StringBuilder ("<html>");
- sb.Append ("<h1>").Append (node.GetAttribute ("name")).Append ("</h1>");
- XmlElement desc = (XmlElement) node.SelectSingleNode ("Description");
- if (desc != null)
- sb.Append (desc.InnerText);
-
- sb.Append ("<p><b>Attributes</b>:</p>");
- sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\"><tr>");
- sb.Append ("<td><b>Name</b></td>");
- sb.Append ("<td><b>Type</b></td>");
- sb.Append ("<td><b>Required</b></td>");
- sb.Append ("<td><b>Localizable</b></td>");
- sb.Append ("<td><b>Description</b></td>");
- sb.Append ("<tr>");
- sb.Append ("<td>id</td>");
- sb.Append ("<td>System.String</td>");
- sb.Append ("<td></td>");
- sb.Append ("<td></td>");
- sb.Append ("<td>Identifier of the node.</td>");
- sb.Append ("</tr>");
-
- foreach (XmlElement at in node.SelectNodes ("Attributes/Attribute")) {
- sb.Append ("<tr>");
- sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("name"));
- sb.AppendFormat ("<td>{0}</td>", at.GetAttribute ("type"));
- if (at.GetAttribute ("required") == "True")
- sb.Append ("<td>Yes</td>");
- else
- sb.Append ("<td></td>");
- if (at.GetAttribute ("localizable") == "True")
- sb.Append ("<td>Yes</td>");
- else
- sb.Append ("<td></td>");
- string sdesc = "";
- desc = (XmlElement) at.SelectSingleNode ("Description");
- if (desc != null)
- sdesc = desc.InnerText;
-
- sb.AppendFormat ("<td>{0}</td>", sdesc);
- sb.Append ("</tr>");
- }
- sb.Append ("</table>");
-
- XmlNodeList children = node.SelectNodes ("ChildNodes/ExtensionNode");
- if (children.Count > 0) {
- sb.Append ("<p><b>Child Nodes</b>:</p>");
- sb.Append ("<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">");
-
- foreach (XmlElement en in children) {
- string nid = en.GetAttribute ("id");
- string nname = en.GetAttribute ("name");
- string sdesc = "";
- desc = (XmlElement) en.SelectSingleNode ("Description");
- if (desc != null)
- sdesc = desc.InnerText;
-
- sb.AppendFormat ("<tr><td><a href=\"extension-node:{0}#{1}#{2}\">{3}</td><td>{4}</td></tr>", fileId, addinId, nid, nname, sdesc);
- }
- sb.Append ("</table>");
- }
-
- sb.Append ("</html>");
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Linq;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-using System.Collections.Generic;
-
-using Mono.Documentation;
-using BF = System.Reflection.BindingFlags;
-
-namespace Monodoc.Generators.Html
-{
- public class Ecma2Html : IHtmlExporter
- {
- static string css_ecma;
- static string js;
- static XslCompiledTransform ecma_transform;
- readonly ExtensionObject ExtObject = new ExtensionObject ();
-
- public Ecma2Html ()
- {
- }
-
- public string CssCode {
- get {
- if (css_ecma != null)
- return css_ecma;
- var assembly = typeof(Ecma2Html).Assembly;
- Stream str_css = assembly.GetManifestResourceStream ("mono-ecma.css");
- css_ecma = (new StreamReader (str_css)).ReadToEnd();
- return css_ecma;
- }
- }
-
- public string JsCode {
- get {
- if (js != null)
- return js;
- var assembly = typeof(Ecma2Html).Assembly;
- Stream str_js = assembly.GetManifestResourceStream ("helper.js");
- js = (new StreamReader (str_js)).ReadToEnd();
- return js;
- }
- }
-
- public string Htmlize (XmlReader ecma_xml, Dictionary<string, string> extraArgs)
- {
- var args = new XsltArgumentList ();
- args.AddExtensionObject("monodoc:///extensions", ExtObject);
- string specialPage;
- if (extraArgs.TryGetValue ("specialpage", out specialPage) && specialPage == "root") {
- extraArgs.Remove ("specialpage");
- extraArgs["show"] = "masteroverview";
- }
-
- foreach (var kvp in extraArgs)
- args.AddParam (kvp.Key, string.Empty, kvp.Value);
-
- return Htmlize (ecma_xml, args);
- }
-
- public string Htmlize (XmlReader ecma_xml, XsltArgumentList args)
- {
- try{
- EnsureTransform ();
-
- var output = new StringBuilder ();
- ecma_transform.Transform (ecma_xml,
- args,
- XmlWriter.Create (output, ecma_transform.OutputSettings),
- CreateDocumentResolver ());
- return output.ToString ();
- }
- catch(Exception x)
- {
- var msg = x.ToString ();
- return msg;
- }
- }
-
- protected virtual XmlResolver CreateDocumentResolver ()
- {
- // results in using XmlUrlResolver
- return null;
- }
-
- public string Export (Stream stream, Dictionary<string, string> extraArgs)
- {
- return Htmlize (XmlReader.Create (new StreamReader(stream)), extraArgs);
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- return Htmlize (XmlReader.Create (new StringReader(input)), extraArgs);
- }
-
-
- static void EnsureTransform ()
- {
- if (ecma_transform == null) {
- ecma_transform = new XslCompiledTransform ();
- var assembly = System.Reflection.Assembly.GetAssembly (typeof (Ecma2Html));
-
- Stream stream = assembly.GetManifestResourceStream ("mono-ecma-css.xsl");
- XmlReader xml_reader = new XmlTextReader (stream);
- XmlResolver r = new ManifestResourceResolver (".");
- ecma_transform.Load (xml_reader, XsltSettings.TrustedXslt, r);
- }
- }
-
- public class ExtensionObject
- {
- bool quiet = true;
- Dictionary<string, System.Reflection.Assembly> assemblyCache = new Dictionary<string, System.Reflection.Assembly> ();
-
- public string Colorize(string code, string lang)
- {
- return Mono.Utilities.Colorizer.Colorize(code,lang);
- }
-
- // Used by stylesheet to nicely reformat the <see cref=> tags.
- public string MakeNiceSignature(string sig, string contexttype)
- {
- if (sig.Length < 3)
- return sig;
- if (sig[1] != ':')
- return sig;
-
- char s = sig[0];
- sig = sig.Substring(2);
-
- switch (s) {
- case 'N': return sig;
- case 'T': return ShortTypeName (sig, contexttype);
-
- case 'C': case 'M': case 'P': case 'F': case 'E':
- string type, mem, arg;
-
- // Get arguments
- int paren;
- if (s == 'C' || s == 'M')
- paren = sig.IndexOf("(");
- else if (s == 'P')
- paren = sig.IndexOf("[");
- else
- paren = 0;
-
- if (paren > 0 && paren < sig.Length-1) {
- string[] args = sig.Substring(paren+1, sig.Length-paren-2).Split(',');
- for (int i = 0; i < args.Length; i++)
- args[i] = ShortTypeName(args[i], contexttype);
- arg = "(" + String.Join(", ", args) + ")";
- sig = sig.Substring(0, paren);
- } else {
- arg = string.Empty;
- }
-
- // Get type and member names
- int dot = sig.LastIndexOf(".");
- if (s == 'C' || dot <= 0 || dot == sig.Length-1) {
- mem = string.Empty;
- type = sig;
- } else {
- type = sig.Substring(0, dot);
- mem = sig.Substring(dot);
- }
-
- type = ShortTypeName(type, contexttype);
-
- return type + mem + arg;
-
- default:
- return sig;
- }
- }
-
- static string ShortTypeName(string name, string contexttype)
- {
- int dot = contexttype.LastIndexOf(".");
- if (dot < 0) return name;
- string contextns = contexttype.Substring(0, dot+1);
-
- if (name == contexttype)
- return name.Substring(dot+1);
-
- if (name.StartsWith(contextns))
- return name.Substring(contextns.Length);
-
- return name.Replace("+", ".");
- }
-
- string MonoImpInfo(string assemblyname, string typename, string membername, string arglist, bool strlong)
- {
- if (quiet)
- return string.Empty;
-
- var a = new List<string> ();
- if (!string.IsNullOrEmpty (arglist)) a.Add (arglist);
- return MonoImpInfo(assemblyname, typename, membername, a, strlong);
- }
-
- string MonoImpInfo(string assemblyname, string typename, string membername, XPathNodeIterator itr, bool strlong)
- {
- if (quiet)
- return string.Empty;
-
- var rgs = itr.Cast<XPathNavigator> ().Select (nav => nav.Value).ToList ();
-
- return MonoImpInfo (assemblyname, typename, membername, rgs, strlong);
- }
-
- string MonoImpInfo(string assemblyname, string typename, string membername, List<string> arglist, bool strlong)
- {
- try {
- System.Reflection.Assembly assembly = null;
-
- try {
- if (!assemblyCache.TryGetValue (assemblyname, out assembly)) {
- assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
- if (assembly != null)
- assemblyCache[assemblyname] = assembly;
- }
- } catch (Exception) {
- // nothing.
- }
-
- if (assembly == null) {
- /*if (strlong) return "The assembly " + assemblyname + " is not available to MonoDoc.";
- else return string.Empty;*/
- return string.Empty; // silently ignore
- }
-
- Type t = assembly.GetType(typename, false);
- if (t == null) {
- if (strlong)
- return typename + " has not been implemented.";
- else
- return "Not implemented.";
- }
-
- // The following code is flakey and fails to find existing members
- return string.Empty;
- } catch (Exception) {
- return string.Empty;
- }
- }
-
- string MonoImpInfo(System.Reflection.MemberInfo mi, string itemtype, bool strlong)
- {
- if (quiet)
- return string.Empty;
-
- string s = string.Empty;
-
- object[] atts = mi.GetCustomAttributes(true);
- int todoctr = 0;
- foreach (object att in atts) if (att.GetType().Name == "MonoTODOAttribute") todoctr++;
-
- if (todoctr > 0) {
- if (strlong)
- s = "This " + itemtype + " is marked as being unfinished.<BR/>\n";
- else
- s = "Unfinished.";
- }
-
- return s;
- }
-
- public string MonoImpInfo(string assemblyname, string typename, bool strlong)
- {
- if (quiet)
- return string.Empty;
-
- try {
- if (assemblyname == string.Empty)
- return string.Empty;
-
- System.Reflection.Assembly assembly;
- if (!assemblyCache.TryGetValue (assemblyname, out assembly)) {
- assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
- if (assembly != null)
- assemblyCache[assemblyname] = assembly;
- }
-
- if (assembly == null)
- return string.Empty;
-
- Type t = assembly.GetType(typename, false);
- if (t == null) {
- if (strlong)
- return typename + " has not been implemented.";
- else
- return "Not implemented.";
- }
-
- string s = MonoImpInfo(t, "type", strlong);
-
- if (strlong) {
- var mis = t.GetMembers (BF.Static | BF.Instance | BF.Public | BF.NonPublic);
-
- // Scan members for MonoTODO attributes
- int mctr = 0;
- foreach (var mi in mis) {
- string mii = MonoImpInfo(mi, null, false);
- if (mii != string.Empty) mctr++;
- }
- if (mctr > 0) {
- s += "This type has " + mctr + " members that are marked as unfinished.<BR/>";
- }
- }
-
- return s;
-
- } catch (Exception) {
- return string.Empty;
- }
- }
-
- public bool MonoEditing ()
- {
- return false;
- }
-
- public bool IsToBeAdded(string text)
- {
- return text.StartsWith ("To be added");
- }
- }
- }
-
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-using System.Collections.Generic;
-
-namespace Monodoc.Generators.Html
-{
- public class Ecmaspec2Html : IHtmlExporter
- {
- static string css_ecmaspec;
- static XslTransform ecma_transform;
- static XsltArgumentList args = new XsltArgumentList();
-
- public string CssCode {
- get {
- if (css_ecmaspec != null)
- return css_ecmaspec;
- System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly (typeof (Ecmaspec2Html));
- Stream str_css = assembly.GetManifestResourceStream ("ecmaspec.css");
- css_ecmaspec = (new StreamReader (str_css)).ReadToEnd ();
- return css_ecmaspec;
- }
- }
-
- class ExtObj
- {
- public string Colorize (string code, string lang)
- {
- return Mono.Utilities.Colorizer.Colorize (code, lang);
- }
- }
-
- public string Export (Stream stream, Dictionary<string, string> extraArgs)
- {
- return Htmlize (new XPathDocument (stream));
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- return Htmlize (new XPathDocument (new StringReader (input)));
- }
-
- static string Htmlize (XPathDocument ecma_xml)
- {
- if (ecma_transform == null){
- ecma_transform = new XslTransform ();
- System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly (typeof (Ecmaspec2Html));
- Stream stream;
- stream = assembly.GetManifestResourceStream ("ecmaspec-html-css.xsl");
-
- XmlReader xml_reader = new XmlTextReader (stream);
- ecma_transform.Load (xml_reader, null, null);
- args.AddExtensionObject ("monodoc:///extensions", new ExtObj ());
- }
-
- if (ecma_xml == null) return "";
-
- StringWriter output = new StringWriter ();
- ecma_transform.Transform (ecma_xml, args, output, null);
-
- return output.ToString ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Xml.XPath;
-using System.Collections.Generic;
-
-namespace Monodoc.Generators.Html
-{
- public class Error2Html : IHtmlExporter
- {
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- return Htmlize (new XPathDocument (new StringReader (input)));
- }
-
- public string Export (Stream input, Dictionary<string, string> extraArgs)
- {
- return Htmlize (new XPathDocument (input));
- }
-
- public string CssCode {
- get {
- return @"
- #error_ref {
- background: #debcb0;
- border: 2px solid #782609;
- }
- div.summary {
- font-size: 110%;
- font-weight: bolder;
- }
- div.details {
- font-size: 110%;
- font-weight: bolder;
- }
- div.code_example {
- background: #f5f5dd;
- border: 1px solid black;
- padding-left: 1em;
- padding-bottom: 1em;
- margin-top: 1em;
- white-space: pre;
- margin-bottom: 1em;
- }
- div.code_ex_title {
- position: relative;
- top: -1em;
- left: 30%;
- background: #cdcd82;
- border: 1px solid black;
- color: black;
- font-size: 65%;
- text-transform: uppercase;
- width: 40%;
- padding: 0.3em;
- text-align: center;
- }";
- }
- }
-
- public string Htmlize (IXPathNavigable doc)
- {
- var navigator = doc.CreateNavigator ();
- var errorName = navigator.SelectSingleNode ("//ErrorDocumentation/ErrorName");
- var details = navigator.SelectSingleNode ("//ErrorDocumentation/Details");
-
- StringWriter sw = new StringWriter ();
- XmlWriter w = new XmlTextWriter (sw);
-
- WriteElementWithClass (w, "div", "header");
- w.WriteAttributeString ("id", "error_ref");
- WriteElementWithClass (w, "div", "subtitle", "Compiler Error Reference");
- WriteElementWithClass (w, "div", "title", "Error " + (errorName == null ? string.Empty : errorName.Value));
- w.WriteEndElement ();
-
- if (details != null) {
- WriteElementWithClass (w, "div", "summary", "Summary");
-
- var summary = details.SelectSingleNode ("/Summary");
- w.WriteValue (summary == null ? string.Empty : summary.Value);
-
- WriteElementWithClass (w, "div", "details", "Details");
- var de = details.SelectSingleNode ("/Details");
- w.WriteValue (de == null ? string.Empty : de.Value);
- }
-
- foreach (XPathNavigator xmp in navigator.Select ("//ErrorDocumentation/Examples/string")) {
- WriteElementWithClass (w, "div", "code_example");
- WriteElementWithClass (w, "div", "code_ex_title", "Example");
- w.WriteRaw (Mono.Utilities.Colorizer.Colorize (xmp.Value, "c#"));;
- w.WriteEndElement ();
- }
-
- w.Close ();
-
- return sw.ToString ();
- }
-
- void WriteElementWithClass (XmlWriter w, string element, string cls, string content = null)
- {
- w.WriteStartElement (element);
- w.WriteAttributeString ("class", cls);
- if (!string.IsNullOrEmpty (content)) {
- w.WriteValue (content);
- w.WriteEndElement ();
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace Monodoc.Generators.Html
-{
- // Input is expected to be already HTML so just return it
- public class Idem : IHtmlExporter
- {
- public string CssCode {
- get {
- return string.Empty;
- }
- }
-
- public string Export (Stream input, Dictionary<string, string> extraArgs)
- {
- if (input == null)
- return null;
- return new StreamReader (input).ReadToEnd ();
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- if (string.IsNullOrEmpty (input))
- return null;
- return input;
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace Monodoc.Generators.Html
-{
- public class Man2Html : IHtmlExporter
- {
- public string CssCode {
- get {
- return string.Empty;
- }
- }
-
- public string Export (Stream input, Dictionary<string, string> extraArgs)
- {
- if (input == null)
- return null;
- return GetTextFromReader (new StreamReader (input));
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- if (string.IsNullOrEmpty (input))
- return null;
- return GetTextFromReader (new StringReader (input));
- }
-
- public static string GetTextFromReader (TextReader file)
- {
- string line;
- StateInfo s = new StateInfo ();
-
- while ((line = file.ReadLine ()) != null)
- ProcessLine (line, s);
-
- return s.output.ToString ();
- }
-
- enum ListState {
- None,
- Start,
- Title,
- }
-
- class StateInfo {
- public ListState ls;
- public Stack<string> tags = new Stack<string> ();
- public StringBuilder output = new StringBuilder ();
- }
-
- static void ProcessLine (string line, StateInfo s)
- {
- string[] parts = SplitLine (line);
- switch (parts [0]) {
- case ".\\\"": // comments
- case ".de": // define macro
- case ".if": // if
- case ".ne": // ???
- case "..": // end macro
- // ignore
- break;
- case ".I":
- s.output.Append ("<i>");
- Translate (parts, 1, s.output);
- s.output.Append ("</i>");
- break;
- case ".B":
- s.output.Append ("<b>");
- Translate (parts, 1, s.output);
- s.output.Append ("</b>");
- break;
- case ".br":
- Translate (parts, 1, s.output);
- s.output.Append ("<br />");
- break;
- case ".nf":
- Expect (s, "</p>");
- s.output.Append ("<pre>\n");
- s.tags.Push ("</pre>");
- break;
- case ".fi":
- Expect (s, "</pre>");
- break;
- case ".PP":
- Expect (s, "</p>", "</dd>", "</dl>");
- goto case ".Sp";
- case ".Sp":
- Expect (s, "</p>");
- s.output.Append ("<p>");
- Translate (parts, 1, s.output);
- s.tags.Push ("</p>");
- break;
- case ".RS":
- Expect (s, "</p>");
- s.output.Append ("<blockquote>");
- s.tags.Push ("</blockquote>");
- break;
- case ".RE":
- ClearUntil (s, "</blockquote>");
- break;
- case ".SH":
- ClearAll (s);
- s.output.Append ("<h2>");
- Translate (parts, 1, s.output);
- s.output.Append ("</h2>")
- .Append ("<blockquote>");
- s.tags.Push ("</blockquote>");
- break;
- case ".SS":
- s.output.Append ("<h3>");
- Translate (parts, 1, s.output);
- s.output.Append ("</h3>");
- break;
- case ".TH": {
- ClearAll (s);
- string name = "", extra = "";
- if (parts.Length >= 4 && parts [2].Trim ().Length == 0) {
- name = parts [1] + "(" + parts [3] + ")";
- if (parts.Length > 4) {
- int start = 4;
- if (parts [start].Trim ().Length == 0)
- ++start;
- extra = string.Join ("", parts, start, parts.Length-start);
- }
- }
- else
- name = string.Join ("", parts, 1, parts.Length-1);
- s.output.Append ("<table width=\"100%\" bgcolor=\"#b0c4da\">" +
- "<tr colspan=\"2\"><td>Manual Pages</td></tr>\n" +
- "<tr><td><h3>");
- Translate (name, s.output);
- s.output.Append ("</h3></td><td align=\"right\">");
- Translate (extra, s.output);
- s.output.Append ("</td></tr></table>");
- break;
- }
- case ".TP":
- Expect (s, "</p>");
- if (s.tags.Count > 0 && s.tags.Peek ().ToString () != "</dd>") {
- s.output.Append ("<dl>");
- s.tags.Push ("</dl>");
- }
- else
- Expect (s, "</dd>");
- s.output.Append ("<dt>");
- s.tags.Push ("</dt>");
- s.ls = ListState.Start;
- break;
- default:
- Translate (line, s.output);
- break;
- }
- if (s.ls == ListState.Start)
- s.ls = ListState.Title;
- else if (s.ls == ListState.Title) {
- Expect (s, "</dt>");
- s.output.Append ("<dd>");
- s.tags.Push ("</dd>");
- s.ls = ListState.None;
- }
- s.output.Append ("\n");
- }
-
- static string[] SplitLine (string line)
- {
- if (line.Length > 1 && line [0] != '.')
- return new string[]{null, line};
-
- int i;
- for (i = 0; i < line.Length; ++i) {
- if (char.IsWhiteSpace (line, i))
- break;
- }
-
- if (i == line.Length)
- return new string[]{line};
-
- var pieces = new List<string> ();
- pieces.Add (line.Substring (0, i));
- bool inQuotes = false;
- bool prevWs = true;
- ++i;
- int start = i;
- for ( ; i < line.Length; ++i) {
- char c = line [i];
- if (inQuotes) {
- if (c == '"') {
- Add (pieces, line, start, i);
- start = i+1;
- inQuotes = false;
- }
- }
- else {
- if (prevWs && c == '"') {
- Add (pieces, line, start, i);
- start = i+1;
- inQuotes = true;
- }
- else if (char.IsWhiteSpace (c)) {
- if (!prevWs) {
- Add (pieces, line, start, i);
- start = i;
- }
- prevWs = true;
- }
- else {
- if (prevWs) {
- Add (pieces, line, start, i);
- start = i;
- }
- prevWs = false;
- }
- }
- }
- if (start > 0 && start != line.Length)
- pieces.Add (line.Substring (start, line.Length-start));
- return pieces.ToArray ();
- }
-
- static void Add (List<string> pieces, string line, int start, int end)
- {
- if (start == end)
- return;
- pieces.Add (line.Substring (start, end-start));
- }
-
- static void Expect (StateInfo s, params string[] expected)
- {
- string e;
- while (s.tags.Count > 0 &&
- Array.IndexOf (expected, (e = s.tags.Peek ().ToString ())) >= 0) {
- s.output.Append (s.tags.Pop ().ToString ());
- }
- }
-
- static void ClearUntil (StateInfo s, string required)
- {
- string e = null;
- while (s.tags.Count > 0 &&
- (e = s.tags.Peek ().ToString ()) != required) {
- s.output.Append (s.tags.Pop ().ToString ());
- }
- if (e == required)
- s.output.Append (s.tags.Pop ().ToString ());
- }
-
- static void ClearAll (StateInfo s)
- {
- while (s.tags.Count > 0)
- s.output.Append (s.tags.Pop ().ToString ());
- }
-
- static void Translate (string[] lines, int startIndex, StringBuilder output)
- {
- if (lines.Length <= startIndex)
- return;
- do {
- Translate (lines [startIndex++], output);
- if (startIndex == lines.Length)
- break;
- } while (startIndex < lines.Length);
- }
-
- static void Translate (string line, StringBuilder output)
- {
- string span = null;
- int start = output.Length;
- for (int i = 0; i < line.Length; ++i) {
- switch (line [i]) {
- case '\\': {
- if ((i+2) < line.Length && line [i+1] == 'f') {
- if (line [i+2] == 'I') {
- output.Append ("<i>");
- span = "</i>";
- }
- else if (line [i+2] == 'B') {
- output.Append ("<b>");
- span = "</b>";
- }
- else if (line [i+2] == 'R' || line [i+2] == 'P') {
- output.Append (span);
- }
- else
- goto default;
- i += 2;
- }
- else if ((i+1) < line.Length) {
- output.Append (line [i+1]);
- ++i;
- }
- else
- goto default;
- break;
- }
- case '<':
- output.Append ("<");
- break;
- case '>':
- output.Append (">");
- break;
- case '&':
- output.Append ("&");
- break;
- default:
- output.Append (line [i]);
- break;
- }
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Collections.Generic;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace Monodoc.Generators.Html
-{
- // Input is expected to be already HTML so just return it
- public class MonoBook2Html : IHtmlExporter
- {
- public string CssCode {
- get {
- return @" h3 {
- font-size: 18px;
- padding-bottom: 4pt;
- border-bottom: 2px solid #dddddd;
- }
-
- .api {
- border: 1px solid;
- padding: 10pt;
- margin: 10pt;
- }
-
- .api-entry {
- border-bottom: none;
- font-size: 18px;
- }
-
- .prototype {
- border: 1px solid;
- background-color: #f2f2f2;
- padding: 5pt;
- margin-top: 5pt;
- margin-bottom: 5pt;
- }
-
- .header {
- border: 1px solid !important;
- padding: 0 0 5pt 5pt !important;
- margin: 10pt !important;
- white-space: pre !important;
- font-family: monospace !important;
- font-weight: normal !important;
- font-size: 1em !important;
- }
-
- .code {
- border: 1px solid;
- padding: 0 0 5pt 5pt;
- margin: 10pt;
- white-space: pre;
- font-family: monospace;
- }
-";
- }
- }
-
- public string Export (Stream input, Dictionary<string, string> extraArgs)
- {
- if (input == null)
- return null;
- return FromXmlReader (XmlReader.Create (input));
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- if (string.IsNullOrEmpty (input))
- return null;
- return FromXmlReader (XmlReader.Create (new StringReader (input)));
- }
-
- public string FromXmlReader (XmlReader reader)
- {
- if (!reader.ReadToDescendant ("head"))
- return null;
- if (!reader.ReadToNextSibling ("body"))
- return null;
-
- return reader.ReadInnerXml ();
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace Monodoc.Generators.Html
-{
- public class Toc2Html : IHtmlExporter
- {
- XslTransform transform;
-
- public Toc2Html ()
- {
- transform = new XslTransform ();
- var assembly = Assembly.GetAssembly (typeof (Toc2Html));
- var stream = assembly.GetManifestResourceStream ("toc-html.xsl");
- XmlReader xml_reader = new XmlTextReader (stream);
- transform.Load (xml_reader, null, null);
- }
-
- public string Export (Stream input, Dictionary<string, string> extraArgs)
- {
- var output = new StringWriter ();
- transform.Transform (new XPathDocument (input), null, output, null);
- return output.ToString ();
- }
-
- public string Export (string input, Dictionary<string, string> extraArgs)
- {
- var output = new StringWriter ();
- transform.Transform (new XPathDocument (new StringReader (input)), null, output, null);
- return output.ToString ();
- }
-
- public string CssCode {
- get {
- return string.Empty;
- }
- }
- }
-}
+++ /dev/null
-//
-// index.cs: Handling of the index files
-//
-// Author:
-// Miguel de Icaza (miguel@xamarin.com)
-//
-// (C) 2003 Ximian, Inc.
-// Copyright 2003-2011 Novell Inc
-// Copyright 2011 Xamarin Inc.
-//
-// Possible file format optimizations:
-// * Do not use 4 bytes for each index entry, use 3 bytes
-// * Find a way of compressing strings, there are plenty of duplicates
-// Find common roots, and use an encoding that uses a root to compress data.
-// "System", "System.Data", "System.Data class"
-// 0: PLAIN: "System"
-// 1: PLAIN: " class"
-// 2: LINK0 PLAIN ".DATA"
-// 3: LINK0 LINK1
-//
-// Maybe split everything at spaces and dots, and encode that:
-// string-1-idx "System."
-// string-1-idx "Data"
-// 2-items [ string-1-idx string-2-idx]
-//
-// Other variations are possible; Like Archive "System", "System." when we
-// see "System.Data".
-//
-//
-
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-
-namespace Monodoc
-{
- public class Topic
- {
- public readonly string Caption;
- public readonly string SortKey;
- public readonly string Url;
-
- public Topic (string caption, string sort_key, string url)
- {
- Caption = caption;
- SortKey = sort_key;
- Url = url;
- }
- }
-
- public class IndexEntry
- {
- List<Topic> topics;
-
- public int Position {
- get;
- private set;
- }
-
- public IList<Topic> Topics {
- get {
- return topics.AsReadOnly ();
- }
- }
-
- public int Count {
- get;
- private set;
- }
-
- public void Add (Topic t)
- {
- Count++;
- topics.Add (t);
- }
-
- public Topic this [int idx] {
- get {
- if (idx < 0 || idx > topics.Count)
- throw new ArgumentOutOfRangeException ("idx");
- return topics[idx];
- }
- }
-
- //
- // Constructor from a stream
- //
- public IndexEntry (FileStream fs, BinaryReader reader, int position)
- {
- Count = reader.ReadInt32 ();
- int caption_offset = reader.ReadInt32 ();
- string caption;
- topics = new List<Topic> (Count);
-
- int [] offsets = new int [Count];
- for (int i = 0; i < Count; i++)
- offsets [i] = reader.ReadInt32 ();
-
- fs.Position = caption_offset;
- caption = reader.ReadString ();
- for (int i = 0; i < Count; i++){
- fs.Position = offsets [i];
- string url = reader.ReadString ();
- topics.Add (new Topic (caption, string.Empty, url));
- }
- }
-
- //
- // Regular constructor
-
- public IndexEntry ()
- {
- topics = new List<Topic> ();
- }
-
- public void WriteTopics (IndexMaker maker, Stream stream, BinaryWriter writer)
- {
- //
- // Convention: entries with the same SortKey should have the same Caption
- //
- Position = (int) stream.Position;
- writer.Write (Count);
-
- if (Count == 0)
- return;
-
- writer.Write (maker.GetCode (topics[0].Caption));
- foreach (Topic t in topics)
- writer.Write (maker.GetCode (t.Url));
- }
- }
-
- public class IndexMaker
- {
- Dictionary<string, IndexEntry> entries = new Dictionary<string, IndexEntry> ();
- Dictionary<string, int> all_strings = new Dictionary<string, int> ();
- int index_position;
-
- void AddString (string str)
- {
- if (!all_strings.ContainsKey (str))
- all_strings.Add (str, 0);
- }
-
- public void AddTopic (Topic topic)
- {
- IndexEntry entry;
- if (!entries.TryGetValue (topic.SortKey, out entry)) {
- entry = new IndexEntry ();
- entries[topic.SortKey] = entry;
- }
-
- AddString (topic.SortKey);
- AddString (topic.Caption);
- AddString (topic.Url);
- entry.Add (topic);
- }
-
- public void Add (string caption, string sort_key, string url)
- {
- Topic t = new Topic (caption, sort_key, url);
- AddTopic (t);
- }
-
- void SaveStringTable (Stream stream, BinaryWriter writer)
- {
- var keys = new List<string> (all_strings.Keys);
- foreach (string s in keys) {
- int pos = (int) stream.Position;
- writer.Write (s);
- all_strings [s] = pos;
- }
- }
-
- public int GetCode (string s)
- {
- return all_strings [s];
- }
-
- void SaveTopics (Stream stream, BinaryWriter writer)
- {
- //
- // Convention: entries with the same SortKey should have the same Caption
- //
- foreach (IndexEntry e in entries.Values)
- e.WriteTopics (this, stream, writer);
- }
-
- void SaveIndexEntries (Stream stream, BinaryWriter writer)
- {
- index_position = (int) stream.Position;
- writer.Write (entries.Count);
- var keys = new List<string> (entries.Keys);
- keys.Sort (StringComparer.OrdinalIgnoreCase);
-
- foreach (string s in keys){
- IndexEntry e = entries [s];
- writer.Write (e.Position);
- }
- }
-
- public void Save (string filename)
- {
- Encoding utf8 = new UTF8Encoding (false, true);
-
- using (FileStream fs = File.OpenWrite (filename)){
- BinaryWriter writer = new BinaryWriter (fs, utf8);
- writer.Write (new byte [] { (byte) 'M',
- (byte) 'o', (byte) 'i',
- (byte) 'x'});
-
- // Leave room for pointer
- fs.Position = 8;
-
- SaveStringTable (fs, writer);
- SaveTopics (fs, writer);
-
- // index_position is set here
-
- SaveIndexEntries (fs, writer);
-
- fs.Position = 4;
- writer.Write (index_position);
- }
- }
- }
-
- public interface IListModel
- {
- int Rows { get; }
- string GetValue (int row);
- string GetDescription (int row);
- }
-
- public class IndexReader : IListModel
- {
- Encoding utf8 = new UTF8Encoding (false, true);
- FileStream fs;
- BinaryReader reader;
-
- // The offset of the table of entries
- int table_offset;
- int entries;
-
- static public IndexReader Load (string filename)
- {
- if (!File.Exists (filename))
- return null;
-
- try {
- return new IndexReader (filename);
- } catch {
- return null;
- }
- }
-
- IndexReader (string filename)
- {
- fs = File.OpenRead (filename);
- reader = new BinaryReader (fs, utf8);
-
- if (fs.ReadByte () != 'M' ||
- fs.ReadByte () != 'o' ||
- fs.ReadByte () != 'i' ||
- fs.ReadByte () != 'x'){
- throw new Exception ("Corrupt index");
- }
-
- // Seek to index_entries
- fs.Position = reader.ReadInt32 ();
-
- entries = reader.ReadInt32 ();
-
- table_offset = (int) fs.Position;
- }
-
- public int Rows {
- get {
- return entries;
- }
- }
-
- public string GetValue (int row)
- {
- fs.Position = row * 4 + table_offset;
- fs.Position = reader.ReadInt32 () + 4;
- int code = reader.ReadInt32 ();
- fs.Position = code;
- string caption = reader.ReadString ();
-
- return caption;
- }
-
- public string GetDescription (int row)
- {
- return GetValue (row);
- }
-
- public IndexEntry GetIndexEntry (int row)
- {
- fs.Position = row * 4 + table_offset;
- int entry_offset = reader.ReadInt32 ();
- fs.Position = entry_offset;
-
- return new IndexEntry (fs, reader, entry_offset);
- }
- }
-}
-
+++ /dev/null
-using System;
-using System.Linq;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-using System.Collections.Generic;
-
-using Monodoc.Ecma;
-
-namespace Monodoc.Providers
-{
- public enum EcmaNodeType {
- Invalid,
- Namespace,
- Type,
- Member,
- Meta, // A node that's here to serve as a header for other node
- }
-
-
-
- // Common functionality between ecma-provider and ecmauncompiled-provider
- internal class EcmaDoc
- {
- static EcmaUrlParser parser = new EcmaUrlParser ();
-
- public static void PopulateTreeFromIndexFile (string indexFilePath,
- string idPrefix,
- Tree tree,
- IDocStorage storage,
- Dictionary<string, XElement> nsSummaries,
- Func<XElement, string> indexGenerator = null,
- IEcmaProviderFileSource fileSource = null)
- {
- fileSource = fileSource ?? DefaultEcmaProviderFileSource.Default;
- var root = tree.RootNode;
- int resID = 0;
- var asm = Path.GetDirectoryName (indexFilePath);
-
- storage = storage ?? new Storage.NullStorage ();
- // nsSummaries is allowed to be null if the user doesn't care about it
- nsSummaries = nsSummaries ?? new Dictionary<string, XElement> ();
- // default index generator uses a counter
- indexGenerator = indexGenerator ?? (_ => resID++.ToString ());
-
- using (var reader = fileSource.GetIndexReader (indexFilePath)) {
- reader.ReadToFollowing ("Types");
- var types = XElement.Load (reader.ReadSubtree ());
-
- foreach (var ns in types.Elements ("Namespace")) {
- var nsName = (string)ns.Attribute ("Name");
- nsName = !string.IsNullOrEmpty (nsName) ? nsName : "global";
- var nsNode = root.GetOrCreateNode (nsName, "N:" + nsName);
-
- XElement nsElements;
- if (!nsSummaries.TryGetValue (nsName, out nsElements))
- nsSummaries[nsName] = nsElements = new XElement ("elements",
- new XElement ("summary"),
- new XElement ("remarks"));
- //Add namespace summary and remarks data from file, if available
- var nsFileName = fileSource.GetNamespaceXmlPath(asm, nsName);
-
- if(File.Exists(nsFileName)){
- var nsEl = fileSource.GetNamespaceElement (nsFileName);
-
- nsElements.Element ("summary").ReplaceWith (nsEl.Descendants ("summary").First ());
- nsElements.Element ("remarks").ReplaceWith (nsEl.Descendants ("remarks").First ());
- }else{
- Console.WriteLine ("Error reading namespace XML for {0} at {1}", nsName, nsFileName);
- }
-
- foreach (var type in ns.Elements ("Type")) {
- // Add the XML file corresponding to the type to our storage
- var id = indexGenerator (type);
- string typeFilePath;
- var typeDocument = EcmaDoc.LoadTypeDocument (asm, nsName, type.Attribute ("Name").Value, out typeFilePath, fileSource);
- if (typeDocument == null)
- continue;
-
- // write the document (which may have been modified by the fileSource) to the storage
- MemoryStream io = new MemoryStream ();
- using (var writer = XmlWriter.Create (io)) {
- typeDocument.WriteTo (writer);
- }
- io.Seek (0, SeekOrigin.Begin);
- storage.Store (id, io);
-
- nsElements.Add (ExtractClassSummary (typeDocument));
-
- var typeCaption = EcmaDoc.GetTypeCaptionFromIndex (type);
- var url = idPrefix + id + '#' + typeCaption + '/';
- typeCaption = EcmaDoc.GetTypeCaptionFromIndex (type, true);
- var typeNode = nsNode.CreateNode (typeCaption, url);
-
- // Add meta "Members" node
- typeNode.CreateNode ("Members", "*");
- var membersNode = typeDocument.Root.Element ("Members");
- if (membersNode == null || !membersNode.Elements ().Any ())
- continue;
- var members = membersNode
- .Elements ("Member")
- .ToLookup (EcmaDoc.GetMemberType);
-
- foreach (var memberType in members) {
- // We pluralize the member type to get the caption and take the first letter as URL
- var node = typeNode.CreateNode (EcmaDoc.PluralizeMemberType (memberType.Key), memberType.Key[0].ToString ());
- var memberIndex = 0;
-
- var isCtors = memberType.Key[0] == 'C';
-
- // We do not escape much member name here
- foreach (var memberGroup in memberType.GroupBy (m => MakeMemberCaption (m, isCtors))) {
- if (memberGroup.Count () > 1) {
- // Generate overload
- var overloadCaption = MakeMemberCaption (memberGroup.First (), false);
- var overloadNode = node.CreateNode (overloadCaption, overloadCaption);
- foreach (var member in memberGroup)
- overloadNode.CreateNode (MakeMemberCaption (member, true), (memberIndex++).ToString ());
- overloadNode.Sort ();
- } else {
- // We treat constructor differently by showing their argument list in all cases
- node.CreateNode (MakeMemberCaption (memberGroup.First (), isCtors), (memberIndex++).ToString ());
- }
- }
- node.Sort ();
- }
- }
-
- nsNode.Sort ();
- }
- root.Sort ();
- }
- }
-
- // Utility methods
-
- public static XDocument LoadTypeDocument (string basePath, string nsName, string typeName, IEcmaProviderFileSource fileSource = null)
- {
- string dummy;
- return LoadTypeDocument (basePath, nsName, typeName, out dummy, fileSource ?? DefaultEcmaProviderFileSource.Default);
- }
-
- public static XDocument LoadTypeDocument (string basePath, string nsName, string typeName, out string finalPath, IEcmaProviderFileSource fileSource = null)
- {
- fileSource = fileSource ?? DefaultEcmaProviderFileSource.Default;
-
- finalPath = fileSource.GetTypeXmlPath (basePath, nsName, typeName);
- if (!File.Exists (finalPath)) {
- Console.Error.WriteLine ("Warning: couldn't process type file `{0}' as it doesn't exist", finalPath);
- return null;
- }
-
- XDocument doc = null;
- try {
- doc = fileSource.GetTypeDocument(finalPath);
- } catch (Exception e) {
- Console.WriteLine ("Document `{0}' is unparsable, {1}", finalPath, e.ToString ());
- }
-
- return doc;
- }
-
- public static string GetTypeCaptionFromIndex (XElement typeNodeFromIndex, bool full = false)
- {
- var t = typeNodeFromIndex;
- var c = ((string)(t.Attribute ("DisplayName") ?? t.Attribute ("Name"))).Replace ('+', '.');
- if (full)
- c += " " + (string)t.Attribute ("Kind");
- return c;
- }
-
- public static string PluralizeMemberType (string memberType)
- {
- switch (memberType) {
- case "Property":
- return "Properties";
- default:
- return memberType + "s";
- }
- }
-
- public static string GetMemberType (XElement m)
- {
- return m.Attribute ("MemberName").Value.StartsWith ("op_") ? "Operator" : m.Element ("MemberType").Value;
- }
-
- public static string MakeMemberCaption (XElement member, bool withArguments)
- {
- var caption = (string)member.Attribute ("MemberName");
- // Use type name instead of .ctor for cosmetic sake
- if (caption == ".ctor") {
- caption = (string)member.Ancestors ("Type").First ().Attribute ("Name");
- // If this is an inner type ctor, strip the parent type reference
- var plusIndex = caption.LastIndexOf ('+');
- if (plusIndex != -1)
- caption = caption.Substring (plusIndex + 1);
- }
- if (caption.StartsWith ("op_")) {
- string sig;
- caption = MakeOperatorSignature (member, out sig);
- caption = withArguments ? sig : caption;
- return caption;
- }
- if (withArguments) {
- var args = member.Element ("Parameters");
- caption += '(';
- if (args != null && args.Elements ("Parameter").Any ()) {
- caption += args.Elements ("Parameter")
- .Select (p => (string)p.Attribute ("Type"))
- .Aggregate ((p1, p2) => p1 + "," + p2);
- }
- caption += ')';
- }
-
- return caption;
- }
-
- public static Node MatchNodeWithEcmaUrl (string url, Tree tree)
- {
- Node result = null;
- EcmaDesc desc;
- if (!parser.TryParse (url, out desc))
- return null;
-
- // Namespace search
- Node currentNode = tree.RootNode;
- Node searchNode = new Node () { Caption = desc.Namespace };
- int index = currentNode.ChildNodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
- if (index >= 0)
- result = currentNode.ChildNodes[index];
- if (desc.DescKind == EcmaDesc.Kind.Namespace || index < 0)
- return result;
-
- // Type search
- currentNode = result;
- result = null;
- searchNode.Caption = desc.ToCompleteTypeName ();
- if (!desc.GenericTypeArgumentsIsNumeric)
- index = currentNode.ChildNodes.BinarySearch (searchNode, EcmaTypeNodeComparer.Instance);
- else
- index = GenericTypeBacktickSearch (currentNode.ChildNodes, desc);
- if (index >= 0)
- result = currentNode.ChildNodes[index];
- if ((desc.DescKind == EcmaDesc.Kind.Type && !desc.IsEtc) || index < 0)
- return result;
-
- // Member selection
- currentNode = result;
- result = null;
- var caption = desc.IsEtc ? EtcKindToCaption (desc.Etc) : MemberKindToCaption (desc.DescKind);
- currentNode = FindNodeForCaption (currentNode.ChildNodes, caption);
- if (currentNode == null
- || (desc.IsEtc && desc.DescKind == EcmaDesc.Kind.Type && string.IsNullOrEmpty (desc.EtcFilter)))
- return currentNode;
-
- // Member search
- result = null;
- var format = desc.DescKind == EcmaDesc.Kind.Constructor ? EcmaDesc.Format.WithArgs : EcmaDesc.Format.WithoutArgs;
- searchNode.Caption = desc.ToCompleteMemberName (format);
- index = currentNode.ChildNodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
- if (index < 0)
- return null;
- result = currentNode.ChildNodes[index];
- if (result.ChildNodes.Count == 0 || desc.IsEtc)
- return result;
-
- // Overloads search
- currentNode = result;
- searchNode.Caption = desc.ToCompleteMemberName (EcmaDesc.Format.WithArgs);
- index = currentNode.ChildNodes.BinarySearch (searchNode, EcmaGenericNodeComparer.Instance);
- if (index < 0)
- return result;
- result = result.ChildNodes[index];
-
- return result;
- }
-
- static int GenericTypeBacktickSearch (IList<Node> childNodes, EcmaDesc desc)
- {
- /* Our strategy is to search for the non-generic variant of the type
- * (which in most case should fail) and then use the closest index
- * to linearily search for the generic variant with the right generic arg number
- */
- var searchNode = new Node () { Caption = desc.TypeName };
- int index = childNodes.BinarySearch (searchNode, EcmaTypeNodeComparer.Instance);
- // Place the index in the right start position
- if (index < 0)
- index = ~index;
-
- for (int i = index; i < childNodes.Count; i++) {
- var currentNode = childNodes[i];
- // Find the index of the generic argument list
- int genericIndex = currentNode.Caption.IndexOf ('<');
- // If we are not on the same base type name anymore, there is no point
- int captionSlice = genericIndex != -1 ? genericIndex : currentNode.Caption.LastIndexOf (' ');
- if (string.Compare (searchNode.Caption, 0,
- currentNode.Caption, 0,
- Math.Max (captionSlice, searchNode.Caption.Length),
- StringComparison.Ordinal) != 0)
- break;
-
- var numGenerics = CountTypeGenericArguments (currentNode.Caption, genericIndex);
- if (numGenerics == desc.GenericTypeArguments.Count) {
- // Simple comparison if we are not looking for an inner type
- if (desc.NestedType == null)
- return i;
- // If more complicated, we fallback to using EcmaUrlParser
- var caption = currentNode.Caption;
- caption = "T:" + caption.Substring (0, caption.LastIndexOf (' ')).Replace ('.', '+');
- EcmaDesc otherDesc;
- var parser = new EcmaUrlParser ();
- if (parser.TryParse (caption, out otherDesc) && desc.NestedType.Equals (otherDesc.NestedType))
- return i;
- }
- }
-
- return -1;
- }
-
- // This comparer returns the answer straight from caption comparison
- class EcmaGenericNodeComparer : IComparer<Node>
- {
- public static readonly EcmaGenericNodeComparer Instance = new EcmaGenericNodeComparer ();
-
- public int Compare (Node n1, Node n2)
- {
- return string.Compare (n1.Caption, n2.Caption, StringComparison.Ordinal);
- }
- }
-
- // This comparer take into account the space in the caption
- class EcmaTypeNodeComparer : IComparer<Node>
- {
- public static readonly EcmaTypeNodeComparer Instance = new EcmaTypeNodeComparer ();
-
- public int Compare (Node n1, Node n2)
- {
- int length1 = CaptionLength (n1.Caption);
- int length2 = CaptionLength (n2.Caption);
-
- return string.Compare (n1.Caption, 0, n2.Caption, 0, Math.Max (length1, length2), StringComparison.Ordinal);
- }
-
- int CaptionLength (string caption)
- {
- var length = caption.LastIndexOf (' ');
- return length == -1 ? caption.Length : length;
- }
- }
-
- public static Dictionary<string, string> GetContextForEcmaNode (string hash, string sourceID, Node node)
- {
- var args = new Dictionary<string, string> ();
-
- args["source-id"] = sourceID;
-
- if (node != null) {
- var nodeType = GetNodeType (node);
- switch (nodeType) {
- case EcmaNodeType.Namespace:
- args["show"] = "namespace";
- args["namespace"] = node.Element.Substring ("N:".Length);
- break;
- case EcmaNodeType.Type:
- args["show"] = "typeoverview";
- break;
- case EcmaNodeType.Member:
- case EcmaNodeType.Meta:
- switch (GetNodeMemberTypeChar (node)){
- case 'C':
- args["membertype"] = "Constructor";
- break;
- case 'M':
- args["membertype"] = "Method";
- break;
- case 'P':
- args["membertype"] = "Property";
- break;
- case 'F':
- args["membertype"] = "Field";
- break;
- case 'E':
- args["membertype"] = "Event";
- break;
- case 'O':
- args["membertype"] = "Operator";
- break;
- case 'X':
- args["membertype"] = "ExtensionMethod";
- break;
- case '*':
- args["membertype"] = "All";
- break;
- }
-
- if (nodeType == EcmaNodeType.Meta) {
- args["show"] = "members";
- args["index"] = "all";
- } else {
- args["show"] = "member";
- args["index"] = node.Element;
- }
- break;
- }
- }
-
- if (!string.IsNullOrEmpty (hash))
- args["hash"] = hash;
-
- return args;
- }
-
- public static EcmaNodeType GetNodeType (Node node)
- {
- // We guess the node type by checking the depth level it's at in the tree
- int level = GetNodeLevel (node);
- switch (level) {
- case 0:
- return EcmaNodeType.Namespace;
- case 1:
- return EcmaNodeType.Type;
- case 2:
- return EcmaNodeType.Meta;
- case 3: // Here it's either a member or, in case of overload, a meta
- return node.IsLeaf ? EcmaNodeType.Member : EcmaNodeType.Meta;
- case 4: // At this level, everything is necessarily a member
- return EcmaNodeType.Member;
- default:
- return EcmaNodeType.Invalid;
- }
- }
-
- public static char GetNodeMemberTypeChar (Node node)
- {
- int level = GetNodeLevel (node);
- // We try to reach the member group node depending on node nested level
- switch (level) {
- case 2:
- return node.Element[0];
- case 3:
- return node.Parent.Element[0];
- case 4:
- return node.Parent.Parent.Element[0];
- default:
- throw new ArgumentException ("node", "Couldn't determine member type of node `" + node.Caption + "'");
- }
- }
-
- public static int GetNodeLevel (Node node)
- {
- int i = 0;
- for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++) {
- node = node.Parent;
- if (node == null)
- return i - 1;
- }
- return i - 1;
- }
-
- public static string EtcKindToCaption (char etc)
- {
- switch (etc) {
- case 'M':
- return "Methods";
- case 'P':
- return "Properties";
- case 'C':
- return "Constructors";
- case 'F':
- return "Fields";
- case 'E':
- return "Events";
- case 'O':
- return "Operators";
- case '*':
- return "Members";
- default:
- return null;
- }
- }
-
- public static string MemberKindToCaption (EcmaDesc.Kind kind)
- {
- switch (kind) {
- case EcmaDesc.Kind.Method:
- return "Methods";
- case EcmaDesc.Kind.Property:
- return "Properties";
- case EcmaDesc.Kind.Constructor:
- return "Constructors";
- case EcmaDesc.Kind.Field:
- return "Fields";
- case EcmaDesc.Kind.Event:
- return "Events";
- case EcmaDesc.Kind.Operator:
- return "Operators";
- default:
- return null;
- }
- }
-
- public static Node FindNodeForCaption (IList<Node> nodes, string caption)
- {
- foreach (var node in nodes)
- if (node.Caption.Equals (caption, StringComparison.OrdinalIgnoreCase))
- return node;
- return null;
- }
-
- public static int CountTypeGenericArguments (string typeDefinition, int startIndex = 0)
- {
- int nestedLevel = 0;
- int count = 0;
- bool started = false;
-
- foreach (char c in typeDefinition.Skip (startIndex)) {
- switch (c) {
- case '<':
- if (!started)
- count = 1;
- started = true;
- nestedLevel++;
- break;
- case ',':
- if (started && nestedLevel == 1)
- count++;
- break;
- case '>':
- nestedLevel--;
- break;
- }
- }
-
- return count;
- }
-
- internal static string MakeOperatorSignature (XElement member, out string memberSignature)
- {
- string name = (string)member.Attribute ("MemberName");
- var nicename = name.Substring(3);
- memberSignature = null;
-
- switch (name) {
- // unary operators: no overloading possible [ECMA-335 §10.3.1]
- case "op_UnaryPlus": // static R operator+ (T)
- case "op_UnaryNegation": // static R operator- (T)
- case "op_LogicalNot": // static R operator! (T)
- case "op_OnesComplement": // static R operator~ (T)
- case "op_Increment": // static R operator++ (T)
- case "op_Decrement": // static R operator-- (T)
- case "op_True": // static bool operator true (T)
- case "op_False": // static bool operator false (T)
- case "op_AddressOf": // static R operator& (T)
- case "op_PointerDereference": // static R operator* (T)
- memberSignature = nicename;
- break;
- // conversion operators: overloading based on parameter and return type [ECMA-335 §10.3.3]
- case "op_Implicit": // static implicit operator R (T)
- case "op_Explicit": // static explicit operator R (T)
- nicename = name.EndsWith ("Implicit") ? "ImplicitConversion" : "ExplicitConversion";
- string arg = (string)member.Element ("Parameters").Element ("Parameter").Attribute ("Type");
- string ret = (string)member.Element ("ReturnValue").Element ("ReturnType");
- memberSignature = arg + " to " + ret;
- break;
- // binary operators: overloading is possible [ECMA-335 §10.3.2]
- default:
- if (member.Element ("Parameters") != null)
- memberSignature =
- nicename + "("
- + string.Join (",", member.Element ("Parameters").Elements ("Parameter").Select (p => (string)p.Attribute ("Type")))
- + ")";
- break;
- }
-
- return nicename;
- }
-
- static XElement ExtractClassSummary (XDocument typeDoc)
- {
- string name = typeDoc.Root.Attribute("Name").Value;
- string fullName = typeDoc.Root.Attribute("FullName").Value;
- string assemblyName = typeDoc.Root.Element("AssemblyInfo") != null ? typeDoc.Root.Element("AssemblyInfo").Element("AssemblyName").Value : string.Empty;
- var docs = typeDoc.Root.Element("Docs");
- var summary = docs.Element("summary") ?? new XElement("summary");
- var remarks = docs.Element("remarks") ?? new XElement("remarks");
- return new XElement ("class",
- new XAttribute ("name", name ?? string.Empty),
- new XAttribute ("fullname", fullName ?? string.Empty),
- new XAttribute ("assembly", assemblyName ?? string.Empty),
- summary,
- remarks);
- }
- }
-}
+++ /dev/null
-// addins-provider.cs
-//
-// A provider to display Mono.Addins extension models
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-using System;
-using System.Linq;
-using System.Diagnostics;
-using System.Text;
-using System.IO;
-using System.Xml;
-using System.Collections.Generic;
-
-namespace Monodoc.Providers
-{
- public class AddinsProvider : Provider
- {
- string file;
-
- public AddinsProvider (string xmlModelFile)
- {
- file = xmlModelFile;
-
- if (!File.Exists (file))
- throw new FileNotFoundException (String.Format ("The file `{0}' does not exist", file));
- }
-
- public override void PopulateTree (Tree tree)
- {
- string fileId = Path.GetFileNameWithoutExtension (file);
- using (var f = File.OpenRead (file))
- tree.HelpSource.Storage.Store (fileId, f);
-
- XmlDocument doc = new XmlDocument ();
- doc.Load (file);
-
- foreach (XmlElement addin in doc.SelectNodes ("Addins/Addin")) {
-
- string addinId = addin.GetAttribute ("fullId");
- Node newNode = tree.RootNode.CreateNode (addin.GetAttribute ("name"), "addin:" + fileId + "#" + addinId);
-
- foreach (XmlElement node in addin.SelectNodes ("ExtensionPoint")) {
- string target = "extension-point:" + fileId + "#" + addinId + "#" + node.GetAttribute ("path");
- Node newExt = newNode.CreateNode (node.GetAttribute ("name"), target);
-
- foreach (XmlElement en in node.SelectNodes ("ExtensionNode")) {
- string nid = en.GetAttribute ("id");
- string nname = en.GetAttribute ("name");
- newExt.CreateNode (nname, "extension-node:" + fileId + "#" + addinId + "#" + nid);
- }
- }
- }
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- }
- }
-
- public class AddinsHelpSource : HelpSource
- {
- public AddinsHelpSource (string base_file, bool create) : base (base_file, create)
- {
- }
-
- internal protected const string AddinPrefix = "addin:";
- internal protected const string ExtensionPrefix = "extension-point:";
- internal protected const string ExtensionNodePrefix = "extension-node:";
-
- public override bool CanHandleUrl (string url)
- {
- return url.StartsWith (AddinPrefix, StringComparison.OrdinalIgnoreCase)
- || url.StartsWith (ExtensionPrefix, StringComparison.OrdinalIgnoreCase)
- || url.StartsWith (ExtensionNodePrefix, StringComparison.OrdinalIgnoreCase);
- }
-
- protected override string UriPrefix {
- get {
- return AddinPrefix;
- }
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return DocumentType.AddinXml;
- }
-
- public override string GetInternalIdForUrl (string url, out Node node, out Dictionary<string, string> context)
- {
- var id = base.GetInternalIdForUrl (url, out node, out context);
- var idParts = id.Split ('#');
- context = new Dictionary<string, string> ();
- context["FileID"] = idParts[0];
- context["AddinID"] = idParts[1];
- context["NodeID"] = idParts[2];
-
- return idParts[0];
- }
-
- public override Node MatchNode (string url)
- {
- var prefix = new[] { AddinPrefix, ExtensionPrefix, ExtensionNodePrefix }.First (p => url.StartsWith (p, StringComparison.OrdinalIgnoreCase));
- return base.MatchNode (prefix != null ? url.Substring (prefix.Length) : url);
- }
- }
-}
+++ /dev/null
-//
-// The ecmaspec provider is for ECMA specifications
-//
-// Authors:
-// John Luke (jluke@cfl.rr.com)
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// Use like this:
-// mono assembler.exe --ecmaspec DIRECTORY --out name
-//
-
-using System;
-using System.Linq;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-using System.Collections.Generic;
-
-using Lucene.Net.Index;
-using Lucene.Net.Documents;
-
-using Monodoc.Ecma;
-using Mono.Utilities;
-
-namespace Monodoc.Providers
-{
- public interface IEcmaProviderFileSource {
- XmlReader GetIndexReader(string path);
- XDocument GetTypeDocument(string path);
- XElement GetNamespaceElement(string path);
- string GetTypeXmlPath(string basePath, string nsName, string typeName);
- string GetNamespaceXmlPath(string basePath, string ns);
- XElement ExtractNamespaceSummary (string path);
- }
-
- internal class DefaultEcmaProviderFileSource : IEcmaProviderFileSource {
- public static readonly IEcmaProviderFileSource Default = new DefaultEcmaProviderFileSource();
-
- public XmlReader GetIndexReader(string path) {
- return XmlReader.Create (File.OpenRead (path));
- }
-
- public XElement GetNamespaceElement(string path) {
- return XElement.Load (path);
- }
-
- public string GetTypeXmlPath(string basePath, string nsName, string typeName) {
- string finalPath = Path.Combine (basePath, nsName, Path.ChangeExtension (typeName, ".xml"));
- return finalPath;
- }
-
- public XDocument GetTypeDocument(string path) {
- return XDocument.Load (path);
- }
-
- public string GetNamespaceXmlPath(string basePath, string ns) {
- string finalPath = Path.Combine(basePath, String.Format("ns-{0}.xml", ns));
- return finalPath;
- }
-
- public XElement ExtractNamespaceSummary (string path)
- {
- using (var reader = XmlReader.Create (path)) {
- reader.ReadToFollowing ("Namespace");
- var name = reader.GetAttribute ("Name");
- var summary = reader.ReadToFollowing ("summary") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("summary");
- var remarks = reader.ReadToFollowing ("remarks") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("remarks");
-
- return new XElement ("namespace",
- new XAttribute ("ns", name ?? string.Empty),
- summary,
- remarks);
- }
- }
- }
-
- public class EcmaProvider : Provider
- {
- HashSet<string> directories = new HashSet<string> ();
- IEcmaProviderFileSource fileSource;
-
- public EcmaProvider ()
- {
- }
-
- public EcmaProvider (string baseDir)
- {
- AddDirectory (baseDir);
- }
-
- public IEcmaProviderFileSource FileSource {
- get {
- if (fileSource == null) {
- fileSource = new DefaultEcmaProviderFileSource();
- }
- return fileSource;
- }
- set { fileSource = value; }
- }
-
- public void AddDirectory (string directory)
- {
- if (string.IsNullOrEmpty (directory))
- throw new ArgumentNullException ("directory");
-
- directories.Add (directory);
- }
-
- public override void PopulateTree (Tree tree)
- {
- var storage = tree.HelpSource.Storage;
- var nsSummaries = new Dictionary<string, XElement> ();
- int resID = 0;
-
- foreach (var asm in directories) {
- var indexFilePath = Path.Combine (asm, "index.xml");
- if (!File.Exists (indexFilePath)) {
- Console.Error.WriteLine ("Warning: couldn't process directory `{0}' as it has no index.xml file", asm);
- continue;
- }
-
- EcmaDoc.PopulateTreeFromIndexFile (indexFilePath, EcmaHelpSource.EcmaPrefix, tree, storage, nsSummaries, _ => resID++.ToString (), FileSource);
- }
-
- foreach (var summary in nsSummaries)
- storage.Store ("xml.summary." + summary.Key, summary.Value.ToString ());
-
- var masterSummary = new XElement ("elements",
- directories
- .SelectMany (d => Directory.EnumerateFiles (d, "ns-*.xml"))
- .Select (FileSource.ExtractNamespaceSummary));
- storage.Store ("mastersummary.xml", masterSummary.ToString ());
- }
-
-
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- AddImages (hs);
- AddExtensionMethods (hs);
- }
-
- void AddEcmaXml (HelpSource hs)
- {
- var xmls = directories
- .SelectMany (Directory.EnumerateDirectories) // Assemblies
- .SelectMany (Directory.EnumerateDirectories) // Namespaces
- .SelectMany (Directory.EnumerateFiles)
- .Where (f => f.EndsWith (".xml")); // Type XML files
-
- int resID = 0;
- foreach (var xml in xmls)
- using (var file = File.OpenRead (xml))
- hs.Storage.Store ((resID++).ToString (), file);
- }
-
- void AddImages (HelpSource hs)
- {
- var imgs = directories
- .SelectMany (Directory.EnumerateDirectories)
- .Select (d => Path.Combine (d, "_images"))
- .Where (Directory.Exists)
- .SelectMany (Directory.EnumerateFiles);
-
- foreach (var img in imgs)
- using (var file = File.OpenRead (img))
- hs.Storage.Store (Path.GetFileName (img), file);
- }
-
- void AddExtensionMethods (HelpSource hs)
- {
- var extensionMethods = directories
- .SelectMany (Directory.EnumerateDirectories)
- .Select (d => Path.Combine (d, "index.xml"))
- .Where (File.Exists)
- .Select (f => {
- using (var file = File.OpenRead (f)) {
- var reader = XmlReader.Create (file);
- reader.ReadToFollowing ("ExtensionMethods");
- return reader.ReadInnerXml ();
- }
- })
- .DefaultIfEmpty (string.Empty);
-
- hs.Storage.Store ("ExtensionMethods.xml",
- "<ExtensionMethods>" + extensionMethods.Aggregate (string.Concat) + "</ExtensionMethods>");
- }
-
- IEnumerable<string> GetEcmaXmls ()
- {
- return directories
- .SelectMany (Directory.EnumerateDirectories) // Assemblies
- .SelectMany (Directory.EnumerateDirectories) // Namespaces
- .SelectMany (Directory.EnumerateFiles)
- .Where (f => f.EndsWith (".xml")); // Type XML files
- }
- }
-
- public class EcmaHelpSource : HelpSource
- {
- internal const string EcmaPrefix = "ecma:";
- LRUCache<string, Node> cache = new LRUCache<string, Node> (4);
-
- public EcmaHelpSource (string base_file, bool create) : base (base_file, create)
- {
- }
-
- protected EcmaHelpSource () : base ()
- {
- }
-
- protected override string UriPrefix {
- get {
- return EcmaPrefix;
- }
- }
-
- public override bool CanHandleUrl (string url)
- {
- if (url.Length > 2 && url[1] == ':') {
- switch (url[0]) {
- case 'T':
- case 'M':
- case 'C':
- case 'P':
- case 'E':
- case 'F':
- case 'N':
- case 'O':
- return true;
- }
- }
- return base.CanHandleUrl (url);
- }
-
- // Clean the extra paramers in the id
- public override Stream GetHelpStream (string id)
- {
- var idParts = id.Split ('?');
- var name = idParts[0];
- if (name == "root:")
- name = "mastersummary.xml";
- return base.GetHelpStream (name);
- }
-
- public override Stream GetCachedHelpStream (string id)
- {
- var idParts = id.Split ('?');
- return base.GetCachedHelpStream (idParts[0]);
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return DocumentType.EcmaXml;
- }
-
- public override string GetPublicUrl (Node node)
- {
- string url = string.Empty;
- var type = EcmaDoc.GetNodeType (node);
- //Console.WriteLine ("GetPublicUrl {0} : {1} [{2}]", node.Element, node.Caption, type.ToString ());
- switch (type) {
- case EcmaNodeType.Namespace:
- return node.Element; // A namespace node has already a well formated internal url
- case EcmaNodeType.Type:
- return MakeTypeNodeUrl (node);
- case EcmaNodeType.Meta:
- return MakeTypeNodeUrl (GetNodeTypeParent (node)) + GenerateMetaSuffix (node);
- case EcmaNodeType.Member:
- var typeChar = EcmaDoc.GetNodeMemberTypeChar (node);
- var parentNode = GetNodeTypeParent (node);
- var typeNode = MakeTypeNodeUrl (parentNode).Substring (2);
- return typeChar + ":" + typeNode + MakeMemberNodeUrl (typeChar, node);
- default:
- return null;
- }
- }
-
- string MakeTypeNodeUrl (Node node)
- {
- // A Type node has a Element property of the form: 'ecma:{number}#{typename}/'
- var hashIndex = node.Element.IndexOf ('#');
- var typeName = node.Element.Substring (hashIndex + 1, node.Element.Length - hashIndex - 2);
- return "T:" + node.Parent.Caption + '.' + typeName.Replace ('.', '+');
- }
-
- string MakeMemberNodeUrl (char typeChar, Node node)
- {
- // We clean inner type ctor name which may contain the outer type name
- var caption = node.Caption;
-
- // Sanitize constructor caption of inner types
- if (typeChar == 'C') {
- int lastDot = -1;
- for (int i = 0; i < caption.Length && caption[i] != '('; i++)
- lastDot = caption[i] == '.' ? i : lastDot;
- return lastDot == -1 ? '.' + caption : caption.Substring (lastDot);
- }
-
- /* We handle type conversion operator by checking if the name contains " to "
- * (as in 'foo to bar') and we generate a corresponding conversion signature
- */
- if (typeChar == 'O' && caption.IndexOf (" to ") != -1) {
- var parts = caption.Split (' ');
- return "." + node.Parent.Caption + "(" + parts[0] + ", " + parts[2] + ")";
- }
-
- /* The goal here is to treat method which are explicit interface definition
- * such as 'void IDisposable.Dispose ()' for which the caption is a dot
- * expression thus colliding with the ecma parser.
- * If the first non-alpha character in the caption is a dot then we have an
- * explicit member implementation (we assume the interface has namespace)
- */
- var firstNonAlpha = caption.FirstOrDefault (c => !char.IsLetterOrDigit (c));
- if (firstNonAlpha == '.')
- return "$" + caption;
-
- return "." + caption;
- }
-
- Node GetNodeTypeParent (Node node)
- {
- // Type nodes are always at level 2 so we just need to get there
- while (node != null && node.Parent != null
- && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase) && node.Parent.Parent.Parent != null)
- node = node.Parent;
- return node;
- }
-
- string GenerateMetaSuffix (Node node)
- {
- string suffix = string.Empty;
- // A meta node has always a type element to begin with
- while (EcmaDoc.GetNodeType (node) != EcmaNodeType.Type) {
- suffix = '/' + node.Element + suffix;
- node = node.Parent;
- }
- return suffix;
- }
-
- public override string GetInternalIdForUrl (string url, out Node node, out Dictionary<string, string> context)
- {
- var id = string.Empty;
- node = null;
- context = null;
-
- if (!url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase)) {
- node = MatchNode (url);
- if (node == null)
- return null;
- id = node.GetInternalUrl ();
- }
-
- string hash;
- id = GetInternalIdForInternalUrl (id, out hash);
- context = EcmaDoc.GetContextForEcmaNode (hash, SourceID.ToString (), node);
-
- return id;
- }
-
- public string GetInternalIdForInternalUrl (string internalUrl, out string hash)
- {
- var id = internalUrl;
- if (id.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase))
- id = id.Substring (UriPrefix.Length);
- else if (id.StartsWith ("N:", StringComparison.OrdinalIgnoreCase))
- id = "xml.summary." + id.Substring ("N:".Length);
-
- var hashIndex = id.IndexOf ('#');
- hash = string.Empty;
- if (hashIndex != -1) {
- hash = id.Substring (hashIndex + 1);
- id = id.Substring (0, hashIndex);
- }
-
- return id;
- }
-
- public override Node MatchNode (string url)
- {
- Node node = null;
- if ((node = cache.Get (url)) == null) {
- node = EcmaDoc.MatchNodeWithEcmaUrl (url, Tree);
- if (node != null)
- cache.Put (url, node);
- }
- return node;
- }
-
- public override void PopulateIndex (IndexMaker index_maker)
- {
- foreach (Node ns_node in Tree.RootNode.ChildNodes){
- foreach (Node type_node in ns_node.ChildNodes){
- string typename = type_node.Caption.Substring (0, type_node.Caption.IndexOf (' '));
- string full = ns_node.Caption + "." + typename;
-
- string doc_tag = GetKindFromCaption (type_node.Caption);
- string url = type_node.PublicUrl;
-
- //
- // Add MonoMac/MonoTouch [Export] attributes, those live only in classes
- //
- XDocument type_doc = null;
- ILookup<string, XElement> prematchedMembers = null;
- bool hasExports = doc_tag == "Class" && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"));
- if (hasExports) {
- try {
- string rest, hash;
- var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
- type_doc = XDocument.Load (GetHelpStream (id));
- prematchedMembers = type_doc.Root.Element ("Members").Elements ("Member").ToLookup (n => (string)n.Attribute ("MemberName"), n => n);
- } catch (Exception e) {
- Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
- hasExports = false;
- }
- }
-
- if (doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"){
- index_maker.Add (type_node.Caption, typename, url);
- index_maker.Add (full + " " + doc_tag, full, url);
-
- foreach (Node c in type_node.ChildNodes){
- switch (c.Caption){
- case "Constructors":
- index_maker.Add (" constructors", typename+"0", url + "/C");
- break;
- case "Fields":
- index_maker.Add (" fields", typename+"1", url + "/F");
- break;
- case "Events":
- index_maker.Add (" events", typename+"2", url + "/E");
- break;
- case "Properties":
- index_maker.Add (" properties", typename+"3", url + "/P");
- break;
- case "Methods":
- index_maker.Add (" methods", typename+"4", url + "/M");
- break;
- case "Operators":
- index_maker.Add (" operators", typename+"5", url + "/O");
- break;
- }
- }
-
- //
- // Now repeat, but use a different sort key, to make sure we come after
- // the summary data above, start the counter at 6
- //
- string keybase = typename + "6.";
-
- foreach (Node c in type_node.ChildNodes){
- var type = c.Caption[0];
-
- foreach (Node nc in c.ChildNodes) {
- string res = nc.Caption;
- string nurl = nc.PublicUrl;
-
- // Process exports
- if (hasExports && (type == 'C' || type == 'M' || type == 'P')) {
- try {
- var member = GetMemberFromCaption (type_doc, type == 'C' ? ".ctor" : res, false, prematchedMembers);
- var exports = member.Descendants ("AttributeName").Where (a => a.Value.Contains ("Foundation.Export"));
- foreach (var exportNode in exports) {
- var parts = exportNode.Value.Split ('"');
- if (parts.Length != 3) {
- Console.WriteLine ("Export attribute not found or not usable in {0}", exportNode);
- } else {
- var export = parts[1];
- index_maker.Add (export + " selector", export, nurl);
- }
- }
- } catch (Exception e) {
- Console.WriteLine ("Problem processing {0}/{1} for MonoTouch/MonoMac exports\n\n{2}", nurl, res, e);
- }
- }
-
- switch (type){
- case 'C':
- break;
- case 'F':
- index_maker.Add (String.Format ("{0}.{1} field", typename, res),
- keybase + res, nurl);
- index_maker.Add (String.Format ("{0} field", res), res, nurl);
- break;
- case 'E':
- index_maker.Add (String.Format ("{0}.{1} event", typename, res),
- keybase + res, nurl);
- index_maker.Add (String.Format ("{0} event", res), res, nurl);
- break;
- case 'P':
- index_maker.Add (String.Format ("{0}.{1} property", typename, res),
- keybase + res, nurl);
- index_maker.Add (String.Format ("{0} property", res), res, nurl);
- break;
- case 'M':
- index_maker.Add (String.Format ("{0}.{1} method", typename, res),
- keybase + res, nurl);
- index_maker.Add (String.Format ("{0} method", res), res, nurl);
- break;
- case 'O':
- index_maker.Add (String.Format ("{0}.{1} operator", typename, res),
- keybase + res, nurl);
- break;
- }
- }
- }
- } else if (doc_tag == "Enumeration"){
- //
- // Enumerations: add the enumeration values
- //
- index_maker.Add (type_node.Caption, typename, url);
- index_maker.Add (full + " " + doc_tag, full, url);
-
- // Now, pull the values.
- string rest, hash;
- var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
- var xdoc = XDocument.Load (GetHelpStream (id));
- if (xdoc == null)
- continue;
-
- var members = xdoc.Root.Element ("Members").Elements ("Members");
- if (members == null)
- continue;
-
- foreach (var member_node in members){
- string enum_value = member_node.Attribute ("MemberName").Value;
- string caption = enum_value + " value";
- index_maker.Add (caption, caption, url);
- }
- } else if (doc_tag == "Delegate"){
- index_maker.Add (type_node.Caption, typename, url);
- index_maker.Add (full + " " + doc_tag, full, url);
- }
- }
- }
- }
-
-
- public override void PopulateSearchableIndex (IndexWriter writer)
- {
- StringBuilder text = new StringBuilder ();
- SearchableDocument searchDoc = new SearchableDocument ();
-
- foreach (Node ns_node in Tree.RootNode.ChildNodes) {
- foreach (Node type_node in ns_node.ChildNodes) {
- string typename = type_node.Caption.Substring (0, type_node.Caption.IndexOf (' '));
- string full = ns_node.Caption + "." + typename;
- string url = type_node.PublicUrl;
- string doc_tag = GetKindFromCaption (type_node.Caption);
- string rest, hash;
- var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
- var xdoc = XDocument.Load (GetHelpStream (id));
- if (xdoc == null)
- continue;
- if (string.IsNullOrEmpty (doc_tag))
- continue;
-
- // For classes, structures or interfaces add a doc for the overview and
- // add a doc for every constructor, method, event, ...
- // doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"
- if (doc_tag[0] == 'C' || doc_tag[0] == 'S' || doc_tag[0] == 'I') {
- // Adds a doc for every overview of every type
- SearchableDocument doc = searchDoc.Reset ();
- doc.Title = type_node.Caption;
- doc.HotText = typename;
- doc.Url = url;
- doc.FullTitle = full;
-
- var node_sel = xdoc.Root.Element ("Docs");
- text.Clear ();
- GetTextFromNode (node_sel, text);
- doc.Text = text.ToString ();
-
- text.Clear ();
- GetExamples (node_sel, text);
- doc.Examples = text.ToString ();
-
- writer.AddDocument (doc.LuceneDoc);
- var exportParsable = doc_tag[0] == 'C' && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"));
-
- //Add docs for contructors, methods, etc.
- foreach (Node c in type_node.ChildNodes) { // c = Constructors || Fields || Events || Properties || Methods || Operators
- if (c.Element == "*")
- continue;
- const float innerTypeBoost = 0.2f;
-
- IEnumerable<Node> ncnodes = c.ChildNodes;
- // The rationale is that we need to properly handle method overloads
- // so for those method node which have children, flatten them
- if (c.Caption == "Methods") {
- ncnodes = ncnodes
- .Where (n => n.ChildNodes == null || n.ChildNodes.Count == 0)
- .Concat (ncnodes.Where (n => n.ChildNodes.Count > 0).SelectMany (n => n.ChildNodes));
- } else if (c.Caption == "Operators") {
- ncnodes = ncnodes
- .Where (n => !n.Caption.EndsWith ("Conversion"))
- .Concat (ncnodes.Where (n => n.Caption.EndsWith ("Conversion")).SelectMany (n => n.ChildNodes));
- }
-
- var prematchedMembers = xdoc.Root.Element ("Members").Elements ("Member").ToLookup (n => (string)n.Attribute ("MemberName"), n => n);
-
- foreach (Node nc in ncnodes) {
- XElement docsNode = null;
- try {
- docsNode = GetDocsFromCaption (xdoc, c.Caption[0] == 'C' ? ".ctor" : nc.Caption, c.Caption[0] == 'O', prematchedMembers);
- } catch {}
- if (docsNode == null) {
- Console.Error.WriteLine ("Problem: {0}", nc.PublicUrl);
- continue;
- }
-
- SearchableDocument doc_nod = searchDoc.Reset ();
- doc_nod.Title = LargeName (nc) + " " + EcmaDoc.EtcKindToCaption (c.Caption[0]);
- doc_nod.FullTitle = ns_node.Caption + '.' + typename + "::" + nc.Caption;
- doc_nod.HotText = string.Empty;
-
- /* Disable constructors hottext indexing as it's often "polluting" search queries
- because it has the same hottext than standard types */
- if (c.Caption != "Constructors") {
- //dont add the parameters to the hottext
- int ppos = nc.Caption.IndexOf ('(');
- doc_nod.HotText = ppos != -1 ? nc.Caption.Substring (0, ppos) : nc.Caption;
- }
-
- var urlnc = nc.PublicUrl;
- doc_nod.Url = urlnc;
-
- text.Clear ();
- GetTextFromNode (docsNode, text);
- doc_nod.Text = text.ToString ();
-
- text.Clear ();
- GetExamples (docsNode, text);
- doc_nod.Examples = text.ToString ();
-
- Document lucene_doc = doc_nod.LuceneDoc;
- lucene_doc.Boost = innerTypeBoost;
- writer.AddDocument (lucene_doc);
-
- // Objective-C binding specific parsing of [Export] attributes
- if (exportParsable) {
- try {
- var exports = docsNode.Parent.Elements ("Attributes").Elements ("Attribute").Elements ("AttributeName")
- .Select (a => (string)a).Where (txt => txt.Contains ("Foundation.Export"));
-
- foreach (var exportNode in exports) {
- var parts = exportNode.Split ('"');
- if (parts.Length != 3) {
- Console.WriteLine ("Export attribute not found or not usable in {0}", exportNode);
- continue;
- }
-
- var export = parts[1];
- var export_node = searchDoc.Reset ();
- export_node.Title = export + " Export";
- export_node.FullTitle = ns_node.Caption + '.' + typename + "::" + export;
- export_node.Url = urlnc;
- export_node.HotText = export;
- export_node.Text = string.Empty;
- export_node.Examples = string.Empty;
- lucene_doc = export_node.LuceneDoc;
- lucene_doc.Boost = innerTypeBoost;
- writer.AddDocument (lucene_doc);
- }
- } catch (Exception e){
- Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
- }
- }
- }
- }
- // doc_tag == "Enumeration"
- } else if (doc_tag[0] == 'E'){
- var members = xdoc.Root.Element ("Members").Elements ("Member");
- if (members == null)
- continue;
-
- text.Clear ();
- foreach (var member_node in members) {
- string enum_value = (string)member_node.Attribute ("MemberName");
- text.Append (enum_value);
- text.Append (" ");
- GetTextFromNode (member_node.Element ("Docs"), text);
- text.AppendLine ();
- }
-
- SearchableDocument doc = searchDoc.Reset ();
-
- text.Clear ();
- GetExamples (xdoc.Root.Element ("Docs"), text);
- doc.Examples = text.ToString ();
-
- doc.Title = type_node.Caption;
- doc.HotText = (string)xdoc.Root.Attribute ("Name");
- doc.FullTitle = full;
- doc.Url = url;
- doc.Text = text.ToString();
- writer.AddDocument (doc.LuceneDoc);
- // doc_tag == "Delegate"
- } else if (doc_tag[0] == 'D'){
- SearchableDocument doc = searchDoc.Reset ();
- doc.Title = type_node.Caption;
- doc.HotText = (string)xdoc.Root.Attribute ("Name");
- doc.FullTitle = full;
- doc.Url = url;
-
- var node_sel = xdoc.Root.Element ("Docs");
-
- text.Clear ();
- GetTextFromNode (node_sel, text);
- doc.Text = text.ToString();
-
- text.Clear ();
- GetExamples (node_sel, text);
- doc.Examples = text.ToString();
-
- writer.AddDocument (doc.LuceneDoc);
- }
- }
- }
- }
-
- string GetKindFromCaption (string s)
- {
- int p = s.LastIndexOf (' ');
- if (p > 0)
- return s.Substring (p + 1);
- return null;
- }
-
- // Extract the interesting text from the docs node
- void GetTextFromNode (XElement n, StringBuilder sb)
- {
- // Include the text content of the docs
- sb.AppendLine (n.Value);
- foreach (var tag in n.Descendants ())
- //include the url to which points the see tag and the name of the parameter
- if ((tag.Name.LocalName.Equals ("see", StringComparison.Ordinal) || tag.Name.LocalName.Equals ("paramref", StringComparison.Ordinal))
- && tag.HasAttributes)
- sb.AppendLine ((string)tag.Attributes ().First ());
- }
-
- // Extract the code nodes from the docs
- void GetExamples (XElement n, StringBuilder sb)
- {
- foreach (var code in n.Descendants ("code"))
- sb.Append ((string)code);
- }
-
- // Extract a large name for the Node
- static string LargeName (Node matched_node)
- {
- string[] parts = matched_node.GetInternalUrl ().Split('/', '#');
- if (parts.Length == 3 && parts[2] != String.Empty) //List of Members, properties, events, ...
- return parts[1] + ": " + matched_node.Caption;
- else if(parts.Length >= 4) //Showing a concrete Member, property, ...
- return parts[1] + "." + matched_node.Caption;
- else
- return matched_node.Caption;
- }
-
- XElement GetMemberFromCaption (XDocument xdoc, string caption, bool isOperator, ILookup<string, XElement> prematchedMembers)
- {
- string name;
- IList<string> args;
- var doc = xdoc.Root.Element ("Members").Elements ("Member");
-
- if (isOperator) {
- // The first case are explicit and implicit conversion operators which are grouped specifically
- if (caption.IndexOf (" to ") != -1) {
- var convArgs = caption.Split (new[] { " to " }, StringSplitOptions.None);
- return doc
- .First (n => (AttrEq (n, "MemberName", "op_Explicit") || AttrEq (n, "MemberName", "op_Implicit"))
- && ((string)n.Element ("ReturnValue").Element ("ReturnType")).Equals (convArgs[1], StringComparison.Ordinal)
- && AttrEq (n.Element ("Parameters").Element ("Parameter"), "Type", convArgs[0]));
- } else {
- return doc.First (m => AttrEq (m, "MemberName", "op_" + caption));
- }
- }
-
- TryParseCaption (caption, out name, out args);
-
- if (!string.IsNullOrEmpty (name)) { // Filter member by name
- var prematched = prematchedMembers[name];
- doc = prematched.Any () ? prematched : doc.Where (m => AttrEq (m, "MemberName", name));
- }
- if (args != null && args.Count > 0) // Filter member by its argument list
- doc = doc.Where (m => m.Element ("Parameters").Elements ("Parameter").Attributes ("Type").Select (a => (string)a).SequenceEqual (args));
-
- return doc.First ();
- }
-
- XElement GetDocsFromCaption (XDocument xdoc, string caption, bool isOperator, ILookup<string, XElement> prematchedMembers)
- {
- return GetMemberFromCaption (xdoc, caption, isOperator, prematchedMembers).Element ("Docs");
- }
-
- // A simple stack-based parser to detect single type definition separated by commas
- IEnumerable<string> ExtractArguments (string rawArgList)
- {
- var sb = new System.Text.StringBuilder ();
- int genericDepth = 0;
- int arrayDepth = 0;
-
- for (int i = 0; i < rawArgList.Length; i++) {
- char c = rawArgList[i];
- switch (c) {
- case ',':
- if (genericDepth == 0 && arrayDepth == 0) {
- yield return sb.ToString ();
- sb.Clear ();
- continue;
- }
- break;
- case '<':
- genericDepth++;
- break;
- case '>':
- genericDepth--;
- break;
- case '[':
- arrayDepth++;
- break;
- case ']':
- arrayDepth--;
- break;
- }
- sb.Append (c);
- }
- if (sb.Length > 0)
- yield return sb.ToString ();
- }
-
- void TryParseCaption (string caption, out string name, out IList<string> argList)
- {
- name = null;
- argList = null;
- int parenIdx = caption.IndexOf ('(');
- // In case of simple name, there is no need for processing
- if (parenIdx == -1) {
- name = caption;
- return;
- }
- name = caption.Substring (0, parenIdx);
- // Now we gather the argument list if there is any
- var rawArgList = caption.Substring (parenIdx + 1, caption.Length - parenIdx - 2); // Only take what's inside the parens
- if (string.IsNullOrEmpty (rawArgList))
- return;
-
- argList = ExtractArguments (rawArgList).Select (arg => arg.Trim ()).ToList ();
- }
-
- bool AttrEq (XElement element, string attributeName, string expectedValue)
- {
- return ((string)element.Attribute (attributeName)).Equals (expectedValue, StringComparison.Ordinal);
- }
- }
-}
+++ /dev/null
-//
-// The ecmaspec provider is for ECMA specifications
-//
-// Authors:
-// John Luke (jluke@cfl.rr.com)
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// Use like this:
-// mono assembler.exe --ecmaspec DIRECTORY --out name
-//
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using System.Xml.XPath;
-using System.Xml.Xsl;
-using System.Xml;
-using System.Collections.Generic;
-using Lucene.Net.Index;
-using Lucene.Net.Documents;
-
-namespace Monodoc.Providers
-{
- public class EcmaSpecProvider : Provider
- {
- string basedir;
-
- public EcmaSpecProvider (string base_directory)
- {
- basedir = base_directory;
- if (!Directory.Exists (basedir))
- throw new DirectoryNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
- }
-
- public override void PopulateTree (Tree tree)
- {
- XPathNavigator n = new XPathDocument (Path.Combine (basedir, "toc.xml")).CreateNavigator ();
- n.MoveToRoot ();
- n.MoveToFirstChild ();
- PopulateNode (n.SelectChildren ("node", ""), tree.RootNode);
- }
-
- void PopulateNode (XPathNodeIterator nodes, Node treeNode)
- {
- foreach (XPathNavigator n in nodes) {
- string secNumber = n.GetAttribute ("number", "");
- string secName = n.GetAttribute ("name", "");
-
- var storage = treeNode.Tree.HelpSource.Storage;
- using (var file = File.OpenRead (Path.Combine (basedir, secNumber + ".xml")))
- storage.Store (secNumber, file);
-
- Node thisNode = treeNode.GetOrCreateNode (secNumber + ": " + secName, "ecmaspec:" + secNumber);
-
- if (n.HasChildren)
- PopulateNode (n.SelectChildren ("node", ""), thisNode);
- }
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- }
- }
-
- public class EcmaSpecHelpSource : HelpSource
- {
- const string EcmaspecPrefix = "ecmaspec:";
- const string TocPart = "%toc"; // What is returned as TocXml
- const string SpecPart = "%spec"; // What is returned as Ecmaspec
-
- public EcmaSpecHelpSource (string base_file, bool create) : base (base_file, create)
- {
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return id.EndsWith (TocPart) ? DocumentType.TocXml : DocumentType.EcmaSpecXml;
- }
-
- public override bool IsGeneratedContent (string id)
- {
- return id == "root:" || id.EndsWith (TocPart);
- }
-
- public override bool IsMultiPart (string id, out IEnumerable<string> parts)
- {
- if (id == "root:" || id.EndsWith (TocPart) || id.EndsWith (SpecPart)) {
- parts = null;
- return false;
- }
- parts = MakeMultiPart (id);
- return true;
- }
-
- IEnumerable<string> MakeMultiPart (string baseId)
- {
- yield return baseId + SpecPart;
- yield return baseId + TocPart;
- }
-
- public override string GetText (string id)
- {
- Node n = id == "root:" ? Tree.RootNode : MatchNode (EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length));
- if (n == null)
- throw new ArgumentException ("id", string.Format ("{0} -> {1}", id, EcmaspecPrefix + id.Substring (0, id.Length - TocPart.Length)));
- return TreeDumper.ExportToTocXml (n, "C# Language Specification", "In this section:");
- }
-
- public override Stream GetHelpStream (string id)
- {
- return id.EndsWith (SpecPart) ? base.GetHelpStream (id.Substring (0, id.IndexOf (SpecPart))) : base.GetHelpStream (id);
- }
-
- public override void PopulateSearchableIndex (IndexWriter writer)
- {
- foreach (Node n in Tree.RootNode.ChildNodes)
- AddDocuments (writer, n);
- }
-
- protected override string UriPrefix {
- get {
- return EcmaspecPrefix;
- }
- }
-
- void AddDocuments (IndexWriter writer, Node node)
- {
- string url = node.PublicUrl;
- Stream file_stream = GetHelpStream (url.Substring (9));
- if (file_stream == null) //Error
- return;
- XmlDocument xdoc = new XmlDocument ();
- xdoc.Load (new XmlTextReader (file_stream));
-
- //Obtain the title
- XmlNode nelem = xdoc.DocumentElement;
- string title = nelem.Attributes["number"].Value + ": " + nelem.Attributes["title"].Value;
-
- //Obtain the text
- StringBuilder s = new StringBuilder ();
- GetTextNode (nelem, s);
- string text = s.ToString ();
-
- //Obtain the examples
- StringBuilder s2 = new StringBuilder ();
- GetExamples (nelem, s2);
- string examples = s2.ToString ();
-
- //Write to the Lucene Index all the parts
- SearchableDocument doc = new SearchableDocument ();
- doc.Title = title;
- doc.HotText = title.Substring (title.IndexOf (':'));
- doc.Url = url;
- doc.Text = text;
- doc.Examples = examples;
- writer.AddDocument (doc.LuceneDoc);
-
- if (node.IsLeaf)
- return;
-
- foreach (Node n in node.ChildNodes)
- AddDocuments (writer, n);
- }
-
- void GetTextNode (XmlNode n, StringBuilder s)
- {
- //dont include c# code
- if (n.Name == "code_example")
- return;
- //include all text from nodes
- if (n.NodeType == XmlNodeType.Text)
- s.Append (n.Value);
-
- //recursively explore all nodes
- if (n.HasChildNodes)
- foreach (XmlNode n_child in n.ChildNodes)
- GetTextNode (n_child, s);
- }
-
- void GetExamples (XmlNode n, StringBuilder s)
- {
- if (n.Name == "code_example") {
- if (n.FirstChild.Name == "#cdata-section")
- s.Append (n.FirstChild.Value);
- } else {
- if (n.HasChildNodes)
- foreach (XmlNode n_child in n.ChildNodes)
- GetExamples (n_child, s);
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-using System.Collections.Generic;
-
-using Lucene.Net.Index;
-using Lucene.Net.Documents;
-
-using Monodoc.Ecma;
-using Monodoc.Storage;
-using Mono.Utilities;
-
-namespace Monodoc.Providers
-{
- public class EcmaUncompiledHelpSource : EcmaHelpSource
- {
- readonly DirectoryInfo basedir;
- readonly string basedoc;
-
- public readonly string BasePath;
-
- public new string Name {
- get;
- private set;
- }
-
- /* base_file: the directory containing the index.xml file, usually in Mono land .../Documentation/en
- * markName: if true, we encase the node caption with [] to clearly mark it's from an uncompiled source
- */
- public EcmaUncompiledHelpSource (string base_file, bool markName = true) : base ()
- {
- basedir = new DirectoryInfo (base_file);
- BasePath = basedir.FullName;
-
- basedoc = Path.Combine (basedir.FullName, "index.xml");
-
- Name = ((string)XDocument.Load (basedoc).Root.Element ("Title")) ?? "UnnamedUncompiledSource";
- if (markName)
- Name = '[' + Name + ']';
- Tree.RootNode.Caption = Name;
-
- Func<XElement, string> indexGenerator = type => {
- var nsName = (string)type.Parent.Attribute ("Name");
- var typeName = (string)type.Attribute ("Name");
- return Path.ChangeExtension (nsName + '/' + typeName, ".xml");
- };
-
- this.Storage = new UncompiledDocStorage (BasePath);
-
- EcmaDoc.PopulateTreeFromIndexFile (basedoc, UriPrefix, Tree, null, null, indexGenerator);
- }
-
- protected override string UriPrefix {
- get {
- return "uncompiled:";
- }
- }
-
- public override Stream GetImage (string url)
- {
- var path = Path.Combine (BasePath, "_images", url);
- return File.Exists (path) ? File.OpenRead (path) : (Stream)null;
- }
- }
-}
+++ /dev/null
-//
-// error-provider.cs
-//
-// Author:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-// Copyright 2003-2011 Novell
-// Copyright 2011 Xamarin Inc
-//
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-using System.Linq;
-using Lucene.Net.Index;
-using Lucene.Net.Documents;
-
-namespace Monodoc.Providers
-{
- public class ErrorProviderConfig
- {
- public string FilesPath;
- public string Match;
- public int ErrorNumSubstringStart;
- public int ErrorNumSubstringLength;
- public string FriendlyFormatString;
-
- public override string ToString ()
- {
- var sb = new StringBuilder ();
- var w = new StringWriter (sb);
-
- w.WriteLine ("FilesPath: {0}", FilesPath);
- w.WriteLine ("Match: {0}", Match);
- w.WriteLine ("Error Number Substring: {0} Length:{1}", ErrorNumSubstringStart, ErrorNumSubstringLength);
- w.WriteLine ("FriendlyFormatString: {0}", FriendlyFormatString);
-
- return w.ToString ();
- }
-
- public Dictionary<string, ErrorDocumentation> Compile (HelpSource hs)
- {
- string[] files = Directory.GetFiles (FilesPath, Match);
- var ret = new Dictionary<string, ErrorDocumentation> ();
-
- foreach (string s in files) {
- ErrorDocumentation d;
- int errorNum = 0;
-
- try {
- errorNum = int.Parse (Path.GetFileName (s).Substring (ErrorNumSubstringStart, ErrorNumSubstringLength));
- } catch {
- Console.WriteLine ("Ignoring file {0}", s);
- }
-
- string errorName = String.Format (FriendlyFormatString, errorNum);
-
- if (!ret.TryGetValue (errorName, out d))
- ret[errorName] = d = new ErrorDocumentation (errorName);
-
- if (d.Details == null) {
- string xmlFile = Path.ChangeExtension (s, "xml");
- if (File.Exists (xmlFile)) {
- XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorDetails));
- d.Details = (ErrorDetails)cfgRdr.Deserialize (new XmlTextReader (xmlFile));
- }
- }
- // Encoding is same as used in MCS, so we will be able to do all those files
- using (StreamReader reader = new StreamReader (s, Encoding.GetEncoding (28591))) {
- d.Examples.Add (reader.ReadToEnd ());
- }
- }
-
- return ret;
- }
- }
-
- public class ErrorDocumentation
- {
- public string ErrorName;
- public ErrorDetails Details;
- public List<string> Examples = new List<string> ();
-
- public ErrorDocumentation () {}
- public ErrorDocumentation (string ErrorName)
- {
- this.ErrorName = ErrorName;
- }
- }
-
- public class ErrorDetails
- {
- public XmlNode Summary;
- public XmlNode Details;
- }
-
- public class ErrorProvider : Provider
- {
- ErrorProviderConfig config;
-
- public ErrorProvider (string configFile)
- {
- config = ReadConfig (configFile);
- }
-
- public static ErrorProviderConfig ReadConfig (string file)
- {
- XmlSerializer cfgRdr = new XmlSerializer (typeof (ErrorProviderConfig));
- ErrorProviderConfig ret = (ErrorProviderConfig)cfgRdr.Deserialize (new XmlTextReader (file));
- // handle path rel to the config file
- ret.FilesPath = Path.Combine (Path.GetDirectoryName (file), ret.FilesPath);
- return ret;
- }
-
- public override void PopulateTree (Tree tree)
- {
- // everything is done in CloseTree so we can pack
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- var entries = config.Compile (hs);
- MemoryStream ms = new MemoryStream ();
- XmlSerializer writer = new XmlSerializer (typeof (ErrorDocumentation));
-
- foreach (var de in entries) {
- ErrorDocumentation d = de.Value;
- string s = de.Key;
-
- tree.RootNode.GetOrCreateNode (s, "error:" + s);
-
- writer.Serialize (ms, d);
- ms.Position = 0;
- hs.Storage.Store (s, ms);
- ms.SetLength (0);
- }
-
- tree.RootNode.Sort ();
- }
- }
-
- public class ErrorHelpSource : HelpSource
- {
- public ErrorHelpSource (string base_file, bool create) : base (base_file, create)
- {
- }
-
- public override string GetText (string id)
- {
- return TreeDumper.ExportToTocXml (Tree.RootNode, "Compiler Error Reference", "In this section:");
- }
-
- protected override string UriPrefix {
- get {
- return "error:";
- }
- }
-
- public override bool IsGeneratedContent (string id)
- {
- return id == "root:";
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return id == "root:" ? DocumentType.TocXml : DocumentType.ErrorXml;
- }
-
- public override string GetInternalIdForUrl (string url, out Node node, out Dictionary<string, string> context)
- {
- var result = base.GetInternalIdForUrl (url, out node, out context);
- return result.ToLower ();
- }
-
- public override void PopulateIndex (IndexMaker index_maker)
- {
- foreach (Node n in Tree.RootNode.ChildNodes)
- index_maker.Add (n.Caption, n.Caption, n.Element);
- }
-
- public override void PopulateSearchableIndex (IndexWriter writer)
- {
- foreach (Node n in Tree.RootNode.ChildNodes) {
- XmlSerializer reader = new XmlSerializer (typeof (ErrorDocumentation));
- ErrorDocumentation d = (ErrorDocumentation)reader.Deserialize (GetHelpStream (n.Element.Substring (6)));
- SearchableDocument doc = new SearchableDocument ();
- doc.Title = d.ErrorName;
- doc.Url = n.Element;
- doc.Text = d.Details != null ? d.Details.ToString () : string.Empty;
- doc.Examples = d.Examples.Cast<string> ().Aggregate ((e1, e2) => e1 + Environment.NewLine + e2);
- doc.HotText = d.ErrorName;
- writer.AddDocument (doc.LuceneDoc);
- }
- }
- }
-}
+++ /dev/null
-//
-// A provider to display man pages
-//
-// Authors:
-// Johannes Roith <johannes@roith.de>
-// Jonathan Pryor <jpryor@novell.com>
-//
-// (C) 2008 Novell, Inc.
-
-using System;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace Monodoc.Providers
-{
- public class ManProvider : Provider
- {
- string[] tocFiles;
-
- public ManProvider (string[] handbookTocFiles)
- {
- tocFiles = handbookTocFiles;
-
- // huh...
- if (!File.Exists (tocFiles[0]))
- throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFiles[0]));
- }
-
- public override void PopulateTree (Tree tree)
- {
- foreach(string TocFile in tocFiles) {
- XmlDocument doc = new XmlDocument();
- doc.Load (TocFile);
-
- XmlNodeList nodeList = doc.GetElementsByTagName("manpage");
- Node nodeToAddChildrenTo = tree.RootNode;
- var storage = nodeToAddChildrenTo.Tree.HelpSource.Storage;
-
- foreach (XmlNode node in nodeList) {
-
- XmlAttribute name = node.Attributes["name"];
- XmlAttribute page = node.Attributes["page"];
-
- if (name == null || page == null) continue;
-
- if (!File.Exists (page.Value))
- continue;
-
- string target = "man:" + name.Value;
- nodeToAddChildrenTo.CreateNode (name.Value, target);
-
- if (File.Exists (page.Value))
- using (var file = File.OpenRead (page.Value))
- storage.Store (name.Value, file);
- }
- }
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- }
- }
-
- public class ManHelpSource : HelpSource
- {
- const string ManPrefix = "man:";
- Dictionary<string, Node> nodesMap;
-
- public ManHelpSource (string base_file, bool create) : base (base_file, create)
- {
- nodesMap = Tree.RootNode.ChildNodes.ToDictionary (n => n.Element);
- }
-
- // Since man always has a flat tree and rather small amount of item
- // we store them in a dictionary
- public override Node MatchNode (string url)
- {
- Node result;
- return nodesMap.TryGetValue (url, out result) ? result : null;
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return id == "root:" ? DocumentType.TocXml : DocumentType.Man;
- }
-
- public override bool IsGeneratedContent (string id)
- {
- return id == "root:";
- }
-
- public override string GetText (string url)
- {
- return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Documentation Library", "Available man pages:");
- }
-
- protected override string UriPrefix {
- get {
- return ManPrefix;
- }
- }
- }
-}
+++ /dev/null
-//
-// The simple provider is an example provider
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Use like this:
-// mono assembler.exe --simple DIRECTORY --out name
-//
-// Then create a .source file in your sources directory, and copy
-// name.tree and name.zip to the sources directory.
-//
-// To view the tree generated, use:
-// mono dump.exe name.tree
-//
-namespace Monodoc {
-using System;
-using System.IO;
-using System.Text;
-
-//
-// The simple provider generates the information source
-//
-public class SimpleProvider : Provider {
- string basedir;
-
- public SimpleProvider (string base_directory)
- {
- basedir = base_directory;
- if (!Directory.Exists (basedir))
- throw new FileNotFoundException (String.Format ("The directory `{0}' does not exist", basedir));
- }
-
- public override void PopulateTree (Tree tree)
- {
- Node top = tree.LookupNode ("Directory at: " + basedir, "simple:");
-
- foreach (string dir in Directory.GetDirectories (basedir)){
- string url = Path.GetFileName (dir);
- Node n = top.LookupNode ("Dir: " + url, url);
- PopulateDir (n, dir);
- }
- }
-
-#pragma warning disable 219
- void PopulateDir (Node me, string dir)
- {
- Console.WriteLine ("Adding: " + dir);
- foreach (string child_dir in Directory.GetDirectories (dir)){
- string url = Path.GetFileName (child_dir);
- Node n = me.LookupNode ("Dir: " + url, "simple-directory:" + url);
- PopulateDir (me, child_dir);
- }
-
- foreach (string file in Directory.GetFiles (dir)){
- Console.WriteLine (" File: " + file);
- string file_code = me.tree.HelpSource.PackFile (file);
-
- //
- // The url element encoded for the file is:
- // originalfilename#CODE
- //
- // The code is assigned to us after the file has been packaged
- // We use the original-filename later to render html or text files
- //
- Node n = me.LookupNode (Path.GetFileName (file), file + "#" + file_code);
-
- }
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- }
-}
-
-//
-// The HelpSource is used during the rendering phase.
-//
-
-public class SimpleHelpSource : HelpSource {
- Encoding enc;
-
- public SimpleHelpSource (string base_file, bool create) : base (base_file, create)
- {
- enc = new UTF8Encoding (false, false);
- }
-
- public override string GetText (string url, out Node match_node)
- {
- match_node = null;
-
- string c = GetCachedText (url);
- if (c != null)
- return c;
-
- if (url.StartsWith ("simple:") || url.StartsWith ("simple-directory:"))
- return GetTextFromUrl (url);
-
- return null;
- }
-
- string GetTextFromUrl (string url)
- {
- // Remove "simple:" prefix
- url = url.Substring (7);
-
- if (url.StartsWith ("simple-directory:"))
- return String.Format ("<html>This is a directory entry point: {0} </html>",
- url.Substring (17));
-
- // Otherwise the last element of the url is the file code we got.
- int pound = url.LastIndexOf ("#");
- string code;
- if (pound == -1)
- code = url;
- else
- code = url.Substring (pound+1);
-
-
- Stream s = GetHelpStream (code);
- if (s == null)
- return String.Format ("<html>No stream for this node: {0} </html>", url);
-
- //
- // Now, get the file type
- //
- int slash = url.LastIndexOf ("/");
- string fname = url.Substring (slash + 1, pound - slash - 1).ToLower ();
-
- if (fname.EndsWith (".html") || fname.EndsWith (".htm")){
- TextReader r = new StreamReader (s, enc);
- return r.ReadToEnd ();
- }
-
- if (fname.EndsWith (".png") || fname.EndsWith (".jpg") ||
- fname.EndsWith (".jpeg") || fname.EndsWith (".gif")){
- return "<html>Image file, have not implemented rendering this yet</html>";
- }
-
- // Convert text to HTML
- StringBuilder result = new StringBuilder ("<html>");
- TextReader reader = new StreamReader (s, enc);
- string line;
-
- while ((line = reader.ReadLine ()) != null){
- result.Append (line);
- result.Append ("<br>");
- }
- result.Append ("<html>");
- return result.ToString ();
- }
-}
-}
+++ /dev/null
-//
-// A provider that uses Windows help file xhtml TOC files and looks for the
-// referenced documents to create the help source.
-//
-// Authors:
-// Copyright 2003 Lee Mallabone <gnome@fonicmonkey.net>
-// Johannes Roith <johannes@roith.de>
-// Miguel de Icaza <miguel@ximian.com>
-
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace Monodoc.Providers
-{
- public class XhtmlProvider : Provider
- {
- string tocFile;
- readonly XNamespace ns = "http://www.w3.org/1999/xhtml";
-
- public XhtmlProvider (string handbookTocFile)
- {
- tocFile = handbookTocFile;
- if (!File.Exists (tocFile))
- throw new FileNotFoundException (String.Format ("The table of contents, `{0}' does not exist", tocFile));
- }
-
- public override void PopulateTree (Tree tree)
- {
- var doc = XDocument.Load (tocFile);
- var uls = doc.Descendants (ns + "body").First ().Elements (ns + "ul");
- foreach (var ul in uls)
- ParseUl (tree, tree.RootNode, ul);
- }
-
- void ParseUl (Tree tree, Node parent, XElement ul)
- {
- var storage = tree.HelpSource.Storage;
- foreach (var e in ul.Elements (ns + "li")) {
- var inner = e.Element (ns + "object");
- if (inner == null)
- continue;
- string caption, element;
- ObjectEntryToParams (inner, out caption, out element);
- // Don't add if the backing file doesn't exist
- if (!File.Exists (element)) {
- Console.Error.WriteLine ("Warning: File `{0}' referenced in TOC but it doesn't exist. It will be ignored.", element);
- continue;
- }
- using (var file = File.OpenRead (element))
- storage.Store (element, file);
- parent.CreateNode (caption, XhtmlHelpSource.XhtmlPrefix + element);
- }
- }
-
- void ObjectEntryToParams (XElement obj, out string caption, out string element)
- {
- var ps = obj.Elements (ns + "param");
- caption = ps
- .Where (p => p.Attribute ("name").Value == "Name")
- .Select (p => (string)p.Attribute ("value"))
- .FirstOrDefault ();
- caption = caption ?? string.Empty;
-
- element = ps
- .Where (p => p.Attribute ("name").Value == "Local")
- .Select (p => (string)p.Attribute ("value"))
- .FirstOrDefault ();
- element = element ?? string.Empty;
- }
-
- public override void CloseTree (HelpSource hs, Tree tree)
- {
- }
- }
-
- public class XhtmlHelpSource : HelpSource
- {
- public XhtmlHelpSource (string base_file, bool create) : base (base_file, create)
- {
-
- }
-
- internal const string XhtmlPrefix = "xhtml:";
-
- protected override string UriPrefix {
- get {
- return XhtmlPrefix;
- }
- }
-
- public override SortType SortType {
- get {
- return SortType.Element;
- }
- }
-
- public override DocumentType GetDocumentTypeForId (string id)
- {
- return id == "root:" ? DocumentType.TocXml : DocumentType.MonoBook;
- }
-
- public override bool IsGeneratedContent (string id)
- {
- return id == "root:";
- }
-
- public override string GetText (string url)
- {
- return TreeDumper.ExportToTocXml (Tree.RootNode, "Mono Handbook", string.Empty);
- }
-
- public static string GetAbsoluteLink(string target, string url)
- {
- string value = null;
-
- if (target.StartsWith ("#") ||
- target.StartsWith ("T:") ||
- target.StartsWith ("M:") ||
- target.StartsWith ("P:") ||
- target.StartsWith ("T:") ||
- target.StartsWith ("E:") ||
- target.StartsWith ("F:") ||
- target.StartsWith ("O:") ||
- target.StartsWith ("N:") ||
- target.StartsWith ("api:"))
- return null;
-
- int endp = target.IndexOf(':');
-
- if (endp == -1)
- endp = 0;
- string protocol = target.Substring(0, endp);
- switch (protocol) {
- case "mailto":
- case "http":
- case "https":
- case "ftp":
- case "news":
- case "irc":
- break;
- default:
- // handle absolute urls like: /html/en/images/empty.png
- if (!target.StartsWith("/")) {
-
- // url is something like "gnome/bindings/mono.html"
- // This will get the path "gnome/bindings"
-
- int slash = url.LastIndexOf ("/");
- string tmpurl = url;
-
- if (slash != -1)
- tmpurl = url.Substring(0, slash);
-
- // Count "../" in target and go one level down
- // for each in tmpurl, eventually, then remove "../".
-
- Regex reg1 = new Regex("../");
- MatchCollection matches = reg1.Matches(target);
-
- for(int i = 1; i < matches.Count; i++) {
- slash = tmpurl.LastIndexOf ("/");
- if (slash != -1)
- tmpurl = tmpurl.Substring(0, slash);
- }
-
- target = target.Replace("../", "");
-
- value = tmpurl + "/" + target;
-
- } else {
- value = target.Substring(1, target.Length - 1);
- }
- break;
- }
- return value;
- }
-
- XmlDocument RewriteLinks(XmlDocument docToProcess, string url)
- {
- XmlNodeList nodeList = docToProcess.GetElementsByTagName("a");
-
- foreach(XmlNode node in nodeList) {
-
- XmlElement element = (XmlElement) node;
-
- if (element.HasAttribute("href") ){
-
- XmlAttribute href = element.GetAttributeNode("href");
- string target = href.Value;
-
- target = GetAbsoluteLink(target, url);
- if (target != null) {
- string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
- href.Value = newtarget;
- }
- }
- }
-
- nodeList = docToProcess.GetElementsByTagName("img");
-
- foreach(XmlNode node in nodeList) {
-
- XmlElement element = (XmlElement) node;
-
- if (element.HasAttribute("src") ){
-
- XmlAttribute href = element.GetAttributeNode("src");
- string target = href.Value;
-
- target = GetAbsoluteLink(target, url);
- if (target != null) {
- string newtarget = String.Format ("source-id:{0}:xhtml:{1}", SourceID, target);
- href.Value = newtarget;
- }
- }
- }
-
- return docToProcess;
- }
-
- public override void PopulateIndex (IndexMaker index_maker)
- {
- PopulateIndexFromNodes (Tree.RootNode);
- }
-
- void PopulateIndexFromNodes (Node start)
- {
- /*var nodes = start.Nodes;
-
- if (nodes != null) {
- foreach (Node n in nodes)
- PopulateIndexFromNodes (n);
- }*/
- }
- }
-}
+++ /dev/null
-using System;
-using System.Configuration;
-using System.Collections.Specialized;
-
-namespace Monodoc
-{
- public static class Config
- {
- static KeyValueConfigurationCollection libConfig;
- static KeyValueConfigurationCollection exeConfig;
-
- static Config ()
- {
- try {
- var config = ConfigurationManager.OpenExeConfiguration (System.Reflection.Assembly.GetExecutingAssembly ().Location);
- libConfig = config.AppSettings.Settings;
- } catch {}
-
- try {
- exeConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings;
- } catch {}
- }
-
- public static string Get (string key)
- {
- KeyValueConfigurationElement element = null;
- // We check the configuration in order: app first and then library itself
- if (exeConfig != null)
- element = exeConfig[key];
- if (element == null && libConfig != null)
- element = libConfig[key];
-
- return element == null ? null : element.Value;
- }
-
- public static KeyValueConfigurationCollection AppSettings {
- get {
- return exeConfig;
- }
- }
-
- public static KeyValueConfigurationCollection LibSettings {
- get {
- return libConfig;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml;
-using System.Xml.Serialization;
-
-#if LEGACY_MODE
-
-namespace Monodoc {
- [Obsolete]
- public class SettingsHandler {
- static string settingsFile;
- static XmlSerializer settingsSerializer = new XmlSerializer (typeof (Settings));
- [Obsolete]
- public static Settings Settings;
-
- static SettingsHandler ()
- {
- string rootDir = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
- Path = System.IO.Path.Combine (rootDir, "monodoc");
- settingsFile = System.IO.Path.Combine (Path, "settings.xml");
- if (File.Exists (settingsFile)) {
- try {
- using (Stream s = File.OpenRead (settingsFile)) {
- Settings = (Settings) settingsSerializer.Deserialize (s);
- }
- } catch {
- Settings = new Settings ();
- }
- } else
- Settings = new Settings ();
-
- if (Settings.preferred_font_family.Length == 0)
- Settings.preferred_font_family = "Sans";
- if (Settings.preferred_font_size <= 0)
- Settings.preferred_font_size = 100;
- }
-
- [Obsolete]
- public static void CheckUpgrade ()
- {
- // no new version
- if (Settings.LastSeenVersion == RootTree.MonodocVersion)
- return;
-
- // new install
- if (! File.Exists (settingsFile)) {
- Settings.LastSeenVersion = RootTree.MonodocVersion;
- Save ();
- return;
- }
- }
-
- [Obsolete]
- public static void Save ()
- {
- EnsureSettingsDirectory ();
- using (FileStream fs = File.Create (settingsFile)){
- settingsSerializer.Serialize (fs, Settings);
- }
- }
-
- // these can be used for other types of settings to
- [Obsolete]
- public static string Path;
-
- [Obsolete]
- public static void EnsureSettingsDirectory ()
- {
- DirectoryInfo d = new DirectoryInfo (Path);
- if (!d.Exists)
- d.Create ();
- }
- }
-
- [Obsolete]
- public class Settings {
- // public to allow serialization
- [Obsolete]
- public bool EnableEditing = true;
-
- // Last serial number commited
- [Obsolete]
- public int SerialNumber = 0;
-
- [Obsolete]
- public bool ShowInheritedMembers = false;
- [Obsolete]
- public bool ShowComments = false;
-
- [Obsolete]
- public string Email;
- [Obsolete]
- public string Key;
-
- [Obsolete]
- public int LastSeenVersion = -1;
-
- [Obsolete]
- public static bool RunningGUI = false;
-
- // fonts for rendering
- [Obsolete]
- public string preferred_font_family = "Sans";
- [Obsolete]
- public double preferred_font_size = 100;
- }
-}
-
-#endif
-
+++ /dev/null
-using System;
-using System.IO;
-using System.Collections.Generic;
-
-namespace Monodoc
-{
- // Define a storage mechanism for a help source
- public interface IDocStorage : IDisposable
- {
- // Tell if the storage can store successive change to the doc as revision
- bool SupportRevision { get; }
- IDocRevisionManager RevisionManager { get; }
-
- // Tell if the storage support modifying an existing data
- bool SupportChange { get; }
-
- /* Store data inside the storage backend
- * if SupportChange is false and user try to store something with an existing id
- * an exception will be thrown
- * if id is null or empty, the storage will try to create an automatic id. In all
- * case the id that has been used to store the content is returned by the method
- */
- string Store (string id, string text);
- string Store (string id, byte[] data);
- string Store (string id, Stream stream);
-
- Stream Retrieve (string id);
-
- IEnumerable<string> GetAvailableIds ();
- }
-
- public interface IDocRevisionManager
- {
- Stream RetrieveWithRevision (string id, string revision);
-
- // This should be ordered by most recent first
- IEnumerable<string> AvailableRevisionsForId (string id);
- // This can simply be implemented with above property but it can also be
- // a revision storage symbolic value like "HEAD"
- string LatestRevisionForId (string id);
-
- // A commit message for instance
- string GetRevisionDescription (string revision);
- }
-
- public static class DocRevisionManagerExtensions
- {
- public static Stream RetrieveLatestRevision (this IDocRevisionManager revManager, string id)
- {
- return revManager.RetrieveWithRevision (id, revManager.LatestRevisionForId (id));
- }
- }
-
- public static class DocStorageExtensions
- {
- public static bool TryRetrieve (this IDocStorage storage, string id, out Stream stream)
- {
- stream = null;
- try {
- stream = storage.Retrieve (id);
- return true;
- } catch {
- return false;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace Monodoc.Storage
-{
- // A storage that doesn't store
- public class NullStorage : IDocStorage
- {
- public NullStorage ()
- {
- }
-
- public bool SupportRevision {
- get {
- return false;
- }
- }
-
- public IDocRevisionManager RevisionManager {
- get {
- return null;
- }
- }
-
- public bool SupportChange {
- get {
- return true;
- }
- }
-
- public string Store (string id, string text)
- {
- return id;
- }
-
- public string Store (string id, byte[] data)
- {
- return id;
- }
-
- public string Store (string id, Stream stream)
- {
- return id;
- }
-
- public Stream Retrieve (string id)
- {
- return null;
- }
-
- public IEnumerable<string> GetAvailableIds ()
- {
- return Enumerable.Empty<string> ();
- }
-
- public void Dispose ()
- {
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-namespace Monodoc.Storage
-{
- // A read-only storage to access ecma XML document based on a standard directory layout
- // id are relative path inside the base doc directory
- public class UncompiledDocStorage : IDocStorage
- {
- readonly string basePath;
-
- public UncompiledDocStorage (string basePath)
- {
- this.basePath = basePath;
- }
-
- public bool SupportRevision {
- get {
- return false;
- }
- }
-
- public IDocRevisionManager RevisionManager {
- get {
- return null;
- }
- }
-
- public bool SupportChange {
- get {
- return false;
- }
- }
-
- public string Store (string id, string text)
- {
- throw new NotSupportedException ();
- }
-
- public string Store (string id, byte[] data)
- {
- throw new NotSupportedException ();
- }
-
- public string Store (string id, Stream stream)
- {
- throw new NotSupportedException ();
- }
-
- public Stream Retrieve (string id)
- {
- var path = id;
- if ('/' != Path.DirectorySeparatorChar)
- path = path.Replace ('/', Path.DirectorySeparatorChar);
- return File.OpenRead (Path.Combine (basePath, path));
- }
-
- public IEnumerable<string> GetAvailableIds ()
- {
- return Directory.EnumerateFiles (basePath, "*.xml", SearchOption.AllDirectories);
- }
-
- public void Dispose ()
- {
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Xml;
-using System.Linq;
-using System.Text;
-using System.Collections.Generic;
-
-using ICSharpCode.SharpZipLib.Zip;
-
-namespace Monodoc.Storage
-{
- public class ZipStorage : IDocStorage
- {
- string zipFileName;
- int code;
- ZipOutputStream zipOutput;
- ZipFile zipFile;
- // SharpZipLib use linear search to map name to index, correct that a bit
- Dictionary<string, int> entries = new Dictionary<string, int> ();
-
- public ZipStorage (string zipFileName)
- {
- this.zipFileName = zipFileName;
- }
-
- public bool SupportRevision {
- get {
- return false;
- }
- }
-
- public IDocRevisionManager RevisionManager {
- get {
- return null;
- }
- }
-
- public bool SupportChange {
- get {
- return true;
- }
- }
-
- public string Store (string id, string text)
- {
- EnsureOutput ();
- SetupEntry (zipOutput, ref id);
- var writer = new StreamWriter (zipOutput);
- writer.Write (text);
- writer.Flush ();
-
- return id;
- }
-
- public string Store (string id, byte[] data)
- {
- EnsureOutput ();
- SetupEntry (zipOutput, ref id);
- zipOutput.Write (data, 0, data.Length);
- return id;
- }
-
- public string Store (string id, Stream stream)
- {
- EnsureOutput ();
- SetupEntry (zipOutput, ref id);
- stream.CopyTo (zipOutput);
- return id;
- }
-
- void SetupEntry (ZipOutputStream zipOutput, ref string id)
- {
- if (string.IsNullOrEmpty (id))
- id = GetNewCode ();
-
- ZipEntry entry = new ZipEntry (id);
- zipOutput.PutNextEntry (entry);
- }
-
- public Stream Retrieve (string id)
- {
- EnsureInput ();
- int index;
- ZipEntry entry;
- if (!entries.TryGetValue (id, out index) || (entry = zipFile[index]) == null)
- entry = zipFile.GetEntry (id);
- if (entry != null)
- return zipFile.GetInputStream (entry);
- else
- throw new ArgumentException ("id", string.Format ("'{0}' isn't a valid id for this storage", id));
- }
-
- public IEnumerable<string> GetAvailableIds ()
- {
- EnsureInput ();
- return zipFile.Cast<ZipEntry> ().Select (ze => ze.Name);
- }
-
- void EnsureOutput ()
- {
- if (zipFile != null)
- throw new InvalidOperationException ("This ZipStorage instance is already used in read-mode");
- if (zipOutput != null)
- return;
- zipOutput = new ZipOutputStream (File.Create (zipFileName));
- }
-
- void EnsureInput ()
- {
- if (zipOutput != null)
- throw new InvalidOperationException ("This ZipStorage instance is already used in write-mode");
- if (zipFile != null)
- return;
- zipFile = new ZipFile (zipFileName);
- entries = Enumerable.Range (0, zipFile.Size).ToDictionary (i => zipFile[i].Name, i => i);
- }
-
- public void Dispose ()
- {
- if (zipOutput != null)
- zipOutput.Dispose ();
- if (zipFile != null)
- zipFile.Close ();
- }
-
- string GetNewCode ()
- {
- return String.Format ("{0}", code++);
- }
- }
-}
+++ /dev/null
-/helper.js -crlf
+++ /dev/null
-/*
-* base.css: CSS applied to all the docs
-*
-* Author: Mario Sopena
-*/
-
-body, table {
- margin: 0px;
-}
-
-body, table, pre, p {
- font-family: @@FONT_FAMILY@@, sans-serif;
- /* font-size: @@FONT_SIZE@@pt; */
- font-size: 11pt;
-}
-
-div.header {
- background-color: #FAFBFD;
- font-size: 1.7em;
- font-weight: bold;
- padding: 8px 0 0 10px;
- font-family: 'Segoe UI',Verdana,Arial;
-}
-
-div.title {
- font-size: 130%;
- font-weight: bolder;
- margin-top: 0.3em;
- margin-left: 0.2em;
- margin-bottom: 0.1em;
-}
-
-.subtitle {
- font-style: italic;
-}
-
-.attributionlogo {
- display:none;
- float:right;
-}
-
-div:hover > .attributionlogo,p:hover > .attributionlogo,td:hover > .attributionlogo,blockquote:hover > .attributionlogo {
- display:inline;
- float:right;
-}
+++ /dev/null
-<?xml version="1.0"?>
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
-<xsl:output omit-xml-declaration="yes" />
-
-<xsl:template match="/clause">
- <div class="header" id="ecmaspec">
- <div class="subtitle">ECMA-334 C# Language Specification</div>
- <div class="title"><xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
- <xsl:if test="@informative"> (informative) </xsl:if></div>
- </div>
- <xsl:apply-templates />
-</xsl:template>
-
-<xsl:template match="paragraph">
- <p>
- <xsl:apply-templates />
- </p>
-</xsl:template>
-
-<xsl:template match="keyword">
- <span class="keyword"> <xsl:apply-templates/></span> <xsl:text> </xsl:text>
-</xsl:template>
-
-<xsl:template match="hyperlink">
- <a href="ecmaspec:{.}">
- <xsl:value-of select="." />
- </a>
-</xsl:template>
-
-<xsl:template match="list">
- <ul>
- <xsl:for-each select="list_item|list">
- <li><xsl:apply-templates /></li>
- </xsl:for-each>
- </ul>
-</xsl:template>
-
-<xsl:template match="code_example">
- <div class="code_example">
- <div class="code_ex_title">Code example</div>
- <span class="code">
- <xsl:value-of select="monodoc:Colorize(string(descendant-or-self::text()), string('csharp'))" disable-output-escaping="yes" />
- </span>
- </div>
-</xsl:template>
-
-<xsl:template match="symbol">
- <span class="symbol">
- <xsl:apply-templates />
- </span>
-</xsl:template>
-
-<xsl:template match="grammar_production">
- <dl class="nt_{name/non_terminal/.}">
- <dt><xsl:value-of select="name/non_terminal/." /></dt>
-
- <xsl:for-each select="rhs">
- <dd>
- <xsl:apply-templates select="node()" />
- </dd>
- </xsl:for-each>
- </dl>
-</xsl:template>
-
-<xsl:template match="non_terminal">
- <span class="non_terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
-</xsl:template>
-
-<xsl:template match="terminal">
- <span class="terminal"><xsl:text> </xsl:text><xsl:value-of select="." /></span>
-</xsl:template>
-
-<xsl:template match="opt">
- <xsl:text> (</xsl:text><span class="opt">optional</span><xsl:text>) </xsl:text>
-</xsl:template>
-
-<xsl:template match="note|example">
- <div class="note">
- <xsl:apply-templates />
- </div>
-</xsl:template>
-
-<xsl:template match="table_line">
- <xsl:apply-templates /><br />
-</xsl:template>
-
-<xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
-</xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:output omit-xml-declaration="yes" />
-
-<xsl:template match="/clause">
- <table width="100%" cellpadding="5">
- <tr bgcolor="#b0c4de"><td>
- <i>ECMA-334 C# Language Specification</i>
-
- <h3>
- <xsl:value-of select="@number"/>: <xsl:value-of select="@title"/>
-
- <xsl:if test="@informative">
- (informative)
- </xsl:if>
- </h3>
- </td></tr>
- </table>
-
- <xsl:apply-templates />
-</xsl:template>
-
-<xsl:template match="paragraph">
- <p>
- <xsl:apply-templates />
- </p>
-</xsl:template>
-
-<xsl:template match="keyword">
- <i> <xsl:apply-templates/></i> <xsl:text> </xsl:text>
-</xsl:template>
-
-<xsl:template match="hyperlink">
- <a href="ecmaspec:{.}">
- <xsl:value-of select="." />
- </a>
-</xsl:template>
-
-<xsl:template match="list">
- <ul>
- <xsl:for-each select="list_item|list">
- <li><xsl:apply-templates /></li>
- </xsl:for-each>
- </ul>
-</xsl:template>
-
-<xsl:template match="code_example">
- <table bgcolor="#f5f5dd" border="1" cellpadding="5">
- <tr>
- <td>
- <pre>
- <xsl:apply-templates />
- </pre>
- </td>
- </tr>
- </table>
-</xsl:template>
-
-<xsl:template match="symbol">
- <code>
- <xsl:apply-templates />
- </code>
-</xsl:template>
-
-<xsl:template match="grammar_production">
- <dl id="nt_{name/non_terminal/.}">
- <dt><xsl:value-of select="name/non_terminal/." /></dt>
-
- <xsl:for-each select="rhs">
- <dd>
- <xsl:apply-templates select="node()" />
- </dd>
- </xsl:for-each>
- </dl>
-</xsl:template>
-
-<xsl:template match="non_terminal">
-
- <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
-</xsl:template>
-
-<xsl:template match="terminal">
- <code><xsl:text> </xsl:text><xsl:value-of select="." /></code>
-</xsl:template>
-
-<xsl:template match="opt">
- <sub>opt</sub>
-</xsl:template>
-
-<xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
-</xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-/*
-* ecmaspec.css: CSS applied to ECMA C# specs
-*
-* Author: Mario Sopena
-*/
-
-#ecmaspec {
- background: #a4dda4; /*#83b183;*/
- border: 2px solid #556655;
-}
-
-p {
- margin-top: .5em;
- margin-bottom: .5em;
-}
-
-span.keyword {
- color: #a6563a;
-}
-
-a:link {
- text-decoration: none;
-}
-
-a:hover {
- text-decoration: underline;
-}
-
-div.code_example {
- background: #f5f5dd;
- border: 1px solid #cdcd82;
- border: 1px solid black;
- padding-left: 1em;
- padding-bottom: 1em;
- margin-top: 1em;
- font-family: fixed;
- white-space: pre;
- margin-bottom: 1em;
-}
-div.code_ex_title {
- position: relative;
- top: -1em;
- left: 30%;
- background: #cdcd82;
- border: 1px solid black;
- color: black;
- text-transform: uppercase;
- width: 40%;
- padding: 0.3em;
- text-align: center;
-}
-
-span.symbol {
- font-weight: bolder;
-}
-
-
-span.optional {
- font-style: italic;
-}
-
-div.note {
- background: #cdcd82;
- border: 1px solid black;
- padding: 1em;
- margin-top: 1em;
- margin-bottom: 1em;
-}
+++ /dev/null
-function toggle_display (block) {\r
- var w = document.getElementById (block);\r
- var t = document.getElementById (block + ":toggle");\r
- if (w.style.display == "none") {\r
- w.style.display = "block";\r
- t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lminus.gif"); // <img src="xtree/images/clean/Lminus.gif">\r
- } else {\r
- w.style.display = "none";\r
- t.getElementsByTagName("img")[0].setAttribute ("src", "xtree/images/clean/Lplus.gif"); // <img src="xtree/images/clean/Lplus.gif">\r
- }\r
-}\r
-\r
+++ /dev/null
-<html>
-<head>
-<link type="text/css" rel="stylesheet" href="mono-ecma.css"/>
-</head>
-
-<body>
- <div class="Content">
- <p>The following documentation collections are available:</p>
-
- <div id="docs">
- <ul>
- @@API_DOCS@@
- </ul>
- </div>
- </div>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mdoc-html-format.xsl: HTML pass-through formatting support
-
- Author: Jonathan Pryor (jpryor@novell.com)
-
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- >
-
- <!-- pass-through any other elements unchanged - they may be HTML -->
- <xsl:template match="//format[@type='text/html']//*">
- <xsl:copy>
- <xsl:copy-of select="@*" />
- <xsl:apply-templates select="*|node()" />
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet>
-
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mdoc-html-utils.xsl: ECMA-style docs to HTML stylesheet transformation utils
-
- Author: Joshua Tauberer (tauberer@for.net)
- Author: Jonathan Pryor (jpryor@novell.com)
-
- This file requires that including files define the following callable
- templates:
- - CreateCodeBlock (language, content)
- - CreateEnumerationTable (content)
- - CreateHeader (content)
- - CreateListTable (header, content)
- - CreateMembersTable (content)
- - CreateSignature (content)
- - CreateTypeDocumentationTable (content)
- - GetLinkTarget (type, cref)
- - CreateEditLink (e)
-
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="msxsl"
- >
- <xsl:import href="mdoc-html-format.xsl" />
-
- <!-- TEMPLATE PARAMETERS -->
- <xsl:param name="language" select="'C#'"/>
- <xsl:param name="index" />
- <xsl:param name="source-id"/>
-
- <xsl:variable name="ThisType" select="/Type"/>
-
- <!-- The namespace that the current type belongs to. -->
- <xsl:variable name="TypeNamespace" select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)"/>
-
- <!-- THE MAIN RENDERING TEMPLATE -->
-
- <!-- TYPE OVERVIEW -->
-
- <xsl:template name="CreateTypeOverview">
- <xsl:param name="implemented" />
- <xsl:param name="show-members-link" />
-
- <xsl:attribute name="id">
- <xsl:text>T:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@FullName" />
- </xsl:call-template>
- <xsl:text>:Summary</xsl:text>
- </xsl:attribute>
- <!-- summary -->
- <div class="msummary">
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- <xsl:apply-templates select="Docs/summary" mode="editlink"/>
- </div>
-
- <xsl:if test="$implemented">
- <p><b>Mono Implementation Note: </b></p>
- <blockquote>
- <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
- </blockquote>
- </xsl:if>
-
- <xsl:if test="$show-members-link and not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate') and count(Members)">
- <p>
- See Also:
- <a>
- <xsl:attribute name="href">
- <xsl:text>T</xsl:text>
- <xsl:call-template name="GetLinkId">
- <xsl:with-param name="type" select="." />
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- <xsl:text>/*</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="translate(@Name, '+', '.')"/>
- <xsl:value-of select="' '" />
- <xsl:text>Members</xsl:text>
- </a>
- </p>
- </xsl:if>
-
- <!--
- Inheritance tree, but only for non-standard classes and not for interfaces
- -->
- <xsl:if test="not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.ValueType' or Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.MulticatDelegate' or count(Base/ParentType)=0)">
- <p>
- <xsl:for-each select="Base/ParentType">
- <xsl:sort select="@Order" order="descending"/>
- <xsl:variable name="p" select="position()" />
- <xsl:for-each select="parent::Base/ParentType[position() < $p]">
- <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
- </xsl:for-each>
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="GetLinkTargetHtml">
- <xsl:with-param name="type" select="@Type" />
- <xsl:with-param name="cref">
- <xsl:text>T:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@Type" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select="@Type"/>
- </a>
- <br/>
- </xsl:for-each>
-
- <xsl:for-each select="Base/ParentType">
- <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
- </xsl:for-each>
- <xsl:value-of select="@FullName"/>
- </p>
- </xsl:if>
- <!--
- <xsl:if test="Base/BaseTypeName='System.Enum'">
- <br/>
- The type of the values in this enumeration is
- <xsl:apply-templates select="Members/Member[@MemberName='value__']/ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
- </xsl:if>
- -->
- </xsl:template>
-
- <xsl:template name="CreateTypeSignature">
- <xsl:call-template name="CreateSignature">
- <xsl:with-param name="id">
- <xsl:text>T:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@FullName" />
- </xsl:call-template>
- <xsl:text>:Signature</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="content">
- <!-- signature -->
- <xsl:choose>
- <xsl:when test="$language='C#'">
-
- <xsl:for-each select="Attributes/Attribute">
- <xsl:text>[</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>]</xsl:text>
- <br/>
- </xsl:for-each>
-
- <xsl:for-each select="ReturnValue/Attributes/Attribute">
- <xsl:text>[return:</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>]</xsl:text>
- <br/>
- </xsl:for-each>
-
- <xsl:choose>
-
- <xsl:when test="Base/BaseTypeName='System.Enum'">
- <xsl:call-template name="getmodifiers">
- <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
- </xsl:call-template>
-
- <xsl:text>enum </xsl:text>
-
- <!-- member name, argument list -->
- <b>
- <xsl:value-of select="translate (@Name, '+', '.')"/>
- </b>
- </xsl:when>
-
- <xsl:when test="Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate'">
- <xsl:choose>
-
- <xsl:when test="count(Parameters) > 0 and count(ReturnValue) > 0">
- <!-- Only recreate the delegate signature if the appropriate information
- is present in the XML file. -->
-
- <xsl:call-template name="getmodifiers">
- <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
- </xsl:call-template>
-
- <xsl:text>delegate </xsl:text>
-
- <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
-
- <!-- hard space -->
- <xsl:value-of select="' '"/>
-
- <!-- member name, argument list -->
- <b>
- <xsl:call-template name="GetDefinitionName">
- <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
- <xsl:with-param name="TypeParameters" select="TypeParameters" />
- </xsl:call-template>
- </b>
-
- <!-- hard space -->
- <xsl:value-of select="' '"/>
-
- <xsl:value-of select="'('"/> <!-- prevents whitespace issues -->
-
- <xsl:for-each select="Parameters/Parameter">
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- </xsl:call-template>
-
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
-
- <xsl:value-of select="')'"/>
-
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
- </xsl:otherwise>
-
- </xsl:choose>
-
-
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:call-template name="getmodifiers">
- <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
- <xsl:with-param name="typetype" select="true()"/>
- </xsl:call-template>
-
- <xsl:value-of select="' '"/>
-
- <b>
- <xsl:call-template name="GetDefinitionName">
- <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
- <xsl:with-param name="TypeParameters" select="TypeParameters" />
- </xsl:call-template>
- </b>
-
- <xsl:variable name="HasStandardBaseType" select="Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.ValueType'"/>
- <xsl:variable name="HasBaseType" select="count(Base/BaseTypeName)>0"/>
- <xsl:if test="(($HasBaseType) and not($HasStandardBaseType)) or not(count(Interfaces/Interface)=0)">
- <xsl:text> : </xsl:text>
-
- <xsl:if test="$HasBaseType and not($HasStandardBaseType)">
- <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
- <xsl:if test="not(count(Interfaces/Interface)=0)">, </xsl:if>
- </xsl:if>
-
- <xsl:for-each select="Interfaces/Interface">
- <xsl:if test="not(position()=1)">, </xsl:if>
- <xsl:apply-templates select="InterfaceName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
- </xsl:for-each>
-
- </xsl:if>
- </xsl:otherwise>
-
- </xsl:choose>
-
- <xsl:call-template name="CreateGenericConstraints">
- <xsl:with-param name="TypeParameters" select="TypeParameters" />
- </xsl:call-template>
-
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
- </xsl:otherwise>
-
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="GetDefinitionName">
- <xsl:param name="name" />
- <xsl:param name="TypeParameters" />
-
- <xsl:choose>
- <!-- do NOT process explicitly implemented generic interface members
- unless they're actually generic methods. -->
- <xsl:when test="contains ($name, '>') and
- '>' = substring ($name, string-length ($name), 1)">
- <xsl:value-of select="substring-before ($name, '<')" />
- <xsl:text><</xsl:text>
- <xsl:for-each select="$TypeParameters/TypeParameter">
- <xsl:for-each select="Attributes/Attribute">
- <xsl:text>[</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>] </xsl:text>
- </xsl:for-each>
- <xsl:choose>
- <xsl:when test="@Name">
- <xsl:value-of select="@Name" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="." />
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
- <xsl:text>></xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$name" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="CreateGenericConstraints">
- <xsl:param name="TypeParameters" />
-
- <xsl:for-each select="$TypeParameters/TypeParameter">
- <xsl:variable name="constraintsCount" select="count(Constraints/*)" />
- <xsl:if test="$constraintsCount > 0 and count(Constraints/*[.='Contravariant' or .='Covariant']) != $constraintsCount">
- <xsl:call-template name="CreateGenericParameterConstraints">
- <xsl:with-param name="constraints" select="Constraints" />
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="CreateGenericParameterConstraints">
- <xsl:param name="constraints" />
-
- <br />
- <xsl:text> where </xsl:text>
- <xsl:value-of select="@Name" />
- <xsl:text> : </xsl:text>
- <xsl:variable name="kind"
- select="count($constraints[ParameterAttribute='ReferenceTypeConstraint'])+
- count($constraints[ParameterAttribute='NotNullableValueTypeConstraint'])" />
- <xsl:variable name="base" select="count($constraints/BaseTypeName)" />
- <xsl:variable name="iface" select="count($constraints/InterfaceName)" />
- <xsl:variable name="struct" select="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'" />
- <xsl:if test="$constraints/ParameterAttribute='ReferenceTypeConstraint'">
- <xsl:text>class</xsl:text>
- </xsl:if>
- <xsl:if test="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'">
- <xsl:text>struct</xsl:text>
- </xsl:if>
- <xsl:if test="$constraints/BaseTypeName and not($struct)">
- <xsl:if test="$kind">, </xsl:if>
- <xsl:apply-templates select="$constraints/BaseTypeName" mode="typelink" />
- </xsl:if>
- <xsl:for-each select="$constraints/InterfaceName">
- <xsl:if test="position()=1">
- <xsl:if test="$kind or $base">, </xsl:if>
- </xsl:if>
- <xsl:apply-templates select="." mode="typelink" />
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
- <xsl:if test="$constraints/ParameterAttribute='DefaultConstructorConstraint' and not($struct)">
- <xsl:if test="$base or $iface">, </xsl:if>
- <xsl:text>new()</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="CreateMemberOverview">
- <xsl:param name="implemented" />
-
- <div class="msummary">
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- <xsl:apply-templates select="Docs/summary" mode="editlink"/>
- </div>
-
- <xsl:if test="$implemented">
- <p><b>Mono Implementation Note: </b></p>
- <blockquote>
- <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
- </blockquote>
- </xsl:if>
-
- <!-- member value -->
- <xsl:if test="MemberValue">
- <p><b>Value: </b>
- <xsl:value-of select="MemberValue"/>
- </p>
- </xsl:if>
-
- </xsl:template>
-
- <xsl:template name="CreateRelatedSection">
- <xsl:param name="section" />
- <xsl:param name="type" />
- <xsl:if test="count(Docs/related[@type=$type])">
- <h3 class="{$type}"><xsl:value-of select="$section" /></h3>
- <ul class="{$type}">
- <xsl:for-each select="Docs/related[@type=$type]">
- <li><a href="{@href}" target="_blank"><xsl:value-of select="." /></a></li>
- </xsl:for-each>
- </ul>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="CreatePlatformRequirements">
- <!-- For now we only have that information in MonoTouch so only process that -->
- <xsl:if test="starts-with(/Type/@FullName, 'MonoTouch')">
- <xsl:choose>
- <!-- We first check if we have a [Since] at the member level -->
- <xsl:when test="count(Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
- <b>Minimum iOS version: </b>
- <xsl:value-of select="translate(substring-before (substring-after (Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
- <br />
- </xsl:when>
- <!-- If not, we then check at the type level -->
- <xsl:when test="count(/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')])">
- <b>Minimum iOS version: </b>
- <xsl:value-of select="translate(substring-before (substring-after (/Type/Attributes/Attribute/AttributeName[starts-with(text(), 'MonoTouch.ObjCRuntime.Since')], 'MonoTouch.ObjCRuntime.Since('), ')'), ', ', '.')" />
- <br />
- </xsl:when>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="CreateMemberSignature">
- <xsl:param name="linkid" select="''" />
-
- <xsl:call-template name="CreateSignature">
- <xsl:with-param name="content">
- <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
- <p><i>This is the default property for this class.</i></p>
- </xsl:if>
-
- <!-- recreate the signature -->
-
- <xsl:for-each select="Attributes/Attribute[AttributeName != 'System.Runtime.CompilerServices.Extension']">
- <xsl:text>[</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>]</xsl:text>
- <br/>
- </xsl:for-each>
-
- <xsl:for-each select="ReturnValue/Attributes/Attribute">
- <xsl:text>[return:</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>]</xsl:text>
- <br/>
- </xsl:for-each>
-
- <xsl:call-template name="getmodifiers">
- <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
- </xsl:call-template>
-
- <xsl:if test="MemberType = 'Event'">
- <xsl:text>event </xsl:text>
-
- <xsl:if test="ReturnValue/ReturnType=''">
- <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, 'event '), concat(' ', @MemberName))"/>
- </xsl:if>
- </xsl:if>
-
- <!-- return value (comes out "" where not applicable/available) -->
- <xsl:choose>
- <xsl:when test="@MemberName='op_Implicit'">
- <xsl:text>implicit operator</xsl:text>
- </xsl:when>
- <xsl:when test="@MemberName='op_Explicit'">
- <xsl:text>explicit operator</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- hard space -->
- <xsl:value-of select="' '"/>
-
- <!-- member name -->
- <xsl:choose>
-
- <!-- Constructors get the name of the class -->
- <xsl:when test="MemberType='Constructor'">
- <b>
- <xsl:call-template name="GetConstructorName">
- <xsl:with-param name="type" select="../.." />
- <xsl:with-param name="ctor" select="." />
- </xsl:call-template>
- </b>
- </xsl:when>
-
- <!-- Conversion operators get the return type -->
- <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
- <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:apply-templates>
- </xsl:when>
-
- <!-- Regular operators get their symbol -->
- <xsl:when test="@MemberName='op_UnaryPlus'">operator+</xsl:when>
- <xsl:when test="@MemberName='op_UnaryNegation'">operator-</xsl:when>
- <xsl:when test="@MemberName='op_LogicalNot'">operator!</xsl:when>
- <xsl:when test="@MemberName='op_OnesComplement'">operator~</xsl:when>
- <xsl:when test="@MemberName='op_Increment'">operator++</xsl:when>
- <xsl:when test="@MemberName='op_Decrement'">operator--</xsl:when>
- <xsl:when test="@MemberName='op_True'">operator true</xsl:when>
- <xsl:when test="@MemberName='op_False'">operator false</xsl:when>
- <xsl:when test="@MemberName='op_Addition'">operator+</xsl:when>
- <xsl:when test="@MemberName='op_Subtraction'">operator-</xsl:when>
- <xsl:when test="@MemberName='op_Multiply'">operator*</xsl:when>
- <xsl:when test="@MemberName='op_Division'">operator/</xsl:when>
- <xsl:when test="@MemberName='op_Modulus'">operator%</xsl:when>
- <xsl:when test="@MemberName='op_BitwiseAnd'">operator&</xsl:when>
- <xsl:when test="@MemberName='op_BitwiseOr'">operator|</xsl:when>
- <xsl:when test="@MemberName='op_ExclusiveOr'">operator^</xsl:when>
- <xsl:when test="@MemberName='op_LeftShift'">operator<<</xsl:when>
- <xsl:when test="@MemberName='op_RightShift'">operator>></xsl:when>
- <xsl:when test="@MemberName='op_Equality'">operator==</xsl:when>
- <xsl:when test="@MemberName='op_Inequality'">operator!=</xsl:when>
- <xsl:when test="@MemberName='op_GreaterThan'">operator></xsl:when>
- <xsl:when test="@MemberName='op_LessThan'">operator<</xsl:when>
- <xsl:when test="@MemberName='op_GreaterThanOrEqual'">operator>=</xsl:when>
- <xsl:when test="@MemberName='op_LessThanOrEqual'">operator<=</xsl:when>
-
- <xsl:when test="MemberType='Property' and count(Parameters/Parameter) > 0">
- <!-- C# only permits indexer properties to have arguments -->
- <xsl:text>this</xsl:text>
- </xsl:when>
-
- <!-- Everything else just gets its name -->
- <xsl:when test="contains (@MemberName, '<')">
- <b>
- <xsl:call-template name="GetDefinitionName">
- <xsl:with-param name="name" select="@MemberName" />
- <xsl:with-param name="TypeParameters" select="TypeParameters" />
- </xsl:call-template>
- </b>
- </xsl:when>
-
- <xsl:otherwise>
- <b><xsl:value-of select="@MemberName"/></b>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- hard space -->
- <xsl:value-of select="' '"/>
-
- <!-- argument list -->
- <xsl:if test="MemberType='Method' or MemberType='Constructor' or (MemberType='Property' and count(Parameters/Parameter))">
- <xsl:if test="not(MemberType='Property')">(</xsl:if>
- <xsl:if test="MemberType='Property'">[</xsl:if>
-
- <xsl:for-each select="Parameters/Parameter">
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- </xsl:call-template>
-
- <xsl:if test="not(position()=last())">, </xsl:if>
- </xsl:for-each>
- <xsl:if test="not(MemberType='Property')">)</xsl:if>
- <xsl:if test="MemberType='Property'">]</xsl:if>
- </xsl:if>
-
- <xsl:if test="MemberType='Property'">
- <xsl:value-of select="' '"/>
- <xsl:text>{</xsl:text>
- <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, '{'), '}')"/>
- <xsl:text>}</xsl:text>
- </xsl:if>
- <xsl:call-template name="CreateGenericConstraints">
- <xsl:with-param name="TypeParameters" select="TypeParameters" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
-
- </xsl:template>
-
- <xsl:template name="GetConstructorName">
- <xsl:param name="type" />
- <xsl:param name="ctor" />
-
- <xsl:choose>
- <xsl:when test="contains($type/@Name, '<')">
- <xsl:value-of select="translate (substring-before ($type/@Name, '<'), '+', '.')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate ($type/@Name, '+', '.')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="ShowParameter">
- <xsl:param name="Param"/>
- <xsl:param name="TypeNamespace"/>
- <xsl:param name="prototype" select="false()"/>
-
- <xsl:if test="not($prototype)">
- <xsl:for-each select="$Param/Attributes/Attribute[not(Exclude='1') and not(AttributeName='ParamArrayAttribute' or AttributeName='System.ParamArray')]">
- <xsl:text>[</xsl:text>
- <xsl:value-of select="AttributeName"/>
- <xsl:text>]</xsl:text>
- <xsl:value-of select="' '"/>
- </xsl:for-each>
- </xsl:if>
-
- <xsl:if test="count($Param/Attributes/Attribute/AttributeName[.='ParamArrayAttribute' or .='System.ParamArray'])">
- <b>params</b>
- <xsl:value-of select="' '"/>
- </xsl:if>
-
- <xsl:if test="$Param/@RefType">
- <i><xsl:value-of select="$Param/@RefType"/></i>
- <!-- hard space -->
- <xsl:value-of select="' '"/>
- </xsl:if>
-
- <!-- parameter type link -->
- <xsl:apply-templates select="$Param/@Type" mode="typelink">
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:apply-templates>
-
- <xsl:if test="not($prototype)">
- <!-- hard space -->
- <xsl:value-of select="' '"/>
-
- <!-- parameter name -->
- <xsl:value-of select="$Param/@Name"/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="DisplayDocsInformation">
- <xsl:param name="linkid" />
-
- <!-- The namespace that the current type belongs to. -->
- <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
-
- <!-- alt member: not sure what these are for, actually -->
-
- <xsl:if test="count(Docs/altmember)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'See Also'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':See Also')" />
- <xsl:with-param name="content">
- <xsl:for-each select="Docs/altmember">
- <div><xsl:apply-templates select="@cref" mode="cref"/></div>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- parameters & return & value -->
-
- <xsl:if test="count(Docs/typeparam)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Type Parameters'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Type Parameters')" />
- <xsl:with-param name="content">
- <dl>
- <xsl:for-each select="Docs/typeparam">
- <dt><i><xsl:value-of select="@name"/></i></dt>
- <dd>
- <xsl:apply-templates select="." mode="notoppara"/>
- <xsl:apply-templates select="." mode="editlink"/>
- </dd>
- </xsl:for-each>
- </dl>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="count(Docs/param)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Parameters'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Parameters')" />
- <xsl:with-param name="content">
- <dl>
- <xsl:for-each select="Docs/param">
- <dt><i><xsl:value-of select="@name"/></i></dt>
- <dd>
- <xsl:apply-templates select="." mode="notoppara"/>
- <xsl:apply-templates select="." mode="editlink"/>
- </dd>
- </xsl:for-each>
- </dl>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="count(Docs/returns)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Returns'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Returns')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="Docs/returns" mode="notoppara"/>
- <xsl:apply-templates select="Docs/returns" mode="editlink"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="count(Docs/value)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Value'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Value')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="Docs/value" mode="notoppara"/>
- <xsl:apply-templates select="Docs/value" mode="editlink"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- method/property/constructor exceptions -->
-
- <xsl:if test="count(Docs/exception)">
- <xsl:call-template name="CreateH4Section">
- <xsl:with-param name="name" select="'Exceptions'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
- <xsl:with-param name="content">
- <xsl:call-template name="CreateTypeDocumentationTable">
- <xsl:with-param name="content">
- <xsl:for-each select="Docs/exception">
- <tr valign="top">
- <td>
- <xsl:apply-templates select="@cref" mode="typelink">
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:apply-templates>
- </td>
- <td>
- <xsl:apply-templates select="." mode="notoppara"/>
- <xsl:apply-templates select="." mode="editlink"/>
- </td>
- </tr>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- remarks -->
-
- <xsl:if test="count(Docs/remarks)">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Remarks'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
- <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- thread safety -->
-
- <xsl:if test="count(ThreadingSafetyStatement)">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Thread Safety'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
-
- <!-- permissions -->
-
- <xsl:if test="count(Docs/permission)">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Permissions'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
- <xsl:with-param name="content">
- <xsl:call-template name="CreateTypeDocumentationTable">
- <xsl:with-param name="content">
- <xsl:for-each select="Docs/permission">
- <tr valign="top">
- <td>
- <xsl:apply-templates select="@cref" mode="typelink">
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="." mode="editlink"/>
- </td>
- <td>
- <xsl:apply-templates select="." mode="notoppara"/>
- </td>
- </tr>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- enumeration values -->
-
- <xsl:if test="Base/BaseTypeName = 'System.Enum'">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Members'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
- <xsl:with-param name="content">
- <xsl:call-template name="CreateEnumerationTable">
- <xsl:with-param name="content">
-
- <xsl:for-each select="Members/Member[MemberType='Field']">
- <xsl:if test="not(@MemberName='value__')">
- <tr valign="top"><td>
- <xsl:attribute name="id">
- <xsl:text>F:</xsl:text>
- <xsl:value-of select="translate (/Type/@FullName, '+', '.')" />
- <xsl:text>.</xsl:text>
- <xsl:value-of select="@MemberName" />
- </xsl:attribute>
- <b>
- <xsl:value-of select="@MemberName"/>
- </b>
- </td>
- <td>
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- <xsl:apply-templates select="Docs/summary" mode="editlink"/>
- </td>
- </tr>
- </xsl:if>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- examples -->
-
- <xsl:if test="count(Docs/example)">
- <xsl:for-each select="Docs/example">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Example'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
- <xsl:with-param name="content">
- <xsl:apply-templates select="." mode="notoppara"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:if>
-
- <!-- related content -->
- <xsl:if test="count(Docs/related)">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Related content'" />
- <xsl:with-param name="child-id" select="concat ($linkid, ':Related:')" />
- <xsl:with-param name="content">
- <div class="related">
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'Platform Docs'" />
- <xsl:with-param name="type" select="'PlatformDocAPI'" />
- </xsl:call-template>
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'Articles'" />
- <xsl:with-param name="type" select="'article'" />
- </xsl:call-template>
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'Recipes'" />
- <xsl:with-param name="type" select="'recipe'" />
- </xsl:call-template>
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'Samples'" />
- <xsl:with-param name="type" select="'sample'" />
- </xsl:call-template>
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'Related specifications'" />
- <xsl:with-param name="type" select="'specification'" />
- </xsl:call-template>
- <xsl:call-template name="CreateRelatedSection">
- <xsl:with-param name="section" select="'External Documentation'" />
- <xsl:with-param name="type" select="'externalDocumentation'" />
- </xsl:call-template>
- </div>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Requirements'"/>
- <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
- <xsl:with-param name="content">
- <xsl:call-template name="CreatePlatformRequirements" />
- <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
- <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) > 0">
- <br />
- <b>Assembly: </b>
- <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
- <xsl:text> (in </xsl:text>
- <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
- <xsl:text>.dll)</xsl:text>
- </xsl:if>
- <xsl:if test="count(AssemblyInfo/AssemblyVersion) > 0">
- <br />
- <b>Assembly Versions: </b>
- <xsl:for-each select="AssemblyInfo/AssemblyVersion">
- <xsl:if test="not(position()=1)">, </xsl:if>
- <xsl:value-of select="."/>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="count(Docs/since) > 0">
- <br />
- <b>Since: </b>
- <xsl:for-each select="Docs/since">
- <xsl:if test="not(position()=1)">; </xsl:if>
- <xsl:value-of select="@version"/>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) > 0">
- <br />
- <b>Since: </b>
- <xsl:for-each select="/Type/Docs/since">
- <xsl:if test="not(position()=1)">; </xsl:if>
- <xsl:value-of select="@version"/>
- </xsl:for-each>
- </xsl:if>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
-
- <!-- Transforms the contents of the selected node into a hyperlink to the type named by the node. The node can contain a type name (eg System.Object) or a type link (eg T:System.String). Use wrt parameter to specify the current namespace. -->
-
- <xsl:template match="*|@*" mode="typelink">
- <xsl:param name="wrt" select="'notset'"/>
-
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="."/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="makenamespacelink">
- <xsl:param name="cref" select="''"/>
-
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="GetLinkTargetHtml">
- <xsl:with-param name="cref" select="$cref" />
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:value-of select="substring-after ($cref, 'N:')" />
- </a>
- </xsl:template>
-
- <xsl:template name="maketypelink">
- <xsl:param name="type" select="'notset'"/>
- <xsl:param name="wrt" select="'notset'"/>
- <xsl:param name="nested" select="0"/>
-
- <xsl:variable name="btype">
- <xsl:call-template name="ToBrackets">
- <xsl:with-param name="s" select="$type" />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name="array">
- <xsl:call-template name="GetArraySuffix">
- <xsl:with-param name="type" select="$type" />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
-
- <!-- chop off T: -->
- <xsl:when test="starts-with($type, 'T:')">
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="substring($type, 3)"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="contains ($type, '&') and
- '&' = substring ($type, string-length ($type), 1)">
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="string($array)">
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- <xsl:value-of select="$array"/>
- </xsl:when>
-
- <xsl:when test="contains ($type, '*') and
- '*' = substring ($type, string-length ($type), 1)">
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- <xsl:value-of select="'*'"/>
- </xsl:when>
-
- <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
- <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] |
- $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
- ancestor::Member/Docs/typeparam[@name=$type]) = 1">
- <!-- note that we check if it is a generic type using /Type/TypeParameters because that will have type parameters declared in an outer class if this is a nested class, but then we get the tooltip text from the type parameters documented in this file -->
- <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
- </xsl:when>
-
- <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
- <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
- <!-- note that an overridden type parameter may be referenced in a type parameter within $type, but we can't replace that nicely since we can't parse generic type names here -->
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </xsl:when>
-
-
- <xsl:otherwise>
- <xsl:variable name="escaped-type">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="$btype" />
- </xsl:call-template>
- </xsl:variable>
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="GetLinkTargetHtml">
- <xsl:with-param name="type" select="$escaped-type" />
- <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$btype"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetArraySuffix">
- <xsl:param name="type" />
-
- <xsl:if test="contains ($type, ']') and
- ']' = substring ($type, string-length ($type), 1)">
- <xsl:variable name="start">
- <xsl:call-template name="GetArraySuffixStart">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="i" select="string-length ($type) - 1" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="substring ($type, $start)" />
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="GetArraySuffixStart">
- <xsl:param name="type" />
- <xsl:param name="i" />
-
- <xsl:choose>
- <xsl:when test="substring ($type, $i, 1) = '['">
- <xsl:value-of select="$i" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetArraySuffixStart">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="i" select="$i - 1" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetTypeDisplayName">
- <xsl:param name="T"/>
- <xsl:param name="wrt"/>
-
- <!-- use C#-style names -->
- <xsl:choose>
- <xsl:when test="$T='System.Object'">object</xsl:when>
- <xsl:when test="$T='System.Boolean'">bool</xsl:when>
- <xsl:when test="$T='System.Byte'">byte</xsl:when>
- <xsl:when test="$T='System.Char'">char</xsl:when>
- <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
- <xsl:when test="$T='System.Double'">double</xsl:when>
- <xsl:when test="$T='System.Int16'">short</xsl:when>
- <xsl:when test="$T='System.Int32'">int</xsl:when>
- <xsl:when test="$T='System.Int64'">long</xsl:when>
- <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
- <xsl:when test="$T='System.Single'">float</xsl:when>
- <xsl:when test="$T='System.String'">string</xsl:when>
- <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
- <xsl:when test="$T='System.UInt32'">uint</xsl:when>
- <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
- <xsl:when test="$T='System.Void'">void</xsl:when>
-
- <xsl:when test="contains($T, '<')">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="substring-before ($T, '<')" />
- <xsl:with-param name="wrt" select="$wrt" />
- </xsl:call-template>
- <xsl:text><</xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-after ($T, '<')" />
- <xsl:with-param name="wrt" select="$wrt" />
- </xsl:call-template>
- <!-- don't need to append > as GetMemberArgList (eventually) appends it -->
- </xsl:when>
-
- <!-- if the type is in the wrt namespace, omit the namespace name -->
- <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
- <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
- </xsl:when>
-
- <!-- if the type is in the System namespace, omit the namespace name -->
- <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
- <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
- </xsl:when>
-
- <!-- if the type is in the System.Collections namespace, omit the namespace name -->
- <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
- <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
- </xsl:when>
-
- <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
- <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
- <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:value-of select="translate ($T, '+', '.')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetMemberDisplayName">
- <xsl:param name="memberName" />
- <xsl:param name="isproperty" select="false()" />
-
- <xsl:choose>
- <xsl:when test="contains($memberName, '.')">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T">
- <xsl:call-template name="GetTypeName">
- <xsl:with-param name="type" select="$memberName"/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="wrt" select="''" />
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- <xsl:call-template name="GetMemberName">
- <xsl:with-param name="type" select="$memberName" />
- <xsl:with-param name="isproperty" select="$isproperty"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$memberName" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="ToBrackets">
- <xsl:param name="s" />
- <xsl:value-of select="translate (translate ($s, '{', '<'), '}', '>')" />
- </xsl:template>
-
- <xsl:template name="ToBraces">
- <xsl:param name="s" />
- <xsl:value-of select="translate (translate ($s, '<', '{'), '>', '}')" />
- </xsl:template>
-
- <xsl:template name="memberlinkprefix">
- <xsl:param name="member" />
- <xsl:choose>
- <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
- <xsl:when test="$member/MemberType='Method'">M</xsl:when>
- <xsl:when test="$member/MemberType='Property'">P</xsl:when>
- <xsl:when test="$member/MemberType='Field'">F</xsl:when>
- <xsl:when test="$member/MemberType='Event'">E</xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="makememberlink">
- <xsl:param name="cref"/>
-
- <xsl:variable name="bcref">
- <xsl:call-template name="ToBrackets">
- <xsl:with-param name="s" select="$cref" />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name="fullname">
- <xsl:choose>
- <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
- <xsl:choose>
- <xsl:when test="contains($bcref, '(')">
- <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring($bcref, 3)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetTypeName">
- <xsl:with-param name="type" select="substring($bcref, 3)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="memberName">
- <xsl:choose>
- <xsl:when test="starts-with($bcref, 'T:')" />
- <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
- <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
- <xsl:text>(</xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
- <xsl:with-param name="wrt" select="$TypeNamespace" />
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>.</xsl:text>
- <xsl:call-template name="GetMemberName">
- <xsl:with-param name="type" select="substring($bcref, 3)" />
- <xsl:with-param name="wrt" select="$fullname"/>
- <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="escaped-type">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename">
- <xsl:call-template name="ToBrackets">
- <xsl:with-param name="s" select="$fullname" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="displayname">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$fullname" />
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:call-template>
- </xsl:variable>
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="GetLinkTargetHtml">
- <xsl:with-param name="type" select="$escaped-type" />
- <xsl:with-param name="cref">
- <xsl:call-template name="ToBraces">
- <xsl:with-param name="s" select="$cref" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
- </a>
- </xsl:template>
-
- <xsl:template name="GetTypeName">
- <xsl:param name="type" />
- <xsl:variable name="prefix" select="substring-before($type, '.')" />
- <xsl:variable name="suffix" select="substring-after($type, '.')" />
- <xsl:choose>
- <xsl:when test="contains($type, '(')">
- <xsl:call-template name="GetTypeName">
- <xsl:with-param name="type" select="substring-before($type, '(')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="not(contains($suffix, '.'))">
- <xsl:value-of select="$prefix" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$prefix" />
- <xsl:text>.</xsl:text>
- <xsl:call-template name="GetTypeName">
- <xsl:with-param name="type" select="$suffix" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetMemberName">
- <xsl:param name="type" />
- <xsl:param name="isproperty" select="0"/>
- <xsl:variable name="prefix" select="substring-before($type, '.')" />
- <xsl:variable name="suffix" select="substring-after($type, '.')" />
- <xsl:choose>
- <xsl:when test="contains($type, '(')">
- <xsl:call-template name="GetMemberName">
- <xsl:with-param name="type" select="substring-before($type, '(')" />
- </xsl:call-template>
- <xsl:text>(</xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
- <xsl:with-param name="wrt" select="$TypeNamespace" />
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:when>
- <xsl:when test="not(contains($suffix, '.'))">
- <xsl:value-of select="$suffix" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetMemberName">
- <xsl:with-param name="type" select="$suffix" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetMemberArgList">
- <xsl:param name="arglist" />
- <xsl:param name="wrt" select="''"/>
-
- <xsl:variable name="_arglist">
- <xsl:choose>
- <xsl:when test="starts-with ($arglist, ',')">
- <xsl:value-of select="substring-after ($arglist, ',')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$arglist" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:if test="starts-with ($arglist, ',')">
- <xsl:text>, </xsl:text>
- </xsl:if>
-
- <xsl:variable name="c" select="substring-before ($_arglist, ',')" />
- <xsl:variable name="lt" select="substring-before ($_arglist, '<')" />
- <xsl:variable name="gt" select="substring-before ($_arglist, '>')" />
-
- <xsl:choose>
- <!-- Need to insert ',' between type arguments -->
- <xsl:when test="
- ($c != '' and $lt != '' and $gt != '' and
- string-length ($c) < string-length ($lt) and
- string-length ($c) < string-length ($gt)) or
- ($c != '' and $lt != '' and $gt = '' and
- string-length ($c) < string-length ($lt)) or
- ($c != '' and $lt = '' and $gt != '' and
- string-length ($c) < string-length ($gt)) or
- ($c != '' and $lt = '' and $gt = '')">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$c"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- <xsl:text>, </xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
- <xsl:with-param name="wrt" select="$wrt" />
- </xsl:call-template>
- </xsl:when>
-
- <!-- start of nested type argument list < -->
- <xsl:when test="
- ($c != '' and $lt != '' and $gt != '' and
- string-length ($lt) < string-length ($c) and
- string-length ($lt) < string-length ($gt)) or
- ($c != '' and $lt != '' and $gt = '' and
- string-length ($lt) < string-length ($c)) or
- ($c = '' and $lt != '' and $gt != '' and
- string-length ($lt) < string-length ($gt))">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$lt"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- <xsl:text><</xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-after($_arglist, '<')" />
- <xsl:with-param name="wrt" select="$wrt" />
- </xsl:call-template>
- </xsl:when>
-
- <!-- end of (nested?) type argument list > -->
- <xsl:when test="
- ($c != '' and $lt != '' and $gt != '' and
- string-length ($gt) < string-length ($c) and
- string-length ($gt) < string-length ($lt)) or
- ($c != '' and $lt = '' and $gt = '' and
- string-length ($gt) < string-length ($c)) or
- ($c = '' and $lt != '' and $gt != '' and
- string-length ($gt) < string-length ($lt)) or
- ($c = '' and $lt = '' and $gt != '')">
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$gt"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- <xsl:text>></xsl:text>
- <xsl:call-template name="GetMemberArgList">
- <xsl:with-param name="arglist" select="substring-after($_arglist, '>')" />
- <xsl:with-param name="wrt" select="$wrt" />
- </xsl:call-template>
- </xsl:when>
-
- <!-- nothing left to do -->
- <xsl:otherwise>
- <xsl:call-template name="GetTypeDisplayName">
- <xsl:with-param name="T" select="$_arglist"/>
- <xsl:with-param name="wrt" select="$wrt"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
- <xsl:template match="*|@*" mode="cref">
- <xsl:call-template name="makememberlink">
- <xsl:with-param name="cref" select="."/>
- </xsl:call-template>
- <!--
- <a>
- <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
- <xsl:value-of select="substring-after(., ':')"/></a>
- -->
- </xsl:template>
-
- <xsl:template name="membertypeplural">
- <xsl:param name="name"/>
- <xsl:choose>
- <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
- <xsl:when test="$name='Constructor'">Constructors</xsl:when>
- <xsl:when test="$name='Property'">Properties</xsl:when>
- <xsl:when test="$name='Method'">Methods</xsl:when>
- <xsl:when test="$name='Field'">Fields</xsl:when>
- <xsl:when test="$name='Event'">Events</xsl:when>
- <xsl:when test="$name='Operator'">Operators</xsl:when>
- <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="membertypeplurallc">
- <xsl:param name="name"/>
- <xsl:choose>
- <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
- <xsl:when test="$name='Constructor'">constructors</xsl:when>
- <xsl:when test="$name='Property'">properties</xsl:when>
- <xsl:when test="$name='Method'">methods</xsl:when>
- <xsl:when test="$name='Field'">fields</xsl:when>
- <xsl:when test="$name='Event'">events</xsl:when>
- <xsl:when test="$name='Operator'">operators</xsl:when>
- <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="gettypetype">
- <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
- <xsl:choose>
- <xsl:when test="contains($sig,'class')">Class</xsl:when>
- <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
- <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
- <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!-- Ensures that the resuting node is not surrounded by a para tag. -->
- <xsl:template match="*|@*" mode="editlink">
- <xsl:call-template name="CreateEditLink">
- <xsl:with-param name="e" select="." />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="*" mode="notoppara">
- <xsl:choose>
- <xsl:when test="starts-with (string(.), 'To be added')">
- <span class="NotEntered">Documentation for this section has not yet been entered.</span>
- </xsl:when>
- <xsl:when test="count(*) = 1 and count(para)=1">
- <xsl:apply-templates select="para/node()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="para">
- <p>
- <xsl:apply-templates/>
- </p>
- </xsl:template>
-
- <xsl:template match="attribution">
- <a href="http://creativecommons.org/licenses/by/4.0/" class="attributionlogo">
- <xsl:attribute name="title">
- <xsl:choose>
- <xsl:when test="@modified='false'"><xsl:value-of select="concat('This content is licensed Creative Commons By ', @from)" /></xsl:when>
- <xsl:otherwise><xsl:value-of select="concat('This content has been modified under a Creative Commons license from ', @from)" /></xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <img src="mdocimages/creativecommons.png" />
- </a>
- </xsl:template>
-
- <xsl:template match="paramref">
- <i><xsl:value-of select="@name"/>
- <xsl:apply-templates/>
- </i>
- </xsl:template>
-
- <xsl:template match="typeparamref">
- <i><xsl:value-of select="@name"/>
- <xsl:apply-templates/>
- </i>
- </xsl:template>
-
- <xsl:template match="block[@type='note']">
- <div>
- <i>Note: </i>
- <xsl:apply-templates/>
- </div>
- </xsl:template>
- <xsl:template match="block[@type='behaviors']">
- <h5 class="Subsection">Operation</h5>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="block[@type='overrides']">
- <h5 class="Subsection">Note to Inheritors</h5>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="block[@type='usage']">
- <h5 class="Subsection">Usage</h5>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="c">
- <tt>
- <xsl:apply-templates/>
- </tt>
- </xsl:template>
- <xsl:template match="c//para">
- <xsl:apply-templates/><br/>
- </xsl:template>
-
- <xsl:template match="code">
- <xsl:call-template name="CreateCodeBlock">
- <xsl:with-param name="language" select="@lang" />
- <xsl:with-param name="content" select="string(descendant-or-self::text())" />
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="img">
- <p>
- <img>
- <xsl:attribute name="src">
- <!-- we recognize two types of images:
- - those with src attribute that reference directly an external image
- - those with a href attributes which are internally available as part of the doc bundle
- -->
- <xsl:choose>
- <xsl:when test="count(@src)>0">
- <xsl:value-of select="@src" />
- </xsl:when>
- <xsl:when test="count(@href)>0">
- <xsl:value-of select="concat('source-id:', $source-id, ':', @href)" />
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="count(@class)>0">
- <xsl:value-of select="@class" />
- </xsl:when>
- <xsl:otherwise>picture</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </img>
- </p>
- </xsl:template>
-
- <xsl:template match="onequarter">¼</xsl:template>
- <xsl:template match="pi">π</xsl:template>
- <xsl:template match="theta">θ</xsl:template>
- <xsl:template match="leq">≤</xsl:template>
- <xsl:template match="geq">≥</xsl:template>
- <xsl:template match="subscript">
- <sub><xsl:value-of select="@term"/></sub>
- </xsl:template>
- <xsl:template match="superscript">
- <sup><xsl:value-of select="@term"/></sup>
- </xsl:template>
-
- <!-- tabular data
- example:
-
- <list type="table">
- <listheader>
- <term>First Col Header</term>
- <description>Second Col Header</description>
- <description>Third Col Header</description>
- </listheader>
- <item>
- <term>First Row First Col</term>
- <description>First Row Second Col</description>
- <description>First Row Third Col</description>
- </item>
- <item>
- <term>Second Row First Col</term>
- <description>Second Row Second Col</description>
- <description>Second Row Third Col</description>
- </item>
- </list>
- -->
-
- <xsl:template match="list[@type='table']">
- <xsl:call-template name="CreateListTable">
- <xsl:with-param name="header">
- <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
- <xsl:for-each select="listheader/description">
- <th><xsl:apply-templates mode="notoppara"/></th>
- </xsl:for-each>
- </xsl:with-param>
-
- <xsl:with-param name="content">
- <xsl:for-each select="item">
- <tr valign="top">
- <td>
- <xsl:apply-templates select="term" mode="notoppara"/>
- </td>
- <xsl:for-each select="description">
- <td>
- <xsl:apply-templates mode="notoppara"/>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="list[@type='bullet']">
- <ul>
- <xsl:for-each select="item">
- <li>
- <xsl:apply-templates select="term" mode="notoppara"/>
- <xsl:apply-templates select="para" mode="notoppara"/>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:template>
- <xsl:template match="list[@type='number']">
- <ol>
- <xsl:for-each select="item">
- <li>
- <xsl:apply-templates select="term" mode="notoppara"/>
- </li>
- </xsl:for-each>
- </ol>
- </xsl:template>
-
- <xsl:template match="list">
- [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
-
- <xsl:message>
- [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
- </xsl:message>
- </xsl:template>
-
- <xsl:template match="see[@cref]">
- <xsl:choose>
- <xsl:when test="not(substring-after(@cref, 'T:')='')">
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="normalize-space (@cref)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="not(substring-after(@cref, 'N:')='')">
- <xsl:call-template name="makenamespacelink">
- <xsl:with-param name="cref" select="normalize-space (@cref)"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="makememberlink">
- <xsl:with-param name="cref" select="normalize-space (@cref)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="see[@langword]">
- <tt><xsl:value-of select="@langword"/></tt>
- </xsl:template>
-
- <xsl:template name="GetInheritedMembers">
- <xsl:param name="declaringtype"/>
- <xsl:param name="generictypereplacements"/>
- <xsl:param name="listmembertype"/>
- <xsl:param name="showprotected"/>
- <xsl:param name="overloads-mode" select="false()" />
- <xsl:param name="showstatic" select='1'/>
-
- <xsl:choose>
- <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
- <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
- <Members Name="Link/@Type" FullName="Link/@Type">
- <Member MemberName="{@MemberName}">
- <xsl:attribute name="ExplicitMemberName">
- <xsl:call-template name="GetMemberNameWithoutGenericTypes">
- <xsl:with-param name="m" select="@MemberName" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="TypeParameters">
- <xsl:call-template name="GetTypeParameterNames">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="Parameters">
- <xsl:call-template name="GetParameterTypes">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:copy-of select="./*" />
- </Member>
- </Members>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
-
- <xsl:copy-of select="$generictypereplacements"/>
-
- <!-- Get all members in this type that are of listmembertype and are either
- protected or not protected according to showprotected. -->
- <xsl:choose>
- <xsl:when test="$listmembertype = 'Explicit'">
- <xsl:for-each select="$declaringtype/Members/Member
- [MemberType != 'Constructor']
- [contains (@MemberName, '.')]">
- <Member MemberName="{@MemberName}">
- <xsl:attribute name="ExplicitMemberName">
- <xsl:call-template name="GetMemberName">
- <xsl:with-param name="type" select="@MemberName" />
- <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="TypeParameters">
- <xsl:call-template name="GetTypeParameterNames">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="Parameters">
- <xsl:call-template name="GetParameterTypes">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:copy-of select="./*" />
- </Member>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="$declaringtype/Members/Member
- [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
- [(not($overloads-mode) or @MemberName=$index or
- ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
- [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
- [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
- or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
- or (not($listmembertype='Method') and not($listmembertype='Operator'))]
- [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
- [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
- ">
- <Member MemberName="{@MemberName}">
- <xsl:attribute name="ExplicitMemberName">
- <xsl:call-template name="GetMemberNameWithoutGenericTypes">
- <xsl:with-param name="m" select="@MemberName" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="TypeParameters">
- <xsl:call-template name="GetTypeParameterNames">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="Parameters">
- <xsl:call-template name="GetParameterTypes">
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:copy-of select="./*" />
- </Member>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
-
- <Docs>
- <xsl:copy-of select="$declaringtype/Docs/typeparam" />
- </Docs>
-
- </Members>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
- <xsl:variable name="basedocsfile">
- <xsl:call-template name="GetLinkTarget">
- <xsl:with-param name="type">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="cref">
- </xsl:with-param>
- <xsl:with-param name="local-suffix" />
- <xsl:with-param name="remote"/>
- <xsl:with-param name="xmltarget" select='1'/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:if test="not(string($basedocsfile) = '')">
- <xsl:call-template name="GetInheritedMembers">
- <xsl:with-param name="listmembertype" select="$listmembertype"/>
- <xsl:with-param name="showprotected" select="$showprotected"/>
- <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
- <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
- <xsl:with-param name="showstatic" select='0'/>
- </xsl:call-template>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="GetMemberNameWithoutGenericTypes">
- <xsl:param name="m" />
- <xsl:choose>
- <xsl:when test="contains ($m, '<')">
- <xsl:value-of select="substring-before ($m, '<')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$m" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetTypeParameterNames">
- <xsl:param name="member" />
-
- <xsl:for-each select="$member/TypeParameters/TypeParameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
- <xsl:value-of select="@Name" />
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="GetParameterTypes">
- <xsl:param name="member" />
-
- <xsl:for-each select="$member/Parameters/Parameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
- <xsl:value-of select="@Type" />
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="ListAllMembers">
- <xsl:param name="html-anchor" select="false()" />
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Constructor'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Constructor'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Field'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Field'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Property'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Property'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Method'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Method'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Event'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Event'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Operator'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'Explicit'"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="html-anchor" select="$html-anchor" />
- </xsl:call-template>
- </xsl:template>
-
- <!-- Lists the members in the current Type node.
- Only lists members of type listmembertype.
- Displays the signature in siglanguage.
- showprotected = true() or false()
- -->
- <xsl:template name="ListMembers">
- <xsl:param name="listmembertype"/>
- <xsl:param name="showprotected"/>
- <xsl:param name="overloads-mode" select="false()" />
- <xsl:param name="html-anchor" select="false()" />
-
- <!-- get name and namespace of current type -->
- <xsl:variable name="TypeFullName" select="@FullName"/>
- <xsl:variable name="TypeName" select="@Name"/>
- <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
-
- <xsl:variable name="MEMBERS-rtf">
- <xsl:call-template name="GetInheritedMembers">
- <xsl:with-param name="listmembertype" select="$listmembertype"/>
- <xsl:with-param name="showprotected" select="$showprotected"/>
- <xsl:with-param name="declaringtype" select="."/>
- <xsl:with-param name="overloads-mode" select="$overloads-mode" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
-
- <!--
- <xsl:variable name="MEMBERS" select="
- $ALLMEMBERS/Member
- [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
- [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
- [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
- or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
- or (not($listmembertype='Method') and not($listmembertype='Operator'))]
- "/>
- -->
-
- <!-- if there aren't any, skip this -->
- <xsl:if test="count($MEMBERS//Member)">
-
- <xsl:variable name="SectionName">
- <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
- <xsl:if test="$showprotected">Protected </xsl:if>
- <xsl:if test="not($showprotected)">Public </xsl:if>
- </xsl:if>
- <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
- </xsl:variable>
-
- <!-- header -->
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="$SectionName" />
- <xsl:with-param name="child-id" select="$SectionName" />
- <xsl:with-param name="content">
- <div class="SubsectionBox">
- <xsl:call-template name="CreateMembersTable">
- <xsl:with-param name="content">
-
- <xsl:for-each select="$MEMBERS/Members/Member">
- <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
- <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
- <xsl:sort select="@ExplicitMemberName" data-type="text"/>
- <xsl:sort select="count(TypeParameters/TypeParameter)"/>
- <xsl:sort select="@TypeParameters"/>
- <xsl:sort select="count(Parameters/Parameter)"/>
- <xsl:sort select="@Parameters"/>
-
- <xsl:variable name="local-id">
- <xsl:choose>
- <xsl:when test="count(Link) = 1">
- <xsl:value-of select="Link/@Member" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetLinkId" >
- <xsl:with-param name="type" select="parent::Members" />
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="linkfile">
- <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
- <xsl:call-template name="GetLinkTargetHtml">
- <xsl:with-param name="type">
- <xsl:choose>
- <xsl:when test="count(Link) = 1">
- <xsl:value-of select="Link/@Type"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="parent::Members/@FullName" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="cref" />
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:variable name="linkid">
- <xsl:if test="$html-anchor">
- <xsl:value-of select="$linkfile" />
- <xsl:text>#</xsl:text>
- </xsl:if>
- <xsl:value-of select="$local-id" />
- </xsl:variable>
-
- <xsl:variable name="isinherited">
- <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
- <xsl:text> (</xsl:text>
- <i>
- <xsl:text>Inherited from </xsl:text>
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="parent::Members/@FullName"/>
- <xsl:with-param name="wrt" select="$TypeNamespace"/>
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- </i>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:variable>
-
- <tr valign="top">
- <td>
- <!-- random info -->
-
- <!-- check if it has get and set accessors -->
- <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
- <xsl:text>[read-only]</xsl:text>
- </xsl:if>
- <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
- <xsl:text>[write-only]</xsl:text>
- </xsl:if>
-
- <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
- <div><i>default property</i></div>
- </xsl:if>
-
- <div>
- <xsl:call-template name="getmodifiers">
- <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
- <xsl:with-param name="protection" select="false()"/>
- <xsl:with-param name="inheritance" select="true()"/>
- <xsl:with-param name="extra" select="false()"/>
- </xsl:call-template>
- </div>
- </td>
-
- <xsl:choose>
- <!-- constructor listing -->
- <xsl:when test="MemberType='Constructor'">
- <!-- link to constructor page -->
- <td>
- <div>
- <b>
- <a href="{$linkid}">
- <xsl:call-template name="GetConstructorName">
- <xsl:with-param name="type" select="parent::Members" />
- <xsl:with-param name="ctor" select="." />
- </xsl:call-template>
- </a>
- </b>
-
- <!-- argument list -->
- <xsl:value-of select="'('"/>
- <xsl:for-each select="Parameters/Parameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
-
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- <xsl:with-param name="prototype" select="true()"/>
- </xsl:call-template>
- </xsl:for-each>
- <xsl:value-of select="')'"/>
- </div>
-
- <!-- TODO: $implemented? -->
-
- </td>
- </xsl:when>
-
- <xsl:when test="$listmembertype = 'Explicit'">
- <td>
- <a href="{$linkid}">
- <b>
- <xsl:call-template name="GetMemberDisplayName">
- <xsl:with-param name="memberName" select="@MemberName" />
- <xsl:with-param name="isproperty" select="MemberType='Property'" />
- </xsl:call-template>
- </b>
- </a>
- </td>
- </xsl:when>
-
- <!-- field, property and event listing -->
- <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
- <td>
-
- <!-- link to member page -->
- <b>
- <a href="{$linkid}">
- <xsl:call-template name="GetMemberDisplayName">
- <xsl:with-param name="memberName" select="@MemberName" />
- <xsl:with-param name="isproperty" select="MemberType='Property'" />
- </xsl:call-template>
- </a>
- </b>
-
- <!-- argument list for accessors -->
- <xsl:if test="Parameters/Parameter">
- <xsl:value-of select="'('"/>
- <xsl:for-each select="Parameters/Parameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
-
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- <xsl:with-param name="prototype" select="true()"/>
- </xsl:call-template>
-
- </xsl:for-each>
- <xsl:value-of select="')'"/>
- </xsl:if>
-
- </td>
- </xsl:when>
-
- <!-- method listing -->
- <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
- <td colspan="2">
-
- <!-- link to method page -->
- <b>
- <a href="{$linkid}">
- <xsl:call-template name="GetMemberDisplayName">
- <xsl:with-param name="memberName" select="@MemberName" />
- <xsl:with-param name="isproperty" select="MemberType='Property'" />
- </xsl:call-template>
- </a>
- </b>
-
- <!-- argument list -->
- <xsl:value-of select="'('"/>
- <xsl:for-each select="Parameters/Parameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
-
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- <xsl:with-param name="prototype" select="true()"/>
- </xsl:call-template>
-
- </xsl:for-each>
- <xsl:value-of select="')'"/>
-
- <!-- return type -->
- <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
- <nobr>
- <xsl:text> : </xsl:text>
- <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
- </nobr>
- </xsl:if>
-
- <blockquote>
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- <xsl:copy-of select="$isinherited"/>
- </blockquote>
- </td>
- </xsl:when>
-
- <xsl:when test="$listmembertype='Operator'">
- <td>
-
- <!-- link to operator page -->
- <xsl:choose>
- <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
- <b>
- <a href="{$linkid}">
- <xsl:text>Conversion</xsl:text>
- <xsl:choose>
- <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
- <xsl:text> From </xsl:text>
- <xsl:value-of select="Parameters/Parameter/@Type"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text> to </xsl:text>
- <xsl:value-of select="ReturnValue/ReturnType"/>
- </xsl:otherwise>
- </xsl:choose>
- </a>
- </b>
-
- <xsl:choose>
- <xsl:when test="@MemberName='op_Implicit'">
- <xsl:text>(Implicit)</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>(Explicit)</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="count(Parameters/Parameter)=1">
- <b>
- <a href="{$linkid}">
- <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
- </a>
- </b>
- </xsl:when>
- <xsl:otherwise>
- <b>
- <a href="{$linkid}">
- <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
- </a>
- </b>
- <xsl:value-of select="'('"/>
- <xsl:for-each select="Parameters/Parameter">
- <xsl:if test="not(position()=1)">, </xsl:if>
-
- <xsl:call-template name="ShowParameter">
- <xsl:with-param name="Param" select="."/>
- <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
- <xsl:with-param name="prototype" select="true()"/>
- </xsl:call-template>
-
- </xsl:for-each>
- <xsl:value-of select="')'"/>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </xsl:when>
-
- <xsl:otherwise>
- <!-- Other types: just provide a link -->
- <td>
- <a href="{$linkid}">
- <xsl:call-template name="GetMemberDisplayName">
- <xsl:with-param name="memberName" select="@MemberName" />
- <xsl:with-param name="isproperty" select="MemberType='Property'" />
- </xsl:call-template>
- </a>
- </td>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
- <td>
- <!-- description -->
- <xsl:if test="MemberType='Field' or MemberType = 'Property'">
- <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
- <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
- <xsl:text>. </xsl:text>
- </xsl:if>
-
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- <xsl:copy-of select="$isinherited"/>
- </td>
- </xsl:if>
-
- </tr>
- </xsl:for-each>
-
- </xsl:with-param>
- </xsl:call-template>
- </div>
- </xsl:with-param>
- </xsl:call-template>
-
- </xsl:if>
-
- </xsl:template>
-
- <xsl:template name="GetLinkName">
- <xsl:param name="type"/>
- <xsl:param name="member"/>
- <xsl:call-template name="memberlinkprefix">
- <xsl:with-param name="member" select="$member"/>
- </xsl:call-template>
- <xsl:text>:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="$type/@FullName" />
- </xsl:call-template>
- <xsl:if test="$member/MemberType != 'Constructor'">
- <xsl:text>.</xsl:text>
- <xsl:variable name="memberName">
- <xsl:call-template name="GetGenericName">
- <xsl:with-param name="membername" select="$member/@MemberName" />
- <xsl:with-param name="member" select="$member" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="Replace">
- <xsl:with-param name="s">
- <xsl:call-template name="ToBraces">
- <xsl:with-param name="s" select="$memberName" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="from">.</xsl:with-param>
- <xsl:with-param name="to">#</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="GetGenericName">
- <xsl:param name="membername" />
- <xsl:param name="member" />
- <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
- <xsl:choose>
- <xsl:when test="$numgenargs = 0">
- <xsl:value-of select="$membername" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="contains($membername, '<')">
- <xsl:value-of select="substring-before ($membername, '<')" />
- </xsl:if>
- <xsl:text>``</xsl:text>
- <xsl:value-of select="$numgenargs" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetEscapedTypeName">
- <xsl:param name="typename" />
- <xsl:variable name="base" select="substring-before ($typename, '<')" />
-
- <xsl:choose>
- <xsl:when test="$base != ''">
- <xsl:value-of select="translate ($base, '+', '.')" />
- <xsl:text>`</xsl:text>
- <xsl:call-template name="GetGenericArgumentCount">
- <xsl:with-param name="arglist" select="substring-after ($typename, '<')" />
- <xsl:with-param name="count">1</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetGenericArgumentCount">
- <xsl:param name="arglist" />
- <xsl:param name="count" />
-
- <xsl:variable name="rest-rtf">
- <xsl:call-template name="SkipTypeArgument">
- <xsl:with-param name="s" select="$arglist" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="rest" select="string($rest-rtf)" />
-
- <xsl:choose>
- <xsl:when test="$arglist != '' and $rest = ''">
- <xsl:value-of select="$count" />
- </xsl:when>
- <xsl:when test="$arglist = '' and $rest = ''">
- <xsl:message terminate="yes">
-!WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
- </xsl:message>
- </xsl:when>
- <xsl:when test="starts-with ($rest, '>')">
- <xsl:value-of select="$count" />
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="starts-with ($rest, ',')">
- <xsl:call-template name="GetGenericArgumentCount">
- <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
- <xsl:with-param name="count" select="$count+1" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">
-!WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="SkipTypeArgument">
- <xsl:param name="s" />
-
- <xsl:variable name="p-rtf">
- <xsl:call-template name="GetCLtGtPositions">
- <xsl:with-param name="s" select="$s" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
-
- <xsl:choose>
- <!--
- Have to select between three `s' patterns:
- A,B>: need to return ",B>"
- Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
- Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
- -->
- <xsl:when test="starts-with ($s, '>')">
- <xsl:message terminate="yes">
-SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
- </xsl:message>
- </xsl:when>
- <xsl:when test="$p/Comma/@Length > 0 and
- ($p/Lt/@Length = 0 or $p/Comma/@Length < $p/Lt/@Length) and
- ($p/Gt/@Length > 0 and $p/Comma/@Length < $p/Gt/@Length)">
- <xsl:text>,</xsl:text>
- <xsl:value-of select="substring-after ($s, ',')" />
- </xsl:when>
- <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
- <xsl:variable name="r">
- <xsl:call-template name="SkipGenericArgument">
- <xsl:with-param name="s" select="substring-after ($s, '<')" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="starts-with ($r, '>') or starts-with ($r, '+')">
- <xsl:value-of select="substring-after ($r, '>')" />
- </xsl:when>
- <xsl:when test="starts-with ($r, ',')">
- <xsl:value-of select="$r" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
-! WTF3: s=<xsl:value-of select="$s" />; r=<xsl:value-of select="$r" />
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$p/Gt/@Length > 0">
- <xsl:text>></xsl:text>
- <xsl:value-of select="substring-after ($s, '>')" />
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetCLtGtPositions">
- <xsl:param name="s" />
-
- <xsl:variable name="c" select="substring-before ($s, ',')" />
- <xsl:variable name="lt" select="substring-before ($s, '<')" />
- <xsl:variable name="gt" select="substring-before ($s, '>')" />
-
- <Comma String="{$c}" Length="{string-length ($c)}" />
- <Lt String="{$lt}" Length="{string-length ($lt)}" />
- <Gt String="{$gt}" Length="{string-length ($gt)}" />
- </xsl:template>
-
- <!--
- when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
- when given 'Bar<C>+Nested>', returns '>'
- when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
- (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
- -->
- <xsl:template name="SkipGenericArgument">
- <xsl:param name="s" />
-
- <xsl:variable name="p-rtf">
- <xsl:call-template name="GetCLtGtPositions">
- <xsl:with-param name="s" select="$s" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
-
- <xsl:choose>
- <xsl:when test="starts-with ($s, '>')">
- <xsl:message terminate="yes">
-SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
- </xsl:message>
- </xsl:when>
- <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
- <!-- within 'Foo<A...'; look for matching '>' -->
- <xsl:variable name="r">
- <xsl:call-template name="SkipGenericArgument">
- <xsl:with-param name="s" select="substring-after ($s, '<')" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="substring-after ($r, '>')" />
- </xsl:when>
- <xsl:when test="$p/Gt/@Length > 0">
- <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
- <xsl:value-of select="substring-after ($s, '>')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$s" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetEscapedParameter">
- <xsl:param name="orig-parameter-type" />
- <xsl:param name="parameter-type" />
- <xsl:param name="parameter-types" />
- <xsl:param name="escape" />
- <xsl:param name="index" />
-
- <xsl:choose>
- <xsl:when test="$index > count($parameter-types)">
- <xsl:if test="$parameter-type != $orig-parameter-type">
- <xsl:value-of select="$parameter-type" />
- </xsl:if>
- <!-- ignore -->
- </xsl:when>
- <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
- <xsl:value-of select="concat ($escape, $index - 1)" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
- <xsl:call-template name="GetEscapedParameter">
- <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
- <xsl:with-param name="parameter-type">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s" select="$parameter-type"/>
- <xsl:with-param name="from" select="concat('<', $typeparam, '>')" />
- <xsl:with-param name="to" select="concat('<', $escape, $index - 1, '>')" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="from" select="concat('<', $typeparam, ',')" />
- <xsl:with-param name="to" select="concat('<', $escape, $index - 1, ',')" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="from" select="concat (',', $typeparam, '>')" />
- <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '>')" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
- <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="parameter-types" select="$parameter-types" />
- <xsl:with-param name="typeparam" select="$typeparam" />
- <xsl:with-param name="escape" select="$escape" />
- <xsl:with-param name="index" select="$index + 1" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GetLinkId">
- <xsl:param name="type"/>
- <xsl:param name="member"/>
- <xsl:call-template name="GetLinkName">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="member" select="$member" />
- </xsl:call-template>
- <xsl:if test="count($member/Parameters/Parameter) > 0 or $member/MemberType='Method' or $member/MemberType='Constructor'">
- <xsl:text>(</xsl:text>
- <xsl:for-each select="Parameters/Parameter">
- <xsl:if test="not(position()=1)">,</xsl:if>
- <xsl:call-template name="GetParameterType">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="member" select="$member" />
- <xsl:with-param name="parameter" select="." />
- </xsl:call-template>
- </xsl:for-each>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
- <xsl:text>~</xsl:text>
- <xsl:variable name="parameter-rtf">
- <Parameter Type="{$member/ReturnValue/ReturnType}" />
- </xsl:variable>
- <xsl:call-template name="GetParameterType">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="member" select="$member" />
- <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!--
- - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
- - generics enter the picture, since a parameter type could come from the
- - type itelf (becoming `N) or from the method (becoming ``N).
- -->
- <xsl:template name="GetParameterType">
- <xsl:param name="type" />
- <xsl:param name="member" />
- <xsl:param name="parameter" />
-
- <!-- the actual parameter type -->
- <xsl:variable name="ptype">
- <xsl:choose>
- <xsl:when test="contains($parameter/@Type, '[')">
- <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
- </xsl:when>
- <xsl:when test="contains($parameter/@Type, '&')">
- <xsl:value-of select="substring-before ($parameter/@Type, '&')" />
- </xsl:when>
- <xsl:when test="contains($parameter/@Type, '*')">
- <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$parameter/@Type" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- parameter modifiers -->
- <xsl:variable name="pmodifier">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
- <xsl:with-param name="from">&</xsl:with-param>
- <xsl:with-param name="to">@</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name="gen-type">
- <xsl:call-template name="GetEscapedParameter">
- <xsl:with-param name="orig-parameter-type" select="$ptype" />
- <xsl:with-param name="parameter-type">
- <xsl:variable name="nested">
- <xsl:call-template name="GetEscapedParameter">
- <xsl:with-param name="orig-parameter-type" select="$ptype" />
- <xsl:with-param name="parameter-type" select="$ptype" />
- <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
- <xsl:with-param name="escape" select="'`'" />
- <xsl:with-param name="index" select="1" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$nested != ''">
- <xsl:value-of select="$nested" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ptype" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
- <xsl:with-param name="escape" select="'``'" />
- <xsl:with-param name="index" select="1" />
- </xsl:call-template>
- </xsl:variable>
-
- <!-- the actual parameter type -->
- <xsl:variable name="parameter-type">
- <xsl:choose>
- <xsl:when test="$gen-type != ''">
- <xsl:value-of select="$gen-type" />
- <xsl:value-of select="$pmodifier" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($ptype, $pmodifier)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
- <xsl:call-template name="Replace">
- <xsl:with-param name="s">
- <xsl:call-template name="Replace">
- <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
- <xsl:with-param name="from">></xsl:with-param>
- <xsl:with-param name="to">}</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="from"><</xsl:with-param>
- <xsl:with-param name="to">{</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="Replace">
- <xsl:param name="s" />
- <xsl:param name="from" />
- <xsl:param name="to" />
- <xsl:choose>
- <xsl:when test="not(contains($s, $from))">
- <xsl:value-of select="$s" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="prefix" select="substring-before($s, $from)"/>
- <xsl:variable name="suffix" select="substring-after($s, $from)" />
- <xsl:value-of select="$prefix" />
- <xsl:value-of select="$to" />
- <xsl:call-template name="Replace">
- <xsl:with-param name="s" select="$suffix" />
- <xsl:with-param name="from" select="$from" />
- <xsl:with-param name="to" select="$to" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="getmodifiers">
- <xsl:param name="sig"/>
- <xsl:param name="protection" select="true()"/>
- <xsl:param name="inheritance" select="true()"/>
- <xsl:param name="extra" select="true()"/>
- <xsl:param name="typetype" select="false()"/>
-
- <xsl:variable name="Sig">
- <xsl:text> </xsl:text>
- <xsl:choose>
- <xsl:when test="contains($sig, '{')">
- <xsl:value-of select="substring-before ($sig, '{')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$sig" />
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> </xsl:text>
- </xsl:variable>
-
- <xsl:if test="$protection">
- <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
- <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
- <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
- <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
- </xsl:if>
-
- <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
- <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
- <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
-
- <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
- <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
-
- <xsl:if test="$inheritance">
- <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
- <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
- </xsl:if>
-
- <xsl:if test="$extra">
- <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
- <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
-
- <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
- <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
- <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
- <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
- <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
- <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
- </xsl:if>
-
- <xsl:if test="$typetype">
- <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
- <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
- <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
- <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
- <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="GetTypeDescription">
- <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
- <xsl:choose>
- <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
- <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
- <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
- <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
- <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="since">
- <p>
- <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />
- and later.</i>
- </p>
- </xsl:template>
-
- <xsl:template name="GetLinkTargetHtml">
- <xsl:param name="type" />
- <xsl:param name="cref" />
-
- <xsl:variable name="href">
- <xsl:call-template name="GetLinkTarget">
- <xsl:with-param name="type" select="$type" />
- <xsl:with-param name="cref" select="$cref" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string($href) = ''">
- <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mdoc-sections-css.xsl: Common CSS implementation of mdoc-html-utils.xsl
- required functions.
-
-
- Including XSLT files need to provide the following functions:
-
- - CreateExpandedToggle()
-
- Author: Jonathan Pryor <jpryor@novell.com>
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
-
- <xsl:template name="CreateH2Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h2 class="Section">
- <xsl:if test="$id != ''">
- <xsl:attribute name="id">
- <xsl:value-of select="$id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="$name" />
- </h2>
- <div class="SectionBox" id="{$child-id}">
- <xsl:copy-of select="$content" />
- </div>
- </xsl:template>
-
- <xsl:template name="CreateH3Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="class" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h3>
- <xsl:if test="$class != ''">
- <xsl:attribute name="class">
- <xsl:value-of select="$class" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="$id != ''">
- <xsl:attribute name="id">
- <xsl:value-of select="$id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="$name" />
- </h3>
- <blockquote id="{$child-id}">
- <xsl:copy-of select="$content" />
- </blockquote>
- </xsl:template>
-
- <xsl:template name="CreateH4Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h4 class="Subsection">
- <xsl:if test="$id != ''">
- <xsl:attribute name="id">
- <xsl:value-of select="$id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of select="$name" />
- </h4>
- <blockquote class="SubsectionBox" id="{$child-id}">
- <xsl:copy-of select="$content" />
- </blockquote>
- </xsl:template>
-
- <xsl:template name="CreateEnumerationTable">
- <xsl:param name="content" />
- <table class="Enumeration">
- <tr><th>Member Name</th><th>Description</th></tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateHeader">
- <xsl:param name="content" />
- <xsl:copy-of select="$content" />
- </xsl:template>
-
- <xsl:template name="CreateListTable">
- <xsl:param name="header" />
- <xsl:param name="content" />
- <table class="Documentation">
- <tr><xsl:copy-of select="$header" /></tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateMembersTable">
- <xsl:param name="content" />
- <table class="TypeMembers">
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateSignature">
- <xsl:param name="content" />
- <xsl:param name="id" />
- <h2>Syntax</h2>
- <div class="Signature">
- <xsl:if test="$id != ''">
- <xsl:attribute name="id">
- <xsl:copy-of select="$id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="$content" />
- </div>
- </xsl:template>
-
- <xsl:template name="CreateTypeDocumentationTable">
- <xsl:param name="content" />
- <table class="TypeDocumentation">
- <tr><th>Type</th><th>Reason</th></tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
-</xsl:stylesheet>
-
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mdoc-sections.xsl: Common non-CSS implementation of mdoc-html-utils.xsl
- required functions.
-
- Author: Jonathan Pryor <jpryor@novell.com>
-
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
- <xsl:template name="CreateH2Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h2 class="Section">
- <xsl:value-of select="$name" />
- </h2>
- <blockquote id="{$child-id}">
- <xsl:copy-of select="$content" />
- </blockquote>
- </xsl:template>
-
- <xsl:template name="CreateH3Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="class" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h3>
- <xsl:value-of select="$name" />
- </h3>
- <blockquote id="{$child-id}">
- <xsl:copy-of select="$content" />
- </blockquote>
- </xsl:template>
-
- <xsl:template name="CreateH4Section">
- <xsl:param name="name" />
- <xsl:param name="id" select="''" />
- <xsl:param name="child-id" select="generate-id (.)" />
- <xsl:param name="content" />
-
- <h4 class="Subsection">
- <xsl:value-of select="$name" />
- </h4>
- <blockquote class="SubsectionBox" id="{$child-id}">
- <xsl:copy-of select="$content" />
- </blockquote>
- </xsl:template>
-
- <xsl:template name="CreateEnumerationTable">
- <xsl:param name="content" />
- <table class="EnumerationsTable" border="1" cellpadding="10" width="100%">
- <tr bgcolor="#f2f2f2">
- <th>Member Name</th>
- <th>Description</th>
- </tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateHeader">
- <xsl:param name="content" />
- <table class="HeaderTable" width="100%" cellpadding="5">
- <tr bgcolor="#b0c4de">
- <td>
- <xsl:copy-of select="$content" />
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template name="CreateListTable">
- <xsl:param name="header" />
- <xsl:param name="content" />
- <table border="1" cellpadding="3" width="100%">
- <tr bgcolor="#f2f2f2" valign="top">
- <xsl:copy-of select="$header" />
- </tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateMembersTable">
- <xsl:param name="content" />
- <table border="1" cellpadding="6" width="100%">
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
- <xsl:template name="CreateSignature">
- <xsl:param name="content" />
- <xsl:param name="id" />
- <table class="SignatureTable" bgcolor="#c0c0c0" cellspacing="0" width="100%">
- <xsl:attribute name="id">
- <xsl:copy-of select="$id" />
- </xsl:attribute>
- <tr><td>
- <table class="InnerSignatureTable" cellpadding="10" cellspacing="0" width="100%">
- <tr bgcolor="#f2f2f2">
- <td>
- <xsl:copy-of select="$content" />
- </td></tr>
- </table>
- </td></tr>
- </table>
- <br />
- </xsl:template>
-
- <xsl:template name="CreateTypeDocumentationTable">
- <xsl:param name="content" />
- <table class="TypePermissionsTable" border="1" cellpadding="6" width="100%">
- <tr bgcolor="#f2f2f2"><th>Type</th><th>Reason</th></tr>
- <xsl:copy-of select="$content" />
- </table>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mono-ecma-css.xsl: ECMA-style docs to HTML+CSS stylesheet trasformation
- based on mono-ecma.xsl by Joshua Tauberer
-
- Author: Joshua Tauberer (tauberer@for.net)
- Author: Mario Sopena Novales (mario.sopena@gmail.com)
-
- TODO:
- split this into multiple files
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
- <xsl:include href="mdoc-sections-css.xsl" />
- <xsl:include href="mono-ecma-impl.xsl" />
-
- <xsl:output omit-xml-declaration="yes" />
-
- <xsl:template name="CreateExpandedToggle">
- <img src="xtree/images/clean/Lminus.gif" border="0" align="top"/>
- </xsl:template>
-
- <xsl:template name="CreateCodeBlock">
- <xsl:param name="language" />
- <xsl:param name="content" />
-
- <div class="CodeExample">
- <p><b><xsl:value-of select="$language"/> Example</b></p>
- <div>
- <pre>
- <!--
- <xsl:value-of select="monodoc:Colorize($content, string($language))"
- disable-output-escaping="yes" />
- -->
- <xsl:value-of select="$content" />
- </pre>
- </div>
- </div>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mono-ecma-impl.xsl: ECMA-style docs to HTML stylesheet trasformation
-
- Author: Joshua Tauberer (tauberer@for.net)
- Author: Jonathan Pryor (jpryor@novell.com)
-
- This file requires that including files define the following callable
- templates:
- - CreateCodeBlock (language, content)
- - CreateEnumerationTable (content)
- - CreateHeader (content)
- - CreateListTable (header, content)
- - CreateMembersTable (content)
- - CreateSignature (content)
- - CreateTypeDocumentationTable (content)
-
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
- <xsl:include href="mdoc-html-utils.xsl" />
-
- <!-- TEMPLATE PARAMETERS -->
-
- <xsl:param name="show"/>
- <xsl:param name="membertype"/>
- <xsl:param name="namespace"/>
-
- <!-- THE MAIN RENDERING TEMPLATE -->
-
- <xsl:template match="Type|elements">
- <!-- The namespace that the current type belongs to. -->
- <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
-
- <!-- HEADER -->
-
- <xsl:variable name="typename" select="translate (@FullName, '+', '.')" />
- <xsl:variable name="typelink">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@FullName" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="basename">
- <xsl:if test="Base/BaseTypeName">
- <xsl:value-of select="translate (Base/BaseTypeName, '+', '.')" />
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="baselink">
- <xsl:if test="Base/BaseTypeName">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="Base/BaseTypeName" />
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:call-template name="CreateHeader">
- <xsl:with-param name="content">
- <ul class="breadcrumb">
- <xsl:choose>
- <xsl:when test="$show='masteroverview'">
- <li class="namespace">
- <xsl:text>Namespaces in this Collection</xsl:text>
- </li>
- </xsl:when>
- <xsl:when test="$show='typeoverview'">
- <li class="namespace">
- <a>
- <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
- <xsl:value-of select="$TypeNamespace"/></a>
- </li>
- <li class="pubclass">
- <xsl:value-of select="@Name"/>
- </li>
- </xsl:when>
- <xsl:when test="$show='members'">
- <li class="namespace">
- <a>
- <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
- <xsl:value-of select="$TypeNamespace"/>
- </a>
- </li>
- <li class="pubclass">
- <a>
- <xsl:attribute name="href">
- <xsl:text>T:</xsl:text>
- <xsl:value-of select="$typelink" />
- </xsl:attribute>
- <xsl:value-of select="@Name"/>
- </a>
- </li>
- <li class="members">
- Members
- </li>
- </xsl:when>
- <xsl:when test="$show='member' or $show='overloads'">
- <li class="namespace">
- <a>
- <xsl:attribute name="href">N:<xsl:value-of select="$TypeNamespace"/></xsl:attribute>
- <xsl:value-of select="$TypeNamespace"/></a>
- </li>
- <li class="pubclass">
- <a>
- <xsl:attribute name="href">
- <xsl:text>T:</xsl:text>
- <xsl:value-of select="$typelink" />
- </xsl:attribute>
- <xsl:value-of select="@Name"/>
- </a>
- </li>
- <li class="pubproperty">
- <xsl:choose>
- <xsl:when test="$membertype='Operator'">
- <xsl:value-of select="$typename"/>
- <xsl:value-of select="' '"/> <!-- hard space -->
- <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
- </xsl:when>
- <xsl:when test="$membertype='Constructor'">
- <xsl:value-of select="$typename"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </xsl:when>
- <xsl:when test="$show='namespace'">
- <li class="namespace">
- <xsl:value-of select="$namespace"/>
- </li>
- </xsl:when>
- </xsl:choose>
- </ul>
- <div class="named-header">
- <xsl:choose>
- <xsl:when test="$show='masteroverview'">
- <xsl:text>Master Overview</xsl:text>
- </xsl:when>
- <xsl:when test="$show='typeoverview'">
- <xsl:value-of select="$typename"/>
- <xsl:value-of select="' '"/>
- <xsl:call-template name="gettypetype"/>
- </xsl:when>
- <xsl:when test="$show='members' and $membertype='All'">
- <xsl:value-of select="$typename"/>
- <xsl:text> Members</xsl:text>
- </xsl:when>
- <xsl:when test="$show='members'">
- <xsl:value-of select="$typename"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="$membertype"/>
- <xsl:text> Members</xsl:text>
- </xsl:when>
- <xsl:when test="$show='member'">
- <xsl:choose>
- <xsl:when test="$membertype='Operator'">
- <xsl:value-of select="$typename"/>
- <xsl:value-of select="' '"/> <!-- hard space -->
- <xsl:value-of select="substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
- </xsl:when>
- <xsl:when test="$membertype='Constructor'">
- <xsl:value-of select="$typename"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$typename"/>.<xsl:value-of select="Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="' '"/>
- <xsl:value-of select="$membertype"/>
- </xsl:when>
-
- <xsl:when test="$show='namespace'">
- <xsl:value-of select="$namespace"/>
- <xsl:text> Namespace</xsl:text>
- </xsl:when>
-
- <xsl:when test="$show='overloads'">
- <xsl:value-of select="$typename"/>.<xsl:value-of select="$index"/> Overloads
- </xsl:when>
-
- </xsl:choose>
- </div>
- </xsl:with-param>
- </xsl:call-template>
-
- <!-- SELECT WHAT TYPE OF VIEW:
- typeoverview
- members
- member
- -->
- <div class="Content">
- <xsl:choose>
- <xsl:when test="$show='masteroverview'">
-
- <xsl:for-each select="namespace">
- <xsl:sort select="@ns"/>
-
- <!-- Don't display the namespace if it is a sub-namespace of another one.
- But don't consider namespaces without periods, e.g. 'System', to be
- parent namespaces because then most everything will get grouped under it. -->
- <xsl:variable name="ns" select="@ns"/>
- <xsl:if test="count(parent::*/namespace[not(substring-before(@ns, '.')='') and starts-with($ns, concat(@ns, '.'))])=0">
-
- <p>
- <b><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></b>
- </p>
- <blockquote>
- <div>
- <xsl:apply-templates select="summary" mode="notoppara"/>
- </div>
-
- <!-- Display the sub-namespaces of this namespace -->
- <xsl:if test="not(substring-before($ns, '.')='')">
- <xsl:for-each select="parent::*/namespace[starts-with(@ns, concat($ns, '.'))]">
- <br/>
- <div><a href="N:{@ns}"><xsl:value-of select="@ns"/></a></div>
- <div><xsl:apply-templates select="summary" mode="notoppara"/></div>
- </xsl:for-each>
- </xsl:if>
- </blockquote>
-
- </xsl:if>
- </xsl:for-each>
-
- </xsl:when>
- <!-- TYPE OVERVIEW -->
- <xsl:when test="$show='typeoverview'">
- <xsl:variable name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
- <xsl:call-template name="CreateTypeOverview">
- <xsl:with-param name="implemented" select="$implemented" />
- <xsl:with-param name="show-members-link" select="true()" />
- </xsl:call-template>
-
-
- <!-- signature -->
- <xsl:call-template name="CreateTypeSignature" />
-
- <xsl:call-template name="DisplayDocsInformation">
- <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
- </xsl:call-template>
- </xsl:when>
-
- <!-- MEMBER LISTING -->
- <xsl:when test="$show='members'">
- <xsl:if test="$membertype='All'">
- <p>
- The members of <xsl:value-of select="$typename"/> are listed below.
- </p>
-
- <xsl:if test="Base/BaseTypeName">
- <p>
- <xsl:text>See Also: </xsl:text>
- <a>
- <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
- <xsl:text>Inherited members from </xsl:text>
- <xsl:value-of select="$basename"/>
- </a>
- </p>
- </xsl:if>
-
- <ul class="TypeMembersIndex">
- <xsl:if test="count(Members/Member[MemberType='Constructor'])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/C</xsl:attribute>Constructors</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='Field'])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/F</xsl:attribute>Fields</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='Property'])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/P</xsl:attribute>Properties</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='Method' and not(starts-with(@MemberName,'op_'))])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/M</xsl:attribute>Methods</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='Event'])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='Method' and starts-with(@MemberName,'op_')])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/E</xsl:attribute>Events</a>
- </li>
- </xsl:if>
- <xsl:if test="count(Members/Member[MemberType='ExtensionMethod'])">
- <li>
- <a><xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/X</xsl:attribute>Extension Methods</a>
- </li>
- </xsl:if>
- </ul>
-
- <!-- list each type of member (public, then protected) -->
-
- <xsl:call-template name="ListAllMembers" />
- </xsl:if>
-
- <xsl:if test="not($membertype='All')">
- <!-- list the members of this type (public, then protected) -->
-
- <p>
- The
- <xsl:call-template name="membertypeplurallc"><xsl:with-param name="name" select="$membertype"/></xsl:call-template>
- of <xsl:value-of select="$typename"/> are listed below. For a list of all members, see the <a>
- <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
- <xsl:value-of select="@Name"/> Members</a> list.
- </p>
-
- <xsl:if test="Base/BaseTypeName">
- <p>
- <xsl:text>See Also: </xsl:text>
- <a>
- <xsl:attribute name="href">T:<xsl:value-of select="$baselink"/>/*</xsl:attribute>
- <xsl:text>Inherited members from </xsl:text>
- <xsl:value-of select="$basename"/>
- </a>
- </p>
- </xsl:if>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="$membertype"/>
- <xsl:with-param name="showprotected" select="false()"/>
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="$membertype"/>
- <xsl:with-param name="showprotected" select="true()"/>
- </xsl:call-template>
- </xsl:if>
-
- </xsl:when>
-
- <xsl:when test="$show='overloads'">
- <p>
- The overloads of <xsl:value-of select="$index"/>
- are listed below. For a list of all members, see the <a>
- <xsl:attribute name="href">T:<xsl:value-of select="$typelink"/>/*</xsl:attribute>
- <xsl:value-of select="@Name"/> Members</a> list.
- </p>
-
- <!-- TODO: can we make this actually test if there are any overloads
- <xsl:if test="Base/BaseTypeName">
- <p>
- See Also: <a>
- <xsl:attribute name="href">T:<xsl:value-of select="Base/BaseTypeName"/>/*</xsl:attribute>
- Inherited members</a> from <xsl:value-of select="Base/BaseTypeName"/>
- </p>
- </xsl:if>
- -->
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="$membertype"/>
- <xsl:with-param name="showprotected" select="false()"/>
- <xsl:with-param name="overloads-mode" select="true()"/>
- </xsl:call-template>
-
- <xsl:call-template name="ListMembers">
- <xsl:with-param name="listmembertype" select="$membertype"/>
- <xsl:with-param name="showprotected" select="true()"/>
- <xsl:with-param name="overloads-mode" select="true()"/>
- </xsl:call-template>
- </xsl:when>
- <!-- MEMBER DETAILS -->
- <xsl:when test="$show='member'">
- <xsl:variable name="Type" select="."/>
-
- <!-- select the member, this just loops through the one member that we are to display -->
- <xsl:for-each select="Members/Member[MemberType=$membertype or ($membertype='Operator' and MemberType='Method')][position()=$index+1]">
-
- <!-- summary -->
-
- <xsl:call-template name="CreateMemberOverview">
- <xsl:with-param name="implemented" select="monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
- </xsl:call-template>
-
- <xsl:call-template name="CreateMemberSignature">
- <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
- </xsl:call-template>
-
- <div class="MemberBox">
- <xsl:call-template name="DisplayDocsInformation">
- <xsl:with-param name="linkid" select="concat ('T:', @FullName)" />
- </xsl:call-template>
- </div>
-
- </xsl:for-each>
-
- </xsl:when>
-
- <!-- NAMESPACE SUMMARY -->
- <xsl:when test="$show='namespace'">
-
- <!-- summary -->
-
- <p><div class="msummary"><xsl:apply-templates select="summary" mode="notoppara"/></div>
-
- <xsl:if test="monodoc:MonoEditing()">
- <xsl:value-of select="' '" />
- [<a href="{monodoc:EditUrlNamespace (., $namespace, 'summary')}">Edit</a>]
- </xsl:if>
- </p>
-
- <!-- remarks -->
-
- <xsl:if test="not(remarks = '')">
- <h2>Remarks</h2>
- <div class="SectionBox">
- <xsl:apply-templates select="remarks"/>
- <xsl:if test="monodoc:MonoEditing()">
- <xsl:value-of select="' '" />
- [<a href="{monodoc:EditUrlNamespace (., $namespace, 'remarks')}">Edit</a>]
- </xsl:if>
- </div>
- </xsl:if>
-
- <xsl:call-template name="namespacetypes">
- <xsl:with-param name="typetype" select="'class'"/>
- <xsl:with-param name="typetitle" select="'Classes'"/>
- </xsl:call-template>
-
- <xsl:call-template name="namespacetypes">
- <xsl:with-param name="typetype" select="'interface'"/>
- <xsl:with-param name="typetitle" select="'Interfaces'"/>
- </xsl:call-template>
-
- <xsl:call-template name="namespacetypes">
- <xsl:with-param name="typetype" select="'struct'"/>
- <xsl:with-param name="typetitle" select="'Structs'"/>
- </xsl:call-template>
-
- <xsl:call-template name="namespacetypes">
- <xsl:with-param name="typetype" select="'delegate'"/>
- <xsl:with-param name="typetitle" select="'Delegates'"/>
- </xsl:call-template>
-
- <xsl:call-template name="namespacetypes">
- <xsl:with-param name="typetype" select="'enum'"/>
- <xsl:with-param name="typetitle" select="'Enumerations'"/>
- </xsl:call-template>
-
-
- </xsl:when>
-
- <!-- don't know what kind of page this is -->
- <xsl:otherwise>
- Don't know what to do!
- </xsl:otherwise>
-
- </xsl:choose>
- </div>
-
- <!-- FOOTER -->
-
- <div class="Footer">
- </div>
-
- </xsl:template>
-
- <xsl:template name="GetLinkTarget">
- <xsl:param name="type" />
- <xsl:param name="cref" />
-
- <xsl:value-of select="$cref" />
- </xsl:template>
-
- <xsl:template name="namespacetypes">
- <xsl:param name="typetype"/>
- <xsl:param name="typetitle"/>
-
- <xsl:variable name="NODES" select="*[name()=$typetype]"/>
-
- <xsl:if test="count($NODES)">
-
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="$typetitle" />
- <xsl:with-param name="child-id" select="$typetitle" />
- <xsl:with-param name="content">
-
- <xsl:call-template name="CreateTypeDocumentationTable">
- <xsl:with-param name="content">
- <xsl:for-each select="$NODES">
- <xsl:sort select="@name"/>
-
- <tr>
- <td>
- <a>
- <xsl:attribute name="href">
- <xsl:text>T:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@fullname" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select="@name"/>
- </a>
-
- <xsl:variable name="containingtype" select="substring-before(@fullname, concat('+',@name))"/>
- <xsl:if test="$containingtype">
- <br/>(in
- <xsl:call-template name="maketypelink">
- <xsl:with-param name="type" select="$containingtype"/>
- <xsl:with-param name="wrt" select="$namespace"/>
- </xsl:call-template>)
- </xsl:if>
- </td>
- <td>
- <xsl:apply-templates select="summary" mode="notoppara"/>
- <xsl:variable name="MonoImplInfo" select="monodoc:MonoImpInfo(string(@assembly), string(@fullname), false())"/>
- <xsl:if test="$MonoImplInfo"><br/><b><xsl:value-of disable-output-escaping="yes" select="$MonoImplInfo"/></b></xsl:if>
- </td>
- </tr>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
-
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="CreateEditLink">
- <xsl:param name="e" />
- <xsl:if test="monodoc:MonoEditing()">
- <xsl:value-of select="' '" />
- [<a href="{monodoc:EditUrl ($e)}">Edit</a>]
- </xsl:if>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-body
-{
- font-family: "Lucida Grande", Geneva, Helvetica, Arial, Verdana, Sans-Serif;
- margin: 0;
- padding: 0;
- color: #555;
-}
-
-a:link
-{
- color: #034af3;
- text-decoration: underline;
-}
-a:visited
-{
- color: #505abc;
-}
-a:hover
-{
- color: #1d60ff;
- text-decoration: none;
-}
-a:active
-{
- color: #12eb87;
-}
-
-pre
-{
- font-family: Consolas, "Courier New", Monospace;
- border: 1px solid #CCCCCC;
- background-color: #F7F7F7;
- padding: 7px;
- /*margin: 0 20px 0 20px;*/
- line-height: 1.3em;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-}
-
-img
-{
- border: 0px;
-}
-
-/* HEADINGS
-----------------------------------------------------------*/
-h1, h2, h3, h4, h5, h6
-{
- color: #333;
- font-family: Arial, Helvetica, sans-serif;
-}
-
-h1
-{
- font-size: 16pt;
- padding-bottom: 0;
- margin-bottom: 0;
-}
-h2
-{
- font-size: 14pt;
- padding: 0 0 1px 0;
- border-bottom: 1px solid #DDDDDD;
- margin-top: .3em;
- margin-bottom: .5em;
-}
-h3
-{
- font-size: 12pt;
- /*margin-top: 20px;*/
- margin-bottom: 5px;
-}
-h4
-{
- font-size: 11pt;
- margin-bottom: 5px;
-}
-h5, h6
-{
- font-size: 10pt;
-}
-
-/* this rule styles <h2> tags that are the
-first child of the left and right table columns */
-.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
-{
- margin-top: 0;
-}
-
-/* PRIMARY LAYOUT ELEMENTS
-----------------------------------------------------------*/
-
-/* you can specify a greater or lesser percentage for the
-page width. Or, you can specify an exact pixel width. */
-.page
-{
- padding: 0;
- margin: 0;
-}
-
-#header
-{
- position: relative;
- margin-bottom: 0px;
- color: #000;
- padding: 0 0 0 15px;
- background: url('mdocimages/headerbg.png');
- background-position: right;
- background-repeat: no-repeat;
- background-color: #679EF1;
- height: 40px;
- border-bottom: 1px solid #98C2F7;
- border-bottom: 1px dotted #3363BD;
-}
-
-#header h1
-{
- font-weight: bold;
- padding: 0;
- margin: 0;
- color: #fff;
- border: none;
- line-height: 1.8em;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 22px !important;
-}
-
-#main
-{
- padding: 0px 0px 15px 0px;
- background-color: #fff;
- margin-bottom: 30px;
- _height: 1px; /* only IE6 applies CSS properties starting with an underscore */
-}
-
-#footer
-{
- color: #999;
- padding: 10px 0;
- text-align: center;
- line-height: normal;
- margin: 0;
- font-size: 8pt;
-}
-
-#line-background
-{
- background-image: url('mdocimages/treebg.png');
- background-repeat: repeat-y;
- height: 100%;
-}
-
-#left-content
-{
- float: left;
- width: 186px;
- padding-top: 5px;
- margin-right: 5px;
- overflow: hidden;
-}
-
-#right-content
-{
- padding-top: 0px;
- overflow: auto;
- height: 100%;
-}
-
-.right-content-pad
-{
- margin: 6px 10px 0px 10px;
-}
-
-.named-header
-{
- background: url('mdocimages/hatch.png') repeat-x left bottom;
- height: 48px;
- background-color: #FAFBFD;
- font-size: 16pt;
- font-weight: bold;
- font-family: 'Segoe UI',Verdana,Arial, sans-serif;
-}
-
-.member-list
-{
- border-spacing: 0px;
-}
-
-.member-list td
-{
- padding: 4px;
- margin: 0px;
- border-bottom: 1px dotted #CCCCCC;
-}
-
-.member-list
-{
-
-}
-/* TAB MENU
-----------------------------------------------------------*/
-ul#menu
-{
- border-bottom: 1px #5C87B2 solid;
- padding: 0 0 2px;
- position: relative;
- margin: 0;
- text-align: right;
-}
-
-ul#menu li
-{
- display: inline;
- list-style: none;
-}
-
-ul#menu li#greeting
-{
- padding: 10px 20px;
- font-weight: bold;
- text-decoration: none;
- line-height: 2.8em;
- color: #fff;
-}
-
-ul#menu li a
-{
- padding: 10px 20px;
- font-weight: bold;
- text-decoration: none;
- line-height: 2.8em;
- background-color: #e8eef4;
- color: #034af3;
-}
-
-ul#menu li a:hover
-{
- background-color: #fff;
- text-decoration: none;
-}
-
-ul#menu li a:active
-{
- background-color: #a6e2a6;
- text-decoration: none;
-}
-
-ul#menu li.selected a
-{
- background-color: #fff;
- color: #000;
-}
-
-/* FORM LAYOUT ELEMENTS
-----------------------------------------------------------*/
-
-fieldset
-{
- margin: 1em 0;
- padding: 1em;
- border: 1px solid #CCC;
-}
-
-fieldset p
-{
- margin: 2px 12px 10px 10px;
-}
-
-legend
-{
- font-size: 11pt;
- font-weight: 600;
- padding: 2px 4px 8px 4px;
-}
-
-input[type="text"]
-{
- width: 200px;
- border: 1px solid #CCC;
-}
-
-input[type="password"]
-{
- width: 200px;
- border: 1px solid #CCC;
-}
-
-/* TABLE
-----------------------------------------------------------*/
-
-table
-{
-/* border: solid 1px #e8eef4;
- border-collapse: collapse;*/
-}
-
-table td
-{
- padding: 5px;
-/* border: solid 1px #e8eef4;*/
-}
-
-table th
-{
- padding: 6px 5px;
- text-align: left;
- background-color: #e8eef4;
- border: solid 1px #e8eef4;
-}
-
-/* MISC
-----------------------------------------------------------*/
-.clear
-{
- clear: both;
-}
-
-.error
-{
- color:Red;
-}
-
-.indent
-{
- margin-left: 20px;
- margin-right: 20px;
-}
-
-#menucontainer
-{
- margin-top:40px;
-}
-
-div#title
-{
- display:block;
- float:left;
- text-align:left;
-}
-
-#logindisplay
-{
- font-size:11pt;
- display:block;
- text-align:right;
- margin:0px;
- color:White;
-}
-
-#logindisplay a:link
-{
- color: white;
- text-decoration: underline;
-}
-
-#logindisplay a:visited
-{
- color: white;
- text-decoration: underline;
-}
-
-#logindisplay a:hover
-{
- color: white;
- text-decoration: none;
-}
-
-/* Styles for validation helpers
------------------------------------------------------------*/
-.field-validation-error
-{
- color: #ff0000;
-}
-
-.field-validation-valid
-{
- display: none;
-}
-
-.input-validation-error
-{
- border: 1px solid #ff0000;
- background-color: #ffeeee;
-}
-
-.validation-summary-errors
-{
- font-weight: bold;
- color: #ff0000;
-}
-
-.validation-summary-valid
-{
- display: none;
-}
-
-/* Styles for editor and display helpers
-----------------------------------------------------------*/
-.display-label,
-.editor-label,
-.display-field,
-.editor-field
-{
- margin: 0.5em 0;
-}
-
-.text-box
-{
- width: 30em;
-}
-
-.text-box.multi-line
-{
- height: 6.5em;
-}
-
-.tri-state
-{
- width: 6em;
-}
-
-/* Breadcrumb Bar */
-.breadcrumb
-{
- border-left: 1px solid #cacaca;
- border-right: 1px solid #cacaca;
- border-bottom: 1px solid #cacaca;
- background-image: url('mdocimages/bc_bg.png');
- background-repeat: repeat-x;
- height: 25px;
- line-height: 25px;
- color: #454545;
- border-top: 0px;
- width: 100%;
- overflow: hidden;
- margin-left: -2px;
- padding: 0px;
- font-style: normal;
- font-variant: normal;
- font-weight: normal;
- font-size: 11px;
- font-family: Arial, Helvetica, sans-serif;
- margin-right: 0px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-.breadcrumb li
-{
- list-style-type: none;
- float: left;
- padding-left: 25px;
- background-position: 5px center;
- background-repeat: no-repeat;
-}
-
-.breadcrumb li.pubclass { background-image: url('mdocimages/pubclass.png'); }
-.breadcrumb li.pubdelegate { background-image: url('mdocimages/pubdelegate.png'); }
-.breadcrumb li.pubenumeration { background-image: url('mdocimages/pubenumeration.png'); }
-.breadcrumb li.pubevent { background-image: url('mdocimages/pubevent.png'); }
-.breadcrumb li.pubextension { background-image: url('mdocimages/pubextension.png'); }
-.breadcrumb li.pubfield { background-image: url('mdocimages/pubfield.png'); }
-.breadcrumb li.pubinterface { background-image: url('mdocimages/pubinterface.png'); }
-.breadcrumb li.pubmethod { background-image: url('mdocimages/pubmethod.png'); }
-.breadcrumb li.pubproperty { background-image: url('mdocimages/pubproperty.png'); }
-.breadcrumb li.pubstructure { background-image: url('mdocimages/pubstructure.png'); }
-
-.breadcrumb li.protclass { background-image: url('mdocimages/protclass.png'); }
-.breadcrumb li.protdelegate { background-image: url('mdocimages/protdelegate.png'); }
-.breadcrumb li.protenumeration { background-image: url('mdocimages/protenumeration.png'); }
-.breadcrumb li.protevent { background-image: url('mdocimages/protevent.png'); }
-.breadcrumb li.protextension { background-image: url('mdocimages/protextension.png'); }
-.breadcrumb li.protfield { background-image: url('mdocimages/protfield.png'); }
-.breadcrumb li.protinterface { background-image: url('mdocimages/protinterface.png'); }
-.breadcrumb li.protmethod { background-image: url('mdocimages/protmethod.png'); }
-.breadcrumb li.protproperty { background-image: url('mdocimages/protproperty.png'); }
-.breadcrumb li.protstructure { background-image: url('mdocimages/protstructure.png'); }
-
-.breadcrumb li.privclass { background-image: url('mdocimages/privclass.png'); }
-.breadcrumb li.privdelegate { background-image: url('mdocimages/privdelegate.png'); }
-.breadcrumb li.privenumeration { background-image: url('mdocimages/privenumeration.png'); }
-.breadcrumb li.privevent { background-image: url('mdocimages/privevent.png'); }
-.breadcrumb li.privextension { background-image: url('mdocimages/privextension.png'); }
-.breadcrumb li.privfield { background-image: url('mdocimages/privfield.png'); }
-.breadcrumb li.privinterface { background-image: url('mdocimages/privinterface.png'); }
-.breadcrumb li.privmethod { background-image: url('mdocimages/privmethod.png'); }
-.breadcrumb li.privproperty { background-image: url('mdocimages/privproperty.png'); }
-.breadcrumb li.privstructure { background-image: url('mdocimages/privstructure.png'); }
-
-.breadcrumb li.namespace
-{
- padding-left: 26px;
- background-image: url('mdocimages/namespace.png');
-}
-
-.breadcrumb li.reference
-{
- padding-left: 26px;
- background-image: url('mdocimages/reference.png');
-}
-
-.breadcrumb li.members
-{
- padding-left: 24px;
- background-image: url('mdocimages/members.png');
-}
-
-.breadcrumb li.home
-{
- padding-left: 31px;
- background-image: url('mdocimages/house.png');
- background-position: 8px center;
-}
-
-.breadcrumb li.help
-{
- background-image: url('mdocimages/help.png');
-}
-
-.breadcrumb li.unrecognized
-{
- background-image: url('mdocimages/error.png');
-}
-
-.breadcrumb a
-{
- height: 25px;
- display: block;
- background-image: url('mdocimages/bc_separator.png');
- background-repeat: no-repeat;
- background-position: right;
- padding-right: 15px;
- color: #454545;
- text-decoration: none;
-}
-
-.breadcrumb a:hover
-{
- text-decoration: underline;
-}
-
-.clearer
-{
- clear: both;
-}
-
-div.Signature {
- border: 1px solid #C0C0C0;
- background: #F2F2F2;
- padding: 1em;
- /* margin-left: 1em; */
-}
-
-div.Content {
- /*margin-left: 1em;*/
-}
-
-div.msummary {
- font-size: 24px;
- color: #38689b;
-}
-
-.SectionBox {
- /*margin-left: 1em;*/
-}
-
-/* Salvaged from the old style */
-table.Documentation, table.Enumeration, table.TypeDocumentation {
- border-collapse: collapse;
- width: 100%;
-}
-
-table.Documentation tr th, table.TypeMembers tr th, table.Enumeration tr th, table.TypeDocumentation tr th {
- background: whitesmoke;
- padding: 0.8em;
- border: 1px solid gray;
- text-align: left;
- vertical-align: bottom;
-}
-
-table.Documentation tr td, table.TypeMembers tr td, table.Enumeration tr td, table.TypeDocumentation tr td {
- padding: 0.5em;
- border: 1px solid gray;
- text-align: left;
- vertical-align: top;
-}
-
-table.TypeMembers {
- border: 1px solid #C0C0C0;
- width: 100%;
-}
-
-table.TypeMembers tr td {
- background: #F8F8F8;
- border: white;
-}
-
-span.NotEntered /* Documentation for this section has not yet been entered */ {
- font-style: italic;
- color: #aaa;
-}
-
-.SubsectionBox {
- margin-top: 0;
- margin-bottom: 0;
-}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- mono-ecma.xsl: ECMA-style docs to HTML stylesheet trasformation
-
- Author: Joshua Tauberer (tauberer@for.net)
-
- TODO:
- split this into multiple files
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:monodoc="monodoc:///extensions"
- exclude-result-prefixes="monodoc"
- >
- <xsl:import href="mdoc-sections.xsl" />
- <xsl:import href="mono-ecma-impl.xsl" />
-
- <xsl:output omit-xml-declaration="yes" />
-
- <xsl:template name="CreateCodeBlock">
- <xsl:param name="language" />
- <xsl:param name="content" />
- <table class="CodeExampleTable" bgcolor="#f5f5dd" border="1" cellpadding="5" width="100%">
- <tr><td><b><xsl:value-of select="$language"/> Example</b></td></tr>
- <tr>
- <td>
- <!--
- <xsl:value-of select="monodoc:Colorize($content, string($language))"
- disable-output-escaping="yes" />
- -->
- <pre>
- <xsl:value-of select="$content" />
- </pre>
- </td>
- </tr>
- </table>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" />
-
- <xsl:template match="/toc">
- <table bgcolor="#b0c4de" width="100%" cellpadding="5"><tr><td><h3><xsl:value-of select="@title" /></h3></td></tr></table>
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="description">
- <p><xsl:value-of select="." /></p>
- </xsl:template>
-
- <xsl:template match="list">
- <ul>
- <xsl:apply-templates />
- </ul>
- </xsl:template>
-
- <xsl:template match="item">
- <xsl:choose>
- <xsl:when test="list">
- <li>
- <xsl:apply-templates select="list" />
- </li>
- </xsl:when>
- <xsl:otherwise>
- <li><a href="{@url}"><xsl:value-of select="." /></a></li>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-using Monodoc.Ecma;
-
-namespace MonoTests.Monodoc.Ecma
-{
- [TestFixture]
- public class EcmaUrlTests
- {
- EcmaUrlParser parser;
-
- [SetUp]
- public void Setup ()
- {
- parser = new EcmaUrlParser ();
- }
-
- void AssertValidUrl (string url)
- {
- try {
- parser.IsValid (url);
- } catch {
- Assert.Fail (string.Format ("URL '{0}' deemed not valid", url));
- }
- }
-
- void AssertInvalidUrl (string url)
- {
- try {
- parser.IsValid (url);
- } catch {
- return;
- }
- Assert.Fail (string.Format ("URL '{0}' deemed valid", url));
- }
-
- void AssertUrlDesc (EcmaDesc expected, string url)
- {
- EcmaDesc actual = null;
- try {
- actual = parser.Parse (url);
- } catch (Exception e) {
- Assert.Fail (string.Format ("URL '{0}' deemed not valid: {1}{2}", url, Environment.NewLine, e.ToString ()));
- }
-
- Assert.AreEqual (expected, actual, "Converted URL differs");
- }
-
- void AssertEcmaString (string expected, EcmaDesc actual)
- {
- string actualString = actual.ToEcmaCref ();
- Assert.AreEqual (expected, actualString);
- }
-
- IEnumerable<EcmaDesc> GenericTypeArgumentsList (params string[] parameters)
- {
- foreach (var p in parameters)
- yield return new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = p,
- Namespace = string.Empty
- };
- }
-
- [Test]
- public void CommonMethodUrlIsValidTest ()
- {
- AssertValidUrl ("M:System.String.FooBar()");
- AssertValidUrl ("M:System.String.FooBar(System.String, Int32)");
- AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo()");
- AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh,Bar)");
- AssertValidUrl ("M:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>.Foo(Bleh<V>,Bar)");
- AssertValidUrl ("M:Gendarme.Framework.Helpers.Log.WriteLine(string,string,object[])");
- AssertValidUrl ("M:Mono.Security.X509.Extensions.SubjectKeyIdentifierExtension.Decode");
- AssertValidUrl ("M:Mono.Security.PKCS7.IssuerAndSerialNumber");
- }
-
- [Test]
- public void CommonTypeUrlIsValidTest ()
- {
- AssertValidUrl ("T:Int32");
- AssertValidUrl ("T:System.Foo.Int32");
- AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar`1>");
- AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
- AssertValidUrl ("T:System.Foo.Int32<T>");
- AssertValidUrl ("T:System.Foo.Int32<T,U>");
- AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U>>>");
- AssertValidUrl ("T:System.Foo.Int32<System.String+FooBar<System.Blop<T, U`2>>>");
- }
-
- [Test]
- public void CommonTypeUrlNotValidTest ()
- {
- AssertInvalidUrl ("TInt32");
- AssertInvalidUrl ("K:Int32");
- AssertInvalidUrl ("T:System..Foo.Int32");
- AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBar`1");
- AssertInvalidUrl ("T:System.Foo.Int32<System.String+FooBarSystem.Blop<T, U>>>");
- AssertInvalidUrl ("T:System.Foo.Int32<T,>");
- AssertInvalidUrl ("T:System.Foo.Int32<+FooBar<System.Blop<T, U>>>");
- }
-
- [Test]
- public void NamespaceValidTest ()
- {
- AssertValidUrl ("N:Foo.Bar");
- AssertValidUrl ("N:Foo");
- AssertValidUrl ("N:Foo.Bar.Baz");
- AssertValidUrl ("N:A.B.C");
-
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Namespace,
- Namespace = "Foo.Bar.Blop" };
- AssertUrlDesc (ast, "N:Foo.Bar.Blop");
- }
-
- [Test]
- public void ConstructorValidTest ()
- {
- AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule");
- AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule()");
- AssertValidUrl ("C:Gendarme.Rules.Concurrency.DecorateThreadsRule.DecorateThreadsRule(System.String)");
- AssertValidUrl ("C:Gendarme.Framework.Helpers.MethodSignature.MethodSignature(string,string,string[],System.Func<Mono.Cecil.MethodReference,System.Boolean>)");
- AssertValidUrl ("C:System.Collections.Generic.Dictionary<TKey,TValue>+KeyCollection.KeyCollection(System.Collections.Generic.Dictionary<TKey,TValue>)");
- AssertValidUrl ("C:Microsoft.Build.Utilities.TaskItem(System.String,System.Collections.IDictionary)");
- }
-
- [Test]
- public void SlashExpressionValidTest ()
- {
- AssertValidUrl ("T:Foo.Bar.Type/*");
- AssertValidUrl ("T:Foo.Bar.Type/M");
- AssertValidUrl ("T:Gendarme.Framework.Bitmask<T>/M/Equals");
- AssertValidUrl ("T:Gendarme.Framework.Helpers.Log/M/WriteLine<T>");
- AssertValidUrl ("T:System.Windows.Forms.AxHost/M/System.ComponentModel.ICustomTypeDescriptor.GetEvents");
- }
-
- [Test]
- public void MethodWithArgModValidTest ()
- {
- AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging&)");
- AssertValidUrl ("M:Foo.Bar.FooBar(int@, System.Drawing.Imaging)");
- AssertValidUrl ("M:Foo.Bar.FooBar(int, System.Drawing.Imaging*)");
- AssertValidUrl ("M:Foo.Bar.FooBar(int*, System.Drawing.Imaging&)");
- AssertValidUrl ("M:Atk.NoOpObject.GetRunAttributes(int,int&,int&)");
- }
-
- [Test]
- public void MethodWithJaggedArrayArgsValidTest ()
- {
- AssertValidUrl ("M:System.Reflection.Emit.SignatureHelper.GetPropertySigHelper(System.Reflection.Module,System.Reflection.CallingConventions,Type,Type[],Type[],Type[],Type[][],Type[][])");
- }
-
- [Test]
- public void MethodWithInnerTypeValidTest ()
- {
- AssertValidUrl ("M:System.TimeZoneInfo+AdjustmentRule.CreateAdjustmentRule");
- }
-
- [Test]
- public void FieldValidTest ()
- {
- AssertValidUrl ("F:Mono.Terminal.Curses.KeyF10");
- AssertValidUrl ("F:Novell.Directory.Ldap.Utilclass.ExceptionMessages.NOT_IMPLEMENTED");
- AssertValidUrl ("F:Novell.Directory.Ldap.LdapException.NOT_ALLOWED_ON_NONLEAF");
- }
-
- [Test]
- public void PropertyValidTest ()
- {
- AssertValidUrl ("P:System.Foo.Bar");
- AssertValidUrl ("P:System.ArraySegment<T>.Array");
- }
-
- [Test]
- public void IndexPropertyValidTest ()
- {
- AssertValidUrl ("P:System.ComponentModel.PropertyDescriptorCollection.Item(int)");
- AssertValidUrl ("P:System.ComponentModel.AttributeCollection.Item(Type)");
- AssertValidUrl ("P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
- AssertValidUrl ("P:System.Collections.Specialized.BitVector32.Item(System.Collections.Specialized.BitVector32+Section)");
- }
-
- [Test]
- public void ExplicitMethodImplValidTest ()
- {
- AssertValidUrl ("M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
- }
-
- [Test]
- public void AspNetSafeUrlValidTest ()
- {
- AssertValidUrl ("M:MonoTouch.UIKit.UICollectionViewLayoutAttributes.CreateForCell{T}");
- }
-
- [Test]
- public void GenericTypeArgsIsNumericTest ()
- {
- var desc = parser.Parse ("T:System.Collections.Generic.Dictionary`2");
- Assert.IsTrue (desc.GenericTypeArgumentsIsNumeric);
- Assert.AreEqual (2, desc.GenericTypeArguments.Count);
- desc = parser.Parse ("T:System.Collections.Generic.Dictionary<TKey,TValue>");
- Assert.IsFalse (desc.GenericTypeArgumentsIsNumeric);
- }
-
- [Test]
- public void GenericTypeArgsNumericToStringTest ()
- {
- string stringCref = "T:System.Collections.Generic.Dictionary`2";
- var desc = parser.Parse (stringCref);
- Assert.IsTrue (desc.GenericTypeArgumentsIsNumeric);
- Assert.AreEqual (2, desc.GenericTypeArguments.Count);
- string generatedEcmaCref = desc.ToEcmaCref ();
- Assert.AreEqual (stringCref, generatedEcmaCref);
- }
-
- [Test]
- public void MetaEtcNodeTest ()
- {
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- Namespace = "Foo.Bar",
- TypeName = "Type",
- Etc = '*' };
- AssertUrlDesc (ast, "T:Foo.Bar.Type/*");
- }
-
- [Test]
- public void MetaEtcWithInnerTypeTest ()
- {
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- Namespace = "Novell.Directory.Ldap",
- TypeName = "Connection",
- NestedType = new EcmaDesc { DescKind = EcmaDesc.Kind.Type, TypeName = "ReaderThread" },
- Etc = '*' };
- AssertUrlDesc (ast, "T:Novell.Directory.Ldap.Connection+ReaderThread/*");
- }
-
- [Test]
- public void SimpleTypeUrlParseTest ()
- {
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- TypeName = "String",
- Namespace = "System" };
- AssertUrlDesc (ast, "T:System.String");
- }
-
- [Test]
- public void TypeWithOneGenericUrlParseTest ()
- {
- var generics = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = string.Empty,
- TypeName = "T"
- }
- };
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- TypeName = "String",
- Namespace = "System",
- GenericTypeArguments = generics,
- };
-
- AssertUrlDesc (ast, "T:System.String<T>");
- }
-
- [Test]
- public void TypeWithOneGenericUrlParseTestUsingAspNetStyleUrl ()
- {
- var generics = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = string.Empty,
- TypeName = "T"
- }
- };
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- TypeName = "String",
- Namespace = "System",
- GenericTypeArguments = generics,
- };
-
- AssertUrlDesc (ast, "T:System.String{T}");
- }
-
- [Test]
- public void TypeWithNestedGenericUrlParseTest ()
- {
- var generics = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "T",
- Namespace = string.Empty
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.Collections.Generic",
- TypeName = "List",
- GenericTypeArguments = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "V",
- Namespace = string.Empty
- }
- }
- }
- };
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,
- TypeName = "String",
- Namespace = "System",
- GenericTypeArguments = generics,
- };
-
- AssertUrlDesc (ast, "T:System.String<T, System.Collections.Generic.List<V>>");
- }
-
- [Test]
- public void SimpleMethodUrlParseTest ()
- {
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
- TypeName = "String",
- Namespace = "System",
- MemberName = "FooBar"
- };
- AssertUrlDesc (ast, "M:System.String.FooBar()");
- }
-
- [Test]
- public void MethodWithArgsUrlParseTest ()
- {
- var args = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "String"
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Int32",
- Namespace = string.Empty
- }
- };
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
- TypeName = "String",
- Namespace = "System",
- MemberName = "FooBar",
- MemberArguments = args
- };
- AssertUrlDesc (ast, "M:System.String.FooBar(System.String, Int32)");
- }
-
- [Test]
- public void MethodWithArgsAndGenericsUrlParseTest ()
- {
- var args = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "String"
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.Collections.Generic",
- TypeName = "Dictionary",
- GenericTypeArguments = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "K",
- Namespace = string.Empty
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "V",
- Namespace = string.Empty
- }
- }
- }
- };
-
- var generics = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Action",
- Namespace = string.Empty,
- GenericTypeArguments = new[] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Single",
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "int",
- Namespace = string.Empty
- },
- }
- }
- };
-
- var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Method,
- TypeName = "String",
- Namespace = "System",
- MemberName = "FooBar",
- MemberArguments = args,
- GenericMemberArguments = generics
- };
- AssertUrlDesc (ast, "M:System.String.FooBar<Action<System.Single, int>>(System.String, System.Collections.Generic.Dictionary<K, V>)");
- }
-
- [Test]
- public void ExplicitMethodImplementationParseTest ()
- {
- var inner = new EcmaDesc {
- MemberName = "Dispose",
- TypeName = "IDisposable",
- Namespace = "System"
- };
- var ast = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- TypeName = "RegistryKey",
- Namespace = "Microsoft.Win32",
- ExplicitImplMember = inner
- };
- AssertUrlDesc (ast, "M:Microsoft.Win32.RegistryKey$System.IDisposable.Dispose");
- }
-
- [Test]
- public void SimpleMethodWithNumberInType ()
- {
- var ast = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- TypeName = "ASN1",
- Namespace = "Mono.Security",
- MemberName = "Add"
- };
- AssertUrlDesc (ast, "M:Mono.Security.ASN1.Add");
- }
-
- [Test]
- public void JaggedArrayWithDimensions ()
- {
- var ast = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Int32",
- Namespace = "System",
- ArrayDimensions = new int[] { 3, 1, 1 }
- };
- AssertUrlDesc (ast, "T:System.Int32[,,][][]");
- }
-
- [Test]
- public void ExplicitIndexerImplementation ()
- {
- var explicitImpl = new EcmaDesc {
- Namespace = "System.Web.SessionState",
- TypeName = "IHttpSessionState",
- MemberName = "Item",
- MemberArguments = new [] { new EcmaDesc { DescKind = EcmaDesc.Kind.Type, Namespace = "System", TypeName = "Int32" } },
- };
- var ast = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Property,
- TypeName = "HttpSessionStateContainer",
- Namespace = "System.Web.SessionState",
- ExplicitImplMember = explicitImpl,
- };
- AssertUrlDesc (ast, "P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)");
- }
-
- [Test]
- public void ToEcmaCref_Namespace ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Namespace,
- Namespace = "System.IO",
- };
-
- AssertEcmaString ("N:System.IO", actual);
- }
-
- [Test]
- public void ToEcmaCref_SimpleType ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.IO",
- TypeName = "Path",
- };
-
- AssertEcmaString ("T:System.IO.Path", actual);
- }
-
- [Test]
- public void ToEcmaCref_NestedType ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.IO",
- TypeName = "Path",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "TheNestedType",
- },
- };
-
- AssertEcmaString ("T:System.IO.Path+TheNestedType", actual);
- }
-
- [Test]
- public void ToEcmaCref_NestedType_FourDeep ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "Mono",
- TypeName = "DocTest",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "NestedClass",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Double",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Triple",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "Quadruple",
- },
- },
- },
- },
- };
-
- string targetUrl = "T:Mono.DocTest+NestedClass+Double+Triple+Quadruple";
- AssertEcmaString (targetUrl, actual);
- AssertUrlDesc (actual, targetUrl);
- }
-
- [Test]
- public void ToEcmaCref_NestedType_Field ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Field,
- Namespace = "System.IO",
- TypeName = "Path",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "TheNestedType",
- },
- MemberName = "NestedField"
- };
-
- AssertEcmaString ("F:System.IO.Path+TheNestedType.NestedField", actual);
- }
-
- [Test]
- public void ToEcmaCref_SimpleType_WithGenerics ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.IO",
- TypeName = "Path",
- GenericTypeArguments = GenericTypeArgumentsList ("K").ToArray ()
- };
-
- AssertEcmaString ("T:System.IO.Path<K>", actual);
- }
-
- [Test]
- public void ToEcmaCref_Nestedype_WithGenerics ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.IO",
- TypeName = "Path",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "TheNestedType",
- },
- GenericTypeArguments = GenericTypeArgumentsList ("K").ToArray ()
- };
-
- AssertEcmaString ("T:System.IO.Path<K>+TheNestedType", actual);
- }
-
- [Test]
- public void ToEcmaCref_Nestedype_WithGenericsOnBoth ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System.IO",
- TypeName = "Path",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "TheNestedType",
- GenericTypeArguments = GenericTypeArgumentsList ("T", "V").ToArray (),
- },
- GenericTypeArguments = GenericTypeArgumentsList ("K").ToArray ()
- };
-
- AssertEcmaString ("T:System.IO.Path<K>+TheNestedType<T,V>", actual);
- }
-
- [Test]
- public void ToEcmaCref_Nestedype_Property_WithGenericsOnBoth ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Property,
- Namespace = "System.IO",
- TypeName = "Path",
- NestedType = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- TypeName = "TheNestedType",
- GenericTypeArguments = GenericTypeArgumentsList ("T", "V").ToArray (),
- },
- GenericTypeArguments = GenericTypeArgumentsList ("K").ToArray (),
- MemberName = "TheProperty"
- };
-
- AssertEcmaString ("P:System.IO.Path<K>+TheNestedType<T,V>.TheProperty", actual);
- }
-
- [Test]
- public void ToEcmaCref_Field ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Field,
- Namespace = "System.IO",
- TypeName = "Path",
- MemberName = "TheField"
- };
-
- AssertEcmaString ("F:System.IO.Path.TheField", actual);
- }
-
- [Test]
- public void ToEcmaCref_ExplicitlyImplemented_Field ()
- {
- var explicitImpl = new EcmaDesc {
- Namespace = "System.Web.SessionState",
- TypeName = "IHttpSessionState",
- MemberName = "Item",
- };
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Field,
- TypeName = "HttpSessionStateContainer",
- Namespace = "System.Web.SessionState",
- ExplicitImplMember = explicitImpl,
- };
- AssertEcmaString ("F:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item", actual);
- }
-
- [Test]
- public void ToEcmaCref_Property ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Property,
- Namespace = "System.IO",
- TypeName = "Path",
- MemberName = "TheProperty",
- };
-
- AssertEcmaString ("P:System.IO.Path.TheProperty", actual);
- }
-
- [Test]
- public void ToEcmaCref_ExplicitlyImplemented_Property ()
- {
- var explicitImpl = new EcmaDesc {
- Namespace = "System.Web.SessionState",
- TypeName = "IHttpSessionState",
- MemberName = "Item",
- };
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Property,
- TypeName = "HttpSessionStateContainer",
- Namespace = "System.Web.SessionState",
- ExplicitImplMember = explicitImpl,
- };
- AssertEcmaString ("P:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item", actual);
- }
-
- [Test]
- public void ToEcmaCref_ExplicitlyImplemented_Method ()
- {
- var explicitImpl = new EcmaDesc {
- Namespace = "System.Web.SessionState",
- TypeName = "IHttpSessionState",
- MemberName = "Item",
- MemberArguments = new [] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Int32",
- },
- },
- };
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- TypeName = "HttpSessionStateContainer",
- Namespace = "System.Web.SessionState",
- ExplicitImplMember = explicitImpl,
- };
- AssertEcmaString ("M:System.Web.SessionState.HttpSessionStateContainer$System.Web.SessionState.IHttpSessionState.Item(System.Int32)", actual);
- }
-
- [Test]
- public void ToEcmaCref_Event ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Event,
- Namespace = "System.IO",
- TypeName = "Path",
- MemberName = "TheEvent",
- };
-
- AssertEcmaString ("E:System.IO.Path.TheEvent", actual);
- }
-
- [Test]
- public void ToEcmaCref_Operator ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Operator,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "Addition",
- };
-
- AssertEcmaString ("O:System.Int32.Addition", actual);
- }
-
- [Test]
- public void ToEcmaCref_Operator_Conversion ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Operator,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "ExplicitConversion",
- MemberArguments = new [] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Double",
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Int32",
- }
- },
- };
-
- AssertEcmaString ("O:System.Int32.ExplicitConversion(System.Double,System.Int32)", actual);
- }
-
- [Test]
- public void ToEcmaCref_Method ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "Add"
- };
-
- AssertEcmaString ("M:System.Int32.Add", actual);
- }
-
- [Test]
- public void ToEcmaCref_Method_Parameters ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "Add",
- MemberArguments = new [] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Double",
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "System",
- TypeName = "Int32",
- },
- },
- };
-
- AssertEcmaString ("M:System.Int32.Add(System.Double,System.Int32)", actual);
- }
-
- [Test]
- public void ToEcmaCref_Method_Generics ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "Add",
- GenericMemberArguments = GenericTypeArgumentsList ("T", "K").ToArray (),
- };
-
- AssertEcmaString ("M:System.Int32.Add<T,K>", actual);
- }
-
- [Test]
- public void ToEcmaCref_Method_Generics_PlusParameters ()
- {
- var actual = new EcmaDesc {
- DescKind = EcmaDesc.Kind.Method,
- Namespace = "System",
- TypeName = "Int32",
- MemberName = "Add",
- GenericMemberArguments = GenericTypeArgumentsList ("T", "K").ToArray (),
- MemberArguments = new [] {
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "",
- TypeName = "T",
- },
- new EcmaDesc {
- DescKind = EcmaDesc.Kind.Type,
- Namespace = "",
- TypeName = "K",
- },
- },
- };
-
- AssertEcmaString ("M:System.Int32.Add<T,K>(T,K)", actual);
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace MonoTests.Monodoc.Generators
-{
- [TestFixture]
- public class RawGeneratorTests
- {
- const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
- RootTree rootTree;
- RawGenerator generator = new RawGenerator ();
-
- [SetUp]
- public void Setup ()
- {
- rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- }
-
- void AssertValidXml (string xml)
- {
- var reader = XmlReader.Create (new StringReader (xml));
- try {
- while (reader.Read ());
- } catch (Exception e) {
- Console.WriteLine (e.ToString ());
- Assert.Fail (e.Message);
- }
- }
-
- void AssertEcmaFullTypeName (string xml, string fullTypeName)
- {
- var reader = XmlReader.Create (new StringReader (xml));
- Assert.IsTrue (reader.ReadToFollowing ("Type"));
- Assert.AreEqual (fullTypeName, reader.GetAttribute ("FullName"));
- }
-
- [Test]
- public void TestSimpleEcmaXml ()
- {
- var xml = rootTree.RenderUrl ("T:System.String", generator);
- Assert.IsNotNull (xml);
- AssertHelper.IsNotEmpty (xml);
- AssertValidXml (xml);
- AssertEcmaFullTypeName (xml, "System.String");
- }
-
- [Test]
- public void TestSimpleEcmaXml2 ()
- {
- var xml = rootTree.RenderUrl ("T:System.Int32", generator);
- Assert.IsNotNull (xml);
- AssertHelper.IsNotEmpty (xml);
- AssertValidXml (xml);
- AssertEcmaFullTypeName (xml, "System.Int32");
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class EcmaDocTest
- {
- // Because EcmaDoc is internal and we can't use InternalsVisibleTo since test assemblies aren't
- // signed/strong-named by the build, we have to resort to reflection
- TDelegate GetTestedMethod<TDelegate> (string methodName)
- {
- var ecmaDoc = Type.GetType ("Monodoc.Providers.EcmaDoc, monodoc, PublicKey=0738eb9f132ed756");
- return (TDelegate)(object)Delegate.CreateDelegate (typeof (TDelegate), ecmaDoc.GetMethod (methodName));
- }
-
- [Test]
- public void CountTypeGenericArgumentsTest ()
- {
- var realCountTypeGenericArguments = GetTestedMethod<Func<string, int, int>> ("CountTypeGenericArguments");
- // Since we don't use the optional start index parameters, bypass it by wrapping the func
- Func<string, int> countTypeGenericArguments = s => realCountTypeGenericArguments (s, 0);
-
- Assert.AreEqual (0, countTypeGenericArguments ("T:System.String"), "#0a");
- Assert.AreEqual (0, countTypeGenericArguments ("T:String"), "#0b");
- Assert.AreEqual (0, countTypeGenericArguments ("String"), "#0c");
-
- Assert.AreEqual (1, countTypeGenericArguments ("T:System.Collections.Foo<T>"), "#1a");
- Assert.AreEqual (1, countTypeGenericArguments ("T:System.Foo<T>"), "#1b");
- Assert.AreEqual (1, countTypeGenericArguments ("T:Foo<T>"), "#1c");
- Assert.AreEqual (1, countTypeGenericArguments ("Foo<T>"), "#1d");
-
- Assert.AreEqual (2, countTypeGenericArguments ("T:System.Collections.Foo<T, U>"), "#2a");
- Assert.AreEqual (2, countTypeGenericArguments ("T:System.Foo<TKey, TValue>"), "#2b");
- Assert.AreEqual (2, countTypeGenericArguments ("T:Foo<Something,Else>"), "#2c");
- Assert.AreEqual (2, countTypeGenericArguments ("Foo<TDelegate,TArray>"), "#2d");
-
- Assert.AreEqual (3, countTypeGenericArguments ("T:System.Collections.Foo<T, U, V>"), "#3a");
- Assert.AreEqual (3, countTypeGenericArguments ("T:System.Foo<TKey, TValue, THash>"), "#3b");
- Assert.AreEqual (3, countTypeGenericArguments ("T:Foo<Something,Else,Really>"), "#3c");
- Assert.AreEqual (3, countTypeGenericArguments ("Foo<TDelegate,TArray,TEvent>"), "#3d");
- }
-
- [Test]
- public void CountTypeGenericArgumentsTest_Nested ()
- {
- var realCountTypeGenericArguments = GetTestedMethod<Func<string, int, int>> ("CountTypeGenericArguments");
- // Since we don't use the optional start index parameters, bypass it by wrapping the func
- Func<string, int> countTypeGenericArguments = s => realCountTypeGenericArguments (s, 0);
-
- Assert.AreEqual (1, countTypeGenericArguments ("T:System.Collections.Foo<T[]>"), "#1a");
- Assert.AreEqual (1, countTypeGenericArguments ("T:System.Collections.Foo<IList<T>>"), "#1b");
- Assert.AreEqual (2, countTypeGenericArguments ("T:System.Collections.Foo<T, KeyValuePair<T, U>>"), "#2a");
- Assert.AreEqual (2, countTypeGenericArguments ("T:System.Collections.Foo<T, KeyValuePair<IProducerConsumerCollection<U>, IEquatable<V>>>"), "#2b");
- Assert.AreEqual (3, countTypeGenericArguments ("T:System.Collections.Foo<T, IProducerConsumerCollection<U>, IEquatable<V>>"), "#3a");
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-using Monodoc.Generators;
-using Monodoc.Providers;
-
-// Used by ReachabilityWithCrefsTest
-// using HtmlAgilityPack;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class HelpSourceTest
- {
- const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
-
- class CheckGenerator : IDocGenerator<bool>
- {
- public string LastCheckMessage { get; set; }
-
- public bool Generate (HelpSource hs, string id, Dictionary<string, string> context)
- {
- LastCheckMessage = string.Format ("#1 : {0} {1}", hs, id);
- if (hs == null || string.IsNullOrEmpty (id))
- return false;
-
- // Stripe the arguments parts since we don't need it
- var argIdx = id.LastIndexOf ('?');
- if (argIdx != -1)
- id = id.Substring (0, argIdx);
-
- LastCheckMessage = string.Format ("#2 : {0} {1}", hs, id);
- if (hs.IsRawContent (id))
- return hs.GetText (id) != null;
-
- IEnumerable<string> parts;
- if (hs.IsMultiPart (id, out parts)) {
- LastCheckMessage = string.Format ("#4 : {0} {1} ({2})", hs, id, string.Join (", ", parts));
- foreach (var partId in parts)
- if (!Generate (hs, partId, context))
- return false;
- }
-
- LastCheckMessage = string.Format ("#3 : {0} {1}", hs, id);
- if (hs.IsGeneratedContent (id))
- return hs.GetCachedText (id) != null;
- else {
- var s = hs.GetCachedHelpStream (id);
- if (s != null) {
- s.Close ();
- return true;
- } else {
- return false;
- }
- }
- }
- }
-
- /* This test verifies that for every node in our tree that possed a PublicUrl,
- * we can correctly access it back through RenderUrl
- */
- [Test]
- public void ReachabilityTest ()
- {
- var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- Node result;
- var generator = new CheckGenerator ();
- int errorCount = 0;
- int testCount = 0;
-
- foreach (var leaf in GetLeaves (rootTree.RootNode)) {
- if (!rootTree.RenderUrl (leaf.PublicUrl, generator, out result) || leaf != result) {
- Console.WriteLine ("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name);
- errorCount++;
- }
- testCount++;
- }
-
- //Assert.AreEqual (0, errorCount, errorCount + " / " + testCount.ToString ());
-
- // HACK: in reality we have currently 4 known issues which are due to duplicated namespaces across
- // doc sources, something that was never supported and that we need to improve/fix at some stage
- AssertHelper.LessOrEqual (4, errorCount, errorCount + " / " + testCount.ToString ());
- }
-
- IEnumerable<Node> GetLeaves (Node node)
- {
- if (node == null)
- yield break;
-
- if (node.IsLeaf)
- yield return node;
- else {
- foreach (var child in node.ChildNodes) {
- if (!string.IsNullOrEmpty (child.Element) && !child.Element.StartsWith ("root:/"))
- yield return child;
- foreach (var childLeaf in GetLeaves (child))
- yield return childLeaf;
- }
- }
- }
-
- [Test]
- public void ReachabilityWithShortGenericNotationTest ()
- {
- var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- Node result;
- var generator = new CheckGenerator ();
-
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Concurrent.IProducerConsumerCollection`1", generator, out result), "#1");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary`2", generator, out result), "#2");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`4", generator, out result), "#3");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.EventHandler`1", generator, out result), "#4");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`5", generator, out result), "#5a");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`4", generator, out result), "#5b");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`6", generator, out result), "#5c");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`7", generator, out result), "#5d");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`3", generator, out result), "#5e");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`2", generator, out result), "#5f");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`1", generator, out result), "#5g");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`8", generator, out result), "#5h");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func`9", generator, out result), "#5i");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`3", generator, out result), "#6a");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`2", generator, out result), "#6b");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Action`4", generator, out result), "#6c");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable`1", generator, out result), "#7");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Lazy`1", generator, out result), "#8");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`1", generator, out result), "#9a");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`2", generator, out result), "#9b");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`3", generator, out result), "#9c");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Tuple`4", generator, out result), "#9d");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary`2+ValueCollection", generator, out result), "#10");
- Assert.IsFalse (rootTree.RenderUrl ("T:System.EventHandler`2", generator, out result), "#11");
- Assert.IsFalse (rootTree.RenderUrl ("T:System.Lazy`2", generator, out result), "#12");
- }
-
- [Test]
- public void AspNetStyleUrlReachabilityTest ()
- {
- var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- Node result;
- var generator = new CheckGenerator ();
-
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary{TKey,TValue}", generator, out result), "#1");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Action{T1,T2}", generator, out result), "#2");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.EventHandler{TEventArgs}", generator, out result), "#3");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Func{T1,T2,T3,TResult}", generator, out result), "#4");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.Collections.Generic.Dictionary{TKey,TValue}+ValueCollection", generator, out result), "#5");
- Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable{T}", generator, out result), "#6");
- }
-
- [Test]
- public void PublicUrlOnUnattachedHelpSourceRoot ()
- {
- // Unattached help source have no root:/ URL attributed
- var hs = new EcmaHelpSource (Path.Combine (BaseDir, "sources", "netdocs"), false);
- var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- hs.RootTree = rootTree;
- Assert.IsNull (hs.Tree.RootNode.PublicUrl);
- var nsChildUrl = hs.Tree.RootNode.ChildNodes.First ().PublicUrl;
- Assert.IsNotNull (nsChildUrl);
- StringAssert.StartsWith ("N:", nsChildUrl);
- // Verify GetNodeTypeParent
- var typeNode = hs.Tree.RootNode.ChildNodes.First ().ChildNodes.First ();
- var metaNode = typeNode.ChildNodes.First (cn => cn.Element == "M");
- StringAssert.StartsWith (typeNode.PublicUrl, metaNode.PublicUrl);
- }
-
- /*
- [Test, Ignore ("Mono documentation is full of syntax errors so we can't use it reliably for this test")]
- public void ReachabilityWithCrefsTest ()
- {
- var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
- Node result;
- var htmlGenerator = new HtmlGenerator (null);
- var crefs = new HashSet<string> ();
- var generator = new CheckGenerator ();
- int errorCount = 0;
-
- foreach (var leaf in GetLeaves (rootTree.RootNode)) {
- Dictionary<string, string> context;
- string internalId = leaf.Tree.HelpSource.GetInternalIdForUrl (leaf.PublicUrl, out result, out context);
- if (leaf.Tree.HelpSource.GetDocumentTypeForId (internalId) != DocumentType.EcmaXml)
- continue;
-
- string content = null;
- if (string.IsNullOrEmpty (content = rootTree.RenderUrl (leaf.PublicUrl, htmlGenerator, out result)) || leaf != result) {
- Console.WriteLine ("Error: {0} with HelpSource {1} ", leaf.PublicUrl, leaf.Tree.HelpSource.Name);
- continue;
- }
-
- HtmlDocument doc = new HtmlDocument();
- try {
- doc.LoadHtml (content);
- } catch {
- Console.WriteLine ("Couldn't load a HTML document for URL {0}", leaf.PublicUrl);
- continue;
- }
-
- foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]")) {
- var newUrl = link.Attributes["href"].Value;
- var hashIndex = newUrl.IndexOf ('#');
- if (hashIndex != -1)
- newUrl = newUrl.Substring (0, hashIndex);
- if (newUrl.Length > 1 && newUrl[1] == ':' && char.IsLetter (newUrl, 0) && char.ToLowerInvariant (newUrl[0]) != 'c')
- crefs.Add (newUrl);
- }
-
- foreach (var cref in crefs) {
- if (!rootTree.RenderUrl (cref, generator, out result) || result == null) {
- Console.WriteLine ("Error with cref: `{0}'", cref);
- errorCount++;
- }
- }
-
- crefs.Clear ();
- }
-
- Assert.AreEqual (0, errorCount, errorCount + " / " + crefs.Count);
- }*/
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class NodeTest
- {
- const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
-
- [Test]
- public void LegacyNodesTest_30 ()
- {
- TestLegacyNodesSameAsChildNodes ("tree-from-3-0.tree");
- }
-
- [Test]
- public void LegacyNodesTest_210 ()
- {
- TestLegacyNodesSameAsChildNodes ("tree-from-2-10.tree");
- }
-
- [Test]
- public void LegacyNodesTest_30old ()
- {
- TestLegacyNodesSameAsChildNodes ("tree-from-3-0-old.tree");
- }
-
- void TestLegacyNodesSameAsChildNodes (string treeFileName)
- {
- var filePath = Path.Combine (BaseDir, "trees", treeFileName);
- var tree = new Tree (null, filePath);
- CollectionAssert.AreEqual (tree.RootNode.ChildNodes, tree.RootNode.Nodes);
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-using Monodoc.Generators;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class RootTreeTest
- {
- const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
-
- RootTree root;
- HtmlGenerator generator;
-
- [SetUp]
- public void Setup ()
- {
- root = RootTree.LoadTree (BaseDir, includeExternal: false);
- generator = new HtmlGenerator (defaultCache: null);
- }
-
- [Test]
- public void RootTreePageTest ()
- {
- var content = root.RenderUrl ("root:", generator);
- Assert.IsNotNull (content);
- StringAssert.Contains ("The following documentation collections are available:", content);
- }
-
- IEnumerable<Node> GetNodesWithSummaries (Node baseNode)
- {
- return baseNode.ChildNodes.Where (n => n.Element.StartsWith ("root:/")).SelectMany (n => new[] { n }.Concat (GetNodesWithSummaries (n)));
- }
-
- [Test]
- public void HelpSourceSummariesTest ()
- {
- foreach (var node in GetNodesWithSummaries (root.RootNode)) {
- var content = root.RenderUrl (node.Element, generator);
- Assert.IsNotNull (content, "#1 - " + node.Element);
- if (node.ChildNodes.All (n => n.Element.StartsWith ("root:/")))
- StringAssert.Contains ("This node doesn't have a summary available", content, "#2a - " + node.Element);
- else {
- Assert.IsFalse (content.Contains ("<em>Error:</em>"), "#2b - " + node.Element);
- Assert.IsFalse (content.Contains ("This node doesn't have a summary available"), "#3b - " + node.Element);
- }
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class SettingsTest
- {
- [Test]
- public void DocPathConfigTest ()
- {
- // the docPath variable is the only one we know for sure should exist
- Assert.IsNotNull (Config.Get ("docPath"));
- AssertHelper.IsNotEmpty (Config.Get ("docPath"));
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-using Monodoc;
-
-namespace MonoTests.Monodoc
-{
- [TestFixture]
- public class TreeTest
- {
- const string BaseDir = "../../class/monodoc/Test/monodoc_test/";
-
- [Test]
- public void TestLoadingTree_2_10 ()
- {
- TestTreeLoading ("tree-from-2-10.tree", 0, 2);
- }
-
- [Test]
- public void TestLoadingTree_3_0_old ()
- {
- TestTreeLoading ("tree-from-3-0-old.tree", 1, 2);
- }
-
- [Test]
- public void TestLoadingTree_3_0 ()
- {
- TestTreeLoading ("tree-from-3-0.tree", 1, 2);
- }
-
- void TestTreeLoading (string treeFileName, int expectedVersion, int expectedNodeCount)
- {
- var filePath = Path.Combine (BaseDir, "trees", treeFileName);
- var tree = new Tree (null, filePath);
- Assert.AreEqual (expectedVersion, tree.VersionNumber);
- Assert.IsNotNull (tree.RootNode);
- Assert.AreEqual (expectedNodeCount, tree.RootNode.ChildNodes.Count);
- }
- }
-}
+++ /dev/null
-<?xml version="1.0"?>
-<node label="Mono Documentation" name="libraries">
- <node label="Commands and Files" name="man" />
- <node label="Languages" name="languages" />
- <node label="Tools" name="tools" />
- <node label="Various" name="various" />
-</node>
+++ /dev/null
-#!/bin/sh
-
-TOPDIR=$1
-INPUT=$2
-OUTPUT=$3
-FLAGS=$4
-
-TEMPFILE=`mktemp jay-tmp.XXXXXX` || exit 1
-
-$TOPDIR/jay/jay $FLAGS < $TOPDIR/jay/skeleton.cs $INPUT > $TEMPFILE && mv $TEMPFILE $OUTPUT
Assembly/AssemblyInfo.cs
-Monodoc/SearchableIndex.cs
-Monodoc/SearchableDocument.cs
-Monodoc/storage/ZipStorage.cs
-Monodoc/storage/NullStorage.cs
-Monodoc/storage/UncompiledDocStorage.cs
-Monodoc/providers/man-provider.cs
-Monodoc/providers/ecmaspec-provider.cs
-Monodoc/providers/error-provider.cs
-Monodoc/providers/xhtml-provider.cs
-Monodoc/providers/ecma-provider.cs
-Monodoc/providers/addins-provider.cs
-Monodoc/providers/ecmauncompiled-provider.cs
-Monodoc/providers/EcmaDoc.cs
-Monodoc/HelpSource.cs
-Monodoc/HelpSource_Legacy.cs
-Monodoc/Tree.cs
-Monodoc/Node.cs
-Monodoc/Node_Legacy.cs
-Monodoc/generator.cs
-Monodoc/caches/NullCache.cs
-Monodoc/caches/FileCache.cs
-Monodoc/storage.cs
-Monodoc/Provider.cs
-Monodoc/cache.cs
-Monodoc/index.cs
-Monodoc/settings.cs
-Monodoc/settings_Legacy.cs
-Monodoc/RootTree.cs
-Monodoc/RootTree_Legacy.cs
-Monodoc/TypeUtils.cs
-Monodoc/generators/html/Man2Html.cs
-Monodoc/generators/html/Toc2Html.cs
-Monodoc/generators/html/Ecmaspec2Html.cs
-Monodoc/generators/html/Error2Html.cs
-Monodoc/generators/html/MonoBook2Html.cs
-Monodoc/generators/html/Ecma2Html.cs
-Monodoc/generators/html/Addin2Html.cs
-Monodoc/generators/html/Idem.cs
-Monodoc/generators/HtmlGenerator.cs
-Monodoc/generators/RawGenerator.cs
-Mono.Utilities/colorizer.cs
-Mono.Utilities/LRUCache.cs
-Monodoc.Ecma/EcmaUrlParser.cs
-Monodoc.Ecma/EcmaUrlTokenizer.cs
-Monodoc.Ecma/EcmaDesc.cs
-Mono.Documentation/ManifestResourceResolver.cs
-Mono.Documentation/XmlDocUtils.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Analyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/ASCIIFoldingFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/BaseCharFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CachingTokenFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CharArraySet.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CharFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CharReader.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CharStream.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/CharTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/ISOLatin1AccentFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/KeywordAnalyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/KeywordTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/LengthFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/LetterTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/LowerCaseFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/LowerCaseTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/MappingCharFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/NormalizeCharMap.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/NumericTokenStream.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/PerFieldAnalyzerWrapper.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/PorterStemFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/PorterStemmer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/SimpleAnalyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Standard/StandardAnalyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Standard/StandardFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Standard/StandardTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Standard/StandardTokenizerImpl.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/StopAnalyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/StopFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/TeeSinkTokenFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Token.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IFlagsAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IOffsetAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IPayloadAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IPositionIncrementAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/ITermAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/ITypeAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/OffsetAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/PayloadAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/PositionIncrementAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/TermAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/TypeAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/TokenFilter.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/Tokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/TokenStream.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/WhitespaceAnalyzer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/WhitespaceTokenizer.cs
-../../../external/Lucene.Net.Light/src/core/Analysis/WordlistLoader.cs
-../../../external/Lucene.Net.Light/src/core/Document/AbstractField.cs
-../../../external/Lucene.Net.Light/src/core/Document/CompressionTools.cs
-../../../external/Lucene.Net.Light/src/core/Document/DateField.cs
-../../../external/Lucene.Net.Light/src/core/Document/DateTools.cs
-../../../external/Lucene.Net.Light/src/core/Document/Document.cs
-../../../external/Lucene.Net.Light/src/core/Document/Field.cs
-../../../external/Lucene.Net.Light/src/core/Document/Fieldable.cs
-../../../external/Lucene.Net.Light/src/core/Document/FieldSelector.cs
-../../../external/Lucene.Net.Light/src/core/Document/FieldSelectorResult.cs
-../../../external/Lucene.Net.Light/src/core/Document/LoadFirstFieldSelector.cs
-../../../external/Lucene.Net.Light/src/core/Document/MapFieldSelector.cs
-../../../external/Lucene.Net.Light/src/core/Document/NumberTools.cs
-../../../external/Lucene.Net.Light/src/core/Document/NumericField.cs
-../../../external/Lucene.Net.Light/src/core/Document/SetBasedFieldSelector.cs
-../../../external/Lucene.Net.Light/src/core/Index/AbstractAllTermDocs.cs
-../../../external/Lucene.Net.Light/src/core/Index/AllTermDocs.cs
-../../../external/Lucene.Net.Light/src/core/Index/BufferedDeletes.cs
-../../../external/Lucene.Net.Light/src/core/Index/ByteBlockPool.cs
-../../../external/Lucene.Net.Light/src/core/Index/ByteSliceReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/ByteSliceWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/CharBlockPool.cs
-../../../external/Lucene.Net.Light/src/core/Index/CheckIndex.cs
-../../../external/Lucene.Net.Light/src/core/Index/CompoundFileReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/CompoundFileWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/ConcurrentMergeScheduler.cs
-../../../external/Lucene.Net.Light/src/core/Index/CorruptIndexException.cs
-../../../external/Lucene.Net.Light/src/core/Index/DefaultSkipListReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/DefaultSkipListWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/DirectoryReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocConsumerPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumerPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumerPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumers.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumersPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldConsumersPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldProcessor.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldProcessorPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocFieldProcessorPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocInverter.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocInverterPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocInverterPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocumentsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/DocumentsWriterThreadState.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldInfo.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldInfos.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldInvertState.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldReaderException.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldSortedTermVectorMapper.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldsReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/FieldsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FilterIndexReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsDocsConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsDocsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsFieldsConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsFieldsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsPositionsConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsPositionsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsTermsConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/FormatPostingsTermsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FreqProxFieldMergeState.cs
-../../../external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriterPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriterPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexCommit.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexDeletionPolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexFileDeleter.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexFileNameFilter.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexFileNames.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/IndexWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/IntBlockPool.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocConsumerPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocConsumerPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumerPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumerPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/LogByteSizeMergePolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/LogDocMergePolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/LogMergePolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/MergeDocIDRemapper.cs
-../../../external/Lucene.Net.Light/src/core/Index/MergePolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/MergeScheduler.cs
-../../../external/Lucene.Net.Light/src/core/Index/MultiLevelSkipListReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/MultiLevelSkipListWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/MultipleTermPositions.cs
-../../../external/Lucene.Net.Light/src/core/Index/MultiReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/NormsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/NormsWriterPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/NormsWriterPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/ParallelReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/Payload.cs
-../../../external/Lucene.Net.Light/src/core/Index/PositionBasedTermVectorMapper.cs
-../../../external/Lucene.Net.Light/src/core/Index/RawPostingList.cs
-../../../external/Lucene.Net.Light/src/core/Index/ReadOnlyDirectoryReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/ReadOnlySegmentReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/ReusableStringReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentInfo.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentInfos.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentMergeInfo.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentMergeQueue.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentMerger.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentTermDocs.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentTermPositions.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentTermPositionVector.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentTermVector.cs
-../../../external/Lucene.Net.Light/src/core/Index/SegmentWriteState.cs
-../../../external/Lucene.Net.Light/src/core/Index/SerialMergeScheduler.cs
-../../../external/Lucene.Net.Light/src/core/Index/SnapshotDeletionPolicy.cs
-../../../external/Lucene.Net.Light/src/core/Index/SortedTermVectorMapper.cs
-../../../external/Lucene.Net.Light/src/core/Index/StaleReaderException.cs
-../../../external/Lucene.Net.Light/src/core/Index/StoredFieldsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/StoredFieldsWriterPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/Term.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermBuffer.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermDocs.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermFreqVector.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermInfo.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermInfosReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermInfosWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermPositions.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermPositionVector.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHash.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHashConsumer.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHashConsumerPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHashConsumerPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHashPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermsHashPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorEntry.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorEntryFreqSortedComparator.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorMapper.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorOffsetInfo.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorsReader.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriter.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriterPerField.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriterPerThread.cs
-../../../external/Lucene.Net.Light/src/core/Index/TermVectorsWriter.cs
-../../../external/Lucene.Net.Light/src/core/LucenePackage.cs
-../../../external/Lucene.Net.Light/src/core/LZOCompressor.cs
-../../../external/Lucene.Net.Light/src/core/Messages/INLSException.cs
-../../../external/Lucene.Net.Light/src/core/Messages/Message.cs
-../../../external/Lucene.Net.Light/src/core/Messages/MessageImpl.cs
-../../../external/Lucene.Net.Light/src/core/Messages/NLS.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/CharStream.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/FastCharStream.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/MultiFieldQueryParser.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/ParseException.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/QueryParser.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/QueryParserConstants.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/QueryParserTokenManager.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/Token.cs
-../../../external/Lucene.Net.Light/src/core/QueryParser/TokenMgrError.cs
-../../../external/Lucene.Net.Light/src/core/Search/BooleanClause.cs
-../../../external/Lucene.Net.Light/src/core/Search/BooleanQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/BooleanScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/BooleanScorer2.cs
-../../../external/Lucene.Net.Light/src/core/Search/CachingSpanFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/CachingWrapperFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/Collector.cs
-../../../external/Lucene.Net.Light/src/core/Search/ComplexExplanation.cs
-../../../external/Lucene.Net.Light/src/core/Search/ConjunctionScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/ConstantScoreQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/DefaultSimilarity.cs
-../../../external/Lucene.Net.Light/src/core/Search/DisjunctionMaxQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/DisjunctionMaxScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/DisjunctionSumScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/DocIdSet.cs
-../../../external/Lucene.Net.Light/src/core/Search/DocIdSetIterator.cs
-../../../external/Lucene.Net.Light/src/core/Search/ExactPhraseScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/Explanation.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldCache.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldCacheImpl.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldCacheRangeFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldCacheTermsFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldComparator.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldComparatorSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldDoc.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldDocSortedHitQueue.cs
-../../../external/Lucene.Net.Light/src/core/Search/FieldValueHitQueue.cs
-../../../external/Lucene.Net.Light/src/core/Search/Filter.cs
-../../../external/Lucene.Net.Light/src/core/Search/FilteredDocIdSet.cs
-../../../external/Lucene.Net.Light/src/core/Search/FilteredDocIdSetIterator.cs
-../../../external/Lucene.Net.Light/src/core/Search/FilteredQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/FilteredTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Search/FilterManager.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/ByteFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/CustomScoreProvider.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/CustomScoreQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/DocValues.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/FieldCacheSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/FieldScoreQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/FloatFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/IntFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/OrdFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/ReverseOrdFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/ShortFieldSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/ValueSource.cs
-../../../external/Lucene.Net.Light/src/core/Search/Function/ValueSourceQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/FuzzyQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/FuzzyTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Search/HitQueue.cs
-../../../external/Lucene.Net.Light/src/core/Search/IndexSearcher.cs
-../../../external/Lucene.Net.Light/src/core/Search/MatchAllDocsQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/MultiPhraseQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/MultiSearcher.cs
-../../../external/Lucene.Net.Light/src/core/Search/MultiTermQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/MultiTermQueryWrapperFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/NumericRangeFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/NumericRangeQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/ParallelMultiSearcher.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/AveragePayloadFunction.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/MaxPayloadFunction.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/MinPayloadFunction.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/PayloadFunction.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/PayloadNearQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/PayloadSpanUtil.cs
-../../../external/Lucene.Net.Light/src/core/Search/Payloads/PayloadTermQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/PhrasePositions.cs
-../../../external/Lucene.Net.Light/src/core/Search/PhraseQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/PhraseQueue.cs
-../../../external/Lucene.Net.Light/src/core/Search/PhraseScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/PositiveScoresOnlyCollector.cs
-../../../external/Lucene.Net.Light/src/core/Search/PrefixFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/PrefixQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/PrefixTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Search/Query.cs
-../../../external/Lucene.Net.Light/src/core/Search/QueryTermVector.cs
-../../../external/Lucene.Net.Light/src/core/Search/QueryWrapperFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/ReqExclScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/ReqOptSumScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/ScoreCachingWrappingScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/ScoreDoc.cs
-../../../external/Lucene.Net.Light/src/core/Search/Scorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/Searchable.cs
-../../../external/Lucene.Net.Light/src/core/Search/Searcher.cs
-../../../external/Lucene.Net.Light/src/core/Search/Similarity.cs
-../../../external/Lucene.Net.Light/src/core/Search/SimilarityDelegator.cs
-../../../external/Lucene.Net.Light/src/core/Search/SingleTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Search/SloppyPhraseScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/Sort.cs
-../../../external/Lucene.Net.Light/src/core/Search/SortField.cs
-../../../external/Lucene.Net.Light/src/core/Search/SpanFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/SpanFilterResult.cs
-../../../external/Lucene.Net.Light/src/core/Search/SpanQueryFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/FieldMaskingSpanQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/NearSpansOrdered.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/NearSpansUnordered.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanFirstQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanNearQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanNotQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanOrQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/Spans.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanTermQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/SpanWeight.cs
-../../../external/Lucene.Net.Light/src/core/Search/Spans/TermSpans.cs
-../../../external/Lucene.Net.Light/src/core/Search/TermQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/TermRangeFilter.cs
-../../../external/Lucene.Net.Light/src/core/Search/TermRangeQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/TermRangeTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Search/TermScorer.cs
-../../../external/Lucene.Net.Light/src/core/Search/TimeLimitingCollector.cs
-../../../external/Lucene.Net.Light/src/core/Search/TopDocs.cs
-../../../external/Lucene.Net.Light/src/core/Search/TopDocsCollector.cs
-../../../external/Lucene.Net.Light/src/core/Search/TopFieldCollector.cs
-../../../external/Lucene.Net.Light/src/core/Search/TopFieldDocs.cs
-../../../external/Lucene.Net.Light/src/core/Search/TopScoreDocCollector.cs
-../../../external/Lucene.Net.Light/src/core/Search/Weight.cs
-../../../external/Lucene.Net.Light/src/core/Search/WildcardQuery.cs
-../../../external/Lucene.Net.Light/src/core/Search/WildcardTermEnum.cs
-../../../external/Lucene.Net.Light/src/core/Store/AlreadyClosedException.cs
-../../../external/Lucene.Net.Light/src/core/Store/BufferedIndexInput.cs
-../../../external/Lucene.Net.Light/src/core/Store/BufferedIndexOutput.cs
-../../../external/Lucene.Net.Light/src/core/Store/CheckSumIndexInput.cs
-../../../external/Lucene.Net.Light/src/core/Store/CheckSumIndexOutput.cs
-../../../external/Lucene.Net.Light/src/core/Store/Directory.cs
-../../../external/Lucene.Net.Light/src/core/Store/FileSwitchDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/FSDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/FSLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/IndexInput.cs
-../../../external/Lucene.Net.Light/src/core/Store/IndexOutput.cs
-../../../external/Lucene.Net.Light/src/core/Store/Lock.cs
-../../../external/Lucene.Net.Light/src/core/Store/LockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/LockObtainFailedException.cs
-../../../external/Lucene.Net.Light/src/core/Store/LockReleaseFailedException.cs
-../../../external/Lucene.Net.Light/src/core/Store/LockStressTest.cs
-../../../external/Lucene.Net.Light/src/core/Store/LockVerifyServer.cs
-../../../external/Lucene.Net.Light/src/core/Store/MMapDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/NativeFSLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/NIOFSDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/NoLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/NoSuchDirectoryException.cs
-../../../external/Lucene.Net.Light/src/core/Store/RAMDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/RAMFile.cs
-../../../external/Lucene.Net.Light/src/core/Store/RAMInputStream.cs
-../../../external/Lucene.Net.Light/src/core/Store/RAMOutputStream.cs
-../../../external/Lucene.Net.Light/src/core/Store/SimpleFSDirectory.cs
-../../../external/Lucene.Net.Light/src/core/Store/SimpleFSLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/SingleInstanceLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Store/VerifyingLockFactory.cs
-../../../external/Lucene.Net.Light/src/core/Support/AppSettings.cs
-../../../external/Lucene.Net.Light/src/core/Support/AttributeImplItem.cs
-../../../external/Lucene.Net.Light/src/core/Support/BitSetSupport.cs
-../../../external/Lucene.Net.Light/src/core/Support/BuildType.cs
-../../../external/Lucene.Net.Light/src/core/Support/Character.cs
-../../../external/Lucene.Net.Light/src/core/Support/CloseableThreadLocalProfiler.cs
-../../../external/Lucene.Net.Light/src/core/Support/CollectionsHelper.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compare.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/ConcurrentDictionary.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/Func.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/ISet.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/SetFactory.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/SortedSet.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/ThreadLocal.cs
-../../../external/Lucene.Net.Light/src/core/Support/Compatibility/WrappedHashSet.cs
-../../../external/Lucene.Net.Light/src/core/Support/CRC32.cs
-../../../external/Lucene.Net.Light/src/core/Support/Cryptography.cs
-../../../external/Lucene.Net.Light/src/core/Support/Deflater.cs
-../../../external/Lucene.Net.Light/src/core/Support/Double.cs
-../../../external/Lucene.Net.Light/src/core/Support/EquatableList.cs
-../../../external/Lucene.Net.Light/src/core/Support/FileSupport.cs
-../../../external/Lucene.Net.Light/src/core/Support/GeneralKeyedCollection.cs
-../../../external/Lucene.Net.Light/src/core/Support/HashMap.cs
-../../../external/Lucene.Net.Light/src/core/Support/IChecksum.cs
-../../../external/Lucene.Net.Light/src/core/Support/Inflater.cs
-../../../external/Lucene.Net.Light/src/core/Support/IThreadRunnable.cs
-../../../external/Lucene.Net.Light/src/core/Support/Number.cs
-../../../external/Lucene.Net.Light/src/core/Support/OS.cs
-../../../external/Lucene.Net.Light/src/core/Support/SharpZipLib.cs
-../../../external/Lucene.Net.Light/src/core/Support/Single.cs
-../../../external/Lucene.Net.Light/src/core/Support/TextSupport.cs
-../../../external/Lucene.Net.Light/src/core/Support/ThreadClass.cs
-../../../external/Lucene.Net.Light/src/core/Support/ThreadLock.cs
-../../../external/Lucene.Net.Light/src/core/Support/WeakDictionary.cs
-../../../external/Lucene.Net.Light/src/core/Util/ArrayUtil.cs
-../../../external/Lucene.Net.Light/src/core/Util/Attribute.cs
-../../../external/Lucene.Net.Light/src/core/Util/AttributeSource.cs
-../../../external/Lucene.Net.Light/src/core/Util/AverageGuessMemoryModel.cs
-../../../external/Lucene.Net.Light/src/core/Util/BitUtil.cs
-../../../external/Lucene.Net.Light/src/core/Util/BitVector.cs
-../../../external/Lucene.Net.Light/src/core/Util/Cache/Cache.cs
-../../../external/Lucene.Net.Light/src/core/Util/Cache/SimpleLRUCache.cs
-../../../external/Lucene.Net.Light/src/core/Util/Cache/SimpleMapCache.cs
-../../../external/Lucene.Net.Light/src/core/Util/CloseableThreadLocal.cs
-../../../external/Lucene.Net.Light/src/core/Util/Constants.cs
-../../../external/Lucene.Net.Light/src/core/Util/DocIdBitSet.cs
-../../../external/Lucene.Net.Light/src/core/Util/FieldCacheSanityChecker.cs
-../../../external/Lucene.Net.Light/src/core/Util/IAttribute.cs
-../../../external/Lucene.Net.Light/src/core/Util/IdentityDictionary.cs
-../../../external/Lucene.Net.Light/src/core/Util/IndexableBinaryStringTools.cs
-../../../external/Lucene.Net.Light/src/core/Util/MapOfSets.cs
-../../../external/Lucene.Net.Light/src/core/Util/MemoryModel.cs
-../../../external/Lucene.Net.Light/src/core/Util/NumericUtils.cs
-../../../external/Lucene.Net.Light/src/core/Util/OpenBitSet.cs
-../../../external/Lucene.Net.Light/src/core/Util/OpenBitSetDISI.cs
-../../../external/Lucene.Net.Light/src/core/Util/OpenBitSetIterator.cs
-../../../external/Lucene.Net.Light/src/core/Util/PriorityQueue.cs
-../../../external/Lucene.Net.Light/src/core/Util/RamUsageEstimator.cs
-../../../external/Lucene.Net.Light/src/core/Util/ReaderUtil.cs
-../../../external/Lucene.Net.Light/src/core/Util/ScorerDocQueue.cs
-../../../external/Lucene.Net.Light/src/core/Util/SimpleStringInterner.cs
-../../../external/Lucene.Net.Light/src/core/Util/SmallFloat.cs
-../../../external/Lucene.Net.Light/src/core/Util/SortedVIntList.cs
-../../../external/Lucene.Net.Light/src/core/Util/SorterTemplate.cs
-../../../external/Lucene.Net.Light/src/core/Util/StringHelper.cs
-../../../external/Lucene.Net.Light/src/core/Util/StringInterner.cs
-../../../external/Lucene.Net.Light/src/core/Util/ToStringUtils.cs
-../../../external/Lucene.Net.Light/src/core/Util/UnicodeUtil.cs
-../../../external/Lucene.Net.Light/src/core/Util/Version.cs
+
+../../../external/api-doc-tools/monodoc/Monodoc/cache.cs
+../../../external/api-doc-tools/monodoc/Monodoc/caches/FileCache.cs
+../../../external/api-doc-tools/monodoc/Monodoc/caches/NullCache.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generator.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Addin2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Ecma2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Ecmaspec2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Error2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Idem.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Man2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/MonoBook2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/html/Toc2Html.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/HtmlGenerator.cs
+../../../external/api-doc-tools/monodoc/Monodoc/generators/RawGenerator.cs
+../../../external/api-doc-tools/monodoc/Monodoc/HelpSource.cs
+../../../external/api-doc-tools/monodoc/Monodoc/HelpSource_Legacy.cs
+../../../external/api-doc-tools/monodoc/Monodoc/index.cs
+../../../external/api-doc-tools/monodoc/Monodoc/Node.cs
+../../../external/api-doc-tools/monodoc/Monodoc/Node_Legacy.cs
+../../../external/api-doc-tools/monodoc/Monodoc/Provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/addins-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/ecma-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/EcmaDoc.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/ecmaspec-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/ecmauncompiled-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/error-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/man-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/providers/xhtml-provider.cs
+../../../external/api-doc-tools/monodoc/Monodoc/RootTree.cs
+../../../external/api-doc-tools/monodoc/Monodoc/RootTree_Legacy.cs
+../../../external/api-doc-tools/monodoc/Monodoc/SearchableDocument.cs
+../../../external/api-doc-tools/monodoc/Monodoc/SearchableIndex.cs
+../../../external/api-doc-tools/monodoc/Monodoc/settings.cs
+../../../external/api-doc-tools/monodoc/Monodoc/settings_Legacy.cs
+../../../external/api-doc-tools/monodoc/Monodoc/storage/NullStorage.cs
+../../../external/api-doc-tools/monodoc/Monodoc/storage/UncompiledDocStorage.cs
+../../../external/api-doc-tools/monodoc/Monodoc/storage/ZipStorage.cs
+../../../external/api-doc-tools/monodoc/Monodoc/storage.cs
+../../../external/api-doc-tools/monodoc/Monodoc/Tree.cs
+../../../external/api-doc-tools/monodoc/Monodoc/TypeUtils.cs
+
+../../../external/api-doc-tools/monodoc/Monodoc.Ecma/EcmaDesc.cs
+../../../external/api-doc-tools/monodoc/Monodoc.Ecma/EcmaUrlTokenizer.cs
+../../../external/api-doc-tools/monodoc/Monodoc.Ecma/prebuilt/EcmaUrlParser.cs
+
+../../../external/api-doc-tools/monodoc/Mono.Utilities/colorizer.cs
+../../../external/api-doc-tools/monodoc/Mono.Utilities/LRUCache.cs
+
+../../../external/api-doc-tools/monodoc/Mono.Documentation/ManifestResourceResolver.cs
+../../../external/api-doc-tools/monodoc/Mono.Documentation/XmlDocUtils.cs
+
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Analyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/ASCIIFoldingFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/BaseCharFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CachingTokenFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CharArraySet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CharFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CharReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CharStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/CharTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/ISOLatin1AccentFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/KeywordAnalyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/KeywordTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/LengthFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/LetterTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/LowerCaseFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/LowerCaseTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/MappingCharFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/NormalizeCharMap.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/NumericTokenStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/PerFieldAnalyzerWrapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/PorterStemFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/PorterStemmer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/SimpleAnalyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Standard/StandardAnalyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Standard/StandardFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Standard/StandardTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Standard/StandardTokenizerImpl.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/StopAnalyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/StopFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/TeeSinkTokenFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Token.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/FlagsAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IFlagsAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IOffsetAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IPayloadAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/IPositionIncrementAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/ITermAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/ITypeAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/OffsetAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/PayloadAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/PositionIncrementAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/TermAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenattributes/TypeAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/TokenFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/Tokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/TokenStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/WhitespaceAnalyzer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/WhitespaceTokenizer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Analysis/WordlistLoader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/AbstractField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/CompressionTools.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/DateField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/DateTools.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/Document.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/Field.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/Fieldable.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/FieldSelector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/FieldSelectorResult.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/LoadFirstFieldSelector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/MapFieldSelector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/NumberTools.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/NumericField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Document/SetBasedFieldSelector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/AbstractAllTermDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/AllTermDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/BufferedDeletes.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ByteBlockPool.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ByteSliceReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ByteSliceWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/CharBlockPool.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/CheckIndex.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/CompoundFileReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/CompoundFileWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ConcurrentMergeScheduler.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/CorruptIndexException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DefaultSkipListReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DefaultSkipListWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DirectoryReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocConsumerPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumerPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumerPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumers.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumersPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldConsumersPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldProcessor.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldProcessorPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocFieldProcessorPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocInverter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocInverterPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocInverterPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocumentsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/DocumentsWriterThreadState.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldInfo.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldInfos.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldInvertState.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldReaderException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldSortedTermVectorMapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldsReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FieldsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FilterIndexReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsDocsConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsDocsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsFieldsConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsFieldsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsPositionsConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsPositionsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsTermsConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FormatPostingsTermsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FreqProxFieldMergeState.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriterPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/FreqProxTermsWriterPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexCommit.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexDeletionPolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexFileDeleter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexFileNameFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexFileNames.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IndexWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/IntBlockPool.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocConsumerPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocConsumerPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumerPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/InvertedDocEndConsumerPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/LogByteSizeMergePolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/LogDocMergePolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/LogMergePolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MergeDocIDRemapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MergePolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MergeScheduler.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MultiLevelSkipListReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MultiLevelSkipListWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MultipleTermPositions.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/MultiReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/NormsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/NormsWriterPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/NormsWriterPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ParallelReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/Payload.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/PositionBasedTermVectorMapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/RawPostingList.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ReadOnlyDirectoryReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ReadOnlySegmentReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/ReusableStringReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentInfo.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentInfos.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentMergeInfo.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentMergeQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentMerger.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentTermDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentTermPositions.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentTermPositionVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentTermVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SegmentWriteState.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SerialMergeScheduler.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SnapshotDeletionPolicy.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/SortedTermVectorMapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/StaleReaderException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/StoredFieldsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/StoredFieldsWriterPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/Term.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermBuffer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermFreqVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermInfo.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermInfosReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermInfosWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermPositions.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermPositionVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHash.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHashConsumer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHashConsumerPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHashConsumerPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHashPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermsHashPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorEntry.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorEntryFreqSortedComparator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorMapper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorOffsetInfo.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorsReader.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriterPerField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorsTermsWriterPerThread.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Index/TermVectorsWriter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/LucenePackage.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/LZOCompressor.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Messages/INLSException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Messages/Message.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Messages/MessageImpl.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Messages/NLS.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/CharStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/FastCharStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/MultiFieldQueryParser.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/ParseException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/QueryParser.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/QueryParserConstants.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/QueryParserTokenManager.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/Token.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/QueryParser/TokenMgrError.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/BooleanClause.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/BooleanQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/BooleanScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/BooleanScorer2.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/CachingSpanFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/CachingWrapperFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Collector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ComplexExplanation.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ConjunctionScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ConstantScoreQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DefaultSimilarity.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DisjunctionMaxQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DisjunctionMaxScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DisjunctionSumScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DocIdSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/DocIdSetIterator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ExactPhraseScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Explanation.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldCache.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldCacheImpl.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldCacheRangeFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldCacheTermsFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldComparator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldComparatorSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldDoc.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldDocSortedHitQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FieldValueHitQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Filter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FilteredDocIdSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FilteredDocIdSetIterator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FilteredQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FilteredTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FilterManager.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/ByteFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/CustomScoreProvider.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/CustomScoreQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/DocValues.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/FieldCacheSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/FieldScoreQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/FloatFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/IntFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/OrdFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/ReverseOrdFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/ShortFieldSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/ValueSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Function/ValueSourceQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FuzzyQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/FuzzyTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/HitQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/IndexSearcher.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/MatchAllDocsQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/MultiPhraseQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/MultiSearcher.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/MultiTermQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/MultiTermQueryWrapperFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/NumericRangeFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/NumericRangeQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ParallelMultiSearcher.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/AveragePayloadFunction.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/MaxPayloadFunction.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/MinPayloadFunction.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/PayloadFunction.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/PayloadNearQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/PayloadSpanUtil.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Payloads/PayloadTermQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PhrasePositions.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PhraseQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PhraseQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PhraseScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PositiveScoresOnlyCollector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PrefixFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PrefixQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/PrefixTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Query.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/QueryTermVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/QueryWrapperFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ReqExclScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ReqOptSumScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ScoreCachingWrappingScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/ScoreDoc.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Scorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Searchable.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Searcher.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Similarity.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SimilarityDelegator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SingleTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SloppyPhraseScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Sort.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SortField.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SpanFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SpanFilterResult.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/SpanQueryFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/FieldMaskingSpanQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/NearSpansOrdered.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/NearSpansUnordered.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanFirstQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanNearQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanNotQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanOrQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/Spans.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanTermQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/SpanWeight.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Spans/TermSpans.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TermQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TermRangeFilter.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TermRangeQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TermRangeTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TermScorer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TimeLimitingCollector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TopDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TopDocsCollector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TopFieldCollector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TopFieldDocs.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/TopScoreDocCollector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/Weight.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/WildcardQuery.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Search/WildcardTermEnum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/AlreadyClosedException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/BufferedIndexInput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/BufferedIndexOutput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/CheckSumIndexInput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/CheckSumIndexOutput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/Directory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/FileSwitchDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/FSDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/FSLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/IndexInput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/IndexOutput.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/Lock.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/LockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/LockObtainFailedException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/LockReleaseFailedException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/LockStressTest.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/LockVerifyServer.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/MMapDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/NativeFSLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/NIOFSDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/NoLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/NoSuchDirectoryException.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/RAMDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/RAMFile.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/RAMInputStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/RAMOutputStream.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/SimpleFSDirectory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/SimpleFSLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/SingleInstanceLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Store/VerifyingLockFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/AppSettings.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/AttributeImplItem.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/BitSetSupport.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/BuildType.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Character.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/CloseableThreadLocalProfiler.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/CollectionsHelper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compare.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/ConcurrentDictionary.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/Func.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/ISet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/SetFactory.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/SortedSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/ThreadLocal.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Compatibility/WrappedHashSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/CRC32.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Cryptography.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Deflater.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Double.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/EquatableList.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/FileSupport.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/GeneralKeyedCollection.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/HashMap.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/IChecksum.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Inflater.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/IThreadRunnable.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Number.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/OS.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/SharpZipLib.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/Single.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/TextSupport.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/ThreadClass.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/ThreadLock.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Support/WeakDictionary.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/ArrayUtil.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Attribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/AttributeSource.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/AverageGuessMemoryModel.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/BitUtil.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/BitVector.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Cache/Cache.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Cache/SimpleLRUCache.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Cache/SimpleMapCache.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/CloseableThreadLocal.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Constants.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/DocIdBitSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/FieldCacheSanityChecker.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/IAttribute.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/IdentityDictionary.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/IndexableBinaryStringTools.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/MapOfSets.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/MemoryModel.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/NumericUtils.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/OpenBitSet.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/OpenBitSetDISI.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/OpenBitSetIterator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/PriorityQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/RamUsageEstimator.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/ReaderUtil.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/ScorerDocQueue.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/SimpleStringInterner.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/SmallFloat.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/SortedVIntList.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/SorterTemplate.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/StringHelper.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/StringInterner.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/ToStringUtils.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/UnicodeUtil.cs
+../../../external/api-doc-tools/external/Lucene.Net.Light/src/core/Util/Version.cs
../../test-helpers/NunitHelpers.cs
-Monodoc/HelpSourceTests.cs
-Monodoc/EcmaDocTests.cs
-Monodoc/TreeTest.cs
-Monodoc.Ecma/EcmaUrlTests.cs
-Monodoc/SettingsTest.cs
-Monodoc.Generators/RawGeneratorTests.cs
-Monodoc/NodeTest.cs
-Monodoc/RootTreeTest.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/EcmaDocTests.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/HelpSourceTests.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/NodeTest.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/RootTreeTest.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/SettingsTest.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc/TreeTest.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs
+../../../../external/api-doc-tools/monodoc/Test/Monodoc.Generators/RawGeneratorTests.cs
SUBDIRS =
include ../../build/rules.make
-MDOC_COMMON_FLAGS = \
- /resource:../../class/monodoc/Resources/mdoc-html-format.xsl,mdoc-html-format.xsl \
- /resource:../../class/monodoc/Resources/mdoc-html-utils.xsl,mdoc-html-utils.xsl \
- /resource:../../class/monodoc/Resources/mdoc-sections-css.xsl,mdoc-sections-css.xsl \
- /resource:../../class/monodoc/Resources/mono-ecma-css.xsl,mono-ecma-css.xsl \
- /resource:Resources/defaulttemplate.xsl,defaulttemplate.xsl \
- /resource:Resources/monodoc-ecma.xsd,monodoc-ecma.xsd \
- /resource:Resources/msitomsx.xsl,msitomsx.xsl \
- /resource:Resources/overview.xsl,overview.xsl \
- /resource:Resources/stylesheet.xsl,stylesheet.xsl \
+MONODOC_RESOURCES = \
+ Resources/mdoc-html-format.xsl \
+ Resources/mdoc-html-utils.xsl \
+ Resources/mdoc-sections-css.xsl \
+ Resources/mono-ecma-css.xsl
+
+MDOC_RESOURCES = \
+ Resources/defaulttemplate.xsl \
+ Resources/monodoc-ecma.xsd \
+ Resources/msitomsx.xsl \
+ Resources/overview.xsl \
+ Resources/stylesheet.xsl
+
+MDOC_RESOURCES_COMMAND = $(foreach file,$(MDOC_RESOURCES),/resource:../../../external/api-doc-tools/mdoc/$(file),$(notdir $(file)))
+
+MONODOC_RESOURCES_COMMAND = $(foreach file,$(MONODOC_RESOURCES),/resource:../../../external/api-doc-tools/monodoc/$(file),$(notdir $(file)))
LIB_REFS = monodoc System System.Xml System.Core Mono.Cecil ICSharpCode.SharpZipLib System.Xml.Linq System.Web
-LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS)
+LOCAL_MCS_FLAGS = $(MDOC_RESOURCES_COMMAND) $(MONODOC_RESOURCES_COMMAND)
PROGRAM = $(topdir)/class/lib/$(PROFILE)/mdoc.exe
PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
cp $(topdir)/class/lib/$(PROFILE)/monodoc.dll mdoc-net
endif
-MONODOC_RESOURCES = \
- ../../class/monodoc/Resources/mdoc-html-utils.xsl \
- ../../class/monodoc/Resources/mdoc-sections-css.xsl \
- ../../class/monodoc/Resources/mono-ecma-css.xsl
-
-MDOC_RESOURCES = \
- Resources/defaulttemplate.xsl \
- Resources/monodoc-ecma.xsd \
- Resources/msitomsx.xsl \
- Resources/overview.xsl \
- Resources/stylesheet.xsl
-
MDOC_TEST_FILES = \
Test/CLILibraryTypes.dtd \
Test/DocTest-v1.cs \
Test/validate.check.monodocer.importslashdoc \
Test/validate.check.monodocer.since
-EXTRA_DISTFILES = \
- $(MDOC_RESOURCES) \
- $(MDOC_TEST_FILES)
-
MULTI-CLASSIC = Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-multitest.dll
MULTI-UNIFIED = Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-unified-multitest.dll
-$(PROGRAM) : $(MDOC_RESOURCES) $(MONODOC_RESOURCES) $(PROGRAM_DEPS)
+$(PROGRAM): $(PROGRAM_DEPS)
-PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
+PROGRAM_COMPILE = $(CSCOMPILE)
include ../../build/executable.make
+++ /dev/null
-//
-// MdocFile.cs: File utility methods
-//
-// Author:
-// Jonathan Pryor <jpryor@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-
-namespace Mono.Documentation {
-
- static class MdocFile {
-
- public static void UpdateFile (string file, Action<string> creator)
- {
- if (!File.Exists (file) || file == "-") {
- creator (file);
- return;
- }
-
- string temp = Path.GetTempFileName ();
- bool move = true;
- try {
- creator (temp);
-
- using (var a = File.OpenRead (file))
- using (var b = File.OpenRead (temp)) {
- if (a.Length == b.Length)
- move = !FileContentsIdentical (a, b);
- }
-
- if (move) {
- File.Delete (file);
- File.Move (temp, file);
- }
- }
- finally {
- if (!move && File.Exists (temp))
- File.Delete (temp);
- }
- }
-
- static bool FileContentsIdentical (Stream a, Stream b)
- {
- byte[] ba = new byte[4096];
- byte[] bb = new byte[4096];
- int ra, rb;
-
- while ((ra = a.Read (ba, 0, ba.Length)) > 0 &&
- (rb = b.Read (bb, 0, bb.Length)) > 0) {
- if (ra != rb)
- return false;
- for (int i = 0; i < ra; ++i) {
- if (ba [i] != bb [i])
- return false;
- }
- }
- return true;
- }
- }
-}
+++ /dev/null
-//
-// XhtmlWriter.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Jonathan Pryor <jpryor@novell.com>
-//
-// (C)2004 Atsushi Enomoto
-//
-//
-using System;
-using System.Globalization;
-using System.Collections.Generic;
-using System.Xml;
-
-namespace Mono.Documentation {
-
- class XhtmlWriter : DelegatingXmlWriter {
- XmlWriter writer;
- Stack<string> localNames;
- Stack<string> namespaces;
-
- public XhtmlWriter (XmlWriter writer) : base (writer)
- {
- this.writer = writer;
- localNames = new Stack<string> ();
- namespaces = new Stack<string> ();
- }
-
- public override void WriteStartElement (string prefix, string localName, string ns)
- {
- localNames.Push (localName);
- namespaces.Push (ns);
- writer.WriteStartElement (prefix, localName, ns);
- }
-
- public override void WriteEndElement ()
- {
- WriteWiseEndElement (false);
- }
-
- public override void WriteFullEndElement ()
- {
- WriteWiseEndElement (true);
- }
-
- void WriteWiseEndElement (bool full)
- {
- string localName = localNames.Pop ();
- /* string ns = */ namespaces.Pop ();
- if (true /* ns == "http://www.w3.org/1999/xhtml" */) {
- switch (localName.ToLower (CultureInfo.InvariantCulture)) {
- case "area":
- case "base":
- case "basefont":
- case "br":
- case "col":
- case "frame":
- case "hr":
- case "img":
- case "input":
- case "isindex":
- case "link":
- case "meta":
- case "param":
- full = false;
- break;
- default:
- full = true;
- break;
- }
- }
- if (full)
- writer.WriteFullEndElement ();
- else
- writer.WriteEndElement ();
- }
- }
-
- class DelegatingXmlWriter : XmlWriter {
- XmlWriter writer;
-
- public DelegatingXmlWriter (XmlWriter writer)
- {
- this.writer = writer;
- }
-
- public override void Close ()
- {
- writer.Close ();
- }
-
- public override void Flush ()
- {
- writer.Flush ();
- }
-
- public override string LookupPrefix (string ns)
- {
- return writer.LookupPrefix (ns);
- }
-
- public override void WriteBase64 (byte [] buffer, int index, int count)
- {
- writer.WriteBase64 (buffer, index, count);
- }
-
- public override void WriteBinHex (byte [] buffer, int index, int count)
- {
- writer.WriteBinHex (buffer, index, count);
- }
-
- public override void WriteCData (string text)
- {
- writer.WriteCData (text);
- }
-
- public override void WriteCharEntity (char ch)
- {
- writer.WriteCharEntity (ch);
- }
-
- public override void WriteChars (char [] buffer, int index, int count)
- {
- writer.WriteChars (buffer, index, count);
- }
-
- public override void WriteComment (string text)
- {
- writer.WriteComment (text);
- }
-
- public override void WriteDocType (string name, string pubid, string sysid, string subset)
- {
- writer.WriteDocType (name, pubid, sysid, subset);
- }
-
- public override void WriteEndAttribute ()
- {
- writer.WriteEndAttribute ();
- }
-
- public override void WriteEndDocument ()
- {
- writer.WriteEndDocument ();
- }
-
- public override void WriteEndElement ()
- {
- writer.WriteEndElement ();
- }
-
- public override void WriteEntityRef (string name)
- {
- writer.WriteEntityRef (name);
- }
-
- public override void WriteFullEndElement ()
- {
- writer.WriteFullEndElement ();
- }
-
- public override void WriteName (string name)
- {
- writer.WriteName (name);
- }
-
- public override void WriteNmToken (string name)
- {
- writer.WriteNmToken (name);
- }
-
- public override void WriteNode (XmlReader reader, bool defattr)
- {
- writer.WriteNode (reader, defattr);
- }
-
- public override void WriteProcessingInstruction (string name, string text)
- {
- writer.WriteProcessingInstruction (name, text);
- }
-
- public override void WriteQualifiedName (string localName, string ns)
- {
- writer.WriteQualifiedName (localName, ns);
- }
-
- public override void WriteRaw (string data)
- {
- writer.WriteRaw (data);
- }
-
- public override void WriteRaw (char [] buffer, int index, int count)
- {
- writer.WriteRaw (buffer, index, count);
- }
-
- public override void WriteStartAttribute (string prefix, string localName, string ns)
- {
- writer.WriteStartAttribute (prefix, localName, ns);
- }
-
- public override void WriteStartDocument (bool standalone)
- {
- writer.WriteStartDocument (standalone);
- }
-
- public override void WriteStartDocument ()
- {
- writer.WriteStartDocument ();
- }
-
- public override void WriteStartElement (string prefix, string localName, string ns)
- {
- writer.WriteStartElement (prefix, localName, ns);
- }
-
- public override void WriteString (string text)
- {
- writer.WriteString (text);
- }
-
- public override void WriteSurrogateCharEntity (char lowChar, char highChar)
- {
- writer.WriteSurrogateCharEntity (lowChar, highChar);
- }
-
- public override void WriteWhitespace (string ws)
- {
- writer.WriteWhitespace (ws);
- }
-
- public override WriteState WriteState {
- get {
- return writer.WriteState;
- }
- }
-
- public override string XmlLang {
- get {
- return writer.XmlLang;
- }
- }
-
- public override XmlSpace XmlSpace {
- get {
- return writer.XmlSpace;
- }
- }
- }
-}
-
+++ /dev/null
-//
-// The assembler: Help compiler.
-//
-// Author:
-// Miguel de Icaza (miguel@gnome.org)
-//
-// (C) 2003 Ximian, Inc.
-//
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
-using Monodoc;
-using Monodoc.Providers;
-using Mono.Options;
-using System.IO;
-using System.Xml.Linq;
-using System.Xml.XPath;
-using Monodoc.Ecma;
-
-namespace Mono.Documentation {
-
-public class MDocAssembler : MDocCommand {
- static readonly string[] ValidFormats = {
- "ecma",
- "ecmaspec",
- "error",
- "hb",
- "man",
- "simple",
- "xhtml"
- };
-
- string droppedNamespace = null;
-
- public static Option[] CreateFormatOptions (MDocCommand self, Dictionary<string, List<string>> formats)
- {
- string cur_format = "ecma";
- var options = new OptionSet () {
- { "f|format=",
- "The documentation {FORMAT} used in DIRECTORIES. " +
- "Valid formats include:\n " +
- string.Join ("\n ", ValidFormats) + "\n" +
- "If not specified, the default format is `ecma'.",
- v => {
- if (Array.IndexOf (ValidFormats, v) < 0)
- self.Error ("Invalid documentation format: {0}.", v);
- cur_format = v;
- } },
- { "<>", v => AddFormat (self, formats, cur_format, v) },
- };
- return new Option[]{options[0], options[1]};
- }
-
- public override void Run (IEnumerable<string> args)
- {
- bool replaceNTypes = false;
- var formats = new Dictionary<string, List<string>> ();
- string prefix = "tree";
- var formatOptions = CreateFormatOptions (this, formats);
- var options = new OptionSet () {
- formatOptions [0],
- { "o|out=",
- "Provides the output file prefix; the files {PREFIX}.zip and " +
- "{PREFIX}.tree will be created.\n" +
- "If not specified, `tree' is the default PREFIX.",
- v => prefix = v },
- formatOptions [1],
- {"dropns=","The namespace that has been dropped from this version of the assembly.", v => droppedNamespace = v },
- {"ntypes","Replace references to native types with their original types.", v => replaceNTypes=true },
- };
- List<string> extra = Parse (options, args, "assemble",
- "[OPTIONS]+ DIRECTORIES",
- "Assemble documentation within DIRECTORIES for use within the monodoc browser.");
- if (extra == null)
- return;
-
- List<Provider> list = new List<Provider> ();
- EcmaProvider ecma = null;
- bool sort = false;
-
- foreach (string format in formats.Keys) {
- switch (format) {
- case "ecma":
- if (ecma == null) {
- ecma = new EcmaProvider ();
- list.Add (ecma);
- sort = true;
- }
- ecma.FileSource = new MDocFileSource(droppedNamespace, string.IsNullOrWhiteSpace(droppedNamespace) ? ApiStyle.Unified : ApiStyle.Classic) {
- ReplaceNativeTypes = replaceNTypes
- };
- foreach (string dir in formats [format])
- ecma.AddDirectory (dir);
- break;
-
- case "xhtml":
- case "hb":
- list.AddRange (formats [format].Select (d => (Provider) new XhtmlProvider (d)));
- break;
-
- case "man":
- list.Add (new ManProvider (formats [format].ToArray ()));
- break;
-
- case "error":
- list.AddRange (formats [format].Select (d => (Provider) new ErrorProvider (d)));
- break;
-
- case "ecmaspec":
- list.AddRange (formats [format].Select (d => (Provider) new EcmaSpecProvider (d)));
- break;
-
- case "addins":
- list.AddRange (formats [format].Select (d => (Provider) new AddinsProvider (d)));
- break;
- }
- }
-
- HelpSource hs = new HelpSource (prefix, true);
- hs.TraceLevel = TraceLevel;
-
- foreach (Provider p in list) {
- p.PopulateTree (hs.Tree);
- }
-
- if (sort && hs.Tree != null)
- hs.Tree.RootNode.Sort ();
-
- //
- // Flushes the EcmaProvider
- //
- foreach (Provider p in list)
- p.CloseTree (hs, hs.Tree);
-
- hs.Save ();
- }
-
- private static void AddFormat (MDocCommand self, Dictionary<string, List<string>> d, string format, string file)
- {
- if (format == null)
- self.Error ("No format specified.");
- List<string> l;
- if (!d.TryGetValue (format, out l)) {
- l = new List<string> ();
- d.Add (format, l);
- }
- l.Add (file);
- }
-}
-
- /// <summary>
- /// A custom provider file source that lets us modify the source files before they are processed by monodoc.
- /// </summary>
- internal class MDocFileSource : IEcmaProviderFileSource {
- private string droppedNamespace;
- private bool shouldDropNamespace = false;
- private ApiStyle styleToDrop;
-
- public bool ReplaceNativeTypes { get; set; }
-
- /// <param name="ns">The namespace that is being dropped.</param>
- /// <param name="style">The style that is being dropped.</param>
- public MDocFileSource(string ns, ApiStyle style)
- {
- droppedNamespace = ns;
- shouldDropNamespace = !string.IsNullOrWhiteSpace (ns);
- styleToDrop = style;
- }
-
- public XmlReader GetIndexReader(string path)
- {
- XDocument doc = XDocument.Load (path);
-
- DropApiStyle (doc, path);
- DropNSFromDocument (doc);
-
- // now put the modified contents into a stream for the XmlReader that monodoc will use.
- MemoryStream io = new MemoryStream ();
- using (var writer = XmlWriter.Create (io)) {
- doc.WriteTo (writer);
- }
- io.Seek (0, SeekOrigin.Begin);
-
- return XmlReader.Create (io);
- }
-
- public XElement GetNamespaceElement(string path)
- {
- var element = XElement.Load (path);
-
- var attributes = element.Descendants ().Concat(new XElement[] { element }).SelectMany (n => n.Attributes ());
- var textNodes = element.Nodes ().OfType<XText> ();
-
- DropNS (attributes, textNodes);
-
- return element;
- }
-
- void DropApiStyle(XDocument doc, string path)
- {
- string styleString = styleToDrop.ToString ().ToLower ();
- var items = doc
- .Descendants ()
- .Where (n => n.Attributes ()
- .Any (a => a.Name.LocalName == "apistyle" && a.Value == styleString))
- .ToArray ();
-
- foreach (var element in items) {
- element.Remove ();
- }
-
- if (styleToDrop == ApiStyle.Classic && ReplaceNativeTypes) {
- RewriteCrefsIfNecessary (doc, path);
- }
- }
-
- void RewriteCrefsIfNecessary (XDocument doc, string path)
- {
- // we also have to rewrite crefs
- var sees = doc.Descendants ().Where (d => d.Name.LocalName == "see").ToArray ();
- foreach (var see in sees) {
- var cref = see.Attribute ("cref");
- if (cref == null) {
- continue;
- }
- EcmaUrlParser parser = new EcmaUrlParser ();
- EcmaDesc reference;
- if (!parser.TryParse (cref.Value, out reference)) {
- continue;
- }
- if ((new EcmaDesc.Kind[] {
- EcmaDesc.Kind.Constructor,
- EcmaDesc.Kind.Method
- }).Any (k => k == reference.DescKind)) {
- string ns = reference.Namespace;
- string type = reference.TypeName;
- string memberName = reference.MemberName;
- if (reference.MemberArguments != null) {
- XDocument refDoc = FindReferenceDoc (path, doc, ns, type);
- if (refDoc == null) {
- continue;
- }
- // look in the refDoc for the memberName, and match on parameters and # of type parameters
- var overloads = refDoc.XPathSelectElements ("//Member[@MemberName='" + memberName + "']").ToArray ();
- // Do some initial filtering to find members that could potentially match (based on parameter and typeparam counts)
- var members = overloads.Where (e => reference.MemberArgumentsCount == e.XPathSelectElements ("Parameters/Parameter[not(@apistyle) or @apistyle='classic']").Count () && reference.GenericMemberArgumentsCount == e.XPathSelectElements ("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']").Count ()).Select (m => new {
- Node = m,
- AllParameters = m.XPathSelectElements ("Parameters/Parameter").ToArray (),
- Parameters = m.XPathSelectElements ("Parameters/Parameter[not(@apistyle) or @apistyle='classic']").ToArray (),
- NewParameters = m.XPathSelectElements ("Parameters/Parameter[@apistyle='unified']").ToArray ()
- }).ToArray ();
- // now find the member that matches on types
- var member = members.FirstOrDefault (m => reference.MemberArguments.All (r => m.Parameters.Any (mp => mp.Attribute ("Type").Value.Contains (r.TypeName))));
- if (member == null || member.NewParameters.Length == 0)
- continue;
- foreach (var arg in reference.MemberArguments) {
- // find the "classic" parameter
- var oldParam = member.Parameters.First (p => p.Attribute ("Type").Value.Contains (arg.TypeName));
- var newParam = member.NewParameters.FirstOrDefault (p => oldParam.Attribute ("Name").Value == p.Attribute ("Name").Value);
- if (newParam != null) {
- // this means there was a change made, and we should try to convert this cref
- arg.TypeName = NativeTypeManager.ConvertToNativeType (arg.TypeName);
- }
- }
- var rewrittenReference = reference.ToEcmaCref ();
- Console.WriteLine ("From {0} to {1}", cref.Value, rewrittenReference);
- cref.Value = rewrittenReference;
- }
- }
- }
- }
-
- XDocument FindReferenceDoc (string currentPath, XDocument currentDoc, string ns, string type)
- {
- if (currentPath.Length <= 1) {
- return null;
- }
- // build up the supposed path to the doc
- string dir = Path.GetDirectoryName (currentPath);
- if (dir.Equals (currentPath)) {
- return null;
- }
-
- string supposedPath = Path.Combine (dir, ns, type + ".xml");
-
- // if it's the current path, return currentDoc
- if (supposedPath == currentPath) {
- return currentDoc;
- }
-
- if (!File.Exists (supposedPath)) {
- // hmm, file not there, look one directory up
- return FindReferenceDoc (dir, currentDoc, ns, type);
- }
-
- // otherwise, load the XDoc and return
- return XDocument.Load (supposedPath);
- }
-
- void DropNSFromDocument (XDocument doc)
- {
- var attributes = doc.Descendants ().SelectMany (n => n.Attributes ());
- var textNodes = doc.DescendantNodes().OfType<XText> ().ToArray();
-
- DropNS (attributes, textNodes);
- }
-
- void DropNS(IEnumerable<XAttribute> attributes, IEnumerable<XText> textNodes)
- {
- if (!shouldDropNamespace) {
- return;
- }
-
- string nsString = string.Format ("{0}.", droppedNamespace);
- foreach (var attr in attributes) {
- if (attr.Value.Contains (nsString)) {
- attr.Value = attr.Value.Replace (nsString, string.Empty);
- }
- }
-
- foreach (var textNode in textNodes) {
- if (textNode.Value.Contains (nsString)) {
- textNode.Value = textNode.Value.Replace (nsString, string.Empty);
- }
- }
- }
-
-
- /// <param name="nsName">This is the type's name in the processed XML content.
- /// If dropping the namespace, we'll need to append it so that it's found in the source.</param>
- /// <param name="typeName">Type name.</param>
- public string GetTypeXmlPath(string basePath, string nsName, string typeName)
- {
- string nsNameToUse = nsName;
- if (shouldDropNamespace) {
- nsNameToUse = string.Format ("{0}.{1}", droppedNamespace, nsName);
-
- var droppedPath = BuildTypeXmlPath (basePath, typeName, nsNameToUse);
- var origPath = BuildTypeXmlPath (basePath, typeName, nsName);
-
- if (!File.Exists (droppedPath)) {
- if (File.Exists (origPath)) {
- return origPath;
- }
- }
-
- return droppedPath;
- } else {
-
- var finalPath = BuildTypeXmlPath (basePath, typeName, nsNameToUse);
-
- return finalPath;
- }
- }
-
- static string BuildTypeXmlPath (string basePath, string typeName, string nsNameToUse)
- {
- string finalPath = Path.Combine (basePath, nsNameToUse, Path.ChangeExtension (typeName, ".xml"));
- return finalPath;
- }
-
- static string BuildNamespaceXmlPath (string basePath, string ns)
- {
- var nsFileName = Path.Combine (basePath, String.Format ("ns-{0}.xml", ns));
- return nsFileName;
- }
-
- /// <returns>The namespace for path, with the dropped namespace so it can be used to pick the right file if we're dropping it.</returns>
- /// <param name="ns">This namespace will already have "dropped" the namespace.</param>
- public string GetNamespaceXmlPath(string basePath, string ns)
- {
- string nsNameToUse = ns;
- if (shouldDropNamespace) {
- nsNameToUse = string.Format ("{0}.{1}", droppedNamespace, ns);
-
- var droppedPath = BuildNamespaceXmlPath (basePath, nsNameToUse);
- var origPath = BuildNamespaceXmlPath (basePath, ns);
-
- if (!File.Exists (droppedPath) && File.Exists(origPath)) {
- return origPath;
- }
-
- return droppedPath;
- } else {
- var path = BuildNamespaceXmlPath (basePath, ns);
- return path;
- }
- }
-
- public XDocument GetTypeDocument(string path)
- {
- var doc = XDocument.Load (path);
- DropApiStyle (doc, path);
- DropNSFromDocument (doc);
-
- return doc;
- }
-
- public XElement ExtractNamespaceSummary (string path)
- {
- using (var reader = GetIndexReader (path)) {
- reader.ReadToFollowing ("Namespace");
- var name = reader.GetAttribute ("Name");
- var summary = reader.ReadToFollowing ("summary") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("summary");
- var remarks = reader.ReadToFollowing ("remarks") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("remarks");
-
- return new XElement ("namespace",
- new XAttribute ("ns", name ?? string.Empty),
- summary,
- remarks);
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-using Monodoc;
-using Mono.Options;
-
-namespace Mono.Documentation {
-
- class MDocTreeDumper : MDocCommand {
-
- public override void Run (IEnumerable<string> args)
- {
- var validFormats = RootTree.GetSupportedFormats ();
- string cur_format = "";
- var formats = new Dictionary<string, List<string>> ();
- var options = new OptionSet () {
- { "f|format=",
- "The documentation {FORMAT} used in FILES. " +
- "Valid formats include:\n " +
- string.Join ("\n ", validFormats) + "\n" +
- "If not specified, no HelpSource is used. This may " +
- "impact the PublicUrls displayed for nodes.",
- v => {
- if (Array.IndexOf (validFormats, v) < 0)
- Error ("Invalid documentation format: {0}.", v);
- cur_format = v;
- } },
- { "<>", v => AddFormat (formats, cur_format, v) },
- };
- List<string> files = Parse (options, args, "dump-tree",
- "[OPTIONS]+ FILES",
- "Print out the nodes within the assembled .tree FILES,\n" +
- "as produced by 'mdoc assemble'.");
- if (files == null)
- return;
-
- foreach (string format in formats.Keys) {
- foreach (string file in formats [format]) {
- HelpSource hs = format == ""
- ? null
- : RootTree.GetHelpSource (format, file.Replace (".tree", ""));
- Tree t = new Tree (hs, file);
- TreeDumper.PrintTree (t.RootNode);
- }
- }
- }
-
- private void AddFormat (Dictionary<string, List<string>> d, string format, string file)
- {
- if (format == null)
- format = "";
- List<string> l;
- if (!d.TryGetValue (format, out l)) {
- l = new List<string> ();
- d.Add (format, l);
- }
- l.Add (file);
- }
- }
-}
+++ /dev/null
-//
-// ecmadoc.cs
-//
-// Author:
-// Jonathan Pryor <jpryor@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-
-using Monodoc;
-using Mono.Documentation;
-
-using Mono.Options;
-using Mono.Rocks;
-
-namespace Mono.Documentation
-{
- public class MDocUpdateEcmaXml : MDocCommand
- {
- string file = "CLILibraryTypes.xml";
- List<string> directories;
- Dictionary<string, HashSet<string>> libraries = new Dictionary<string, HashSet<string>>();
-
- public override void Run (IEnumerable<string> args)
- {
- string current_library = "";
-
- var options = new OptionSet () {
- { "o|out=",
- "{FILE} to generate/update documentation within.\n" +
- "If not specified, will process " + file + ".\n" +
- "Set to '-' to skip updates and write to standard output.",
- v => file = v },
- { "library=",
- "The {LIBRARY} that the following --type=TYPE types should be a part of.",
- v => current_library = v },
- { "type=",
- "The full {TYPE} name of a type to copy into the output file.",
- v => AddTypeToLibrary (current_library, v) },
- };
- directories = Parse (options, args, "export-ecma-xml",
- "[OPTIONS]+ DIRECTORIES",
- "Export mdoc documentation within DIRECTORIES into ECMA-format XML.\n\n" +
- "DIRECTORIES are mdoc(5) directories as produced by 'mdoc update'.");
- if (directories == null || directories.Count == 0)
- return;
-
- Update ();
- }
-
- void AddTypeToLibrary (string library, string type)
- {
- HashSet<string> types;
- if (!libraries.TryGetValue (library, out types))
- libraries.Add (library, types = new HashSet<string> ());
- types.Add (type.Replace ('/', '.').Replace ('+', '.'));
- }
-
- void Update ()
- {
- Action<string> creator = file => {
- XDocument docs = LoadFile (this.file);
-
- var seenLibraries = new HashSet<string> ();
-
- UpdateExistingLibraries (docs, seenLibraries);
- GenerateMissingLibraries (docs, seenLibraries);
-
- SortLibraries (docs.Root);
- SortTypes (docs.Root);
-
- using (var output = CreateWriter (file)) {
- foreach (var node in docs.Nodes ()) {
- if (node.NodeType == XmlNodeType.Element || node.NodeType == XmlNodeType.Text)
- continue;
- node.WriteTo (output);
- }
- docs.Root.WriteTo (output);
- output.WriteWhitespace ("\r\n");
- }
- };
- MdocFile.UpdateFile (this.file, creator);
- }
-
- static XDocument LoadFile (string file)
- {
- if (file == "-" || !File.Exists (file))
- return CreateDefaultDocument ();
-
- var settings = new XmlReaderSettings {
- DtdProcessing = DtdProcessing.Parse
- };
- using (var reader = XmlReader.Create (file, settings))
- return XDocument.Load (reader);
- }
-
- static XDocument CreateDefaultDocument ()
- {
- return new XDocument (
- new XComment (" ====================================================================== "),
- new XComment (" This XML is a description of the Common Language Infrastructure (CLI) library. "),
- new XComment (" This file is a normative part of Partition IV of the following standards: ISO/IEC 23271 and ECMA 335 "),
- new XComment (" ====================================================================== "),
- new XDocumentType ("Libraries", null, "CLILibraryTypes.dtd", null),
- new XElement ("Libraries"));
- }
-
- static XmlWriter CreateWriter (string file)
- {
- var settings = new XmlWriterSettings {
- Indent = true,
- IndentChars = "\t",
- NewLineChars = "\r\n",
- OmitXmlDeclaration = true,
- };
-
- if (file == "-")
- return XmlWriter.Create (Console.Out, settings);
-
- settings.Encoding = new UTF8Encoding (false);
- return XmlWriter.Create (file, settings);
- }
-
- void UpdateExistingLibraries (XDocument docs, HashSet<string> seenLibraries)
- {
- foreach (XElement types in docs.Root.Elements ("Types")) {
- XAttribute library = types.Attribute ("Library");
- HashSet<string> libraryTypes;
- if (library == null || !libraries.TryGetValue (library.Value, out libraryTypes)) {
- continue;
- }
- seenLibraries.Add (library.Value);
- var seenTypes = new HashSet<string> ();
- foreach (XElement type in types.Elements ("Type").ToList ()) {
- XAttribute fullName = type.Attribute ("FullName");
- string typeName = fullName == null
- ? null
- : XmlDocUtils.ToEscapedTypeName (fullName.Value);
- if (typeName == null || !libraryTypes.Contains (typeName)) {
- continue;
- }
- type.Remove ();
- seenTypes.Add (typeName);
- types.Add (LoadType (typeName, library.Value));
- }
- foreach (string typeName in libraryTypes.Except (seenTypes))
- types.Add (LoadType (typeName, library.Value));
- }
- }
-
- void GenerateMissingLibraries (XDocument docs, HashSet<string> seenLibraries)
- {
- foreach (KeyValuePair<string, HashSet<string>> lib in libraries) {
- if (seenLibraries.Contains (lib.Key))
- continue;
- seenLibraries.Add (lib.Key);
- docs.Root.Add (new XElement ("Types", new XAttribute ("Library", lib.Key),
- lib.Value.Select (type => LoadType (type, lib.Key))));
- }
- }
-
- XElement LoadType (string type, string library)
- {
- foreach (KeyValuePair<string, string> permutation in GetTypeDirectoryFilePermutations (type)) {
- foreach (string root in directories) {
- string path = Path.Combine (root, Path.Combine (permutation.Key, permutation.Value + ".xml"));
- if (File.Exists (path))
- return FixupType (path, library);
- }
- }
- throw new FileNotFoundException ("Unable to find documentation file for type: " + type + ".");
- }
-
- // type has been "normalized", which (alas) means we have ~no clue which
- // part is the namespace and which is the type name, particularly
- // problematic as types may be nested to any level.
- // Try ~all permutations. :-)
- static IEnumerable<KeyValuePair<string, string>> GetTypeDirectoryFilePermutations (string type)
- {
- int end = type.Length;
- int dot;
- while ((dot = type.LastIndexOf ('.', end-1)) >= 0) {
- yield return new KeyValuePair<string, string> (
- type.Substring (0, dot),
- type.Substring (dot+1).Replace ('.', '+'));
- end = dot;
- }
- yield return new KeyValuePair<string, string> ("", type.Replace ('.', '+'));
- }
-
- static XElement FixupType (string path, string library)
- {
- var type = XElement.Load (path);
-
- XAttribute fullName = type.Attribute ("FullName");
- XAttribute fullNameSp = type.Attribute ("FullNameSP");
- if (fullNameSp == null && fullName != null) {
- type.Add (new XAttribute ("FullNameSP", fullName.Value.Replace ('.', '_')));
- }
- if (type.Element ("TypeExcluded") == null)
- type.Add (new XElement ("TypeExcluded", "0"));
- if (type.Element ("MemberOfLibrary") == null) {
- XElement member = new XElement ("MemberOfLibrary", library);
- XElement assemblyInfo = type.Element ("AssemblyInfo");
- if (assemblyInfo != null)
- assemblyInfo.AddBeforeSelf (member);
- else
- type.Add (member);
- }
-
- XElement ai = type.Element ("AssemblyInfo");
-
- XElement assembly =
- XElement.Load (
- Path.Combine (
- Path.Combine (Path.GetDirectoryName (path), ".."),
- "index.xml"))
- .Element ("Assemblies")
- .Elements ("Assembly")
- .FirstOrDefault (a => a.Attribute ("Name").Value == ai.Element ("AssemblyName").Value &&
- a.Attribute ("Version").Value == ai.Element ("AssemblyVersion").Value);
- if (assembly == null)
- return type;
-
- if (assembly.Element ("AssemblyPublicKey") != null)
- ai.Add (assembly.Element ("AssemblyPublicKey"));
-
- if (assembly.Element ("AssemblyCulture") != null)
- ai.Add (assembly.Element ("AssemblyCulture"));
- else
- ai.Add (new XElement ("AssemblyCulture", "neutral"));
-
- // TODO: assembly attributes?
- // The problem is that .NET mscorlib.dll v4.0 has ~26 attributes, and
- // importing these for every time seems like some serious bloat...
- var clsDefAttr = assembly.Elements ("Attributes").Elements ("Attribute")
- .FirstOrDefault (a => a.Element ("AttributeName").Value.StartsWith ("System.CLSCompliant"));
- if (clsDefAttr != null &&
- ai.Elements ("Attributes").Elements ("Attribute")
- .FirstOrDefault (a => a.Element ("AttributeName").Value.StartsWith ("System.CLSCompliant")) == null) {
- var dest = ai.Element ("Attributes");
- if (dest == null)
- ai.Add (dest = new XElement ("Attributes"));
- dest.Add (clsDefAttr);
- }
-
- return type;
- }
-
- static void SortLibraries (XContainer libraries)
- {
- SortElements (libraries, (x, y) => x.Attribute ("Library").Value.CompareTo (y.Attribute ("Library").Value));
- }
-
- static void SortElements (XContainer container, Comparison<XElement> comparison)
- {
- var items = new List<XElement> ();
- foreach (var e in container.Elements ())
- items.Add (e);
- items.Sort (comparison);
- for (int i = items.Count - 1; i > 0; --i) {
- items [i-1].Remove ();
- items [i].AddBeforeSelf (items [i-1]);
- }
- }
-
- static void SortTypes (XContainer libraries)
- {
- foreach (var types in libraries.Elements ("Types")) {
- SortElements (types, (x, y) => {
- string xName, yName;
- int xCount, yCount;
-
- GetTypeSortName (x, out xName, out xCount);
- GetTypeSortName (y, out yName, out yCount);
-
- int c = xName.CompareTo (yName);
- if (c != 0)
- return c;
- if (xCount < yCount)
- return -1;
- if (yCount < xCount)
- return 1;
- return 0;
- });
- }
- }
-
- static void GetTypeSortName (XElement element, out string name, out int typeParamCount)
- {
- typeParamCount = 0;
- name = element.Attribute ("Name").Value;
-
- int lt = name.IndexOf ('<');
- if (lt >= 0) {
- int gt = name.IndexOf ('>', lt);
- if (gt >= 0) {
- typeParamCount = name.Substring (lt, gt-lt).Count (c => c == ',') + 1;
- }
- name = name.Substring (0, lt);
- }
- }
- }
-}
+++ /dev/null
-//
-// Mono.Documentation/exceptions.cs
-//
-// Authors:
-// Jonathan Pryor (jonpryor@vt.edu)
-//
-// (C) 2008 Novell, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-
-namespace Mono.Documentation {
-
- [Flags]
- public enum ExceptionLocations {
- Member = 0x0,
- Assembly = 0x1,
- DependentAssemblies = 0x2,
- AddedMembers = 0x4,
- }
-
- public class ExceptionSources {
- internal ExceptionSources (TypeReference exception)
- {
- Exception = exception;
- Sources = new HashSet<MemberReference> ();
- }
-
- public TypeReference Exception { get; private set; }
- internal HashSet<MemberReference> Sources;
- }
-
-
- public class ExceptionLookup {
-
- SlashDocMemberFormatter xdoc = new SlashDocMemberFormatter ();
-
- // xdoc(MemberRef) -> xdoc(TypeRef) -> ExceptionSource
- // where ExceptionSource.Exception == xdoc(TypeRef)
- Dictionary<string, Dictionary<string, ExceptionSources>> db = new Dictionary<string, Dictionary<string, ExceptionSources>> ();
-
- ExceptionLocations locations;
-
- public ExceptionLookup (ExceptionLocations locations)
- {
- this.locations = locations;
- }
-
- public IEnumerable<ExceptionSources> this [MemberReference member] {
- get {
- if (member == null)
- throw new ArgumentNullException ("member");
-
- var memberDef = member.Resolve ();
- if (memberDef == null) {
- ArrayType array = member.DeclaringType as ArrayType;
- if (array != null && array.Rank > 1) {
- // Multi-dimensional array; the member is runtime generated,
- // doesn't "really" exist (in a form that we can resolve),
- // so we can't do anything further.
- return new ExceptionSources[0];
- }
- throw new NotSupportedException (string.Format (
- "Unable to resolve member {0}::{1}.",
- member.DeclaringType.FullName, member.Name));
- }
- string memberDecl = xdoc.GetDeclaration (member);
- Dictionary<string, ExceptionSources> e;
- if (!db.TryGetValue (memberDecl, out e)) {
- e = new Dictionary<string, ExceptionSources> ();
- db.Add (memberDecl, e);
- var bodies = GetMethodBodies (member);
- foreach (var body in bodies) {
- if (body == null)
- continue;
- FillExceptions (body, e);
- }
- }
- return e.Values;
- }
- }
-
- MethodBody[] GetMethodBodies (MemberReference member)
- {
- if (member is MethodReference) {
- return new[]{ (((MethodReference) member).Resolve ()).Body };
- }
- if (member is PropertyReference) {
- PropertyDefinition prop = (PropertyDefinition) member;
- return new[]{
- prop.GetMethod != null ? prop.GetMethod.Body : null,
- prop.SetMethod != null ? prop.SetMethod.Body : null,
- };
- }
- if (member is FieldReference)
- return new MethodBody[]{};
- if (member is EventReference) {
- EventDefinition ev = (EventDefinition) member;
- return new[]{
- ev.AddMethod != null ? ev.AddMethod.Body : null,
- ev.InvokeMethod != null ? ev.InvokeMethod.Body : null,
- ev.RemoveMethod != null ? ev.RemoveMethod.Body : null,
- };
- }
- throw new NotSupportedException ("Unsupported member type: " + member.GetType().FullName);
- }
-
- void FillExceptions (MethodBody body, Dictionary<string, ExceptionSources> exceptions)
- {
- for (int i = 0; i < body.Instructions.Count; ++i) {
- Instruction instruction = body.Instructions [i];
- switch (instruction.OpCode.Code) {
- case Code.Call:
- case Code.Callvirt: {
- if ((locations & ExceptionLocations.Assembly) == 0 &&
- (locations & ExceptionLocations.DependentAssemblies) == 0)
- break;
- MemberReference memberRef = ((MemberReference) instruction.Operand);
- if (((locations & ExceptionLocations.Assembly) != 0 &&
- body.Method.DeclaringType.Scope.Name == memberRef.DeclaringType.Scope.Name) ||
- ((locations & ExceptionLocations.DependentAssemblies) != 0 &&
- body.Method.DeclaringType.Scope.Name != memberRef.DeclaringType.Scope.Name)) {
-
- IEnumerable<ExceptionSources> memberExceptions = this [memberRef];
- AddExceptions (body, instruction,
- memberExceptions.Select (es => es.Exception),
- memberExceptions.SelectMany (es => es.Sources),
- exceptions);
- }
- break;
- }
- case Code.Newobj: {
- MethodReference ctor = (MethodReference) instruction.Operand;
- if (IsExceptionConstructor (ctor)) {
- AddExceptions (body, instruction,
- new TypeReference[]{ctor.DeclaringType},
- new MemberReference[]{body.Method},
- exceptions);
- }
- break;
- }
- }
- }
- }
-
- void AddExceptions (MethodBody body, Instruction instruction, IEnumerable<TypeReference> add, IEnumerable<MemberReference> sources,
- Dictionary<string, ExceptionSources> exceptions)
- {
- var handlers = body.ExceptionHandlers.Cast<ExceptionHandler> ()
- .Where (eh => instruction.Offset >= eh.TryStart.Offset &&
- instruction.Offset <= eh.TryEnd.Offset);
- foreach (var ex in add) {
- if (!handlers.Any (h => IsExceptionCaught (ex, h.CatchType))) {
- ExceptionSources s;
- string eName = xdoc.GetDeclaration (ex);
- if (!exceptions.TryGetValue (eName, out s)) {
- s = new ExceptionSources (ex);
- exceptions.Add (eName, s);
- }
- foreach (var m in sources)
- s.Sources.Add (m);
- }
- }
- }
-
- static bool IsExceptionConstructor (MethodReference ctor)
- {
- return GetBases (ctor.DeclaringType)
- .Any (t => t.FullName == "System.Exception");
- }
-
- bool IsExceptionCaught (TypeReference exception, TypeReference catcher)
- {
- return GetBases (exception).Select (e => xdoc.GetDeclaration (e))
- .Union (GetBases (catcher).Select (e => xdoc.GetDeclaration (e)))
- .Any ();
- }
-
- static IEnumerable<TypeReference> GetBases (TypeReference type)
- {
- yield return type;
- TypeDefinition def = type.Resolve ();
- while (def != null && def.BaseType != null) {
- yield return def.BaseType;
- def = def.BaseType.Resolve ();
- }
- }
- }
-}
+++ /dev/null
-//
-// index.cs
-// Index maker (both normal and Lucene-based)
-//
-// Authors:
-// Jérémie Laval <jeremie dot laval at xamarin dot com>
-//
-// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-using System;
-using System.Collections.Generic;
-
-using Mono.Options;
-using Monodoc;
-
-namespace Mono.Documentation {
-
- class MDocIndex : MDocCommand {
- public override void Run (IEnumerable<string> args)
- {
- string rootPath = null;
-
- var options = new OptionSet () {
- { "r=|root=", "Specify which documentation root to use. Default is $libdir/monodoc", v => rootPath = v },
- };
-
- var extra = Parse (options, args, "index",
- "[OPTIONS]+ ACTION",
- "Create Monodoc indexes depending on ACTION. Possible values are \"tree\" or \"search\" for, respectively, mdoc tree and lucene search");
- if (extra == null)
- return;
-
- var root = string.IsNullOrEmpty (rootPath) ? RootTree.LoadTree () : RootTree.LoadTree (rootPath);
-
- foreach (var action in extra) {
- switch (action) {
- case "tree":
- root.GenerateIndex ();
- break;
- case "search":
- root.GenerateSearchIndex ();
- break;
- }
- }
- }
- }
-}
+++ /dev/null
-// Part of the mdoc(7) suite of tools.
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Mono.Options;
-
-namespace Mono.Documentation {
-
- class MDoc {
-
- private static bool debug;
-
- private static void Main (string[] args)
- {
- MDoc d = new MDoc ();
- try {
- d.Run (args);
- }
- catch (Exception e) {
- if (debug) {
- Console.Error.WriteLine ("mdoc: {0}", e.ToString ());
- }
- else {
- Console.Error.WriteLine ("mdoc: {0}", e.Message);
- }
- Console.Error.WriteLine ("See `mdoc help' for more information or use --debug to diagnose.");
- Environment.ExitCode = 1;
- }
- }
-
- int verbosity = 2;
-
- internal Dictionary<string, MDocCommand> subcommands;
-
- private void Run (string[] args)
- {
- subcommands = new Dictionary<string, MDocCommand> () {
- { "assemble", new MDocAssembler () },
- { "dump-tree", new MDocTreeDumper () },
- { "export-html", new MDocToHtmlConverter () },
- { "export-html-webdoc", new MDocExportWebdocHtml () },
- { "export-msxdoc", new MDocToMSXDocConverter () },
- { "help", new MDocHelpCommand (this) },
- { "update", new MDocUpdater () },
- { "update-ecma-xml", new MDocUpdateEcmaXml () },
- { "validate", new MDocValidator () },
- { "index", new MDocIndex () },
- { "preserve", new MDocPreserve () }
- };
-
- bool showVersion = false;
- bool showHelp = false;
- var p = new OptionSet () {
- { "version", v => showVersion = v != null },
- { "v:", (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
- { "debug", v => debug = v != null },
- { "h|?|help", v => showHelp = v != null },
- new ResponseFileSource (),
- };
-
- var extra = p.Parse (args);
-
- if (showVersion) {
- Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
- return;
- }
- if (extra.Count == 0) {
- Console.WriteLine ("Use `mdoc help' for usage.");
- return;
- }
- if (showHelp) {
- extra.Add ("--help");
- }
- switch (extra [0]) {
- case "x-msitomsx":
- new MsidocToMsxdocConverter ().Run (extra);
- break;
- default:
- GetCommand (extra [0]).Run (extra);
- break;
- }
- }
-
- internal MDocCommand GetCommand (string command)
- {
- MDocCommand h;
- if (!subcommands.TryGetValue (command, out h)) {
- Error ("Unknown command: {0}.", command);
- }
- h.TraceLevel = (TraceLevel) verbosity;
- h.DebugOutput = debug;
- return h;
- }
-
- private static void Error (string format, params object[] args)
- {
- throw new Exception (string.Format (format, args));
- }
- }
-
- public abstract class MDocCommand {
-
- public TraceLevel TraceLevel { get; set; }
- public bool DebugOutput { get; set; }
-
- public abstract void Run (IEnumerable<string> args);
-
- protected List<string> Parse (OptionSet p, IEnumerable<string> args,
- string command, string prototype, string description)
- {
- bool showHelp = false;
- p.Add ("h|?|help",
- "Show this message and exit.",
- v => showHelp = v != null );
-
- List<string> extra = null;
- if (args != null) {
- extra = p.Parse (args.Skip (1));
- }
- if (args == null || showHelp) {
- Console.WriteLine ("usage: mdoc {0} {1}",
- args == null ? command : args.First(), prototype);
- Console.WriteLine ();
- Console.WriteLine (description);
- Console.WriteLine ();
- Console.WriteLine ("Available Options:");
- p.WriteOptionDescriptions (Console.Out);
- return null;
- }
- return extra;
- }
-
- public void Error (string format, params object[] args)
- {
- throw new Exception (string.Format (format, args));
- }
-
- public void Message (TraceLevel level, string format, params object[] args)
- {
- if ((int) level > (int) TraceLevel)
- return;
- if (level == TraceLevel.Error)
- Console.Error.WriteLine (format, args);
- else
- Console.WriteLine (format, args);
- }
- }
-
- class MDocHelpCommand : MDocCommand {
-
- MDoc instance;
-
- public MDocHelpCommand (MDoc instance)
- {
- this.instance = instance;
- }
-
- public override void Run (IEnumerable<string> args)
- {
- if (args != null && args.Count() > 1) {
- foreach (var arg in args.Skip (1)) {
- instance.GetCommand (arg).Run (new string[]{arg, "--help"});
- }
- return;
- }
- Message (TraceLevel.Warning,
- "usage: mdoc COMMAND [OPTIONS]\n" +
- "Use `mdoc help COMMAND' for help on a specific command.\n" +
- "\n" +
- "Available commands:\n\n " +
- string.Join ("\n ", instance.subcommands.Keys.OrderBy (v => v).ToArray()) +
- "\n\n" +
- "mdoc is a tool for documentation management.\n" +
- "For additional information, see http://www.mono-project.com/"
- );
- }
- }
-}
-
+++ /dev/null
-// Updater program for syncing Mono's ECMA-style documentation files
-// with an assembly.
-// By Joshua Tauberer <tauberer@for.net>
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Xml;
-using System.Xml.XPath;
-
-using Mono.Cecil;
-using Mono.Options;
-
-using MyXmlNodeList = System.Collections.Generic.List<System.Xml.XmlNode>;
-using StringList = System.Collections.Generic.List<string>;
-using StringToStringMap = System.Collections.Generic.Dictionary<string, string>;
-using StringToXmlNodeMap = System.Collections.Generic.Dictionary<string, System.Xml.XmlNode>;
-
-namespace Mono.Documentation {
- static class NativeTypeManager {
-
- static Dictionary<string, string> toNativeType = new Dictionary<string,string>(){
-
- {"int", "nint"},
- {"Int32", "nint"},
- {"System.Int32", "System.nint"},
- {"uint", "nuint"},
- {"UInt32", "nuint"},
- {"System.UInt32", "System.nuint"},
- {"float", "nfloat"},
- {"Single", "nfloat"},
- {"System.Single", "System.nfloat"},
- {"SizeF", "CoreGraphics.CGSize"},
- {"System.Drawing.SizeF", "CoreGraphics.CGSize"},
- {"PointF", "CoreGraphics.CGPoint"},
- {"System.Drawing.PointF", "CoreGraphics.CGPoint"},
- {"RectangleF", "CoreGraphics.CGRect" },
- {"System.Drawing.RectangleF", "CoreGraphics.CGRect"}
- };
-
- static Dictionary<string, string> fromNativeType = new Dictionary<string,string>(){
-
- {"nint", "int"},
- {"System.nint", "System.Int32"},
- {"nuint", "uint"},
- {"System.nuint", "System.UInt32"},
- {"nfloat", "float"},
- {"System.nfloat", "System.Single"},
- {"CoreGraphics.CGSize", "System.Drawing.SizeF"},
- {"CoreGraphics.CGPoint", "System.Drawing.PointF"},
- {"CoreGraphics.CGRect", "System.Drawing.RectangleF"},
- {"MonoTouch.CoreGraphics.CGSize", "System.Drawing.SizeF"},
- {"MonoTouch.CoreGraphics.CGPoint", "System.Drawing.PointF"},
- {"MonoTouch.CoreGraphics.CGRect", "System.Drawing.RectangleF"}
- };
-
- public static string ConvertToNativeType(string typename) {
- string nvalue;
-
- bool isOut=false;
- bool isArray=false;
- string valueToCompare = StripToComparableType (typename, ref isOut, ref isArray);
-
- if (toNativeType.TryGetValue (valueToCompare, out nvalue)) {
-
- if (isArray) {
- nvalue += "[]";
- }
- if (isOut) {
- nvalue += "&";
- }
- return nvalue;
- }
- return typename;
- }
- public static string ConvertFromNativeType(string typename) {
- string nvalue;
-
- bool isOut=false;
- bool isArray=false;
- string valueToCompare = StripToComparableType (typename, ref isOut, ref isArray);
-
- if (fromNativeType.TryGetValue (valueToCompare, out nvalue)) {
- if (isArray) {
- nvalue += "[]";
- }
- if (isOut) {
- nvalue += "&";
- }
- return nvalue;
- }
- // it wasn't one of the native types ... just return it
- return typename;
- }
-
- static string StripToComparableType (string typename, ref bool isOut, ref bool isArray)
- {
- string valueToCompare = typename;
- if (typename.EndsWith ("[]")) {
- valueToCompare = typename.Substring (0, typename.Length - 2);
- isArray = true;
- }
- if (typename.EndsWith ("&")) {
- valueToCompare = typename.Substring (0, typename.Length - 1);
- isOut = true;
- }
- if (typename.Contains ("<")) {
- // TODO: Need to recursively process generic parameters
- }
- return valueToCompare;
- }
-
- public static string GetTranslatedName(TypeReference t) {
- string typename = t.FullName;
-
- bool isInAssembly = MDocUpdater.IsInAssemblies (t.Module.Name);
- if (isInAssembly && !typename.StartsWith ("System") && MDocUpdater.HasDroppedNamespace (t)) {
- string nameWithDropped = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, typename);
- return nameWithDropped;
- }
- return typename;
- }
- }
-class MDocUpdater : MDocCommand
-{
- string srcPath;
- List<AssemblyDefinition> assemblies;
- readonly DefaultAssemblyResolver assemblyResolver = new DefaultAssemblyResolver();
-
- string apistyle = string.Empty;
- bool isClassicRun;
-
- bool delete;
- bool show_exceptions;
- bool no_assembly_versions, ignore_missing_types;
- ExceptionLocations? exceptions;
-
- internal int additions = 0, deletions = 0;
-
- List<DocumentationImporter> importers = new List<DocumentationImporter> ();
-
- DocumentationEnumerator docEnum;
-
- string since;
-
- static readonly MemberFormatter docTypeFormatter = new DocTypeMemberFormatter ();
- static readonly MemberFormatter filenameFormatter = new FileNameMemberFormatter ();
-
- static MemberFormatter[] typeFormatters = new MemberFormatter[]{
- new CSharpMemberFormatter (),
- new ILMemberFormatter (),
- };
-
- static MemberFormatter[] memberFormatters = new MemberFormatter[]{
- new CSharpFullMemberFormatter (),
- new ILFullMemberFormatter (),
- };
-
- internal static readonly MemberFormatter slashdocFormatter = new SlashDocMemberFormatter ();
-
- MyXmlNodeList extensionMethods = new MyXmlNodeList ();
-
- HashSet<string> forwardedTypes = new HashSet<string> ();
-
- public static string droppedNamespace = string.Empty;
-
- public static bool HasDroppedNamespace(TypeDefinition forType)
- {
- return HasDroppedNamespace(forType.Module);
- }
-
- public static bool HasDroppedNamespace(MemberReference forMember)
- {
- return HasDroppedNamespace(forMember.Module);
- }
-
- public static bool HasDroppedNamespace(AssemblyDefinition forAssembly)
- {
- return HasDroppedNamespace(forAssembly.MainModule);
- }
-
- public static bool HasDroppedNamespace(ModuleDefinition forModule)
- {
- return !string.IsNullOrWhiteSpace (droppedNamespace) && droppedAssemblies.Any(da => da == forModule.Name);
- }
-
- public static bool HasDroppedAnyNamespace ()
- {
- return !string.IsNullOrWhiteSpace (droppedNamespace);
- }
-
- /// <summary>Logic flag to signify that we should list assemblies at the method level, since there are multiple
- /// assemblies for a given type/method.</summary>
- public bool IsMultiAssembly {
- get {
- return apistyle == "classic" || apistyle == "unified";
- }
- }
-
- static List<string> droppedAssemblies = new List<string>();
-
- public string PreserveTag { get; set; }
- public static MDocUpdater Instance { get; private set; }
- public static bool SwitchingToMagicTypes { get; private set; }
-
- public override void Run (IEnumerable<string> args)
- {
- Instance = this;
- show_exceptions = DebugOutput;
- var types = new List<string> ();
- var p = new OptionSet () {
- { "delete",
- "Delete removed members from the XML files.",
- v => delete = v != null },
- { "exceptions:",
- "Document potential exceptions that members can generate. {SOURCES} " +
- "is a comma-separated list of:\n" +
- " asm Method calls in same assembly\n" +
- " depasm Method calls in dependent assemblies\n" +
- " all Record all possible exceptions\n" +
- " added Modifier; only create <exception/>s\n" +
- " for NEW types/members\n" +
- "If nothing is specified, then only exceptions from the member will " +
- "be listed.",
- v => exceptions = ParseExceptionLocations (v) },
- { "f=",
- "Specify a {FLAG} to alter behavior. See later -f* options for available flags.",
- v => {
- switch (v) {
- case "ignore-missing-types":
- ignore_missing_types = true;
- break;
- case "no-assembly-versions":
- no_assembly_versions = true;
- break;
- default:
- throw new Exception ("Unsupported flag `" + v + "'.");
- }
- } },
- { "fignore-missing-types",
- "Do not report an error if a --type=TYPE type\nwas not found.",
- v => ignore_missing_types = v != null },
- { "fno-assembly-versions",
- "Do not generate //AssemblyVersion elements.",
- v => no_assembly_versions = v != null },
- { "i|import=",
- "Import documentation from {FILE}.",
- v => AddImporter (v) },
- { "L|lib=",
- "Check for assembly references in {DIRECTORY}.",
- v => assemblyResolver.AddSearchDirectory (v) },
- { "library=",
- "Ignored for compatibility with update-ecma-xml.",
- v => {} },
- { "o|out=",
- "Root {DIRECTORY} to generate/update documentation.",
- v => srcPath = v },
- { "r=",
- "Search for dependent assemblies in the directory containing {ASSEMBLY}.\n" +
- "(Equivalent to '-L `dirname ASSEMBLY`'.)",
- v => assemblyResolver.AddSearchDirectory (Path.GetDirectoryName (v)) },
- { "since=",
- "Manually specify the assembly {VERSION} that new members were added in.",
- v => since = v },
- { "type=",
- "Only update documentation for {TYPE}.",
- v => types.Add (v) },
- { "dropns=",
- "When processing assembly {ASSEMBLY}, strip off leading namespace {PREFIX}:\n" +
- " e.g. --dropns ASSEMBLY=PREFIX",
- v => {
- var parts = v.Split ('=');
- if (parts.Length != 2) { Console.Error.WriteLine ("Invalid dropns input"); return; }
- var assembly = Path.GetFileName (parts [0].Trim ());
- var prefix = parts [1].Trim();
- droppedAssemblies.Add (assembly);
- droppedNamespace = prefix;
- } },
- { "ntypes",
- "If the new assembly is switching to 'magic types', then this switch should be defined.",
- v => SwitchingToMagicTypes = true },
- { "preserve",
- "Do not delete members that don't exist in the assembly, but rather mark them as preserved.",
- v => PreserveTag = "true" },
- { "api-style=",
- "Denotes the apistyle. Currently, only `classic` and `unified` are supported. `classic` set of assemblies should be run first, immediately followed by 'unified' assemblies with the `dropns` parameter.",
- v => { apistyle = v.ToLowerInvariant (); }},
- };
- var assemblies = Parse (p, args, "update",
- "[OPTIONS]+ ASSEMBLIES",
- "Create or update documentation from ASSEMBLIES.");
- if (assemblies == null)
- return;
- if (assemblies.Count == 0)
- Error ("No assemblies specified.");
-
- // validation for the api-style parameter
- if (apistyle == "classic")
- isClassicRun = true;
- else if (apistyle == "unified") {
- if (!droppedAssemblies.Any ())
- Error ("api-style 'unified' must also supply the 'dropns' parameter with at least one assembly and dropped namespace.");
- } else if (!string.IsNullOrWhiteSpace (apistyle))
- Error ("api-style '{0}' is not currently supported", apistyle);
-
-
- foreach (var dir in assemblies
- .Where (a => a.Contains (Path.DirectorySeparatorChar))
- .Select (a => Path.GetDirectoryName (a)))
- assemblyResolver.AddSearchDirectory (dir);
-
- // PARSE BASIC OPTIONS AND LOAD THE ASSEMBLY TO DOCUMENT
-
- if (srcPath == null)
- throw new InvalidOperationException("The --out option is required.");
-
- this.assemblies = assemblies.Select (a => LoadAssembly (a)).ToList ();
-
- // Store types that have been forwarded to avoid duplicate generation
- GatherForwardedTypes ();
-
- docEnum = docEnum ?? new DocumentationEnumerator ();
-
- // PERFORM THE UPDATES
-
- if (types.Count > 0) {
- types.Sort ();
- DoUpdateTypes (srcPath, types, srcPath);
- }
-#if false
- else if (opts.@namespace != null)
- DoUpdateNS (opts.@namespace, Path.Combine (opts.path, opts.@namespace),
- Path.Combine (dest_dir, opts.@namespace));
-#endif
- else
- DoUpdateAssemblies (srcPath, srcPath);
-
- Console.WriteLine("Members Added: {0}, Members Deleted: {1}", additions, deletions);
- }
- public static bool IsInAssemblies(string name) {
- var query = Instance.assemblies.Where (a => a.MainModule.Name == name).ToArray ();
- return query.Length > 0;
- }
- void AddImporter (string path)
- {
- try {
- XmlReader r = new XmlTextReader (path);
- if (r.Read ()) {
- while (r.NodeType != XmlNodeType.Element) {
- if (!r.Read ())
- Error ("Unable to read XML file: {0}.", path);
- }
- if (r.LocalName == "doc") {
- importers.Add (new MsxdocDocumentationImporter (path));
- }
- else if (r.LocalName == "Libraries") {
- var ecmadocs = new XmlTextReader (path);
- docEnum = new EcmaDocumentationEnumerator (this, ecmadocs);
- importers.Add (new EcmaDocumentationImporter (ecmadocs));
- }
- else
- Error ("Unsupported XML format within {0}.", path);
- }
- r.Close ();
- } catch (Exception e) {
- Environment.ExitCode = 1;
- Error ("Could not load XML file: {0}.", e.Message);
- }
- }
-
- void GatherForwardedTypes ()
- {
- foreach (var asm in assemblies)
- foreach (var type in asm.MainModule.ExportedTypes.Where (t => t.IsForwarder).Select (t => t.FullName))
- forwardedTypes.Add (type);
- }
-
- static ExceptionLocations ParseExceptionLocations (string s)
- {
- ExceptionLocations loc = ExceptionLocations.Member;
- if (s == null)
- return loc;
- foreach (var type in s.Split (',')) {
- switch (type) {
- case "added": loc |= ExceptionLocations.AddedMembers; break;
- case "all": loc |= ExceptionLocations.Assembly | ExceptionLocations.DependentAssemblies; break;
- case "asm": loc |= ExceptionLocations.Assembly; break;
- case "depasm": loc |= ExceptionLocations.DependentAssemblies; break;
- default: throw new NotSupportedException ("Unsupported --exceptions value: " + type);
- }
- }
- return loc;
- }
-
- internal void Warning (string format, params object[] args)
- {
- Message (TraceLevel.Warning, "mdoc: " + format, args);
- }
-
- private AssemblyDefinition LoadAssembly (string name)
- {
- AssemblyDefinition assembly = null;
- try {
- assembly = AssemblyDefinition.ReadAssembly (name, new ReaderParameters { AssemblyResolver = assemblyResolver });
- } catch (System.IO.FileNotFoundException) { }
-
- if (assembly == null)
- throw new InvalidOperationException("Assembly " + name + " not found.");
-
- return assembly;
- }
-
- private static void WriteXml(XmlElement element, System.IO.TextWriter output) {
- OrderTypeAttributes (element);
- XmlTextWriter writer = new XmlTextWriter(output);
- writer.Formatting = Formatting.Indented;
- writer.Indentation = 2;
- writer.IndentChar = ' ';
- element.WriteTo(writer);
- output.WriteLine();
- }
-
- private static void WriteFile (string filename, FileMode mode, Action<TextWriter> action)
- {
- Action<string> creator = file => {
- using (var writer = OpenWrite (file, mode))
- action (writer);
- };
-
- MdocFile.UpdateFile (filename, creator);
- }
-
- private static void OrderTypeAttributes (XmlElement e)
- {
- foreach (XmlElement type in e.SelectNodes ("//Type")) {
- OrderTypeAttributes (type.Attributes);
- }
- }
-
- static readonly string[] TypeAttributeOrder = {
- "Name", "FullName", "FullNameSP", "Maintainer"
- };
-
- private static void OrderTypeAttributes (XmlAttributeCollection c)
- {
- XmlAttribute[] attrs = new XmlAttribute [TypeAttributeOrder.Length];
- for (int i = 0; i < c.Count; ++i) {
- XmlAttribute a = c [i];
- for (int j = 0; j < TypeAttributeOrder.Length; ++j) {
- if (a.Name == TypeAttributeOrder [j]) {
- attrs [j] = a;
- break;
- }
- }
- }
- for (int i = attrs.Length-1; i >= 0; --i) {
- XmlAttribute n = attrs [i];
- if (n == null)
- continue;
- XmlAttribute r = null;
- for (int j = i+1; j < attrs.Length; ++j) {
- if (attrs [j] != null) {
- r = attrs [j];
- break;
- }
- }
- if (r == null)
- continue;
- if (c [n.Name] != null) {
- c.RemoveNamedItem (n.Name);
- c.InsertBefore (n, r);
- }
- }
- }
-
- private XmlDocument CreateIndexStub()
- {
- XmlDocument index = new XmlDocument();
-
- XmlElement index_root = index.CreateElement("Overview");
- index.AppendChild(index_root);
-
- if (assemblies.Count == 0)
- throw new Exception ("No assembly");
-
- XmlElement index_assemblies = index.CreateElement("Assemblies");
- index_root.AppendChild(index_assemblies);
-
- XmlElement index_remarks = index.CreateElement("Remarks");
- index_remarks.InnerText = "To be added.";
- index_root.AppendChild(index_remarks);
-
- XmlElement index_copyright = index.CreateElement("Copyright");
- index_copyright.InnerText = "To be added.";
- index_root.AppendChild(index_copyright);
-
- XmlElement index_types = index.CreateElement("Types");
- index_root.AppendChild(index_types);
-
- return index;
- }
-
- private static void WriteNamespaceStub(string ns, string outdir) {
- XmlDocument index = new XmlDocument();
-
- XmlElement index_root = index.CreateElement("Namespace");
- index.AppendChild(index_root);
-
- index_root.SetAttribute("Name", ns);
-
- XmlElement index_docs = index.CreateElement("Docs");
- index_root.AppendChild(index_docs);
-
- XmlElement index_summary = index.CreateElement("summary");
- index_summary.InnerText = "To be added.";
- index_docs.AppendChild(index_summary);
-
- XmlElement index_remarks = index.CreateElement("remarks");
- index_remarks.InnerText = "To be added.";
- index_docs.AppendChild(index_remarks);
-
- WriteFile (outdir + "/ns-" + ns + ".xml", FileMode.CreateNew,
- writer => WriteXml (index.DocumentElement, writer));
- }
-
- public void DoUpdateTypes (string basepath, List<string> typenames, string dest)
- {
- var index = CreateIndexForTypes (dest);
-
- var found = new HashSet<string> ();
- foreach (AssemblyDefinition assembly in assemblies) {
- foreach (TypeDefinition type in docEnum.GetDocumentationTypes (assembly, typenames)) {
- string relpath = DoUpdateType (type, basepath, dest);
- if (relpath == null)
- continue;
-
- found.Add (type.FullName);
-
- if (index == null)
- continue;
-
- index.Add (assembly);
- index.Add (type);
- }
- }
-
- if (index != null)
- index.Write ();
-
- if (ignore_missing_types)
- return;
-
- var notFound = from n in typenames where !found.Contains (n) select n;
- if (notFound.Any ())
- throw new InvalidOperationException("Type(s) not found: " + string.Join (", ", notFound.ToArray ()));
- }
-
- class IndexForTypes {
-
- MDocUpdater app;
- string indexFile;
-
- XmlDocument index;
- XmlElement index_types;
- XmlElement index_assemblies;
-
- public IndexForTypes (MDocUpdater app, string indexFile, XmlDocument index)
- {
- this.app = app;
- this.indexFile = indexFile;
- this.index = index;
-
- index_types = WriteElement (index.DocumentElement, "Types");
- index_assemblies = WriteElement (index.DocumentElement, "Assemblies");
- }
-
- public void Add (AssemblyDefinition assembly)
- {
- if (index_assemblies.SelectSingleNode ("Assembly[@Name='" + assembly.Name.Name + "']") != null)
- return;
-
- app.AddIndexAssembly (assembly, index_assemblies);
- }
-
- public void Add (TypeDefinition type)
- {
- app.AddIndexType (type, index_types);
- }
-
- public void Write ()
- {
- SortIndexEntries (index_types);
- WriteFile (indexFile, FileMode.Create,
- writer => WriteXml (index.DocumentElement, writer));
- }
- }
-
- IndexForTypes CreateIndexForTypes (string dest)
- {
- string indexFile = Path.Combine (dest, "index.xml");
- if (File.Exists (indexFile))
- return null;
- return new IndexForTypes (this, indexFile, CreateIndexStub ());
- }
-
- /// <summary>Constructs the presumed path to the type's documentation file</summary>
- /// <returns><c>true</c>, if the type file was found, <c>false</c> otherwise.</returns>
- /// <param name="result">A typle that contains 1) the 'reltypefile', 2) the 'typefile', and 3) the file info</param>
- bool TryFindTypeFile(string nsname, string typename, string basepath, out Tuple<string, string, FileInfo> result) {
- string reltypefile = DocUtils.PathCombine (nsname, typename + ".xml");
- string typefile = Path.Combine (basepath, reltypefile);
- System.IO.FileInfo file = new System.IO.FileInfo(typefile);
-
- result = new Tuple<string, string, FileInfo> (reltypefile, typefile, file);
-
- return file.Exists;
- }
-
- public string DoUpdateType (TypeDefinition type, string basepath, string dest)
- {
- if (type.Namespace == null)
- Warning ("warning: The type `{0}' is in the root namespace. This may cause problems with display within monodoc.",
- type.FullName);
- if (!IsPublic (type))
- return null;
-
- // Must get the A+B form of the type name.
- string typename = GetTypeFileName(type);
- string nsname = DocUtils.GetNamespace (type);
-
- // Find the file, if it exists
- string[] searchLocations = new string[] {
- nsname
- };
-
- if (MDocUpdater.HasDroppedNamespace (type)) {
- // If dropping namespace, types may have moved into a couple of different places.
- var newSearchLocations = searchLocations.Union (new string[] {
- string.Format ("{0}.{1}", droppedNamespace, nsname),
- nsname.Replace (droppedNamespace + ".", string.Empty),
- MDocUpdater.droppedNamespace
- });
-
- searchLocations = newSearchLocations.ToArray ();
- }
-
- string reltypefile="", typefile="";
- System.IO.FileInfo file = null;
-
- foreach (var f in searchLocations) {
- Tuple<string, string, FileInfo> result;
- bool fileExists = TryFindTypeFile (f, typename, basepath, out result);
-
- if (fileExists) {
- reltypefile = result.Item1;
- typefile = result.Item2;
- file = result.Item3;
-
- break;
- }
- }
-
- if (file == null || !file.Exists) {
- // we were not able to find a file, let's use the original type informatio.
- // so that we create the stub in the right place.
- Tuple<string, string, FileInfo> result;
- TryFindTypeFile (nsname, typename, basepath, out result);
-
- reltypefile = result.Item1;
- typefile = result.Item2;
- file = result.Item3;
- }
-
- string output = null;
- if (dest == null) {
- output = typefile;
- } else if (dest == "-") {
- output = null;
- } else {
- output = Path.Combine (dest, reltypefile);
- }
-
- if (file != null && file.Exists) {
- // Update
- XmlDocument basefile = new XmlDocument();
- try {
- basefile.Load(typefile);
- } catch (Exception e) {
- throw new InvalidOperationException("Error loading " + typefile + ": " + e.Message, e);
- }
-
- DoUpdateType2("Updating", basefile, type, output, false);
- } else {
- // Stub
- XmlElement td = StubType(type, output);
- if (td == null)
- return null;
- }
- return reltypefile;
- }
-
- public void DoUpdateNS (string ns, string nspath, string outpath)
- {
- Dictionary<TypeDefinition, object> seenTypes = new Dictionary<TypeDefinition,object> ();
- AssemblyDefinition assembly = assemblies [0];
-
- foreach (System.IO.FileInfo file in new System.IO.DirectoryInfo(nspath).GetFiles("*.xml")) {
- XmlDocument basefile = new XmlDocument();
- string typefile = Path.Combine(nspath, file.Name);
- try {
- basefile.Load(typefile);
- } catch (Exception e) {
- throw new InvalidOperationException("Error loading " + typefile + ": " + e.Message, e);
- }
-
- string typename =
- GetTypeFileName (basefile.SelectSingleNode("Type/@FullName").InnerText);
- TypeDefinition type = assembly.GetType(typename);
- if (type == null) {
- // --
- if (!string.IsNullOrWhiteSpace (droppedNamespace)) {
- string nameWithNs = string.Format ("{0}.{1}", droppedNamespace, typename);
- type = assembly.GetType (nameWithNs);
- if (type == null) {
- Warning ("Type no longer in assembly: " + typename);
- continue;
- }
- }
- //--
- }
-
- seenTypes[type] = seenTypes;
- DoUpdateType2("Updating", basefile, type, Path.Combine(outpath, file.Name), false);
- }
-
- // Stub types not in the directory
- foreach (TypeDefinition type in docEnum.GetDocumentationTypes (assembly, null)) {
- if (type.Namespace != ns || seenTypes.ContainsKey(type))
- continue;
-
- XmlElement td = StubType(type, Path.Combine(outpath, GetTypeFileName(type) + ".xml"));
- if (td == null) continue;
- }
- }
-
- private static string GetTypeFileName (TypeReference type)
- {
- return filenameFormatter.GetName (type);
- }
-
- public static string GetTypeFileName (string typename)
- {
- StringBuilder filename = new StringBuilder (typename.Length);
- int numArgs = 0;
- int numLt = 0;
- bool copy = true;
- for (int i = 0; i < typename.Length; ++i) {
- char c = typename [i];
- switch (c) {
- case '<':
- copy = false;
- ++numLt;
- break;
- case '>':
- --numLt;
- if (numLt == 0) {
- filename.Append ('`').Append ((numArgs+1).ToString());
- numArgs = 0;
- copy = true;
- }
- break;
- case ',':
- if (numLt == 1)
- ++numArgs;
- break;
- default:
- if (copy)
- filename.Append (c);
- break;
- }
- }
- return filename.ToString ();
- }
-
- private void AddIndexAssembly (AssemblyDefinition assembly, XmlElement parent)
- {
- XmlElement index_assembly = null;
- if (IsMultiAssembly)
- index_assembly = (XmlElement)parent.SelectSingleNode ("Assembly[@Name='"+ assembly.Name.Name +"']");
-
- if (index_assembly == null)
- index_assembly = parent.OwnerDocument.CreateElement ("Assembly");
-
- index_assembly.SetAttribute ("Name", assembly.Name.Name);
- index_assembly.SetAttribute ("Version", assembly.Name.Version.ToString());
-
- AssemblyNameDefinition name = assembly.Name;
- if (name.HasPublicKey) {
- XmlElement pubkey = parent.OwnerDocument.CreateElement ("AssemblyPublicKey");
- var key = new StringBuilder (name.PublicKey.Length*3 + 2);
- key.Append ("[");
- foreach (byte b in name.PublicKey)
- key.AppendFormat ("{0,2:x2} ", b);
- key.Append ("]");
- pubkey.InnerText = key.ToString ();
- index_assembly.AppendChild (pubkey);
- }
-
- if (!string.IsNullOrEmpty (name.Culture)) {
- XmlElement culture = parent.OwnerDocument.CreateElement ("AssemblyCulture");
- culture.InnerText = name.Culture;
- index_assembly.AppendChild (culture);
- }
-
- MakeAttributes (index_assembly, GetCustomAttributes (assembly.CustomAttributes, ""));
- parent.AppendChild(index_assembly);
- }
-
- private void AddIndexType (TypeDefinition type, XmlElement index_types)
- {
- string typename = GetTypeFileName(type);
-
- // Add namespace and type nodes into the index file as needed
- string ns = DocUtils.GetNamespace (type);
- XmlElement nsnode = (XmlElement) index_types.SelectSingleNode ("Namespace[@Name='" + ns + "']");
- if (nsnode == null) {
- nsnode = index_types.OwnerDocument.CreateElement("Namespace");
- nsnode.SetAttribute ("Name", ns);
- index_types.AppendChild (nsnode);
- }
- string doc_typename = GetDocTypeName (type);
- XmlElement typenode = (XmlElement) nsnode.SelectSingleNode ("Type[@Name='" + typename + "']");
- if (typenode == null) {
- typenode = index_types.OwnerDocument.CreateElement ("Type");
- typenode.SetAttribute ("Name", typename);
- nsnode.AppendChild (typenode);
- }
- if (typename != doc_typename)
- typenode.SetAttribute("DisplayName", doc_typename);
- else
- typenode.RemoveAttribute("DisplayName");
-
- typenode.SetAttribute ("Kind", GetTypeKind (type));
- }
-
- private void DoUpdateAssemblies (string source, string dest)
- {
- string indexfile = dest + "/index.xml";
- XmlDocument index;
- if (System.IO.File.Exists(indexfile)) {
- index = new XmlDocument();
- index.Load(indexfile);
-
- // Format change
- ClearElement(index.DocumentElement, "Assembly");
- ClearElement(index.DocumentElement, "Attributes");
- } else {
- index = CreateIndexStub();
- }
-
- string defaultTitle = "Untitled";
- if (assemblies.Count == 1)
- defaultTitle = assemblies[0].Name.Name;
- WriteElementInitialText(index.DocumentElement, "Title", defaultTitle);
-
- XmlElement index_types = WriteElement(index.DocumentElement, "Types");
- XmlElement index_assemblies = WriteElement(index.DocumentElement, "Assemblies");
- if (!IsMultiAssembly)
- index_assemblies.RemoveAll ();
-
-
- HashSet<string> goodfiles = new HashSet<string> (StringComparer.OrdinalIgnoreCase);
-
- foreach (AssemblyDefinition assm in assemblies) {
- AddIndexAssembly (assm, index_assemblies);
- DoUpdateAssembly (assm, index_types, source, dest, goodfiles);
- }
-
- SortIndexEntries (index_types);
-
- CleanupFiles (dest, goodfiles);
- CleanupIndexTypes (index_types, goodfiles);
- CleanupExtensions (index_types);
-
- WriteFile (indexfile, FileMode.Create,
- writer => WriteXml(index.DocumentElement, writer));
- }
-
- private static char[] InvalidFilenameChars = {'\\', '/', ':', '*', '?', '"', '<', '>', '|'};
-
- private void DoUpdateAssembly (AssemblyDefinition assembly, XmlElement index_types, string source, string dest, HashSet<string> goodfiles)
- {
- foreach (TypeDefinition type in docEnum.GetDocumentationTypes (assembly, null)) {
- string typename = GetTypeFileName(type);
- if (!IsPublic (type) || typename.IndexOfAny (InvalidFilenameChars) >= 0 || forwardedTypes.Contains (type.FullName))
- continue;
-
- string reltypepath = DoUpdateType (type, source, dest);
- if (reltypepath == null)
- continue;
-
- // Add namespace and type nodes into the index file as needed
- AddIndexType (type, index_types);
-
- // Ensure the namespace index file exists
- string namespaceToUse = type.Namespace;
- if (HasDroppedNamespace(assembly)) {
- namespaceToUse = string.Format ("{0}.{1}", droppedNamespace, namespaceToUse);
- }
- string onsdoc = DocUtils.PathCombine (dest, namespaceToUse + ".xml");
- string nsdoc = DocUtils.PathCombine (dest, "ns-" + namespaceToUse + ".xml");
- if (File.Exists (onsdoc)) {
- File.Move (onsdoc, nsdoc);
- }
-
- if (!File.Exists (nsdoc)) {
- Console.WriteLine("New Namespace File: " + type.Namespace);
- WriteNamespaceStub(namespaceToUse, dest);
- }
-
- goodfiles.Add (reltypepath);
- }
- }
-
- private static void SortIndexEntries (XmlElement indexTypes)
- {
- XmlNodeList namespaces = indexTypes.SelectNodes ("Namespace");
- XmlNodeComparer c = new AttributeNameComparer ();
- SortXmlNodes (indexTypes, namespaces, c);
-
- for (int i = 0; i < namespaces.Count; ++i)
- SortXmlNodes (namespaces [i], namespaces [i].SelectNodes ("Type"), c);
- }
-
- private static void SortXmlNodes (XmlNode parent, XmlNodeList children, XmlNodeComparer comparer)
- {
- MyXmlNodeList l = new MyXmlNodeList (children.Count);
- for (int i = 0; i < children.Count; ++i)
- l.Add (children [i]);
- l.Sort (comparer);
- for (int i = l.Count - 1; i > 0; --i) {
- parent.InsertBefore (parent.RemoveChild ((XmlNode) l [i-1]), (XmlNode) l [i]);
- }
- }
-
- abstract class XmlNodeComparer : IComparer, IComparer<XmlNode>
- {
- public abstract int Compare (XmlNode x, XmlNode y);
-
- public int Compare (object x, object y)
- {
- return Compare ((XmlNode) x, (XmlNode) y);
- }
- }
-
- class AttributeNameComparer : XmlNodeComparer {
- string attribute;
-
- public AttributeNameComparer ()
- : this ("Name")
- {
- }
-
- public AttributeNameComparer (string attribute)
- {
- this.attribute = attribute;
- }
-
- public override int Compare (XmlNode x, XmlNode y)
- {
- return x.Attributes [attribute].Value.CompareTo (y.Attributes [attribute].Value);
- }
- }
-
- class VersionComparer : XmlNodeComparer {
- public override int Compare (XmlNode x, XmlNode y)
- {
- // Some of the existing docs use e.g. 1.0.x.x, which Version doesn't like.
- string a = GetVersion (x.InnerText);
- string b = GetVersion (y.InnerText);
- return new Version (a).CompareTo (new Version (b));
- }
-
- static string GetVersion (string v)
- {
- int n = v.IndexOf ("x");
- if (n < 0)
- return v;
- return v.Substring (0, n-1);
- }
- }
-
- private static string GetTypeKind (TypeDefinition type)
- {
- if (type.IsEnum)
- return "Enumeration";
- if (type.IsValueType)
- return "Structure";
- if (type.IsInterface)
- return "Interface";
- if (DocUtils.IsDelegate (type))
- return "Delegate";
- if (type.IsClass || type.FullName == "System.Enum") // FIXME
- return "Class";
- throw new ArgumentException ("Unknown kind for type: " + type.FullName);
- }
-
- public static bool IsPublic (TypeDefinition type)
- {
- TypeDefinition decl = type;
- while (decl != null) {
- if (!(decl.IsPublic || decl.IsNestedPublic ||
- decl.IsNestedFamily || decl.IsNestedFamily || decl.IsNestedFamilyOrAssembly)) {
- return false;
- }
- decl = (TypeDefinition) decl.DeclaringType;
- }
- return true;
- }
-
- private void CleanupFiles (string dest, HashSet<string> goodfiles)
- {
- // Look for files that no longer correspond to types
- foreach (System.IO.DirectoryInfo nsdir in new System.IO.DirectoryInfo(dest).GetDirectories("*")) {
- foreach (System.IO.FileInfo typefile in nsdir.GetFiles("*.xml")) {
- string relTypeFile = Path.Combine(nsdir.Name, typefile.Name);
- if (!goodfiles.Contains (relTypeFile)) {
- XmlDocument doc = new XmlDocument ();
- doc.Load (typefile.FullName);
- XmlElement e = doc.SelectSingleNode("/Type") as XmlElement;
- var assemblyNameNode = doc.SelectSingleNode ("/Type/AssemblyInfo/AssemblyName");
- if (assemblyNameNode == null){
- Warning ("Did not find /Type/AssemblyInfo/AssemblyName on {0}", typefile.FullName);
- continue;
- }
- string assemblyName = assemblyNameNode.InnerText;
- AssemblyDefinition assembly = assemblies.FirstOrDefault (a => a.Name.Name == assemblyName);
-
- Action saveDoc = () => {
- using (TextWriter writer = OpenWrite (typefile.FullName, FileMode.Truncate))
- WriteXml(doc.DocumentElement, writer);
- };
-
- if (e != null && !no_assembly_versions && assembly != null && assemblyName != null && UpdateAssemblyVersions (e, assembly, GetAssemblyVersions(assemblyName), false)) {
- saveDoc ();
- goodfiles.Add (relTypeFile);
- continue;
- }
-
- Action actuallyDelete = () => {
- string newname = typefile.FullName + ".remove";
- try { System.IO.File.Delete (newname); } catch (Exception) { Warning ("Unable to delete existing file: {0}", newname); }
- try { typefile.MoveTo (newname); } catch (Exception) { Warning ("Unable to rename to: {0}", newname); }
- Console.WriteLine ("Class no longer present; file renamed: " + Path.Combine (nsdir.Name, typefile.Name));
- };
-
- if (string.IsNullOrWhiteSpace (PreserveTag)) { // only do this if there was not a -preserve
- saveDoc ();
-
- var unifiedAssemblyNode = doc.SelectSingleNode ("/Type/AssemblyInfo[@apistyle='unified']");
- var classicAssemblyNode = doc.SelectSingleNode ("/Type/AssemblyInfo[not(@apistyle) or @apistyle='classic']");
- var unifiedMembers = doc.SelectNodes ("//Member[@apistyle='unified']|//Member/AssemblyInfo[@apistyle='unified']");
- var classicMembers = doc.SelectNodes ("//Member[@apistyle='classic']|//Member/AssemblyInfo[@apistyle='classic']");
- bool isUnifiedRun = HasDroppedAnyNamespace ();
- bool isClassicOrNormalRun = !isUnifiedRun;
-
- Action<XmlNode, ApiStyle> removeStyles = (x, style) => {
- var styledNodes = doc.SelectNodes("//*[@apistyle='"+ style.ToString ().ToLowerInvariant () +"']");
- if (styledNodes != null && styledNodes.Count > 0) {
- foreach(var node in styledNodes.Cast<XmlNode> ()) {
- node.ParentNode.RemoveChild (node);
- }
- }
- saveDoc ();
- };
- if (isClassicOrNormalRun) {
- if (unifiedAssemblyNode != null || unifiedMembers.Count > 0) {
- Warning ("*** this type is marked as unified, not deleting during this run: {0}", typefile.FullName);
- // if truly removed from both assemblies, it will be removed fully during the unified run
- removeStyles (doc, ApiStyle.Classic);
- continue;
- } else {
- // we should be safe to delete here because it was not marked as a unified assembly
- actuallyDelete ();
- }
- }
- if (isUnifiedRun) {
- if (classicAssemblyNode != null || classicMembers.Count > 0) {
- Warning ("*** this type is marked as classic, not deleting {0}", typefile.FullName);
- continue;
- } else {
- // safe to delete because it wasn't marked as a classic assembly, so the type is gone in both.
- actuallyDelete ();
- }
- }
- }
- }
- }
- }
- }
-
- private static TextWriter OpenWrite (string path, FileMode mode)
- {
- var w = new StreamWriter (
- new FileStream (path, mode),
- new UTF8Encoding (false)
- );
- w.NewLine = "\n";
- return w;
- }
-
- private string[] GetAssemblyVersions (string assemblyName)
- {
- return (from a in assemblies
- where a.Name.Name == assemblyName
- select GetAssemblyVersion (a)).ToArray ();
- }
-
- private static void CleanupIndexTypes (XmlElement index_types, HashSet<string> goodfiles)
- {
- // Look for type nodes that no longer correspond to types
- MyXmlNodeList remove = new MyXmlNodeList ();
- foreach (XmlElement typenode in index_types.SelectNodes("Namespace/Type")) {
- string fulltypename = Path.Combine (((XmlElement)typenode.ParentNode).GetAttribute("Name"), typenode.GetAttribute("Name") + ".xml");
- if (!goodfiles.Contains (fulltypename)) {
- remove.Add (typenode);
- }
- }
- foreach (XmlNode n in remove)
- n.ParentNode.RemoveChild (n);
- }
-
- private void CleanupExtensions (XmlElement index_types)
- {
- XmlNode e = index_types.SelectSingleNode ("/Overview/ExtensionMethods");
- if (extensionMethods.Count == 0) {
- if (e == null)
- return;
- index_types.SelectSingleNode ("/Overview").RemoveChild (e);
- return;
- }
- if (e == null) {
- e = index_types.OwnerDocument.CreateElement ("ExtensionMethods");
- index_types.SelectSingleNode ("/Overview").AppendChild (e);
- }
- else
- e.RemoveAll ();
- extensionMethods.Sort (DefaultExtensionMethodComparer);
- foreach (XmlNode m in extensionMethods) {
- e.AppendChild (index_types.OwnerDocument.ImportNode (m, true));
- }
- }
-
- class ExtensionMethodComparer : XmlNodeComparer {
- public override int Compare (XmlNode x, XmlNode y)
- {
- XmlNode xLink = x.SelectSingleNode ("Member/Link");
- XmlNode yLink = y.SelectSingleNode ("Member/Link");
-
- int n = xLink.Attributes ["Type"].Value.CompareTo (
- yLink.Attributes ["Type"].Value);
- if (n != 0)
- return n;
- n = xLink.Attributes ["Member"].Value.CompareTo (
- yLink.Attributes ["Member"].Value);
- if (n == 0 && !object.ReferenceEquals (x, y))
- throw new InvalidOperationException ("Duplicate extension method found!");
- return n;
- }
- }
-
- static readonly XmlNodeComparer DefaultExtensionMethodComparer = new ExtensionMethodComparer ();
-
- public void DoUpdateType2 (string message, XmlDocument basefile, TypeDefinition type, string output, bool insertSince)
- {
- Console.WriteLine(message + ": " + type.FullName);
-
- StringToXmlNodeMap seenmembers = new StringToXmlNodeMap ();
-
- // Update type metadata
- UpdateType(basefile.DocumentElement, type);
-
- // Update existing members. Delete member nodes that no longer should be there,
- // and remember what members are already documented so we don't add them again.
-
- MyXmlNodeList todelete = new MyXmlNodeList ();
-
- foreach (DocsNodeInfo info in docEnum.GetDocumentationMembers (basefile, type)) {
- XmlElement oldmember = info.Node;
- MemberReference oldmember2 = info.Member;
-
- if (info.Member != null && info.Node != null) {
- // Check for an error condition where the xml MemberName doesn't match the matched member
- var memberName = GetMemberName (info.Member);
- var memberAttribute = info.Node.Attributes ["MemberName"];
- if (memberAttribute == null || (memberAttribute.Value != memberName && memberAttribute.Value.Split (',').Length != memberName.Split (',').Length)) {
- oldmember.SetAttribute ("MemberName", memberName);
- }
- }
-
- string sig = oldmember2 != null ? memberFormatters [0].GetDeclaration (oldmember2) : null;
-
- // Interface implementations and overrides are deleted from the docs
- // unless the overrides option is given.
- if (oldmember2 != null && sig == null)
- oldmember2 = null;
-
- // Deleted (or signature changed)
- if (oldmember2 == null) {
- if (!no_assembly_versions && UpdateAssemblyVersions (oldmember, type.Module.Assembly, new string[]{ GetAssemblyVersion (type.Module.Assembly) }, false))
- continue;
-
- DeleteMember ("Member Removed", output, oldmember, todelete, type);
- continue;
- }
-
- // Duplicated
- if (seenmembers.ContainsKey (sig)) {
- if (object.ReferenceEquals (oldmember, seenmembers [sig])) {
- // ignore, already seen
- }
- else if (DefaultMemberComparer.Compare (oldmember, seenmembers [sig]) == 0)
- DeleteMember ("Duplicate Member Found", output, oldmember, todelete, type);
- else
- Warning ("TODO: found a duplicate member '{0}', but it's not identical to the prior member found!", sig);
- continue;
- }
-
- // Update signature information
- UpdateMember(info);
-
- // get all apistyles of sig from info.Node
- var styles = oldmember.GetElementsByTagName ("MemberSignature").Cast<XmlElement> ()
- .Where (x => x.GetAttribute ("Language") == "C#" && !seenmembers.ContainsKey(x.GetAttribute("Value")))
- .Select (x => x.GetAttribute ("Value"));
-
- foreach (var stylesig in styles) {
- seenmembers.Add (stylesig, oldmember);
- }
- }
- foreach (XmlElement oldmember in todelete)
- oldmember.ParentNode.RemoveChild (oldmember);
-
-
- if (!DocUtils.IsDelegate (type)) {
- XmlNode members = WriteElement (basefile.DocumentElement, "Members");
- var typemembers = type.GetMembers()
- .Where(m => {
- if (m is TypeDefinition) return false;
- string sig = memberFormatters [0].GetDeclaration (m);
- if (sig == null) return false;
- if (seenmembers.ContainsKey(sig)) return false;
-
- // Verify that the member isn't an explicitly implemented
- // member of an internal interface, in which case we shouldn't return true.
- MethodDefinition methdef = null;
- if (m is MethodDefinition)
- methdef = m as MethodDefinition;
- else if (m is PropertyDefinition) {
- var prop = m as PropertyDefinition;
- methdef = prop.GetMethod ?? prop.SetMethod;
- }
-
- if (methdef != null) {
- TypeReference iface;
- MethodReference imethod;
-
- if (methdef.Overrides.Count == 1) {
- DocUtils.GetInfoForExplicitlyImplementedMethod (methdef, out iface, out imethod);
- if (!IsPublic (iface.Resolve ())) return false;
- }
- }
-
- return true;
- })
- .ToArray();
- foreach (MemberReference m in typemembers) {
- XmlElement mm = MakeMember(basefile, new DocsNodeInfo (null, m));
- if (mm == null) continue;
-
- if (MDocUpdater.SwitchingToMagicTypes || MDocUpdater.HasDroppedNamespace (m)) {
- // this is a unified style API that obviously doesn't exist in the classic API. Let's mark
- // it with apistyle="unified", so that it's not displayed for classic style APIs
- mm.AddApiStyle (ApiStyle.Unified);
- }
-
- members.AppendChild( mm );
-
- Console.WriteLine("Member Added: " + mm.SelectSingleNode("MemberSignature/@Value").InnerText);
- additions++;
- }
- }
-
- // Import code snippets from files
- foreach (XmlNode code in basefile.GetElementsByTagName("code")) {
- if (!(code is XmlElement)) continue;
- string file = ((XmlElement)code).GetAttribute("src");
- string lang = ((XmlElement)code).GetAttribute("lang");
- if (file != "") {
- string src = GetCodeSource (lang, Path.Combine (srcPath, file));
- if (src != null)
- code.InnerText = src;
- }
- }
-
- if (insertSince && since != null) {
- XmlNode docs = basefile.DocumentElement.SelectSingleNode("Docs");
- docs.AppendChild (CreateSinceNode (basefile));
- }
-
- do {
- XmlElement d = basefile.DocumentElement ["Docs"];
- XmlElement m = basefile.DocumentElement ["Members"];
- if (d != null && m != null)
- basefile.DocumentElement.InsertBefore (
- basefile.DocumentElement.RemoveChild (d), m);
- SortTypeMembers (m);
- } while (false);
-
- if (output == null)
- WriteXml(basefile.DocumentElement, Console.Out);
- else {
- FileInfo file = new FileInfo (output);
- if (!file.Directory.Exists) {
- Console.WriteLine("Namespace Directory Created: " + type.Namespace);
- file.Directory.Create ();
- }
- WriteFile (output, FileMode.Create,
- writer => WriteXml(basefile.DocumentElement, writer));
- }
- }
-
- private string GetCodeSource (string lang, string file)
- {
- int anchorStart;
- if (lang == "C#" && (anchorStart = file.IndexOf (".cs#")) >= 0) {
- // Grab the specified region
- string region = "#region " + file.Substring (anchorStart + 4);
- file = file.Substring (0, anchorStart + 3);
- try {
- using (StreamReader reader = new StreamReader (file)) {
- string line;
- StringBuilder src = new StringBuilder ();
- int indent = -1;
- while ((line = reader.ReadLine ()) != null) {
- if (line.Trim() == region) {
- indent = line.IndexOf (region);
- continue;
- }
- if (indent >= 0 && line.Trim().StartsWith ("#endregion")) {
- break;
- }
- if (indent >= 0)
- src.Append (
- (line.Length > 0 ? line.Substring (indent) : string.Empty) +
- "\n");
- }
- return src.ToString ();
- }
- } catch (Exception e) {
- Warning ("Could not load <code/> file '{0}' region '{1}': {2}",
- file, region, show_exceptions ? e.ToString () : e.Message);
- return null;
- }
- }
- try {
- using (StreamReader reader = new StreamReader (file))
- return reader.ReadToEnd ();
- } catch (Exception e) {
- Warning ("Could not load <code/> file '" + file + "': " + e.Message);
- }
- return null;
- }
-
- void DeleteMember (string reason, string output, XmlNode member, MyXmlNodeList todelete, TypeDefinition type)
- {
- string format = output != null
- ? "{0}: File='{1}'; Signature='{4}'"
- : "{0}: XPath='/Type[@FullName=\"{2}\"]/Members/Member[@MemberName=\"{3}\"]'; Signature='{4}'";
- string signature = member.SelectSingleNode ("MemberSignature[@Language='C#']/@Value").Value;
- Warning (format,
- reason,
- output,
- member.OwnerDocument.DocumentElement.GetAttribute ("FullName"),
- member.Attributes ["MemberName"].Value,
- signature);
-
- // Identify all of the different states that could affect our decision to delete the member
- bool shouldPreserve = !string.IsNullOrWhiteSpace (PreserveTag);
- bool hasContent = MemberDocsHaveUserContent (member);
- bool shouldDelete = !shouldPreserve && (delete || !hasContent);
-
- bool unifiedRun = HasDroppedNamespace (type);
-
- var classicAssemblyInfo = member.SelectSingleNode ("AssemblyInfo[not(@apistyle) or @apistyle='classic']");
- bool nodeIsClassic = classicAssemblyInfo != null || member.HasApiStyle (ApiStyle.Classic);
- var unifiedAssemblyInfo = member.SelectSingleNode ("AssemblyInfo[@apistyle='unified']");
- bool nodeIsUnified = unifiedAssemblyInfo != null || member.HasApiStyle (ApiStyle.Unified);
-
- Action actuallyDelete = () => {
- todelete.Add (member);
- deletions++;
- };
-
- if (!shouldDelete) {
- // explicitly not deleting
- string message = shouldPreserve ?
- "Not deleting '{0}' due to --preserve." :
- "Not deleting '{0}'; must be enabled with the --delete option";
- Warning (message, signature);
- } else if (unifiedRun && nodeIsClassic) {
- // this is a unified run, and the member doesn't exist, but is marked as being in the classic assembly.
- member.RemoveApiStyle (ApiStyle.Unified);
- member.AddApiStyle (ApiStyle.Classic);
- Warning ("Not removing '{0}' since it's still in the classic assembly.", signature);
- } else if (unifiedRun && !nodeIsClassic) {
- // unified run, and the node is not classic, which means it doesn't exist anywhere.
- actuallyDelete ();
- } else {
- if (!isClassicRun || (isClassicRun && !nodeIsClassic && !nodeIsUnified)) { // regular codepath (ie. not classic/unified)
- actuallyDelete ();
- } else { // this is a classic run
- Warning ("Removing classic from '{0}' ... will be removed in the unified run if not present there.", signature);
- member.RemoveApiStyle (ApiStyle.Classic);
- if (classicAssemblyInfo != null) {
- member.RemoveChild (classicAssemblyInfo);
- }
- }
- }
- }
-
- class MemberComparer : XmlNodeComparer {
- public override int Compare (XmlNode x, XmlNode y)
- {
- int r;
- string xMemberName = x.Attributes ["MemberName"].Value;
- string yMemberName = y.Attributes ["MemberName"].Value;
-
- // generic methods *end* with '>'
- // it's possible for explicitly implemented generic interfaces to
- // contain <...> without being a generic method
- if ((!xMemberName.EndsWith (">") || !yMemberName.EndsWith (">")) &&
- (r = xMemberName.CompareTo (yMemberName)) != 0)
- return r;
-
- int lt;
- if ((lt = xMemberName.IndexOf ("<")) >= 0)
- xMemberName = xMemberName.Substring (0, lt);
- if ((lt = yMemberName.IndexOf ("<")) >= 0)
- yMemberName = yMemberName.Substring (0, lt);
- if ((r = xMemberName.CompareTo (yMemberName)) != 0)
- return r;
-
- // if @MemberName matches, then it's either two different types of
- // members sharing the same name, e.g. field & property, or it's an
- // overloaded method.
- // for different type, sort based on MemberType value.
- r = x.SelectSingleNode ("MemberType").InnerText.CompareTo (
- y.SelectSingleNode ("MemberType").InnerText);
- if (r != 0)
- return r;
-
- // same type -- must be an overloaded method. Sort based on type
- // parameter count, then parameter count, then by the parameter
- // type names.
- XmlNodeList xTypeParams = x.SelectNodes ("TypeParameters/TypeParameter");
- XmlNodeList yTypeParams = y.SelectNodes ("TypeParameters/TypeParameter");
- if (xTypeParams.Count != yTypeParams.Count)
- return xTypeParams.Count <= yTypeParams.Count ? -1 : 1;
- for (int i = 0; i < xTypeParams.Count; ++i) {
- r = xTypeParams [i].Attributes ["Name"].Value.CompareTo (
- yTypeParams [i].Attributes ["Name"].Value);
- if (r != 0)
- return r;
- }
-
- XmlNodeList xParams = x.SelectNodes ("Parameters/Parameter");
- XmlNodeList yParams = y.SelectNodes ("Parameters/Parameter");
- if (xParams.Count != yParams.Count)
- return xParams.Count <= yParams.Count ? -1 : 1;
- for (int i = 0; i < xParams.Count; ++i) {
- r = xParams [i].Attributes ["Type"].Value.CompareTo (
- yParams [i].Attributes ["Type"].Value);
- if (r != 0)
- return r;
- }
- // all parameters match, but return value might not match if it was
- // changed between one version and another.
- XmlNode xReturn = x.SelectSingleNode ("ReturnValue/ReturnType");
- XmlNode yReturn = y.SelectSingleNode ("ReturnValue/ReturnType");
- if (xReturn != null && yReturn != null) {
- r = xReturn.InnerText.CompareTo (yReturn.InnerText);
- if (r != 0)
- return r;
- }
-
- return 0;
- }
- }
-
- static readonly MemberComparer DefaultMemberComparer = new MemberComparer ();
-
- private static void SortTypeMembers (XmlNode members)
- {
- if (members == null)
- return;
- SortXmlNodes (members, members.SelectNodes ("Member"), DefaultMemberComparer);
- }
-
- private static bool MemberDocsHaveUserContent (XmlNode e)
- {
- e = (XmlElement)e.SelectSingleNode("Docs");
- if (e == null) return false;
- foreach (XmlElement d in e.SelectNodes("*"))
- if (d.InnerText != "" && !d.InnerText.StartsWith("To be added"))
- return true;
- return false;
- }
-
- // UPDATE HELPER FUNCTIONS
-
- // CREATE A STUB DOCUMENTATION FILE
-
- public XmlElement StubType (TypeDefinition type, string output)
- {
- string typesig = typeFormatters [0].GetDeclaration (type);
- if (typesig == null) return null; // not publicly visible
-
- XmlDocument doc = new XmlDocument();
- XmlElement root = doc.CreateElement("Type");
- doc.AppendChild (root);
-
- DoUpdateType2 ("New Type", doc, type, output, true);
-
- return root;
- }
-
- private XmlElement CreateSinceNode (XmlDocument doc)
- {
- XmlElement s = doc.CreateElement ("since");
- s.SetAttribute ("version", since);
- return s;
- }
-
- // STUBBING/UPDATING FUNCTIONS
-
- public void UpdateType (XmlElement root, TypeDefinition type)
- {
- root.SetAttribute("Name", GetDocTypeName (type));
- root.SetAttribute("FullName", GetDocTypeFullName (type));
-
- foreach (MemberFormatter f in typeFormatters) {
- string element = "TypeSignature[@Language='" + f.Language + "']";
- string valueToUse = f.GetDeclaration (type);
-
- AddXmlNode (
- root.SelectNodes (element).Cast<XmlElement> ().ToArray (),
- x => x.GetAttribute ("Value") == valueToUse,
- x => x.SetAttribute ("Value", valueToUse),
- () => {
- var node = WriteElementAttribute (root, element, "Language", f.Language, forceNewElement: true);
- var newnode = WriteElementAttribute (root, node, "Value", valueToUse);
- return newnode;
- },
- type);
- }
-
- AddAssemblyNameToNode (root, type);
-
- string assemblyInfoNodeFilter = MDocUpdater.HasDroppedNamespace (type) ? "[@apistyle='unified']" : "[not(@apistyle) or @apistyle='classic']";
- Func<XmlElement, bool> assemblyFilter = x => x.SelectSingleNode ("AssemblyName").InnerText == type.Module.Assembly.Name.Name;
- foreach(var ass in root.SelectNodes ("AssemblyInfo" + assemblyInfoNodeFilter).Cast<XmlElement> ().Where (assemblyFilter))
- {
- WriteElementText(ass, "AssemblyName", type.Module.Assembly.Name.Name);
- if (!no_assembly_versions) {
- UpdateAssemblyVersions (ass, type, true);
- }
- else {
- var versions = ass.SelectNodes ("AssemblyVersion").Cast<XmlNode> ().ToList ();
- foreach (var version in versions)
- ass.RemoveChild (version);
- }
- if (!string.IsNullOrEmpty (type.Module.Assembly.Name.Culture))
- WriteElementText(ass, "AssemblyCulture", type.Module.Assembly.Name.Culture);
- else
- ClearElement(ass, "AssemblyCulture");
-
-
- // Why-oh-why do we put assembly attributes in each type file?
- // Neither monodoc nor monodocs2html use them, so I'm deleting them
- // since they're outdated in current docs, and a waste of space.
- //MakeAttributes(ass, type.Assembly, true);
- XmlNode assattrs = ass.SelectSingleNode("Attributes");
- if (assattrs != null)
- ass.RemoveChild(assattrs);
-
- NormalizeWhitespace(ass);
- }
-
- if (type.IsGenericType ()) {
- MakeTypeParameters (root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace(type));
- } else {
- ClearElement(root, "TypeParameters");
- }
-
- if (type.BaseType != null) {
- XmlElement basenode = WriteElement(root, "Base");
-
- string basetypename = GetDocTypeFullName (type.BaseType);
- if (basetypename == "System.MulticastDelegate") basetypename = "System.Delegate";
- WriteElementText(root, "Base/BaseTypeName", basetypename);
-
- // Document how this type instantiates the generic parameters of its base type
- TypeReference origBase = type.BaseType.GetElementType ();
- if (origBase.IsGenericType ()) {
- ClearElement(basenode, "BaseTypeArguments");
- GenericInstanceType baseInst = type.BaseType as GenericInstanceType;
- IList<TypeReference> baseGenArgs = baseInst == null ? null : baseInst.GenericArguments;
- IList<GenericParameter> baseGenParams = origBase.GenericParameters;
- if (baseGenArgs.Count != baseGenParams.Count)
- throw new InvalidOperationException ("internal error: number of generic arguments doesn't match number of generic parameters.");
- for (int i = 0; baseGenArgs != null && i < baseGenArgs.Count; i++) {
- GenericParameter param = baseGenParams [i];
- TypeReference value = baseGenArgs [i];
-
- XmlElement bta = WriteElement(basenode, "BaseTypeArguments");
- XmlElement arg = bta.OwnerDocument.CreateElement("BaseTypeArgument");
- bta.AppendChild(arg);
- arg.SetAttribute ("TypeParamName", param.Name);
- arg.InnerText = GetDocTypeFullName (value);
- }
- }
- } else {
- ClearElement(root, "Base");
- }
-
- if (!DocUtils.IsDelegate (type) && !type.IsEnum) {
- IEnumerable<TypeReference> userInterfaces = DocUtils.GetUserImplementedInterfaces (type);
- List<string> interface_names = userInterfaces
- .Select (iface => GetDocTypeFullName (iface))
- .OrderBy (s => s)
- .ToList ();
-
- XmlElement interfaces = WriteElement(root, "Interfaces");
- interfaces.RemoveAll();
- foreach (string iname in interface_names) {
- XmlElement iface = root.OwnerDocument.CreateElement("Interface");
- interfaces.AppendChild(iface);
- WriteElementText(iface, "InterfaceName", iname);
- }
- } else {
- ClearElement(root, "Interfaces");
- }
-
- MakeAttributes (root, GetCustomAttributes (type), type);
-
- if (DocUtils.IsDelegate (type)) {
- MakeTypeParameters (root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace(type));
- var member = type.GetMethod ("Invoke");
- MakeParameters(root, member, member.Parameters);
- MakeReturnValue(root, member);
- }
-
- DocsNodeInfo typeInfo = new DocsNodeInfo (WriteElement(root, "Docs"), type);
- MakeDocNode (typeInfo);
-
- if (!DocUtils.IsDelegate (type))
- WriteElement (root, "Members");
-
- OrderTypeNodes (root, root.ChildNodes);
- NormalizeWhitespace(root);
- }
-
- /// <summary>Adds an AssemblyInfo with AssemblyName node to an XmlElement.</summary>
- /// <returns>The assembly that was either added, or was already present</returns>
- XmlElement AddAssemblyNameToNode (XmlElement root, TypeDefinition type)
- {
- return AddAssemblyNameToNode (root, type.Module);
- }
-
- /// <summary>Adds an AssemblyInfo with AssemblyName node to an XmlElement.</summary>
- /// <returns>The assembly that was either added, or was already present</returns>
- XmlElement AddAssemblyNameToNode (XmlElement root, ModuleDefinition module)
- {
- Func<XmlElement, bool> assemblyFilter = x => {
- var existingName = x.SelectSingleNode ("AssemblyName");
-
- bool apiStyleMatches = true;
- string currentApiStyle = x.GetAttribute ("apistyle");
- if ((HasDroppedNamespace (module) && !string.IsNullOrWhiteSpace (currentApiStyle) && currentApiStyle != "unified") ||
- (isClassicRun && (string.IsNullOrWhiteSpace (currentApiStyle) || currentApiStyle != "classic"))) {
- apiStyleMatches = false;
- }
- return apiStyleMatches && (existingName == null || (existingName != null && existingName.InnerText == module.Assembly.Name.Name));
- };
-
- return AddAssemblyXmlNode (
- root.SelectNodes ("AssemblyInfo").Cast<XmlElement> ().ToArray (),
- assemblyFilter, x => WriteElementText (x, "AssemblyName", module.Assembly.Name.Name),
- () => {
- XmlElement ass = WriteElement (root, "AssemblyInfo", forceNewElement: true);
-
- if (MDocUpdater.HasDroppedNamespace (module))
- ass.AddApiStyle (ApiStyle.Unified);
- if (isClassicRun)
- ass.AddApiStyle (ApiStyle.Classic);
- return ass;
- }, module);
- }
-
- static readonly string[] TypeNodeOrder = {
- "TypeSignature",
- "MemberOfLibrary",
- "AssemblyInfo",
- "ThreadingSafetyStatement",
- "ThreadSafetyStatement",
- "TypeParameters",
- "Base",
- "Interfaces",
- "Attributes",
- "Parameters",
- "ReturnValue",
- "Docs",
- "Members",
- "TypeExcluded",
- };
-
- static void OrderTypeNodes (XmlNode member, XmlNodeList children)
- {
- ReorderNodes (member, children, TypeNodeOrder);
- }
-
- internal static IEnumerable<T> Sort<T> (IEnumerable<T> list)
- {
- List<T> l = new List<T> (list);
- l.Sort ();
- return l;
- }
-
- private void UpdateMember (DocsNodeInfo info)
- {
- XmlElement me = (XmlElement) info.Node;
- MemberReference mi = info.Member;
-
- foreach (MemberFormatter f in memberFormatters) {
- string element = "MemberSignature[@Language='" + f.Language + "']";
-
- var valueToUse = f.GetDeclaration (mi);
-
- AddXmlNode (
- me.SelectNodes (element).Cast<XmlElement> ().ToArray(),
- x => x.GetAttribute("Value") == valueToUse,
- x => x.SetAttribute ("Value", valueToUse),
- () => {
- var node = WriteElementAttribute (me, element, "Language", f.Language, forceNewElement:true);
- var newNode = WriteElementAttribute (me, node, "Value", valueToUse);
- return newNode;
- },
- mi);
-
- }
-
- WriteElementText(me, "MemberType", GetMemberType(mi));
-
- if (!no_assembly_versions) {
- if (!IsMultiAssembly)
- UpdateAssemblyVersions (me, mi, true);
- else {
- var node = AddAssemblyNameToNode (me, mi.Module);
-
- UpdateAssemblyVersionForAssemblyInfo (node, me, new[] { GetAssemblyVersion (mi.Module.Assembly) }, add: true);
- }
- }
- else {
- ClearElement (me, "AssemblyInfo");
- }
-
- MakeAttributes (me, GetCustomAttributes (mi), mi.DeclaringType);
-
- MakeReturnValue(me, mi, MDocUpdater.HasDroppedNamespace(mi));
- if (mi is MethodReference) {
- MethodReference mb = (MethodReference) mi;
- if (mb.IsGenericMethod ())
- MakeTypeParameters (me, mb.GenericParameters, mi, MDocUpdater.HasDroppedNamespace(mi));
- }
- MakeParameters(me, mi, MDocUpdater.HasDroppedNamespace(mi));
-
- string fieldValue;
- if (mi is FieldDefinition && GetFieldConstValue ((FieldDefinition)mi, out fieldValue))
- WriteElementText(me, "MemberValue", fieldValue);
-
- info.Node = WriteElement (me, "Docs");
- MakeDocNode (info);
- OrderMemberNodes (me, me.ChildNodes);
- UpdateExtensionMethods (me, info);
- }
-
- static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, MemberReference member) {
- AddXmlNode (relevant, valueMatches, setValue, makeNewNode, member.Module);
- }
-
- static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, TypeDefinition type) {
- AddXmlNode (relevant, valueMatches, setValue, makeNewNode, type.Module);
- }
-
- static XmlElement AddAssemblyXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, ModuleDefinition module)
- {
- bool isUnified = MDocUpdater.HasDroppedNamespace (module);
- XmlElement thisAssemblyNode = relevant.FirstOrDefault (valueMatches);
- if (thisAssemblyNode == null) {
- thisAssemblyNode = makeNewNode ();
- }
- setValue (thisAssemblyNode);
-
- if (isUnified) {
- thisAssemblyNode.AddApiStyle (ApiStyle.Unified);
-
- foreach (var otherNodes in relevant.Where (n => n != thisAssemblyNode && n.DoesNotHaveApiStyle (ApiStyle.Unified))) {
- otherNodes.AddApiStyle (ApiStyle.Classic);
- }
- }
- return thisAssemblyNode;
- }
-
- /// <summary>Adds an xml node, reusing the node if it's available</summary>
- /// <param name="relevant">The existing set of nodes</param>
- /// <param name="valueMatches">Checks to see if the node's value matches what you're trying to write.</param>
- /// <param name="setValue">Sets the node's value</param>
- /// <param name="makeNewNode">Creates a new node, if valueMatches returns false.</param>
- static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, ModuleDefinition module)
- {
- bool shouldDuplicate = MDocUpdater.HasDroppedNamespace (module);
- var styleToUse = shouldDuplicate ? ApiStyle.Unified : ApiStyle.Classic;
- var existing = relevant;
- bool done = false;
- bool addedOldApiStyle = false;
-
- if (shouldDuplicate) {
- existing = existing.Where (n => n.HasApiStyle (styleToUse)).ToArray ();
- foreach (var n in relevant.Where (n => n.DoesNotHaveApiStyle (styleToUse))) {
- if (valueMatches (n)) {
- done = true;
- }
- else {
- n.AddApiStyle (ApiStyle.Classic);
- addedOldApiStyle = true;
- }
- }
- }
- if (!done) {
- if (!existing.Any ()) {
- var newNode = makeNewNode ();
- if (shouldDuplicate && addedOldApiStyle) {
- newNode.AddApiStyle (ApiStyle.Unified);
- }
- }
- else {
- var itemToReuse = existing.First ();
- setValue (itemToReuse);
-
- if (shouldDuplicate && addedOldApiStyle) {
- itemToReuse.AddApiStyle (styleToUse);
- }
- }
- }
- }
-
- static readonly string[] MemberNodeOrder = {
- "MemberSignature",
- "MemberType",
- "AssemblyInfo",
- "Attributes",
- "ReturnValue",
- "TypeParameters",
- "Parameters",
- "MemberValue",
- "Docs",
- "Excluded",
- "ExcludedLibrary",
- "Link",
- };
-
- static void OrderMemberNodes (XmlNode member, XmlNodeList children)
- {
- ReorderNodes (member, children, MemberNodeOrder);
- }
-
- static void ReorderNodes (XmlNode node, XmlNodeList children, string[] ordering)
- {
- MyXmlNodeList newChildren = new MyXmlNodeList (children.Count);
- for (int i = 0; i < ordering.Length; ++i) {
- for (int j = 0; j < children.Count; ++j) {
- XmlNode c = children [j];
- if (c.Name == ordering [i]) {
- newChildren.Add (c);
- }
- }
- }
- if (newChildren.Count >= 0)
- node.PrependChild ((XmlNode) newChildren [0]);
- for (int i = 1; i < newChildren.Count; ++i) {
- XmlNode prev = (XmlNode) newChildren [i-1];
- XmlNode cur = (XmlNode) newChildren [i];
- node.RemoveChild (cur);
- node.InsertAfter (cur, prev);
- }
- }
-
- IEnumerable<string> GetCustomAttributes (MemberReference mi)
- {
- IEnumerable<string> attrs = Enumerable.Empty<string>();
-
- ICustomAttributeProvider p = mi as ICustomAttributeProvider;
- if (p != null)
- attrs = attrs.Concat (GetCustomAttributes (p.CustomAttributes, ""));
-
- PropertyDefinition pd = mi as PropertyDefinition;
- if (pd != null) {
- if (pd.GetMethod != null)
- attrs = attrs.Concat (GetCustomAttributes (pd.GetMethod.CustomAttributes, "get: "));
- if (pd.SetMethod != null)
- attrs = attrs.Concat (GetCustomAttributes (pd.SetMethod.CustomAttributes, "set: "));
- }
-
- EventDefinition ed = mi as EventDefinition;
- if (ed != null) {
- if (ed.AddMethod != null)
- attrs = attrs.Concat (GetCustomAttributes (ed.AddMethod.CustomAttributes, "add: "));
- if (ed.RemoveMethod != null)
- attrs = attrs.Concat (GetCustomAttributes (ed.RemoveMethod.CustomAttributes, "remove: "));
- }
-
- return attrs;
- }
-
- IEnumerable<string> GetCustomAttributes (IList<CustomAttribute> attributes, string prefix)
- {
- foreach (CustomAttribute attribute in attributes.OrderBy (ca => ca.AttributeType.FullName)) {
-
- TypeDefinition attrType = attribute.AttributeType as TypeDefinition;
- if (attrType != null && !IsPublic (attrType))
- continue;
- if (slashdocFormatter.GetName (attribute.AttributeType) == null)
- continue;
-
- if (Array.IndexOf (IgnorableAttributes, attribute.AttributeType.FullName) >= 0)
- continue;
-
- StringList fields = new StringList ();
-
- for (int i = 0; i < attribute.ConstructorArguments.Count; ++i) {
- CustomAttributeArgument argument = attribute.ConstructorArguments [i];
- fields.Add (MakeAttributesValueString (
- argument.Value,
- argument.Type));
- }
- var namedArgs =
- (from namedArg in attribute.Fields
- select new { Type=namedArg.Argument.Type, Name=namedArg.Name, Value=namedArg.Argument.Value })
- .Concat (
- (from namedArg in attribute.Properties
- select new { Type=namedArg.Argument.Type, Name=namedArg.Name, Value=namedArg.Argument.Value }))
- .OrderBy (v => v.Name);
- foreach (var d in namedArgs)
- fields.Add (string.Format ("{0}={1}", d.Name,
- MakeAttributesValueString (d.Value, d.Type)));
-
- string a2 = String.Join(", ", fields.ToArray ());
- if (a2 != "") a2 = "(" + a2 + ")";
-
- string name = attribute.GetDeclaringType();
- if (name.EndsWith("Attribute")) name = name.Substring(0, name.Length-"Attribute".Length);
- yield return prefix + name + a2;
- }
- }
-
- static readonly string[] ValidExtensionMembers = {
- "Docs",
- "MemberSignature",
- "MemberType",
- "Parameters",
- "ReturnValue",
- "TypeParameters",
- };
-
- static readonly string[] ValidExtensionDocMembers = {
- "param",
- "summary",
- "typeparam",
- };
-
- private void UpdateExtensionMethods (XmlElement e, DocsNodeInfo info)
- {
- MethodDefinition me = info.Member as MethodDefinition;
- if (me == null)
- return;
- if (info.Parameters.Count < 1)
- return;
- if (!DocUtils.IsExtensionMethod (me))
- return;
-
- XmlNode em = e.OwnerDocument.CreateElement ("ExtensionMethod");
- XmlNode member = e.CloneNode (true);
- em.AppendChild (member);
- RemoveExcept (member, ValidExtensionMembers);
- RemoveExcept (member.SelectSingleNode ("Docs"), ValidExtensionDocMembers);
- WriteElementText (member, "MemberType", "ExtensionMethod");
- XmlElement link = member.OwnerDocument.CreateElement ("Link");
- link.SetAttribute ("Type", slashdocFormatter.GetName (me.DeclaringType));
- link.SetAttribute ("Member", slashdocFormatter.GetDeclaration (me));
- member.AppendChild (link);
- AddTargets (em, info);
-
- var sig = em.SelectSingleNode ("Member/MemberSignature[@Language='C#']/@Value");
- if (!IsMultiAssembly || (IsMultiAssembly && sig != null && !extensionMethods.Any (ex => ex.SelectSingleNode ("Member/MemberSignature[@Language='C#']/@Value").Value == sig.Value))) {
- extensionMethods.Add (em);
- }
- }
-
- private static void RemoveExcept (XmlNode node, string[] except)
- {
- if (node == null)
- return;
- MyXmlNodeList remove = null;
- foreach (XmlNode n in node.ChildNodes) {
- if (Array.BinarySearch (except, n.Name) < 0) {
- if (remove == null)
- remove = new MyXmlNodeList ();
- remove.Add (n);
- }
- }
- if (remove != null)
- foreach (XmlNode n in remove)
- node.RemoveChild (n);
- }
-
- private static void AddTargets (XmlNode member, DocsNodeInfo info)
- {
- XmlElement targets = member.OwnerDocument.CreateElement ("Targets");
- member.PrependChild (targets);
- if (!(info.Parameters [0].ParameterType is GenericParameter)) {
- AppendElementAttributeText (targets, "Target", "Type",
- slashdocFormatter.GetDeclaration (info.Parameters [0].ParameterType));
- }
- else {
- GenericParameter gp = (GenericParameter) info.Parameters [0].ParameterType;
- IList<TypeReference> constraints = gp.Constraints;
- if (constraints.Count == 0)
- AppendElementAttributeText (targets, "Target", "Type", "System.Object");
- else
- foreach (TypeReference c in constraints)
- AppendElementAttributeText(targets, "Target", "Type",
- slashdocFormatter.GetDeclaration (c));
- }
- }
-
- private static bool GetFieldConstValue (FieldDefinition field, out string value)
- {
- value = null;
- TypeDefinition type = field.DeclaringType.Resolve ();
- if (type != null && type.IsEnum) return false;
-
- if (type != null && type.IsGenericType ()) return false;
- if (!field.HasConstant)
- return false;
- if (field.IsLiteral) {
- object val = field.Constant;
- if (val == null) value = "null";
- else if (val is Enum) value = val.ToString();
- else if (val is IFormattable) {
- value = ((IFormattable)val).ToString(null, CultureInfo.InvariantCulture);
- if (val is string)
- value = "\"" + value + "\"";
- }
- if (value != null && value != "")
- return true;
- }
- return false;
- }
-
- // XML HELPER FUNCTIONS
-
- internal static XmlElement WriteElement(XmlNode parent, string element, bool forceNewElement = false) {
- XmlElement ret = (XmlElement)parent.SelectSingleNode(element);
- if (ret == null || forceNewElement) {
- string[] path = element.Split('/');
- foreach (string p in path) {
- ret = (XmlElement)parent.SelectSingleNode(p);
- if (ret == null || forceNewElement) {
- string ename = p;
- if (ename.IndexOf('[') >= 0) // strip off XPath predicate
- ename = ename.Substring(0, ename.IndexOf('['));
- ret = parent.OwnerDocument.CreateElement(ename);
- parent.AppendChild(ret);
- parent = ret;
- } else {
- parent = ret;
- }
- }
- }
- return ret;
- }
- private static XmlElement WriteElementText(XmlNode parent, string element, string value, bool forceNewElement = false) {
- XmlElement node = WriteElement(parent, element, forceNewElement: forceNewElement);
- node.InnerText = value;
- return node;
- }
-
- static XmlElement AppendElementText (XmlNode parent, string element, string value)
- {
- XmlElement n = parent.OwnerDocument.CreateElement (element);
- parent.AppendChild (n);
- n.InnerText = value;
- return n;
- }
-
- static XmlElement AppendElementAttributeText (XmlNode parent, string element, string attribute, string value)
- {
- XmlElement n = parent.OwnerDocument.CreateElement (element);
- parent.AppendChild (n);
- n.SetAttribute (attribute, value);
- return n;
- }
-
- internal static XmlNode CopyNode (XmlNode source, XmlNode dest)
- {
- XmlNode copy = dest.OwnerDocument.ImportNode (source, true);
- dest.AppendChild (copy);
- return copy;
- }
-
- private static void WriteElementInitialText(XmlElement parent, string element, string value) {
- XmlElement node = (XmlElement)parent.SelectSingleNode(element);
- if (node != null)
- return;
- node = WriteElement(parent, element);
- node.InnerText = value;
- }
- private static XmlElement WriteElementAttribute(XmlElement parent, string element, string attribute, string value, bool forceNewElement = false) {
- XmlElement node = WriteElement(parent, element, forceNewElement:forceNewElement);
- return WriteElementAttribute (parent, node, attribute, value);
- }
- private static XmlElement WriteElementAttribute(XmlElement parent, XmlElement node, string attribute, string value) {
- if (node.GetAttribute (attribute) != value) {
- node.SetAttribute (attribute, value);
- }
- return node;
- }
- internal static void ClearElement(XmlElement parent, string name) {
- XmlElement node = (XmlElement)parent.SelectSingleNode(name);
- if (node != null)
- parent.RemoveChild(node);
- }
-
- // DOCUMENTATION HELPER FUNCTIONS
-
- private void MakeDocNode (DocsNodeInfo info)
- {
- List<GenericParameter> genericParams = info.GenericParameters;
- IList<ParameterDefinition> parameters = info.Parameters;
- TypeReference returntype = info.ReturnType;
- bool returnisreturn = info.ReturnIsReturn;
- XmlElement e = info.Node;
- bool addremarks = info.AddRemarks;
-
- WriteElementInitialText(e, "summary", "To be added.");
-
- if (parameters != null) {
- string[] values = new string [parameters.Count];
- for (int i = 0; i < values.Length; ++i)
- values [i] = parameters [i].Name;
- UpdateParameters (e, "param", values);
- }
-
- if (genericParams != null) {
- string[] values = new string [genericParams.Count];
- for (int i = 0; i < values.Length; ++i)
- values [i] = genericParams [i].Name;
- UpdateParameters (e, "typeparam", values);
- }
-
- string retnodename = null;
- if (returntype != null && returntype.FullName != "System.Void") { // FIXME
- retnodename = returnisreturn ? "returns" : "value";
- string retnodename_other = !returnisreturn ? "returns" : "value";
-
- // If it has a returns node instead of a value node, change its name.
- XmlElement retother = (XmlElement)e.SelectSingleNode(retnodename_other);
- if (retother != null) {
- XmlElement retnode = e.OwnerDocument.CreateElement(retnodename);
- foreach (XmlNode node in retother)
- retnode.AppendChild(node.CloneNode(true));
- e.ReplaceChild(retnode, retother);
- } else {
- WriteElementInitialText(e, retnodename, "To be added.");
- }
- } else {
- ClearElement(e, "returns");
- ClearElement(e, "value");
- }
-
- if (addremarks)
- WriteElementInitialText(e, "remarks", "To be added.");
-
- if (exceptions.HasValue && info.Member != null &&
- (exceptions.Value & ExceptionLocations.AddedMembers) == 0) {
- UpdateExceptions (e, info.Member);
- }
-
- foreach (DocumentationImporter importer in importers)
- importer.ImportDocumentation (info);
-
- OrderDocsNodes (e, e.ChildNodes);
- NormalizeWhitespace(e);
- }
-
- static readonly string[] DocsNodeOrder = {
- "typeparam", "param", "summary", "returns", "value", "remarks",
- };
-
- private static void OrderDocsNodes (XmlNode docs, XmlNodeList children)
- {
- ReorderNodes (docs, children, DocsNodeOrder);
- }
-
-
- private void UpdateParameters (XmlElement e, string element, string[] values)
- {
- if (values != null) {
- XmlNode[] paramnodes = new XmlNode[values.Length];
-
- // Some documentation had param nodes with leading spaces.
- foreach (XmlElement paramnode in e.SelectNodes(element)){
- paramnode.SetAttribute("name", paramnode.GetAttribute("name").Trim());
- }
-
- // If a member has only one parameter, we can track changes to
- // the name of the parameter easily.
- if (values.Length == 1 && e.SelectNodes(element).Count == 1) {
- UpdateParameterName (e, (XmlElement) e.SelectSingleNode(element), values [0]);
- }
-
- bool reinsert = false;
-
- // Pick out existing and still-valid param nodes, and
- // create nodes for parameters not in the file.
- Hashtable seenParams = new Hashtable();
- for (int pi = 0; pi < values.Length; pi++) {
- string p = values [pi];
- seenParams[p] = pi;
-
- paramnodes[pi] = e.SelectSingleNode(element + "[@name='" + p + "']");
- if (paramnodes[pi] != null) continue;
-
- XmlElement pe = e.OwnerDocument.CreateElement(element);
- pe.SetAttribute("name", p);
- pe.InnerText = "To be added.";
- paramnodes[pi] = pe;
- reinsert = true;
- }
-
- // Remove parameters that no longer exist and check all params are in the right order.
- int idx = 0;
- MyXmlNodeList todelete = new MyXmlNodeList ();
- foreach (XmlElement paramnode in e.SelectNodes(element)) {
- string name = paramnode.GetAttribute("name");
- if (!seenParams.ContainsKey(name)) {
- if (!delete && !paramnode.InnerText.StartsWith("To be added")) {
- Warning ("The following param node can only be deleted if the --delete option is given: ");
- if (e.ParentNode == e.OwnerDocument.DocumentElement) {
- // delegate type
- Warning ("\tXPath=/Type[@FullName=\"{0}\"]/Docs/param[@name=\"{1}\"]",
- e.OwnerDocument.DocumentElement.GetAttribute ("FullName"),
- name);
- }
- else {
- Warning ("\tXPath=/Type[@FullName=\"{0}\"]//Member[@MemberName=\"{1}\"]/Docs/param[@name=\"{2}\"]",
- e.OwnerDocument.DocumentElement.GetAttribute ("FullName"),
- e.ParentNode.Attributes ["MemberName"].Value,
- name);
- }
- Warning ("\tValue={0}", paramnode.OuterXml);
- } else {
- todelete.Add (paramnode);
- }
- continue;
- }
-
- if ((int)seenParams[name] != idx)
- reinsert = true;
-
- idx++;
- }
-
- foreach (XmlNode n in todelete) {
- n.ParentNode.RemoveChild (n);
- }
-
- // Re-insert the parameter nodes at the top of the doc section.
- if (reinsert)
- for (int pi = values.Length-1; pi >= 0; pi--)
- e.PrependChild(paramnodes[pi]);
- } else {
- // Clear all existing param nodes
- foreach (XmlNode paramnode in e.SelectNodes(element)) {
- if (!delete && !paramnode.InnerText.StartsWith("To be added")) {
- Console.WriteLine("The following param node can only be deleted if the --delete option is given:");
- Console.WriteLine(paramnode.OuterXml);
- } else {
- paramnode.ParentNode.RemoveChild(paramnode);
- }
- }
- }
- }
-
- private static void UpdateParameterName (XmlElement docs, XmlElement pe, string newName)
- {
- string existingName = pe.GetAttribute ("name");
- pe.SetAttribute ("name", newName);
- if (existingName == newName)
- return;
- foreach (XmlElement paramref in docs.SelectNodes (".//paramref"))
- if (paramref.GetAttribute ("name").Trim () == existingName)
- paramref.SetAttribute ("name", newName);
- }
-
- class CrefComparer : XmlNodeComparer {
-
- public CrefComparer ()
- {
- }
-
- public override int Compare (XmlNode x, XmlNode y)
- {
- string xType = x.Attributes ["cref"].Value;
- string yType = y.Attributes ["cref"].Value;
- string xNamespace = GetNamespace (xType);
- string yNamespace = GetNamespace (yType);
-
- int c = xNamespace.CompareTo (yNamespace);
- if (c != 0)
- return c;
- return xType.CompareTo (yType);
- }
-
- static string GetNamespace (string type)
- {
- int n = type.LastIndexOf ('.');
- if (n >= 0)
- return type.Substring (0, n);
- return string.Empty;
- }
- }
-
- private void UpdateExceptions (XmlNode docs, MemberReference member)
- {
- string indent = new string (' ', 10);
- foreach (var source in new ExceptionLookup (exceptions.Value)[member]) {
- string cref = slashdocFormatter.GetDeclaration (source.Exception);
- var node = docs.SelectSingleNode ("exception[@cref='" + cref + "']");
- if (node != null)
- continue;
- XmlElement e = docs.OwnerDocument.CreateElement ("exception");
- e.SetAttribute ("cref", cref);
- e.InnerXml = "To be added; from:\n" + indent + "<see cref=\"" +
- string.Join ("\" />,\n" + indent + "<see cref=\"",
- source.Sources.Select (m => slashdocFormatter.GetDeclaration (m))
- .OrderBy (s => s)) +
- "\" />";
- docs.AppendChild (e);
- }
- SortXmlNodes (docs, docs.SelectNodes ("exception"),
- new CrefComparer ());
- }
-
- private static void NormalizeWhitespace(XmlElement e) {
- // Remove all text and whitespace nodes from the element so it
- // is outputted with nice indentation and no blank lines.
- ArrayList deleteNodes = new ArrayList();
- foreach (XmlNode n in e)
- if (n is XmlText || n is XmlWhitespace || n is XmlSignificantWhitespace)
- deleteNodes.Add(n);
- foreach (XmlNode n in deleteNodes)
- n.ParentNode.RemoveChild(n);
- }
-
- private bool UpdateAssemblyVersions (XmlElement root, MemberReference member, bool add)
- {
- TypeDefinition type = member as TypeDefinition;
- if (type == null)
- type = member.DeclaringType as TypeDefinition;
-
- var versions = new string[] { GetAssemblyVersion (type.Module.Assembly) };
-
- if (root.LocalName == "AssemblyInfo")
- return UpdateAssemblyVersionForAssemblyInfo (root, root.ParentNode as XmlElement, versions, add: true);
- else
- return UpdateAssemblyVersions (root, type.Module.Assembly, versions, add);
- }
-
- private static string GetAssemblyVersion (AssemblyDefinition assembly)
- {
- return assembly.Name.Version.ToString();
- }
-
- private bool UpdateAssemblyVersions(XmlElement root, AssemblyDefinition assembly, string[] assemblyVersions, bool add)
- {
- if (IsMultiAssembly)
- return false;
-
- XmlElement av = (XmlElement) root.SelectSingleNode ("AssemblyVersions");
- if (av != null) {
- // AssemblyVersions is not part of the spec
- root.RemoveChild (av);
- }
-
- string oldNodeFilter = "AssemblyInfo[not(@apistyle) or @apistyle='classic']";
- string newNodeFilter = "AssemblyInfo[@apistyle='unified']";
- string thisNodeFilter = MDocUpdater.HasDroppedNamespace (assembly) ? newNodeFilter : oldNodeFilter;
- string thatNodeFilter = MDocUpdater.HasDroppedNamespace (assembly) ? oldNodeFilter : newNodeFilter;
-
- XmlElement e = (XmlElement) root.SelectSingleNode (thisNodeFilter);
- if (e == null) {
- e = root.OwnerDocument.CreateElement("AssemblyInfo");
-
- if (MDocUpdater.HasDroppedNamespace (assembly)) {
- e.AddApiStyle (ApiStyle.Unified);
- }
-
- root.AppendChild(e);
- }
-
- var thatNode = (XmlElement) root.SelectSingleNode (thatNodeFilter);
- if (MDocUpdater.HasDroppedNamespace (assembly) && thatNode != null) {
- // there's a classic node, we should add apistyles
- e.AddApiStyle (ApiStyle.Unified);
- thatNode.AddApiStyle (ApiStyle.Classic);
- }
-
- return UpdateAssemblyVersionForAssemblyInfo (e, root, assemblyVersions, add);
- }
-
- static bool UpdateAssemblyVersionForAssemblyInfo (XmlElement e, XmlElement root, string[] assemblyVersions, bool add)
- {
- List<XmlNode> matches = e.SelectNodes ("AssemblyVersion").Cast<XmlNode> ().Where (v => Array.IndexOf (assemblyVersions, v.InnerText) >= 0).ToList ();
- // matches.Count > 0 && add: ignore -- already present
- if (matches.Count > 0 && !add) {
- foreach (XmlNode c in matches)
- e.RemoveChild (c);
- }
- else if (matches.Count == 0 && add) {
- foreach (string sv in assemblyVersions) {
- XmlElement c = root.OwnerDocument.CreateElement("AssemblyVersion");
- c.InnerText = sv;
- e.AppendChild(c);
- }
- }
-
- // matches.Count == 0 && !add: ignore -- already not present
- XmlNodeList avs = e.SelectNodes ("AssemblyVersion");
- SortXmlNodes (e, avs, new VersionComparer ());
-
- bool anyNodesLeft = avs.Count != 0;
- if (!anyNodesLeft) {
- e.ParentNode.RemoveChild (e);
- }
- return anyNodesLeft;
- }
-
- // FIXME: get TypeReferences instead of string comparison?
- private static string[] IgnorableAttributes = {
- // Security related attributes
- "System.Reflection.AssemblyKeyFileAttribute",
- "System.Reflection.AssemblyDelaySignAttribute",
- // Present in @RefType
- "System.Runtime.InteropServices.OutAttribute",
- // For naming the indexer to use when not using indexers
- "System.Reflection.DefaultMemberAttribute",
- // for decimal constants
- "System.Runtime.CompilerServices.DecimalConstantAttribute",
- // compiler generated code
- "System.Runtime.CompilerServices.CompilerGeneratedAttribute",
- // more compiler generated code, e.g. iterator methods
- "System.Diagnostics.DebuggerHiddenAttribute",
- "System.Runtime.CompilerServices.FixedBufferAttribute",
- "System.Runtime.CompilerServices.UnsafeValueTypeAttribute",
- // extension methods
- "System.Runtime.CompilerServices.ExtensionAttribute",
- // Used to differentiate 'object' from C#4 'dynamic'
- "System.Runtime.CompilerServices.DynamicAttribute",
- };
-
- private void MakeAttributes (XmlElement root, IEnumerable<string> attributes, TypeReference t=null)
- {
- if (!attributes.Any ()) {
- ClearElement (root, "Attributes");
- return;
- }
-
- XmlElement e = (XmlElement)root.SelectSingleNode("Attributes");
- if (e != null)
- e.RemoveAll();
- else if (e == null)
- e = root.OwnerDocument.CreateElement("Attributes");
-
- foreach (string attribute in attributes) {
- XmlElement ae = root.OwnerDocument.CreateElement("Attribute");
- e.AppendChild(ae);
-
- WriteElementText(ae, "AttributeName", attribute);
- }
-
- if (e.ParentNode == null)
- root.AppendChild(e);
-
- NormalizeWhitespace(e);
- }
-
- public static string MakeAttributesValueString (object v, TypeReference valueType)
- {
- var formatters = new [] {
- new AttributeValueFormatter (),
- new ApplePlatformEnumFormatter (),
- new StandardFlagsEnumFormatter (),
- new DefaultAttributeValueFormatter (),
- };
-
- ResolvedTypeInfo type = new ResolvedTypeInfo (valueType);
- foreach (var formatter in formatters) {
- string formattedValue;
- if (formatter.TryFormatValue (v, type, out formattedValue)) {
- return formattedValue;
- }
- }
-
- // this should never occur because the DefaultAttributeValueFormatter will always
- // successfully format the value ... but this is needed to satisfy the compiler :)
- throw new InvalidDataException (string.Format ("Unable to format attribute value ({0})", v.ToString ()));
- }
-
- internal static IDictionary<long, string> GetEnumerationValues (TypeDefinition type)
- {
- var values = new Dictionary<long, string> ();
- foreach (var f in
- (from f in type.Fields
- where !(f.IsRuntimeSpecialName || f.IsSpecialName)
- select f)) {
- values [ToInt64 (f.Constant)] = f.Name;
- }
- return values;
- }
-
- internal static long ToInt64 (object value)
- {
- if (value is ulong)
- return (long) (ulong) value;
- return Convert.ToInt64 (value);
- }
-
- private void MakeParameters (XmlElement root, MemberReference member, IList<ParameterDefinition> parameters, bool shouldDuplicateWithNew=false)
- {
- XmlElement e = WriteElement(root, "Parameters");
-
- int i = 0;
- foreach (ParameterDefinition p in parameters) {
- XmlElement pe;
-
- // param info
- var ptype = GetDocParameterType (p.ParameterType);
- var newPType = ptype;
-
- if (MDocUpdater.SwitchingToMagicTypes) {
- newPType = NativeTypeManager.ConvertFromNativeType (ptype);
- }
-
- // now find the existing node, if it's there so we can reuse it.
- var nodes = root.SelectSingleNode ("Parameters").SelectNodes ("Parameter")
- .Cast<XmlElement> ().Where (x => x.GetAttribute ("Name") == p.Name)
- .ToArray();
-
- if (nodes.Count () == 0) {
- // wasn't found, let's make sure it wasn't just cause the param name was changed
- nodes = root.SelectSingleNode ("Parameters").SelectNodes ("Parameter")
- .Cast<XmlElement> ()
- .Skip (i) // this makes sure we don't inadvertently "reuse" nodes when adding new ones
- .Where (x => x.GetAttribute ("Name") != p.Name && (x.GetAttribute ("Type") == ptype || x.GetAttribute ("Type") == newPType))
- .Take(1) // there might be more than one that meets this parameter ... only take the first.
- .ToArray();
- }
-
- AddXmlNode (nodes,
- x => x.GetAttribute ("Type") == ptype,
- x => x.SetAttribute ("Type", ptype),
- () => {
- pe = root.OwnerDocument.CreateElement ("Parameter");
- e.AppendChild (pe);
-
- pe.SetAttribute ("Name", p.Name);
- pe.SetAttribute ("Type", ptype);
- if (p.ParameterType is ByReferenceType) {
- if (p.IsOut)
- pe.SetAttribute ("RefType", "out");
- else
- pe.SetAttribute ("RefType", "ref");
- }
-
- MakeAttributes (pe, GetCustomAttributes (p.CustomAttributes, ""));
- return pe;
- },
- member);
-
- i++;
- }
- }
-
- private void MakeTypeParameters (XmlElement root, IList<GenericParameter> typeParams, MemberReference member, bool shouldDuplicateWithNew)
- {
- if (typeParams == null || typeParams.Count == 0) {
- XmlElement f = (XmlElement) root.SelectSingleNode ("TypeParameters");
- if (f != null)
- root.RemoveChild (f);
- return;
- }
- XmlElement e = WriteElement(root, "TypeParameters");
-
- var nodes = e.SelectNodes ("TypeParameter").Cast<XmlElement> ().ToArray ();
-
- foreach (GenericParameter t in typeParams) {
-
- IList<TypeReference> constraints = t.Constraints;
- GenericParameterAttributes attrs = t.Attributes;
-
-
- AddXmlNode (
- nodes,
- x => {
- var baseType = e.SelectSingleNode("BaseTypeName");
- // TODO: should this comparison take into account BaseTypeName?
- return x.GetAttribute("Name") == t.Name;
- },
- x => {}, // no additional action required
- () => {
-
- XmlElement pe = root.OwnerDocument.CreateElement("TypeParameter");
- e.AppendChild(pe);
- pe.SetAttribute("Name", t.Name);
- MakeAttributes (pe, GetCustomAttributes (t.CustomAttributes, ""), t.DeclaringType);
- XmlElement ce = (XmlElement) e.SelectSingleNode ("Constraints");
- if (attrs == GenericParameterAttributes.NonVariant && constraints.Count == 0) {
- if (ce != null)
- e.RemoveChild (ce);
- return pe;
- }
- if (ce != null)
- ce.RemoveAll();
- else {
- ce = root.OwnerDocument.CreateElement ("Constraints");
- }
- pe.AppendChild (ce);
- if ((attrs & GenericParameterAttributes.Contravariant) != 0)
- AppendElementText (ce, "ParameterAttribute", "Contravariant");
- if ((attrs & GenericParameterAttributes.Covariant) != 0)
- AppendElementText (ce, "ParameterAttribute", "Covariant");
- if ((attrs & GenericParameterAttributes.DefaultConstructorConstraint) != 0)
- AppendElementText (ce, "ParameterAttribute", "DefaultConstructorConstraint");
- if ((attrs & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0)
- AppendElementText (ce, "ParameterAttribute", "NotNullableValueTypeConstraint");
- if ((attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0)
- AppendElementText (ce, "ParameterAttribute", "ReferenceTypeConstraint");
- foreach (TypeReference c in constraints) {
- TypeDefinition cd = c.Resolve ();
- AppendElementText (ce,
- (cd != null && cd.IsInterface) ? "InterfaceName" : "BaseTypeName",
- GetDocTypeFullName (c));
- }
-
- return pe;
- },
- member);
- }
- }
-
- private void MakeParameters (XmlElement root, MemberReference mi, bool shouldDuplicateWithNew)
- {
- if (mi is MethodDefinition && ((MethodDefinition) mi).IsConstructor)
- MakeParameters (root, mi, ((MethodDefinition)mi).Parameters, shouldDuplicateWithNew);
- else if (mi is MethodDefinition) {
- MethodDefinition mb = (MethodDefinition) mi;
- IList<ParameterDefinition> parameters = mb.Parameters;
- MakeParameters(root, mi, parameters, shouldDuplicateWithNew);
- if (parameters.Count > 0 && DocUtils.IsExtensionMethod (mb)) {
- XmlElement p = (XmlElement) root.SelectSingleNode ("Parameters/Parameter[position()=1]");
- p.SetAttribute ("RefType", "this");
- }
- }
- else if (mi is PropertyDefinition) {
- IList<ParameterDefinition> parameters = ((PropertyDefinition)mi).Parameters;
- if (parameters.Count > 0)
- MakeParameters(root, mi, parameters, shouldDuplicateWithNew);
- else
- return;
- }
- else if (mi is FieldDefinition) return;
- else if (mi is EventDefinition) return;
- else throw new ArgumentException();
- }
-
- internal static string GetDocParameterType (TypeReference type)
- {
- return GetDocTypeFullName (type).Replace ("@", "&");
- }
-
- private void MakeReturnValue (XmlElement root, TypeReference type, IList<CustomAttribute> attributes, bool shouldDuplicateWithNew=false)
- {
- XmlElement e = WriteElement(root, "ReturnValue");
- var valueToUse = GetDocTypeFullName (type);
-
- AddXmlNode (e.SelectNodes("ReturnType").Cast<XmlElement> ().ToArray (),
- x => x.InnerText == valueToUse,
- x => x.InnerText = valueToUse,
- () => {
- var newNode = WriteElementText(e, "ReturnType", valueToUse, forceNewElement: true);
- if (attributes != null)
- MakeAttributes(e, GetCustomAttributes (attributes, ""), type);
-
- return newNode;
- },
- type);
- }
-
- private void MakeReturnValue (XmlElement root, MemberReference mi, bool shouldDuplicateWithNew=false)
- {
- if (mi is MethodDefinition && ((MethodDefinition) mi).IsConstructor)
- return;
- else if (mi is MethodDefinition)
- MakeReturnValue (root, ((MethodDefinition)mi).ReturnType, ((MethodDefinition)mi).MethodReturnType.CustomAttributes, shouldDuplicateWithNew);
- else if (mi is PropertyDefinition)
- MakeReturnValue (root, ((PropertyDefinition)mi).PropertyType, null, shouldDuplicateWithNew);
- else if (mi is FieldDefinition)
- MakeReturnValue (root, ((FieldDefinition)mi).FieldType, null, shouldDuplicateWithNew);
- else if (mi is EventDefinition)
- MakeReturnValue (root, ((EventDefinition)mi).EventType, null, shouldDuplicateWithNew);
- else
- throw new ArgumentException(mi + " is a " + mi.GetType().FullName);
- }
-
- private XmlElement MakeMember(XmlDocument doc, DocsNodeInfo info)
- {
- MemberReference mi = info.Member;
- if (mi is TypeDefinition) return null;
-
- string sigs = memberFormatters [0].GetDeclaration (mi);
- if (sigs == null) return null; // not publicly visible
-
- // no documentation for property/event accessors. Is there a better way of doing this?
- if (mi.Name.StartsWith("get_")) return null;
- if (mi.Name.StartsWith("set_")) return null;
- if (mi.Name.StartsWith("add_")) return null;
- if (mi.Name.StartsWith("remove_")) return null;
- if (mi.Name.StartsWith("raise_")) return null;
-
- XmlElement me = doc.CreateElement("Member");
- me.SetAttribute("MemberName", GetMemberName (mi));
-
- info.Node = me;
- UpdateMember(info);
- if (exceptions.HasValue &&
- (exceptions.Value & ExceptionLocations.AddedMembers) != 0)
- UpdateExceptions (info.Node, info.Member);
-
- if (since != null) {
- XmlNode docs = me.SelectSingleNode("Docs");
- docs.AppendChild (CreateSinceNode (doc));
- }
-
- return me;
- }
-
- internal static string GetMemberName (MemberReference mi)
- {
- MethodDefinition mb = mi as MethodDefinition;
- if (mb == null) {
- PropertyDefinition pi = mi as PropertyDefinition;
- if (pi == null)
- return mi.Name;
- return DocUtils.GetPropertyName (pi);
- }
- StringBuilder sb = new StringBuilder (mi.Name.Length);
- if (!DocUtils.IsExplicitlyImplemented (mb))
- sb.Append (mi.Name);
- else {
- TypeReference iface;
- MethodReference ifaceMethod;
- DocUtils.GetInfoForExplicitlyImplementedMethod (mb, out iface, out ifaceMethod);
- sb.Append (GetDocTypeFullName (iface));
- sb.Append ('.');
- sb.Append (ifaceMethod.Name);
- }
- if (mb.IsGenericMethod ()) {
- IList<GenericParameter> typeParams = mb.GenericParameters;
- if (typeParams.Count > 0) {
- sb.Append ("<");
- sb.Append (typeParams [0].Name);
- for (int i = 1; i < typeParams.Count; ++i)
- sb.Append (",").Append (typeParams [i].Name);
- sb.Append (">");
- }
- }
- return sb.ToString ();
- }
-
- /// SIGNATURE GENERATION FUNCTIONS
- internal static bool IsPrivate (MemberReference mi)
- {
- return memberFormatters [0].GetDeclaration (mi) == null;
- }
-
- internal static string GetMemberType (MemberReference mi)
- {
- if (mi is MethodDefinition && ((MethodDefinition) mi).IsConstructor)
- return "Constructor";
- if (mi is MethodDefinition)
- return "Method";
- if (mi is PropertyDefinition)
- return "Property";
- if (mi is FieldDefinition)
- return "Field";
- if (mi is EventDefinition)
- return "Event";
- throw new ArgumentException();
- }
-
- private static string GetDocTypeName (TypeReference type)
- {
- return docTypeFormatter.GetName (type);
- }
-
- internal static string GetDocTypeFullName (TypeReference type)
- {
- return DocTypeFullMemberFormatter.Default.GetName (type);
- }
-
- internal static string GetXPathForMember (DocumentationMember member)
- {
- StringBuilder xpath = new StringBuilder ();
- xpath.Append ("//Members/Member[@MemberName=\"")
- .Append (member.MemberName)
- .Append ("\"]");
- if (member.Parameters != null && member.Parameters.Count > 0) {
- xpath.Append ("/Parameters[count(Parameter) = ")
- .Append (member.Parameters.Count);
- for (int i = 0; i < member.Parameters.Count; ++i) {
- xpath.Append (" and Parameter [").Append (i+1).Append ("]/@Type=\"");
- xpath.Append (member.Parameters [i]);
- xpath.Append ("\"");
- }
- xpath.Append ("]/..");
- }
- return xpath.ToString ();
- }
-
- public static string GetXPathForMember (XPathNavigator member)
- {
- StringBuilder xpath = new StringBuilder ();
- xpath.Append ("//Type[@FullName=\"")
- .Append (member.SelectSingleNode ("../../@FullName").Value)
- .Append ("\"]/");
- xpath.Append ("Members/Member[@MemberName=\"")
- .Append (member.SelectSingleNode ("@MemberName").Value)
- .Append ("\"]");
- XPathNodeIterator parameters = member.Select ("Parameters/Parameter");
- if (parameters.Count > 0) {
- xpath.Append ("/Parameters[count(Parameter) = ")
- .Append (parameters.Count);
- int i = 0;
- while (parameters.MoveNext ()) {
- ++i;
- xpath.Append (" and Parameter [").Append (i).Append ("]/@Type=\"");
- xpath.Append (parameters.Current.Value);
- xpath.Append ("\"");
- }
- xpath.Append ("]/..");
- }
- return xpath.ToString ();
- }
-
- public static string GetXPathForMember (MemberReference member)
- {
- StringBuilder xpath = new StringBuilder ();
- xpath.Append ("//Type[@FullName=\"")
- .Append (member.DeclaringType.FullName)
- .Append ("\"]/");
- xpath.Append ("Members/Member[@MemberName=\"")
- .Append (GetMemberName (member))
- .Append ("\"]");
-
- IList<ParameterDefinition> parameters = null;
- if (member is MethodDefinition)
- parameters = ((MethodDefinition) member).Parameters;
- else if (member is PropertyDefinition) {
- parameters = ((PropertyDefinition) member).Parameters;
- }
- if (parameters != null && parameters.Count > 0) {
- xpath.Append ("/Parameters[count(Parameter) = ")
- .Append (parameters.Count);
- for (int i = 0; i < parameters.Count; ++i) {
- xpath.Append (" and Parameter [").Append (i+1).Append ("]/@Type=\"");
- xpath.Append (GetDocParameterType (parameters [i].ParameterType));
- xpath.Append ("\"");
- }
- xpath.Append ("]/..");
- }
- return xpath.ToString ();
- }
-}
-
-static class CecilExtensions {
- public static string GetDeclaringType(this CustomAttribute attribute)
- {
- var type = attribute.Constructor.DeclaringType;
- var typeName = type.FullName;
-
- string translatedType = NativeTypeManager.GetTranslatedName (type);
- return translatedType;
- }
-
- public static IEnumerable<MemberReference> GetMembers (this TypeDefinition type)
- {
- foreach (var c in type.Methods.Where (m => m.IsConstructor))
- yield return (MemberReference) c;
- foreach (var e in type.Events)
- yield return (MemberReference) e;
- foreach (var f in type.Fields)
- yield return (MemberReference) f;
- foreach (var m in type.Methods.Where (m => !m.IsConstructor))
- yield return (MemberReference) m;
- foreach (var t in type.NestedTypes)
- yield return (MemberReference) t;
- foreach (var p in type.Properties)
- yield return (MemberReference) p;
- }
-
- public static IEnumerable<MemberReference> GetMembers (this TypeDefinition type, string member)
- {
- return GetMembers (type).Where (m => m.Name == member);
- }
-
- public static MemberReference GetMember (this TypeDefinition type, string member)
- {
- return GetMembers (type, member).EnsureZeroOrOne ();
- }
-
- static T EnsureZeroOrOne<T> (this IEnumerable<T> source)
- {
- if (source.Count () > 1)
- throw new InvalidOperationException ("too many matches");
- return source.FirstOrDefault ();
- }
-
- public static MethodDefinition GetMethod (this TypeDefinition type, string method)
- {
- return type.Methods
- .Where (m => m.Name == method)
- .EnsureZeroOrOne ();
- }
-
- public static IEnumerable<MemberReference> GetDefaultMembers (this TypeReference type)
- {
- TypeDefinition def = type as TypeDefinition;
- if (def == null)
- return new MemberReference [0];
- CustomAttribute defMemberAttr = def.CustomAttributes
- .FirstOrDefault (c => c.AttributeType.FullName == "System.Reflection.DefaultMemberAttribute");
- if (defMemberAttr == null)
- return new MemberReference [0];
- string name = (string) defMemberAttr.ConstructorArguments [0].Value;
- return def.Properties
- .Where (p => p.Name == name)
- .Select (p => (MemberReference) p);
- }
-
- public static IEnumerable<TypeDefinition> GetTypes (this AssemblyDefinition assembly)
- {
- return assembly.Modules.SelectMany (md => md.GetAllTypes ());
- }
-
- public static TypeDefinition GetType (this AssemblyDefinition assembly, string type)
- {
- return GetTypes (assembly)
- .Where (td => td.FullName == type)
- .EnsureZeroOrOne ();
- }
-
- public static bool IsGenericType (this TypeReference type)
- {
- return type.GenericParameters.Count > 0;
- }
-
- public static bool IsGenericMethod (this MethodReference method)
- {
- return method.GenericParameters.Count > 0;
- }
-
- public static TypeReference GetUnderlyingType (this TypeDefinition type)
- {
- if (!type.IsEnum)
- return type;
- return type.Fields.First (f => f.Name == "value__").FieldType;
- }
-
- public static IEnumerable<TypeDefinition> GetAllTypes (this ModuleDefinition self)
- {
- return self.Types.SelectMany (t => t.GetAllTypes ());
- }
-
- static IEnumerable<TypeDefinition> GetAllTypes (this TypeDefinition self)
- {
- yield return self;
-
- if (!self.HasNestedTypes)
- yield break;
-
- foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ()))
- yield return type;
- }
-}
-
-enum ApiStyle {
- Classic,
- Unified
-}
-
-static class DocUtils {
-
- public static bool DoesNotHaveApiStyle(this XmlElement element, ApiStyle style) {
- string styleString = style.ToString ().ToLowerInvariant ();
- string apistylevalue = element.GetAttribute ("apistyle");
- return apistylevalue != styleString || string.IsNullOrWhiteSpace(apistylevalue);
- }
- public static bool HasApiStyle(this XmlElement element, ApiStyle style) {
- string styleString = style.ToString ().ToLowerInvariant ();
- return element.GetAttribute ("apistyle") == styleString;
- }
- public static bool HasApiStyle(this XmlNode node, ApiStyle style)
- {
- var attribute = node.Attributes ["apistyle"];
- return attribute != null && attribute.Value == style.ToString ().ToLowerInvariant ();
- }
- public static void AddApiStyle(this XmlElement element, ApiStyle style) {
- string styleString = style.ToString ().ToLowerInvariant ();
- var existingValue = element.GetAttribute ("apistyle");
- if (string.IsNullOrWhiteSpace (existingValue) || existingValue != styleString) {
- element.SetAttribute ("apistyle", styleString);
- }
-
- // Propagate the API style up to the membernode if necessary
- if (element.LocalName == "AssemblyInfo" && element.ParentNode != null && element.ParentNode.LocalName == "Member") {
- var member = element.ParentNode;
- var unifiedAssemblyNode = member.SelectSingleNode ("AssemblyInfo[@apistyle='unified']");
- var classicAssemblyNode = member.SelectSingleNode ("AssemblyInfo[not(@apistyle) or @apistyle='classic']");
-
- var parentAttribute = element.ParentNode.Attributes ["apistyle"];
- Action removeStyle = () => element.ParentNode.Attributes.Remove (parentAttribute);
- Action propagateStyle = () => {
- if (parentAttribute == null) {
- // if it doesn't have the attribute, then add it
- parentAttribute = element.OwnerDocument.CreateAttribute ("apistyle");
- parentAttribute.Value = styleString;
- element.ParentNode.Attributes.Append (parentAttribute);
- }
- };
-
- if ((style == ApiStyle.Classic && unifiedAssemblyNode != null) || (style == ApiStyle.Unified && classicAssemblyNode != null))
- removeStyle ();
- else
- propagateStyle ();
- }
- }
- public static void AddApiStyle (this XmlNode node, ApiStyle style)
- {
- string styleString = style.ToString ().ToLowerInvariant ();
- var existingAttribute = node.Attributes ["apistyle"];
- if (existingAttribute == null) {
- existingAttribute = node.OwnerDocument.CreateAttribute ("apistyle");
- node.Attributes.Append (existingAttribute);
- }
- existingAttribute.Value = styleString;
- }
- public static void RemoveApiStyle (this XmlElement element, ApiStyle style)
- {
- string styleString = style.ToString ().ToLowerInvariant ();
- string existingValue = element.GetAttribute ("apistyle");
- if (string.IsNullOrWhiteSpace (existingValue) || existingValue == styleString) {
- element.RemoveAttribute ("apistyle");
- }
- }
- public static void RemoveApiStyle (this XmlNode node, ApiStyle style)
- {
- var styleAttribute = node.Attributes ["apistyle"];
- if (styleAttribute != null && styleAttribute.Value == style.ToString ().ToLowerInvariant ()) {
- node.Attributes.Remove (styleAttribute);
- }
- }
-
- public static bool IsExplicitlyImplemented (MethodDefinition method)
- {
- return method.IsPrivate && method.IsFinal && method.IsVirtual;
- }
-
- public static string GetTypeDotMember (string name)
- {
- int startType, startMethod;
- startType = startMethod = -1;
- for (int i = 0; i < name.Length; ++i) {
- if (name [i] == '.') {
- startType = startMethod;
- startMethod = i;
- }
- }
- return name.Substring (startType+1);
- }
-
- public static string GetMember (string name)
- {
- int i = name.LastIndexOf ('.');
- if (i == -1)
- return name;
- return name.Substring (i+1);
- }
-
- public static void GetInfoForExplicitlyImplementedMethod (
- MethodDefinition method, out TypeReference iface, out MethodReference ifaceMethod)
- {
- iface = null;
- ifaceMethod = null;
- if (method.Overrides.Count != 1)
- throw new InvalidOperationException ("Could not determine interface type for explicitly-implemented interface member " + method.Name);
- iface = method.Overrides [0].DeclaringType;
- ifaceMethod = method.Overrides [0];
- }
-
- public static string GetPropertyName (PropertyDefinition pi)
- {
- // Issue: (g)mcs-generated assemblies that explicitly implement
- // properties don't specify the full namespace, just the
- // TypeName.Property; .NET uses Full.Namespace.TypeName.Property.
- MethodDefinition method = pi.GetMethod;
- if (method == null)
- method = pi.SetMethod;
- if (!IsExplicitlyImplemented (method))
- return pi.Name;
-
- // Need to determine appropriate namespace for this member.
- TypeReference iface;
- MethodReference ifaceMethod;
- GetInfoForExplicitlyImplementedMethod (method, out iface, out ifaceMethod);
- return string.Join (".", new string[]{
- DocTypeFullMemberFormatter.Default.GetName (iface),
- GetMember (pi.Name)});
- }
-
- public static string GetNamespace (TypeReference type)
- {
- if (type.GetElementType ().IsNested)
- type = type.GetElementType ();
- while (type != null && type.IsNested)
- type = type.DeclaringType;
- if (type == null)
- return string.Empty;
-
- string typeNS = type.Namespace;
-
- // first, make sure this isn't a type reference to another assembly/module
-
- bool isInAssembly = MDocUpdater.IsInAssemblies(type.Module.Name);
- if (isInAssembly && !typeNS.StartsWith ("System") && MDocUpdater.HasDroppedNamespace (type)) {
- typeNS = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, typeNS);
- }
- return typeNS;
- }
-
- public static string PathCombine (string dir, string path)
- {
- if (dir == null)
- dir = "";
- if (path == null)
- path = "";
- return Path.Combine (dir, path);
- }
-
- public static bool IsExtensionMethod (MethodDefinition method)
- {
- return
- method.CustomAttributes
- .Any (m => m.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute")
- && method.DeclaringType.CustomAttributes
- .Any (m => m.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute");
- }
-
- public static bool IsDelegate (TypeDefinition type)
- {
- TypeReference baseRef = type.BaseType;
- if (baseRef == null)
- return false;
- return !type.IsAbstract && baseRef.FullName == "System.Delegate" || // FIXME
- baseRef.FullName == "System.MulticastDelegate";
- }
-
- public static List<TypeReference> GetDeclaringTypes (TypeReference type)
- {
- List<TypeReference> decls = new List<TypeReference> ();
- decls.Add (type);
- while (type.DeclaringType != null) {
- decls.Add (type.DeclaringType);
- type = type.DeclaringType;
- }
- decls.Reverse ();
- return decls;
- }
-
- public static int GetGenericArgumentCount (TypeReference type)
- {
- GenericInstanceType inst = type as GenericInstanceType;
- return inst != null
- ? inst.GenericArguments.Count
- : type.GenericParameters.Count;
- }
-
- public static IEnumerable<TypeReference> GetUserImplementedInterfaces (TypeDefinition type)
- {
- HashSet<string> inheritedInterfaces = GetInheritedInterfaces (type);
- List<TypeReference> userInterfaces = new List<TypeReference> ();
- foreach (var ii in type.Interfaces) {
- var iface = ii.InterfaceType;
- TypeReference lookup = iface.Resolve () ?? iface;
- if (!inheritedInterfaces.Contains (GetQualifiedTypeName (lookup)))
- userInterfaces.Add (iface);
- }
- return userInterfaces.Where (i => MDocUpdater.IsPublic (i.Resolve ()));
- }
-
- private static string GetQualifiedTypeName (TypeReference type)
- {
- return "[" + type.Scope.Name + "]" + type.FullName;
- }
-
- private static HashSet<string> GetInheritedInterfaces (TypeDefinition type)
- {
- HashSet<string> inheritedInterfaces = new HashSet<string> ();
- Action<TypeDefinition> a = null;
- a = t => {
- if (t == null) return;
- foreach (var r in t.Interfaces) {
- inheritedInterfaces.Add (GetQualifiedTypeName (r.InterfaceType));
- a (r.InterfaceType.Resolve ());
- }
- };
- TypeReference baseRef = type.BaseType;
- while (baseRef != null) {
- TypeDefinition baseDef = baseRef.Resolve ();
- if (baseDef != null) {
- a (baseDef);
- baseRef = baseDef.BaseType;
- }
- else
- baseRef = null;
- }
- foreach (var r in type.Interfaces)
- a (r.InterfaceType.Resolve ());
- return inheritedInterfaces;
- }
-}
-
-class DocsNodeInfo {
- public DocsNodeInfo (XmlElement node)
- {
- this.Node = node;
- }
-
- public DocsNodeInfo (XmlElement node, TypeDefinition type)
- : this (node)
- {
- SetType (type);
- }
-
- public DocsNodeInfo (XmlElement node, MemberReference member)
- : this (node)
- {
- SetMemberInfo (member);
- }
-
- void SetType (TypeDefinition type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
- Type = type;
- GenericParameters = new List<GenericParameter> (type.GenericParameters);
- List<TypeReference> declTypes = DocUtils.GetDeclaringTypes (type);
- int maxGenArgs = DocUtils.GetGenericArgumentCount (type);
- for (int i = 0; i < declTypes.Count - 1; ++i) {
- int remove = System.Math.Min (maxGenArgs,
- DocUtils.GetGenericArgumentCount (declTypes [i]));
- maxGenArgs -= remove;
- while (remove-- > 0)
- GenericParameters.RemoveAt (0);
- }
- if (DocUtils.IsDelegate (type)) {
- Parameters = type.GetMethod("Invoke").Parameters;
- ReturnType = type.GetMethod("Invoke").ReturnType;
- ReturnIsReturn = true;
- }
- }
-
- void SetMemberInfo (MemberReference member)
- {
- if (member == null)
- throw new ArgumentNullException ("member");
- ReturnIsReturn = true;
- AddRemarks = true;
- Member = member;
-
- if (member is MethodReference ) {
- MethodReference mr = (MethodReference) member;
- Parameters = mr.Parameters;
- if (mr.IsGenericMethod ()) {
- GenericParameters = new List<GenericParameter> (mr.GenericParameters);
- }
- }
- else if (member is PropertyDefinition) {
- Parameters = ((PropertyDefinition) member).Parameters;
- }
-
- if (member is MethodDefinition) {
- ReturnType = ((MethodDefinition) member).ReturnType;
- } else if (member is PropertyDefinition) {
- ReturnType = ((PropertyDefinition) member).PropertyType;
- ReturnIsReturn = false;
- }
-
- // no remarks section for enum members
- if (member.DeclaringType != null && ((TypeDefinition) member.DeclaringType).IsEnum)
- AddRemarks = false;
- }
-
- public TypeReference ReturnType;
- public List<GenericParameter> GenericParameters;
- public IList<ParameterDefinition> Parameters;
- public bool ReturnIsReturn;
- public XmlElement Node;
- public bool AddRemarks = true;
- public MemberReference Member;
- public TypeDefinition Type;
-
- public override string ToString ()
- {
- return string.Format ("{0} - {1} - {2}", Type, Member, Node == null ? "no xml" : "with xml");
- }
-}
-
-class DocumentationEnumerator {
-
- public virtual IEnumerable<TypeDefinition> GetDocumentationTypes (AssemblyDefinition assembly, List<string> forTypes)
- {
- return GetDocumentationTypes (assembly, forTypes, null);
- }
-
- protected IEnumerable<TypeDefinition> GetDocumentationTypes (AssemblyDefinition assembly, List<string> forTypes, HashSet<string> seen)
- {
- foreach (TypeDefinition type in assembly.GetTypes()) {
- if (forTypes != null && forTypes.BinarySearch (type.FullName) < 0)
- continue;
- if (seen != null && seen.Contains (type.FullName))
- continue;
- yield return type;
- foreach (TypeDefinition nested in type.NestedTypes)
- yield return nested;
- }
- }
-
- public virtual IEnumerable<DocsNodeInfo> GetDocumentationMembers (XmlDocument basefile, TypeDefinition type)
- {
- foreach (XmlElement oldmember in basefile.SelectNodes("Type/Members/Member")) {
- if (oldmember.GetAttribute ("__monodocer-seen__") == "true") {
- oldmember.RemoveAttribute ("__monodocer-seen__");
- continue;
- }
- MemberReference m = GetMember (type, new DocumentationMember (oldmember));
- if (m == null) {
- yield return new DocsNodeInfo (oldmember);
- }
- else {
- yield return new DocsNodeInfo (oldmember, m);
- }
- }
- }
-
- protected static MemberReference GetMember (TypeDefinition type, DocumentationMember member)
- {
- string membertype = member.MemberType;
-
- string returntype = member.ReturnType;
-
- string docName = member.MemberName;
-
- string[] docTypeParams = GetTypeParameters (docName, member.TypeParameters);
-
- // If we're using 'magic types', then we might get false positives ... in those cases, we keep searching
- MemberReference likelyCandidate = null;
-
- // Loop through all members in this type with the same name
- var reflectedMembers = GetReflectionMembers (type, docName).ToArray ();
- foreach (MemberReference mi in reflectedMembers) {
- bool matchedMagicType = false;
- if (mi is TypeDefinition) continue;
- if (MDocUpdater.GetMemberType(mi) != membertype) continue;
-
- if (MDocUpdater.IsPrivate (mi))
- continue;
-
- IList<ParameterDefinition> pis = null;
- string[] typeParams = null;
- if (mi is MethodDefinition) {
- MethodDefinition mb = (MethodDefinition) mi;
- pis = mb.Parameters;
- if (mb.IsGenericMethod ()) {
- IList<GenericParameter> args = mb.GenericParameters;
- typeParams = args.Select (p => p.Name).ToArray ();
- }
- }
- else if (mi is PropertyDefinition)
- pis = ((PropertyDefinition)mi).Parameters;
-
- // check type parameters
- int methodTcount = member.TypeParameters == null ? 0 : member.TypeParameters.Count;
- int reflectionTcount = typeParams == null ? 0 : typeParams.Length;
- if (methodTcount != reflectionTcount)
- continue;
-
- // check member parameters
- int mcount = member.Parameters == null ? 0 : member.Parameters.Count;
- int pcount = pis == null ? 0 : pis.Count;
- if (mcount != pcount)
- continue;
-
- MethodDefinition mDef = mi as MethodDefinition;
- if (mDef != null && !mDef.IsConstructor) {
- // Casting operators can overload based on return type.
- string rtype = GetReplacedString (
- MDocUpdater.GetDocTypeFullName (((MethodDefinition)mi).ReturnType),
- typeParams, docTypeParams);
- string originalRType = rtype;
- if (MDocUpdater.SwitchingToMagicTypes) {
- rtype = NativeTypeManager.ConvertFromNativeType (rtype);
-
- }
- if ((returntype != rtype && originalRType == rtype) ||
- (MDocUpdater.SwitchingToMagicTypes && returntype != originalRType && returntype != rtype && originalRType != rtype)) {
- continue;
- }
-
- if (originalRType != rtype)
- matchedMagicType = true;
- }
-
- if (pcount == 0)
- return mi;
- bool good = true;
- for (int i = 0; i < pis.Count; i++) {
- string paramType = GetReplacedString (
- MDocUpdater.GetDocParameterType (pis [i].ParameterType),
- typeParams, docTypeParams);
-
- // if magictypes, replace paramType to "classic value" ... so the comparison works
- string originalParamType = paramType;
- if (MDocUpdater.SwitchingToMagicTypes) {
- paramType = NativeTypeManager.ConvertFromNativeType (paramType);
- }
-
- string xmlMemberType = member.Parameters [i];
- if ((!paramType.Equals(xmlMemberType) && paramType.Equals(originalParamType)) ||
- (MDocUpdater.SwitchingToMagicTypes && !originalParamType.Equals(xmlMemberType) && !paramType.Equals(xmlMemberType) && !paramType.Equals(originalParamType))) {
-
- // did not match ... if we're dropping the namespace, and the paramType has the dropped
- // namespace, we should see if it matches when added
- bool stillDoesntMatch = true;
- if (MDocUpdater.HasDroppedNamespace(type) && paramType.StartsWith (MDocUpdater.droppedNamespace)) {
- string withDroppedNs = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, xmlMemberType);
-
- stillDoesntMatch = withDroppedNs != paramType;
- }
-
- if (stillDoesntMatch) {
- good = false;
- break;
- }
- }
-
- if (originalParamType != paramType)
- matchedMagicType = true;
- }
- if (!good) continue;
-
- if (MDocUpdater.SwitchingToMagicTypes && likelyCandidate == null && matchedMagicType) {
- // we matched this on a magic type conversion ... let's keep going to see if there's another one we should look at that matches more closely
- likelyCandidate = mi;
- continue;
- }
-
- return mi;
- }
-
- return likelyCandidate;
- }
-
- static string[] GetTypeParameters (string docName, IEnumerable<string> knownParameters)
- {
- if (docName [docName.Length-1] != '>')
- return null;
- StringList types = new StringList ();
- int endToken = docName.Length-2;
- int i = docName.Length-2;
- do {
- if (docName [i] == ',' || docName [i] == '<') {
- types.Add (docName.Substring (i + 1, endToken - i));
- endToken = i-1;
- }
- if (docName [i] == '<')
- break;
- } while (--i >= 0);
-
- types.Reverse ();
- var arrayTypes = types.ToArray ();
-
- if (knownParameters != null && knownParameters.Any () && arrayTypes.Length != knownParameters.Count ())
- return knownParameters.ToArray ();
- else
- return arrayTypes;
- }
-
- protected static IEnumerable<MemberReference> GetReflectionMembers (TypeDefinition type, string docName)
- {
- // In case of dropping the namespace, we have to remove the dropped NS
- // so that docName will match what's in the assembly/type
- if (MDocUpdater.HasDroppedNamespace (type) && docName.StartsWith(MDocUpdater.droppedNamespace + ".")) {
- int droppedNsLength = MDocUpdater.droppedNamespace.Length;
- docName = docName.Substring (droppedNsLength + 1, docName.Length - droppedNsLength - 1);
- }
-
- // need to worry about 4 forms of //@MemberName values:
- // 1. "Normal" (non-generic) member names: GetEnumerator
- // - Lookup as-is.
- // 2. Explicitly-implemented interface member names: System.Collections.IEnumerable.Current
- // - try as-is, and try type.member (due to "kludge" for property
- // support.
- // 3. "Normal" Generic member names: Sort<T> (CSC)
- // - need to remove generic parameters --> "Sort"
- // 4. Explicitly-implemented interface members for generic interfaces:
- // -- System.Collections.Generic.IEnumerable<T>.Current
- // - Try as-is, and try type.member, *keeping* the generic parameters.
- // --> System.Collections.Generic.IEnumerable<T>.Current, IEnumerable<T>.Current
- // 5. As of 2008-01-02, gmcs will do e.g. 'IFoo`1[A].Method' instead of
- // 'IFoo<A>.Method' for explicitly implemented methods; don't interpret
- // this as (1) or (2).
- if (docName.IndexOf ('<') == -1 && docName.IndexOf ('[') == -1) {
- // Cases 1 & 2
- foreach (MemberReference mi in type.GetMembers (docName))
- yield return mi;
- if (CountChars (docName, '.') > 0)
- // might be a property; try only type.member instead of
- // namespace.type.member.
- foreach (MemberReference mi in
- type.GetMembers (DocUtils.GetTypeDotMember (docName)))
- yield return mi;
- yield break;
- }
- // cases 3 & 4
- int numLt = 0;
- int numDot = 0;
- int startLt, startType, startMethod;
- startLt = startType = startMethod = -1;
- for (int i = 0; i < docName.Length; ++i) {
- switch (docName [i]) {
- case '<':
- if (numLt == 0) {
- startLt = i;
- }
- ++numLt;
- break;
- case '>':
- --numLt;
- if (numLt == 0 && (i + 1) < docName.Length)
- // there's another character in docName, so this <...> sequence is
- // probably part of a generic type -- case 4.
- startLt = -1;
- break;
- case '.':
- startType = startMethod;
- startMethod = i;
- ++numDot;
- break;
- }
- }
- string refName = startLt == -1 ? docName : docName.Substring (0, startLt);
- // case 3
- foreach (MemberReference mi in type.GetMembers (refName))
- yield return mi;
-
- // case 4
- foreach (MemberReference mi in type.GetMembers (refName.Substring (startType + 1)))
- yield return mi;
-
- // If we _still_ haven't found it, we've hit another generic naming issue:
- // post Mono 1.1.18, gmcs generates [[FQTN]] instead of <TypeName> for
- // explicitly-implemented METHOD names (not properties), e.g.
- // "System.Collections.Generic.IEnumerable`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].GetEnumerator"
- // instead of "System.Collections.Generic.IEnumerable<Foo>.GetEnumerator",
- // which the XML docs will contain.
- //
- // Alas, we can't derive the Mono name from docName, so we need to iterate
- // over all member names, convert them into CSC format, and compare... :-(
- if (numDot == 0)
- yield break;
- foreach (MemberReference mi in type.GetMembers ()) {
- if (MDocUpdater.GetMemberName (mi) == docName)
- yield return mi;
- }
- }
-
- static string GetReplacedString (string typeName, string[] from, string[] to)
- {
- if (from == null)
- return typeName;
- for (int i = 0; i < from.Length; ++i)
- typeName = typeName.Replace (from [i], to [i]);
- return typeName;
- }
-
- private static int CountChars (string s, char c)
- {
- int count = 0;
- for (int i = 0; i < s.Length; ++i) {
- if (s [i] == c)
- ++count;
- }
- return count;
- }
-}
-
-class EcmaDocumentationEnumerator : DocumentationEnumerator {
-
- XmlReader ecmadocs;
- MDocUpdater app;
-
- public EcmaDocumentationEnumerator (MDocUpdater app, XmlReader ecmaDocs)
- {
- this.app = app;
- this.ecmadocs = ecmaDocs;
- }
-
- public override IEnumerable<TypeDefinition> GetDocumentationTypes (AssemblyDefinition assembly, List<string> forTypes)
- {
- HashSet<string> seen = new HashSet<string> ();
- return GetDocumentationTypes (assembly, forTypes, seen)
- .Concat (base.GetDocumentationTypes (assembly, forTypes, seen));
- }
-
- new IEnumerable<TypeDefinition> GetDocumentationTypes (AssemblyDefinition assembly, List<string> forTypes, HashSet<string> seen)
- {
- int typeDepth = -1;
- while (ecmadocs.Read ()) {
- switch (ecmadocs.Name) {
- case "Type": {
- if (typeDepth == -1)
- typeDepth = ecmadocs.Depth;
- if (ecmadocs.NodeType != XmlNodeType.Element)
- continue;
- if (typeDepth != ecmadocs.Depth) // nested <TypeDefinition/> element?
- continue;
- string typename = ecmadocs.GetAttribute ("FullName");
- string typename2 = MDocUpdater.GetTypeFileName (typename);
- if (forTypes != null &&
- forTypes.BinarySearch (typename) < 0 &&
- typename != typename2 &&
- forTypes.BinarySearch (typename2) < 0)
- continue;
- TypeDefinition t;
- if ((t = assembly.GetType (typename)) == null &&
- (t = assembly.GetType (typename2)) == null)
- continue;
- seen.Add (typename);
- if (typename != typename2)
- seen.Add (typename2);
- Console.WriteLine (" Import: {0}", t.FullName);
- if (ecmadocs.Name != "Docs") {
- int depth = ecmadocs.Depth;
- while (ecmadocs.Read ()) {
- if (ecmadocs.Name == "Docs" && ecmadocs.Depth == depth + 1)
- break;
- }
- }
- if (!ecmadocs.IsStartElement ("Docs"))
- throw new InvalidOperationException ("Found " + ecmadocs.Name + "; expecting <Docs/>!");
- yield return t;
- break;
- }
- default:
- break;
- }
- }
- }
-
- public override IEnumerable<DocsNodeInfo> GetDocumentationMembers (XmlDocument basefile, TypeDefinition type)
- {
- return GetMembers (basefile, type)
- .Concat (base.GetDocumentationMembers (basefile, type));
- }
-
- private IEnumerable<DocsNodeInfo> GetMembers (XmlDocument basefile, TypeDefinition type)
- {
- while (ecmadocs.Name != "Members" && ecmadocs.Read ()) {
- // do nothing
- }
- if (ecmadocs.IsEmptyElement)
- yield break;
-
- int membersDepth = ecmadocs.Depth;
- bool go = true;
- while (go && ecmadocs.Read ()) {
- switch (ecmadocs.Name) {
- case "Member": {
- if (membersDepth != ecmadocs.Depth - 1 || ecmadocs.NodeType != XmlNodeType.Element)
- continue;
- DocumentationMember dm = new DocumentationMember (ecmadocs);
-
- string xp = MDocUpdater.GetXPathForMember (dm);
- XmlElement oldmember = (XmlElement) basefile.SelectSingleNode (xp);
- MemberReference m;
- if (oldmember == null) {
- m = GetMember (type, dm);
- if (m == null) {
- app.Warning ("Could not import ECMA docs for `{0}'s `{1}': Member not found.",
- type.FullName, dm.MemberSignatures ["C#"]);
- // SelectSingleNode (ecmaDocsMember, "MemberSignature[@Language=\"C#\"]/@Value").Value);
- continue;
- }
- // oldmember lookup may have failed due to type parameter renames.
- // Try again.
- oldmember = (XmlElement) basefile.SelectSingleNode (MDocUpdater.GetXPathForMember (m));
- if (oldmember == null) {
- XmlElement members = MDocUpdater.WriteElement (basefile.DocumentElement, "Members");
- oldmember = basefile.CreateElement ("Member");
- oldmember.SetAttribute ("MemberName", dm.MemberName);
- members.AppendChild (oldmember);
- foreach (string key in MDocUpdater.Sort (dm.MemberSignatures.Keys)) {
- XmlElement ms = basefile.CreateElement ("MemberSignature");
- ms.SetAttribute ("Language", key);
- ms.SetAttribute ("Value", (string) dm.MemberSignatures [key]);
- oldmember.AppendChild (ms);
- }
- oldmember.SetAttribute ("__monodocer-seen__", "true");
- Console.WriteLine ("Member Added: {0}", oldmember.SelectSingleNode("MemberSignature[@Language='C#']/@Value").InnerText);
- app.additions++;
- }
- }
- else {
- m = GetMember (type, new DocumentationMember (oldmember));
- if (m == null) {
- app.Warning ("Could not import ECMA docs for `{0}'s `{1}': Member not found.",
- type.FullName, dm.MemberSignatures ["C#"]);
- continue;
- }
- oldmember.SetAttribute ("__monodocer-seen__", "true");
- }
- DocsNodeInfo node = new DocsNodeInfo (oldmember, m);
- if (ecmadocs.Name != "Docs")
- throw new InvalidOperationException ("Found " + ecmadocs.Name + "; expected <Docs/>!");
- yield return node;
- break;
- }
- case "Members":
- if (membersDepth == ecmadocs.Depth && ecmadocs.NodeType == XmlNodeType.EndElement) {
- go = false;
- }
- break;
- }
- }
- }
-}
-
-abstract class DocumentationImporter {
-
- public abstract void ImportDocumentation (DocsNodeInfo info);
-}
-
-class MsxdocDocumentationImporter : DocumentationImporter {
-
- XmlDocument slashdocs;
-
- public MsxdocDocumentationImporter (string file)
- {
- var xml = File.ReadAllText (file);
-
- // Ensure Unix line endings
- xml = xml.Replace ("\r", "");
-
- slashdocs = new XmlDocument();
- slashdocs.LoadXml (xml);
- }
-
- public override void ImportDocumentation (DocsNodeInfo info)
- {
- XmlNode elem = GetDocs (info.Member ?? info.Type);
-
- if (elem == null)
- return;
-
- XmlElement e = info.Node;
-
- if (elem.SelectSingleNode("summary") != null)
- MDocUpdater.ClearElement(e, "summary");
- if (elem.SelectSingleNode("remarks") != null)
- MDocUpdater.ClearElement(e, "remarks");
- if (elem.SelectSingleNode ("value") != null || elem.SelectSingleNode ("returns") != null) {
- MDocUpdater.ClearElement(e, "value");
- MDocUpdater.ClearElement(e, "returns");
- }
-
- foreach (XmlNode child in elem.ChildNodes) {
- switch (child.Name) {
- case "param":
- case "typeparam": {
- XmlAttribute name = child.Attributes ["name"];
- if (name == null)
- break;
- XmlElement p2 = (XmlElement) e.SelectSingleNode (child.Name + "[@name='" + name.Value + "']");
- if (p2 != null)
- p2.InnerXml = child.InnerXml;
- break;
- }
- // Occasionally XML documentation will use <returns/> on
- // properties, so let's try to normalize things.
- case "value":
- case "returns": {
- XmlElement v = e.OwnerDocument.CreateElement (info.ReturnIsReturn ? "returns" : "value");
- v.InnerXml = child.InnerXml;
- e.AppendChild (v);
- break;
- }
- case "altmember":
- case "exception":
- case "permission": {
- XmlAttribute cref = child.Attributes ["cref"] ?? child.Attributes ["name"];
- if (cref == null)
- break;
- XmlElement a = (XmlElement) e.SelectSingleNode (child.Name + "[@cref='" + cref.Value + "']");
- if (a == null) {
- a = e.OwnerDocument.CreateElement (child.Name);
- a.SetAttribute ("cref", cref.Value);
- e.AppendChild (a);
- }
- a.InnerXml = child.InnerXml;
- break;
- }
- case "seealso": {
- XmlAttribute cref = child.Attributes ["cref"];
- if (cref == null)
- break;
- XmlElement a = (XmlElement) e.SelectSingleNode ("altmember[@cref='" + cref.Value + "']");
- if (a == null) {
- a = e.OwnerDocument.CreateElement ("altmember");
- a.SetAttribute ("cref", cref.Value);
- e.AppendChild (a);
- }
- break;
- }
- default: {
- bool add = true;
- if (child.NodeType == XmlNodeType.Element &&
- e.SelectNodes (child.Name).Cast<XmlElement>().Any (n => n.OuterXml == child.OuterXml))
- add = false;
- if (add)
- MDocUpdater.CopyNode (child, e);
- break;
- }
- }
- }
- }
-
- private XmlNode GetDocs (MemberReference member)
- {
- string slashdocsig = MDocUpdater.slashdocFormatter.GetDeclaration (member);
- if (slashdocsig != null)
- return slashdocs.SelectSingleNode ("doc/members/member[@name='" + slashdocsig + "']");
- return null;
- }
-}
-
-class EcmaDocumentationImporter : DocumentationImporter {
-
- XmlReader ecmadocs;
-
- public EcmaDocumentationImporter (XmlReader ecmaDocs)
- {
- this.ecmadocs = ecmaDocs;
- }
-
- public override void ImportDocumentation (DocsNodeInfo info)
- {
- if (!ecmadocs.IsStartElement ("Docs")) {
- return;
- }
-
- XmlElement e = info.Node;
-
- int depth = ecmadocs.Depth;
- ecmadocs.ReadStartElement ("Docs");
- while (ecmadocs.Read ()) {
- if (ecmadocs.Name == "Docs") {
- if (ecmadocs.Depth == depth && ecmadocs.NodeType == XmlNodeType.EndElement)
- break;
- else
- throw new InvalidOperationException ("Skipped past current <Docs/> element!");
- }
- if (!ecmadocs.IsStartElement ())
- continue;
- switch (ecmadocs.Name) {
- case "param":
- case "typeparam": {
- string name = ecmadocs.GetAttribute ("name");
- if (name == null)
- break;
- XmlNode doc = e.SelectSingleNode (
- ecmadocs.Name + "[@name='" + name + "']");
- string value = ecmadocs.ReadInnerXml ();
- if (doc != null)
- doc.InnerXml = value.Replace ("\r", "");
- break;
- }
- case "altmember":
- case "exception":
- case "permission":
- case "seealso": {
- string name = ecmadocs.Name;
- string cref = ecmadocs.GetAttribute ("cref");
- if (cref == null)
- break;
- XmlNode doc = e.SelectSingleNode (
- ecmadocs.Name + "[@cref='" + cref + "']");
- string value = ecmadocs.ReadInnerXml ().Replace ("\r", "");
- if (doc != null)
- doc.InnerXml = value;
- else {
- XmlElement n = e.OwnerDocument.CreateElement (name);
- n.SetAttribute ("cref", cref);
- n.InnerXml = value;
- e.AppendChild (n);
- }
- break;
- }
- default: {
- string name = ecmadocs.Name;
- string xpath = ecmadocs.Name;
- StringList attributes = new StringList (ecmadocs.AttributeCount);
- if (ecmadocs.MoveToFirstAttribute ()) {
- do {
- attributes.Add ("@" + ecmadocs.Name + "=\"" + ecmadocs.Value + "\"");
- } while (ecmadocs.MoveToNextAttribute ());
- ecmadocs.MoveToContent ();
- }
- if (attributes.Count > 0) {
- xpath += "[" + string.Join (" and ", attributes.ToArray ()) + "]";
- }
- XmlNode doc = e.SelectSingleNode (xpath);
- string value = ecmadocs.ReadInnerXml ().Replace ("\r", "");
- if (doc != null) {
- doc.InnerXml = value;
- }
- else {
- XmlElement n = e.OwnerDocument.CreateElement (name);
- n.InnerXml = value;
- foreach (string a in attributes) {
- int eq = a.IndexOf ('=');
- n.SetAttribute (a.Substring (1, eq-1), a.Substring (eq+2, a.Length-eq-3));
- }
- e.AppendChild (n);
- }
- break;
- }
- }
- }
- }
-}
-
-class DocumentationMember {
- public StringToStringMap MemberSignatures = new StringToStringMap ();
- public string ReturnType;
- public StringList Parameters;
- public StringList TypeParameters;
- public string MemberName;
- public string MemberType;
-
- public DocumentationMember (XmlReader reader)
- {
- MemberName = reader.GetAttribute ("MemberName");
- int depth = reader.Depth;
- bool go = true;
- StringList p = new StringList ();
- StringList tp = new StringList ();
- do {
- if (reader.NodeType != XmlNodeType.Element)
- continue;
-
- bool shouldUse = true;
- try {
- string apistyle = reader.GetAttribute ("apistyle");
- shouldUse = string.IsNullOrWhiteSpace(apistyle) || apistyle == "classic"; // only use this tag if it's an 'classic' style node
- }
- catch (Exception ex) {}
- switch (reader.Name) {
- case "MemberSignature":
- if (shouldUse) {
- MemberSignatures [reader.GetAttribute ("Language")] = reader.GetAttribute ("Value");
- }
- break;
- case "MemberType":
- MemberType = reader.ReadElementString ();
- break;
- case "ReturnType":
- if (reader.Depth == depth + 2 && shouldUse)
- ReturnType = reader.ReadElementString ();
- break;
- case "Parameter":
- if (reader.Depth == depth + 2 && shouldUse)
- p.Add (reader.GetAttribute ("Type"));
- break;
- case "TypeParameter":
- if (reader.Depth == depth + 2 && shouldUse)
- tp.Add (reader.GetAttribute ("Name"));
- break;
- case "Docs":
- if (reader.Depth == depth + 1)
- go = false;
- break;
- }
- } while (go && reader.Read () && reader.Depth >= depth);
- if (p.Count > 0) {
- Parameters = p;
- }
- if (tp.Count > 0) {
- TypeParameters = tp;
- } else {
- DiscernTypeParameters ();
- }
- }
-
- public DocumentationMember (XmlNode node)
- {
- MemberName = node.Attributes ["MemberName"].Value;
- foreach (XmlNode n in node.SelectNodes ("MemberSignature")) {
- XmlAttribute l = n.Attributes ["Language"];
- XmlAttribute v = n.Attributes ["Value"];
- XmlAttribute apistyle = n.Attributes ["apistyle"];
- bool shouldUse = apistyle == null || apistyle.Value == "classic";
- if (l != null && v != null && shouldUse)
- MemberSignatures [l.Value] = v.Value;
- }
- MemberType = node.SelectSingleNode ("MemberType").InnerText;
- XmlNode rt = node.SelectSingleNode ("ReturnValue/ReturnType[not(@apistyle) or @apistyle='classic']");
- if (rt != null)
- ReturnType = rt.InnerText;
- XmlNodeList p = node.SelectNodes ("Parameters/Parameter[not(@apistyle) or @apistyle='classic']");
- if (p.Count > 0) {
- Parameters = new StringList (p.Count);
- for (int i = 0; i < p.Count; ++i)
- Parameters.Add (p [i].Attributes ["Type"].Value);
- }
- XmlNodeList tp = node.SelectNodes ("TypeParameters/TypeParameter[not(@apistyle) or @apistyle='classic']");
- if (tp.Count > 0) {
- TypeParameters = new StringList (tp.Count);
- for (int i = 0; i < tp.Count; ++i)
- TypeParameters.Add (tp [i].Attributes ["Name"].Value);
- }
- else {
- DiscernTypeParameters ();
- }
- }
-
- void DiscernTypeParameters ()
- {
- // see if we can discern the param list from the name
- if (MemberName.Contains ("<") && MemberName.EndsWith (">")) {
- var starti = MemberName.IndexOf ("<") + 1;
- var endi = MemberName.LastIndexOf (">");
- var paramlist = MemberName.Substring (starti, endi - starti);
- var tparams = paramlist.Split (new char[] {','}, StringSplitOptions.RemoveEmptyEntries);
- TypeParameters = new StringList (tparams);
- }
- }
-}
-
-public class DynamicParserContext {
- public ReadOnlyCollection<bool> TransformFlags;
- public int TransformIndex;
-
- public DynamicParserContext (ICustomAttributeProvider provider)
- {
- CustomAttribute da;
- if (provider.HasCustomAttributes &&
- (da = (provider.CustomAttributes.Cast<CustomAttribute>()
- .SingleOrDefault (ca => ca.GetDeclaringType() == "System.Runtime.CompilerServices.DynamicAttribute"))) != null) {
- CustomAttributeArgument[] values = da.ConstructorArguments.Count == 0
- ? new CustomAttributeArgument [0]
- : (CustomAttributeArgument[]) da.ConstructorArguments [0].Value;
-
- TransformFlags = new ReadOnlyCollection<bool> (values.Select (t => (bool) t.Value).ToArray());
- }
- }
-}
-
-public enum MemberFormatterState {
- None,
- WithinGenericTypeParameters,
-}
-
-public abstract class MemberFormatter {
-
- public virtual string Language {
- get {return "";}
- }
-
- public string GetName (MemberReference member)
- {
- return GetName (member, null);
- }
-
- public virtual string GetName (MemberReference member, DynamicParserContext context)
- {
- TypeReference type = member as TypeReference;
- if (type != null)
- return GetTypeName (type, context);
- MethodReference method = member as MethodReference;
- if (method != null && method.Name == ".ctor") // method.IsConstructor
- return GetConstructorName (method);
- if (method != null)
- return GetMethodName (method);
- PropertyReference prop = member as PropertyReference;
- if (prop != null)
- return GetPropertyName (prop);
- FieldReference field = member as FieldReference;
- if (field != null)
- return GetFieldName (field);
- EventReference e = member as EventReference;
- if (e != null)
- return GetEventName (e);
- throw new NotSupportedException ("Can't handle: " +
- (member == null ? "null" : member.GetType().ToString()));
- }
-
- protected virtual string GetTypeName (TypeReference type)
- {
- return GetTypeName (type, null);
- }
-
- protected virtual string GetTypeName (TypeReference type, DynamicParserContext context)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
- return _AppendTypeName (new StringBuilder (type.Name.Length), type, context).ToString ();
- }
-
- protected virtual char[] ArrayDelimeters {
- get {return new char[]{'[', ']'};}
- }
-
- protected virtual MemberFormatterState MemberFormatterState { get; set; }
-
- protected StringBuilder _AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (type is ArrayType) {
- TypeSpecification spec = type as TypeSpecification;
- _AppendTypeName (buf, spec != null ? spec.ElementType : type.GetElementType (), context);
- return AppendArrayModifiers (buf, (ArrayType) type);
- }
- if (type is ByReferenceType) {
- return AppendRefTypeName (buf, type, context);
- }
- if (type is PointerType) {
- return AppendPointerTypeName (buf, type, context);
- }
- if (type is GenericParameter) {
- return AppendTypeName (buf, type, context);
- }
- AppendNamespace (buf, type);
- GenericInstanceType genInst = type as GenericInstanceType;
- if (type.GenericParameters.Count == 0 &&
- (genInst == null ? true : genInst.GenericArguments.Count == 0)) {
- return AppendFullTypeName (buf, type, context);
- }
- return AppendGenericType (buf, type, context);
- }
-
- protected virtual StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- string ns = DocUtils.GetNamespace (type);
- if (ns != null && ns.Length > 0)
- buf.Append (ns).Append ('.');
- return buf;
- }
-
- protected virtual StringBuilder AppendFullTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (type.DeclaringType != null)
- AppendFullTypeName (buf, type.DeclaringType, context).Append (NestedTypeSeparator);
- return AppendTypeName (buf, type, context);
- }
-
- protected virtual StringBuilder AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (context != null)
- context.TransformIndex++;
- return AppendTypeName (buf, type.Name);
- }
-
- protected virtual StringBuilder AppendTypeName (StringBuilder buf, string typename)
- {
- int n = typename.IndexOf ("`");
- if (n >= 0)
- return buf.Append (typename.Substring (0, n));
- return buf.Append (typename);
- }
-
- protected virtual StringBuilder AppendArrayModifiers (StringBuilder buf, ArrayType array)
- {
- buf.Append (ArrayDelimeters [0]);
- int rank = array.Rank;
- if (rank > 1)
- buf.Append (new string (',', rank-1));
- return buf.Append (ArrayDelimeters [1]);
- }
-
- protected virtual string RefTypeModifier {
- get {return "@";}
- }
-
- protected virtual StringBuilder AppendRefTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- TypeSpecification spec = type as TypeSpecification;
- return _AppendTypeName (buf, spec != null ? spec.ElementType : type.GetElementType (), context)
- .Append (RefTypeModifier);
- }
-
- protected virtual string PointerModifier {
- get {return "*";}
- }
-
- protected virtual StringBuilder AppendPointerTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- TypeSpecification spec = type as TypeSpecification;
- return _AppendTypeName (buf, spec != null ? spec.ElementType : type.GetElementType (), context)
- .Append (PointerModifier);
- }
-
- protected virtual char[] GenericTypeContainer {
- get {return new char[]{'<', '>'};}
- }
-
- protected virtual char NestedTypeSeparator {
- get {return '.';}
- }
-
- protected virtual StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- List<TypeReference> decls = DocUtils.GetDeclaringTypes (
- type is GenericInstanceType ? type.GetElementType () : type);
- List<TypeReference> genArgs = GetGenericArguments (type);
- int argIdx = 0;
- int prev = 0;
- bool insertNested = false;
- foreach (var decl in decls) {
- TypeReference declDef = decl.Resolve () ?? decl;
- if (insertNested) {
- buf.Append (NestedTypeSeparator);
- }
- insertNested = true;
- AppendTypeName (buf, declDef, context);
- int ac = DocUtils.GetGenericArgumentCount (declDef);
- int c = ac - prev;
- prev = ac;
- if (c > 0) {
- buf.Append (GenericTypeContainer [0]);
- var origState = MemberFormatterState;
- MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters;
- _AppendTypeName (buf, genArgs [argIdx++], context);
- for (int i = 1; i < c; ++i) {
- _AppendTypeName (buf.Append (","), genArgs [argIdx++], context);
- }
- MemberFormatterState = origState;
- buf.Append (GenericTypeContainer [1]);
- }
- }
- return buf;
- }
-
- protected List<TypeReference> GetGenericArguments (TypeReference type)
- {
- var args = new List<TypeReference> ();
- GenericInstanceType inst = type as GenericInstanceType;
- if (inst != null)
- args.AddRange (inst.GenericArguments.Cast<TypeReference> ());
- else
- args.AddRange (type.GenericParameters.Cast<TypeReference> ());
- return args;
- }
-
- protected virtual StringBuilder AppendGenericTypeConstraints (StringBuilder buf, TypeReference type)
- {
- return buf;
- }
-
- protected virtual string GetConstructorName (MethodReference constructor)
- {
- return constructor.Name;
- }
-
- protected virtual string GetMethodName (MethodReference method)
- {
- return method.Name;
- }
-
- protected virtual string GetPropertyName (PropertyReference property)
- {
- return property.Name;
- }
-
- protected virtual string GetFieldName (FieldReference field)
- {
- return field.Name;
- }
-
- protected virtual string GetEventName (EventReference e)
- {
- return e.Name;
- }
-
- public string GetDeclaration (MemberReference mreference)
- {
- return GetDeclaration (mreference.Resolve ());
- }
-
- string GetDeclaration (IMemberDefinition member)
- {
- if (member == null)
- throw new ArgumentNullException ("member");
- TypeDefinition type = member as TypeDefinition;
- if (type != null)
- return GetTypeDeclaration (type);
- MethodDefinition method = member as MethodDefinition;
- if (method != null && method.IsConstructor)
- return GetConstructorDeclaration (method);
- if (method != null)
- return GetMethodDeclaration (method);
- PropertyDefinition prop = member as PropertyDefinition;
- if (prop != null)
- return GetPropertyDeclaration (prop);
- FieldDefinition field = member as FieldDefinition;
- if (field != null)
- return GetFieldDeclaration (field);
- EventDefinition e = member as EventDefinition;
- if (e != null)
- return GetEventDeclaration (e);
- throw new NotSupportedException ("Can't handle: " + member.GetType().ToString());
- }
-
- protected virtual string GetTypeDeclaration (TypeDefinition type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
- StringBuilder buf = new StringBuilder (type.Name.Length);
- _AppendTypeName (buf, type, null);
- AppendGenericTypeConstraints (buf, type);
- return buf.ToString ();
- }
-
- protected virtual string GetConstructorDeclaration (MethodDefinition constructor)
- {
- return GetConstructorName (constructor);
- }
-
- protected virtual string GetMethodDeclaration (MethodDefinition method)
- {
- if (method.HasCustomAttributes && method.CustomAttributes.Cast<CustomAttribute>().Any(
- ca => ca.GetDeclaringType() == "System.Diagnostics.Contracts.ContractInvariantMethodAttribute"))
- return null;
-
- // Special signature for destructors.
- if (method.Name == "Finalize" && method.Parameters.Count == 0)
- return GetFinalizerName (method);
-
- StringBuilder buf = new StringBuilder ();
-
- AppendVisibility (buf, method);
- if (buf.Length == 0 &&
- !(DocUtils.IsExplicitlyImplemented (method) && !method.IsSpecialName))
- return null;
-
- AppendModifiers (buf, method);
-
- if (buf.Length != 0)
- buf.Append (" ");
- buf.Append (GetTypeName (method.ReturnType, new DynamicParserContext (method.MethodReturnType))).Append (" ");
-
- AppendMethodName (buf, method);
- AppendGenericMethod (buf, method).Append (" ");
- AppendParameters (buf, method, method.Parameters);
- AppendGenericMethodConstraints (buf, method);
- return buf.ToString ();
- }
-
- protected virtual StringBuilder AppendMethodName (StringBuilder buf, MethodDefinition method)
- {
- return buf.Append (method.Name);
- }
-
- protected virtual string GetFinalizerName (MethodDefinition method)
- {
- return "Finalize";
- }
-
- protected virtual StringBuilder AppendVisibility (StringBuilder buf, MethodDefinition method)
- {
- return buf;
- }
-
- protected virtual StringBuilder AppendModifiers (StringBuilder buf, MethodDefinition method)
- {
- return buf;
- }
-
- protected virtual StringBuilder AppendGenericMethod (StringBuilder buf, MethodDefinition method)
- {
- return buf;
- }
-
- protected virtual StringBuilder AppendParameters (StringBuilder buf, MethodDefinition method, IList<ParameterDefinition> parameters)
- {
- return buf;
- }
-
- protected virtual StringBuilder AppendGenericMethodConstraints (StringBuilder buf, MethodDefinition method)
- {
- return buf;
- }
-
- protected virtual string GetPropertyDeclaration (PropertyDefinition property)
- {
- return GetPropertyName (property);
- }
-
- protected virtual string GetFieldDeclaration (FieldDefinition field)
- {
- return GetFieldName (field);
- }
-
- protected virtual string GetEventDeclaration (EventDefinition e)
- {
- return GetEventName (e);
- }
-}
-
-class ILFullMemberFormatter : MemberFormatter {
-
- public override string Language {
- get {return "ILAsm";}
- }
-
- protected override char NestedTypeSeparator {
- get {
- return '/';
- }
- }
-
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- if (GetBuiltinType (type.FullName) != null)
- return buf;
- string ns = DocUtils.GetNamespace (type);
- if (ns != null && ns.Length > 0) {
- if (type.IsValueType)
- buf.Append ("valuetype ");
- else
- buf.Append ("class ");
- buf.Append (ns).Append ('.');
- }
- return buf;
- }
-
- protected static string GetBuiltinType (string t)
- {
- switch (t) {
- case "System.Byte": return "unsigned int8";
- case "System.SByte": return "int8";
- case "System.Int16": return "int16";
- case "System.Int32": return "int32";
- case "System.Int64": return "int64";
- case "System.IntPtr": return "native int";
-
- case "System.UInt16": return "unsigned int16";
- case "System.UInt32": return "unsigned int32";
- case "System.UInt64": return "unsigned int64";
- case "System.UIntPtr": return "native unsigned int";
-
- case "System.Single": return "float32";
- case "System.Double": return "float64";
- case "System.Boolean": return "bool";
- case "System.Char": return "char";
- case "System.Void": return "void";
- case "System.String": return "string";
- case "System.Object": return "object";
- }
- return null;
- }
-
- protected override StringBuilder AppendTypeName (StringBuilder buf, string typename)
- {
- return buf.Append (typename);
- }
-
- protected override StringBuilder AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (type is GenericParameter) {
- AppendGenericParameterConstraints (buf, (GenericParameter) type).Append (type.Name);
- return buf;
- }
-
- string s = GetBuiltinType (type.FullName);
- if (s != null) {
- return buf.Append (s);
- }
- return base.AppendTypeName (buf, type, context);
- }
-
- private StringBuilder AppendGenericParameterConstraints (StringBuilder buf, GenericParameter type)
- {
- if (MemberFormatterState != MemberFormatterState.WithinGenericTypeParameters) {
- return buf.Append (type.Owner is TypeReference ? "!" : "!!");
- }
- GenericParameterAttributes attrs = type.Attributes;
- if ((attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0)
- buf.Append ("class ");
- if ((attrs & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0)
- buf.Append ("struct ");
- if ((attrs & GenericParameterAttributes.DefaultConstructorConstraint) != 0)
- buf.Append (".ctor ");
- IList<TypeReference> constraints = type.Constraints;
- MemberFormatterState = 0;
- if (constraints.Count > 0) {
- var full = new ILFullMemberFormatter ();
- buf.Append ("(").Append (full.GetName (constraints [0]));
- for (int i = 1; i < constraints.Count; ++i) {
- buf.Append (", ").Append (full.GetName (constraints [i]));
- }
- buf.Append (") ");
- }
- MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters;
-
- if ((attrs & GenericParameterAttributes.Covariant) != 0)
- buf.Append ("+ ");
- if ((attrs & GenericParameterAttributes.Contravariant) != 0)
- buf.Append ("- ");
- return buf;
- }
-
- protected override string GetTypeDeclaration (TypeDefinition type)
- {
- string visibility = GetTypeVisibility (type.Attributes);
- if (visibility == null)
- return null;
-
- StringBuilder buf = new StringBuilder ();
-
- buf.Append (".class ");
- if (type.IsNested)
- buf.Append ("nested ");
- buf.Append (visibility).Append (" ");
- if (type.IsInterface)
- buf.Append ("interface ");
- if (type.IsSequentialLayout)
- buf.Append ("sequential ");
- if (type.IsAutoLayout)
- buf.Append ("auto ");
- if (type.IsAnsiClass)
- buf.Append ("ansi ");
- if (type.IsAbstract)
- buf.Append ("abstract ");
- if (type.IsSerializable)
- buf.Append ("serializable ");
- if (type.IsSealed)
- buf.Append ("sealed ");
- if (type.IsBeforeFieldInit)
- buf.Append ("beforefieldinit ");
- var state = MemberFormatterState;
- MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters;
- buf.Append (GetName (type));
- MemberFormatterState = state;
- var full = new ILFullMemberFormatter ();
- if (type.BaseType != null) {
- buf.Append (" extends ");
- if (type.BaseType.FullName == "System.Object")
- buf.Append ("System.Object");
- else
- buf.Append (full.GetName (type.BaseType).Substring ("class ".Length));
- }
- bool first = true;
- foreach (var name in type.Interfaces.Where (i => MDocUpdater.IsPublic (i.InterfaceType.Resolve ()))
- .Select (i => full.GetName (i.InterfaceType))
- .OrderBy (n => n)) {
- if (first) {
- buf.Append (" implements ");
- first = false;
- }
- else {
- buf.Append (", ");
- }
- buf.Append (name);
- }
-
- return buf.ToString ();
- }
-
- protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- List<TypeReference> decls = DocUtils.GetDeclaringTypes (
- type is GenericInstanceType ? type.GetElementType () : type);
- bool first = true;
- foreach (var decl in decls) {
- TypeReference declDef = decl.Resolve () ?? decl;
- if (!first) {
- buf.Append (NestedTypeSeparator);
- }
- first = false;
- AppendTypeName (buf, declDef, context);
- }
- buf.Append ('<');
- first = true;
- foreach (TypeReference arg in GetGenericArguments (type)) {
- if (!first)
- buf.Append (", ");
- first = false;
- _AppendTypeName (buf, arg, context);
- }
- buf.Append ('>');
- return buf;
- }
-
- static string GetTypeVisibility (TypeAttributes ta)
- {
- switch (ta & TypeAttributes.VisibilityMask) {
- case TypeAttributes.Public:
- case TypeAttributes.NestedPublic:
- return "public";
-
- case TypeAttributes.NestedFamily:
- case TypeAttributes.NestedFamORAssem:
- return "protected";
-
- default:
- return null;
- }
- }
-
- protected override string GetConstructorDeclaration (MethodDefinition constructor)
- {
- return GetMethodDeclaration (constructor);
- }
-
- protected override string GetMethodDeclaration (MethodDefinition method)
- {
- if (method.IsPrivate && !DocUtils.IsExplicitlyImplemented (method))
- return null;
-
- var buf = new StringBuilder ();
- buf.Append (".method ");
- AppendVisibility (buf, method);
- if (method.IsStatic)
- buf.Append ("static ");
- if (method.IsHideBySig)
- buf.Append ("hidebysig ");
- if (method.IsPInvokeImpl) {
- var info = method.PInvokeInfo;
- buf.Append ("pinvokeimpl (\"")
- .Append (info.Module.Name)
- .Append ("\" as \"")
- .Append (info.EntryPoint)
- .Append ("\"");
- if (info.IsCharSetAuto)
- buf.Append (" auto");
- if (info.IsCharSetUnicode)
- buf.Append (" unicode");
- if (info.IsCharSetAnsi)
- buf.Append (" ansi");
- if (info.IsCallConvCdecl)
- buf.Append (" cdecl");
- if (info.IsCallConvStdCall)
- buf.Append (" stdcall");
- if (info.IsCallConvWinapi)
- buf.Append (" winapi");
- if (info.IsCallConvThiscall)
- buf.Append (" thiscall");
- if (info.SupportsLastError)
- buf.Append (" lasterr");
- buf.Append (")");
- }
- if (method.IsSpecialName)
- buf.Append ("specialname ");
- if (method.IsRuntimeSpecialName)
- buf.Append ("rtspecialname ");
- if (method.IsNewSlot)
- buf.Append ("newslot ");
- if (method.IsVirtual)
- buf.Append ("virtual ");
- if (!method.IsStatic)
- buf.Append ("instance ");
- _AppendTypeName (buf, method.ReturnType, new DynamicParserContext (method.MethodReturnType));
- buf.Append (' ')
- .Append (method.Name);
- if (method.IsGenericMethod ()) {
- var state = MemberFormatterState;
- MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters;
- IList<GenericParameter> args = method.GenericParameters;
- if (args.Count > 0) {
- buf.Append ("<");
- _AppendTypeName (buf, args [0], null);
- for (int i = 1; i < args.Count; ++i)
- _AppendTypeName (buf.Append (", "), args [i], null);
- buf.Append (">");
- }
- MemberFormatterState = state;
- }
-
- buf.Append ('(');
- bool first = true;
- for (int i = 0; i < method.Parameters.Count; ++i) {
- if (!first)
- buf.Append (", ");
- first = false;
- _AppendTypeName (buf, method.Parameters [i].ParameterType, new DynamicParserContext (method.Parameters [i]));
- buf.Append (' ');
- buf.Append (method.Parameters [i].Name);
- }
- buf.Append (')');
- if (method.IsIL)
- buf.Append (" cil");
- if (method.IsRuntime)
- buf.Append (" runtime");
- if (method.IsManaged)
- buf.Append (" managed");
-
- return buf.ToString ();
- }
-
- protected override StringBuilder AppendMethodName (StringBuilder buf, MethodDefinition method)
- {
- if (DocUtils.IsExplicitlyImplemented (method)) {
- TypeReference iface;
- MethodReference ifaceMethod;
- DocUtils.GetInfoForExplicitlyImplementedMethod (method, out iface, out ifaceMethod);
- return buf.Append (new CSharpMemberFormatter ().GetName (iface))
- .Append ('.')
- .Append (ifaceMethod.Name);
- }
- return base.AppendMethodName (buf, method);
- }
-
- protected override string RefTypeModifier {
- get {return "";}
- }
-
- protected override StringBuilder AppendVisibility (StringBuilder buf, MethodDefinition method)
- {
- if (method.IsPublic)
- return buf.Append ("public ");
- if (method.IsFamilyAndAssembly)
- return buf.Append ("familyandassembly");
- if (method.IsFamilyOrAssembly)
- return buf.Append ("familyorassembly");
- if (method.IsFamily)
- return buf.Append ("family");
- return buf;
- }
-
- protected override StringBuilder AppendModifiers (StringBuilder buf, MethodDefinition method)
- {
- string modifiers = String.Empty;
- if (method.IsStatic) modifiers += " static";
- if (method.IsVirtual && !method.IsAbstract) {
- if ((method.Attributes & MethodAttributes.NewSlot) != 0) modifiers += " virtual";
- else modifiers += " override";
- }
- TypeDefinition declType = (TypeDefinition) method.DeclaringType;
- if (method.IsAbstract && !declType.IsInterface) modifiers += " abstract";
- if (method.IsFinal) modifiers += " sealed";
- if (modifiers == " virtual sealed") modifiers = "";
-
- return buf.Append (modifiers);
- }
-
- protected override StringBuilder AppendGenericMethod (StringBuilder buf, MethodDefinition method)
- {
- if (method.IsGenericMethod ()) {
- IList<GenericParameter> args = method.GenericParameters;
- if (args.Count > 0) {
- buf.Append ("<");
- buf.Append (args [0].Name);
- for (int i = 1; i < args.Count; ++i)
- buf.Append (",").Append (args [i].Name);
- buf.Append (">");
- }
- }
- return buf;
- }
-
- protected override StringBuilder AppendParameters (StringBuilder buf, MethodDefinition method, IList<ParameterDefinition> parameters)
- {
- return AppendParameters (buf, method, parameters, '(', ')');
- }
-
- private StringBuilder AppendParameters (StringBuilder buf, MethodDefinition method, IList<ParameterDefinition> parameters, char begin, char end)
- {
- buf.Append (begin);
-
- if (parameters.Count > 0) {
- if (DocUtils.IsExtensionMethod (method))
- buf.Append ("this ");
- AppendParameter (buf, parameters [0]);
- for (int i = 1; i < parameters.Count; ++i) {
- buf.Append (", ");
- AppendParameter (buf, parameters [i]);
- }
- }
-
- return buf.Append (end);
- }
-
- private StringBuilder AppendParameter (StringBuilder buf, ParameterDefinition parameter)
- {
- if (parameter.ParameterType is ByReferenceType) {
- if (parameter.IsOut)
- buf.Append ("out ");
- else
- buf.Append ("ref ");
- }
- buf.Append (GetName (parameter.ParameterType)).Append (" ");
- return buf.Append (parameter.Name);
- }
-
- protected override string GetPropertyDeclaration (PropertyDefinition property)
- {
- MethodDefinition gm = null, sm = null;
-
- string get_visible = null;
- if ((gm = property.GetMethod) != null &&
- (DocUtils.IsExplicitlyImplemented (gm) ||
- (!gm.IsPrivate && !gm.IsAssembly && !gm.IsFamilyAndAssembly)))
- get_visible = AppendVisibility (new StringBuilder (), gm).ToString ();
- string set_visible = null;
- if ((sm = property.SetMethod) != null &&
- (DocUtils.IsExplicitlyImplemented (sm) ||
- (!sm.IsPrivate && !sm.IsAssembly && !sm.IsFamilyAndAssembly)))
- set_visible = AppendVisibility (new StringBuilder (), sm).ToString ();
-
- if ((set_visible == null) && (get_visible == null))
- return null;
-
- StringBuilder buf = new StringBuilder ()
- .Append (".property ");
- if (!(gm ?? sm).IsStatic)
- buf.Append ("instance ");
- _AppendTypeName (buf, property.PropertyType, new DynamicParserContext (property));
- buf.Append (' ').Append (property.Name);
- if (!property.HasParameters || property.Parameters.Count == 0)
- return buf.ToString ();
-
- buf.Append ('(');
- bool first = true;
- foreach (ParameterDefinition p in property.Parameters) {
- if (!first)
- buf.Append (", ");
- first = false;
- _AppendTypeName (buf, p.ParameterType, new DynamicParserContext (p));
- }
- buf.Append (')');
-
- return buf.ToString ();
- }
-
- protected override string GetFieldDeclaration (FieldDefinition field)
- {
- TypeDefinition declType = (TypeDefinition) field.DeclaringType;
- if (declType.IsEnum && field.Name == "value__")
- return null; // This member of enums aren't documented.
-
- StringBuilder buf = new StringBuilder ();
- AppendFieldVisibility (buf, field);
- if (buf.Length == 0)
- return null;
-
- buf.Insert (0, ".field ");
-
- if (field.IsStatic)
- buf.Append ("static ");
- if (field.IsInitOnly)
- buf.Append ("initonly ");
- if (field.IsLiteral)
- buf.Append ("literal ");
- _AppendTypeName (buf, field.FieldType, new DynamicParserContext (field));
- buf.Append (' ').Append (field.Name);
- AppendFieldValue (buf, field);
-
- return buf.ToString ();
- }
-
- static StringBuilder AppendFieldVisibility (StringBuilder buf, FieldDefinition field)
- {
- if (field.IsPublic)
- return buf.Append ("public ");
- if (field.IsFamilyAndAssembly)
- return buf.Append ("familyandassembly ");
- if (field.IsFamilyOrAssembly)
- return buf.Append ("familyorassembly ");
- if (field.IsFamily)
- return buf.Append ("family ");
- return buf;
- }
-
- static StringBuilder AppendFieldValue (StringBuilder buf, FieldDefinition field)
- {
- // enums have a value__ field, which we ignore
- if (field.DeclaringType.IsGenericType ())
- return buf;
- if (field.HasConstant && field.IsLiteral) {
- object val = null;
- try {
- val = field.Constant;
- } catch {
- return buf;
- }
- if (val == null)
- buf.Append (" = ").Append ("null");
- else if (val is Enum)
- buf.Append (" = ")
- .Append (GetBuiltinType (field.DeclaringType.GetUnderlyingType ().FullName))
- .Append ('(')
- .Append (val.ToString ())
- .Append (')');
- else if (val is IFormattable) {
- string value = ((IFormattable)val).ToString(null, CultureInfo.InvariantCulture);
- buf.Append (" = ");
- if (val is string)
- buf.Append ("\"" + value + "\"");
- else
- buf.Append (GetBuiltinType (field.DeclaringType.GetUnderlyingType ().FullName))
- .Append ('(')
- .Append (value)
- .Append (')');
- }
- }
- return buf;
- }
-
- protected override string GetEventDeclaration (EventDefinition e)
- {
- StringBuilder buf = new StringBuilder ();
- if (AppendVisibility (buf, e.AddMethod).Length == 0) {
- return null;
- }
-
- buf.Length = 0;
- buf.Append (".event ")
- .Append (GetName (e.EventType))
- .Append (' ')
- .Append (e.Name);
-
- return buf.ToString ();
- }
-}
-
-class ILMemberFormatter : ILFullMemberFormatter {
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- return buf;
- }
-}
-
- class ILNativeTypeMemberFormatter : ILFullMemberFormatter {
- protected static string _GetBuiltinType (string t)
- {
- //string moddedType = base.GetBuiltinType (t);
- return null;
- //return moddedType;
- }
- }
-
- class CSharpNativeTypeMemberFormatter : CSharpFullMemberFormatter {
- protected override string GetCSharpType (string t) {
- string moddedType = base.GetCSharpType (t);
-
- switch (moddedType) {
- case "int": return "nint";
- case "uint":
- return "nuint";
- case "float":
- return "nfloat";
- case "System.Drawing.SizeF":
- return "CoreGraphics.CGSize";
- case "System.Drawing.PointF":
- return "CoreGraphics.CGPoint";
- case "System.Drawing.RectangleF":
- return "CoreGraphics.CGPoint";
- }
- return null;
- }
- }
-
-class CSharpFullMemberFormatter : MemberFormatter {
-
- public override string Language {
- get {return "C#";}
- }
-
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
-
- string ns = DocUtils.GetNamespace (type);
- if (GetCSharpType (type.FullName) == null && ns != null && ns.Length > 0 && ns != "System")
- buf.Append (ns).Append ('.');
- return buf;
- }
-
- protected virtual string GetCSharpType (string t)
- {
- switch (t) {
- case "System.Byte": return "byte";
- case "System.SByte": return "sbyte";
- case "System.Int16": return "short";
- case "System.Int32": return "int";
- case "System.Int64": return "long";
-
- case "System.UInt16": return "ushort";
- case "System.UInt32": return "uint";
- case "System.UInt64": return "ulong";
-
- case "System.Single": return "float";
- case "System.Double": return "double";
- case "System.Decimal": return "decimal";
- case "System.Boolean": return "bool";
- case "System.Char": return "char";
- case "System.Void": return "void";
- case "System.String": return "string";
- case "System.Object": return "object";
- }
- return null;
- }
-
- protected override StringBuilder AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (context != null && context.TransformFlags != null &&
- (context.TransformFlags.Count == 0 || context.TransformFlags [context.TransformIndex])) {
- context.TransformIndex++;
- return buf.Append ("dynamic");
- }
-
- if (type is GenericParameter)
- return AppendGenericParameterConstraints (buf, (GenericParameter) type, context).Append (type.Name);
- string t = type.FullName;
- if (!t.StartsWith ("System.")) {
- return base.AppendTypeName (buf, type, context);
- }
-
- string s = GetCSharpType (t);
- if (s != null) {
- if (context != null)
- context.TransformIndex++;
- return buf.Append (s);
- }
-
- return base.AppendTypeName (buf, type, context);
- }
-
- private StringBuilder AppendGenericParameterConstraints (StringBuilder buf, GenericParameter type, DynamicParserContext context)
- {
- if (MemberFormatterState != MemberFormatterState.WithinGenericTypeParameters)
- return buf;
- GenericParameterAttributes attrs = type.Attributes;
- bool isout = (attrs & GenericParameterAttributes.Covariant) != 0;
- bool isin = (attrs & GenericParameterAttributes.Contravariant) != 0;
- if (isin)
- buf.Append ("in ");
- else if (isout)
- buf.Append ("out ");
- return buf;
- }
-
- protected override string GetTypeDeclaration (TypeDefinition type)
- {
- string visibility = GetTypeVisibility (type.Attributes);
- if (visibility == null)
- return null;
-
- StringBuilder buf = new StringBuilder ();
-
- buf.Append (visibility);
- buf.Append (" ");
-
- MemberFormatter full = new CSharpFullMemberFormatter ();
-
- if (DocUtils.IsDelegate (type)) {
- buf.Append("delegate ");
- MethodDefinition invoke = type.GetMethod ("Invoke");
- buf.Append (full.GetName (invoke.ReturnType, new DynamicParserContext (invoke.MethodReturnType))).Append (" ");
- buf.Append (GetName (type));
- AppendParameters (buf, invoke, invoke.Parameters);
- AppendGenericTypeConstraints (buf, type);
- buf.Append (";");
-
- return buf.ToString();
- }
-
- if (type.IsAbstract && !type.IsInterface)
- buf.Append("abstract ");
- if (type.IsSealed && !DocUtils.IsDelegate (type) && !type.IsValueType)
- buf.Append("sealed ");
- buf.Replace ("abstract sealed", "static");
-
- buf.Append (GetTypeKind (type));
- buf.Append (" ");
- buf.Append (GetCSharpType (type.FullName) == null
- ? GetName (type)
- : type.Name);
-
- if (!type.IsEnum) {
- TypeReference basetype = type.BaseType;
- if (basetype != null && basetype.FullName == "System.Object" || type.IsValueType) // FIXME
- basetype = null;
-
- List<string> interface_names = DocUtils.GetUserImplementedInterfaces (type)
- .Select (iface => full.GetName (iface))
- .OrderBy (s => s)
- .ToList ();
-
- if (basetype != null || interface_names.Count > 0)
- buf.Append (" : ");
-
- if (basetype != null) {
- buf.Append (full.GetName (basetype));
- if (interface_names.Count > 0)
- buf.Append (", ");
- }
-
- for (int i = 0; i < interface_names.Count; i++){
- if (i != 0)
- buf.Append (", ");
- buf.Append (interface_names [i]);
- }
- AppendGenericTypeConstraints (buf, type);
- }
-
- return buf.ToString ();
- }
-
- static string GetTypeKind (TypeDefinition t)
- {
- if (t.IsEnum)
- return "enum";
- if (t.IsValueType)
- return "struct";
- if (t.IsClass || t.FullName == "System.Enum")
- return "class";
- if (t.IsInterface)
- return "interface";
- throw new ArgumentException(t.FullName);
- }
-
- static string GetTypeVisibility (TypeAttributes ta)
- {
- switch (ta & TypeAttributes.VisibilityMask) {
- case TypeAttributes.Public:
- case TypeAttributes.NestedPublic:
- return "public";
-
- case TypeAttributes.NestedFamily:
- case TypeAttributes.NestedFamORAssem:
- return "protected";
-
- default:
- return null;
- }
- }
-
- protected override StringBuilder AppendGenericTypeConstraints (StringBuilder buf, TypeReference type)
- {
- if (type.GenericParameters.Count == 0)
- return buf;
- return AppendConstraints (buf, type.GenericParameters);
- }
-
- private StringBuilder AppendConstraints (StringBuilder buf, IList<GenericParameter> genArgs)
- {
- foreach (GenericParameter genArg in genArgs) {
- GenericParameterAttributes attrs = genArg.Attributes;
- IList<TypeReference> constraints = genArg.Constraints;
- if (attrs == GenericParameterAttributes.NonVariant && constraints.Count == 0)
- continue;
-
- bool isref = (attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0;
- bool isvt = (attrs & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0;
- bool isnew = (attrs & GenericParameterAttributes.DefaultConstructorConstraint) != 0;
- bool comma = false;
-
- if (!isref && !isvt && !isnew && constraints.Count == 0)
- continue;
- buf.Append (" where ").Append (genArg.Name).Append (" : ");
- if (isref) {
- buf.Append ("class");
- comma = true;
- }
- else if (isvt) {
- buf.Append ("struct");
- comma = true;
- }
- if (constraints.Count > 0 && !isvt) {
- if (comma)
- buf.Append (", ");
- buf.Append (GetTypeName (constraints [0]));
- for (int i = 1; i < constraints.Count; ++i)
- buf.Append (", ").Append (GetTypeName (constraints [i]));
- }
- if (isnew && !isvt) {
- if (comma)
- buf.Append (", ");
- buf.Append ("new()");
- }
- }
- return buf;
- }
-
- protected override string GetConstructorDeclaration (MethodDefinition constructor)
- {
- StringBuilder buf = new StringBuilder ();
- AppendVisibility (buf, constructor);
- if (buf.Length == 0)
- return null;
-
- buf.Append (' ');
- base.AppendTypeName (buf, constructor.DeclaringType.Name).Append (' ');
- AppendParameters (buf, constructor, constructor.Parameters);
- buf.Append (';');
-
- return buf.ToString ();
- }
-
- protected override string GetMethodDeclaration (MethodDefinition method)
- {
- string decl = base.GetMethodDeclaration (method);
- if (decl != null)
- return decl + ";";
- return null;
- }
-
- protected override StringBuilder AppendMethodName (StringBuilder buf, MethodDefinition method)
- {
- if (DocUtils.IsExplicitlyImplemented (method)) {
- TypeReference iface;
- MethodReference ifaceMethod;
- DocUtils.GetInfoForExplicitlyImplementedMethod (method, out iface, out ifaceMethod);
- return buf.Append (new CSharpMemberFormatter ().GetName (iface))
- .Append ('.')
- .Append (ifaceMethod.Name);
- }
- return base.AppendMethodName (buf, method);
- }
-
- protected override StringBuilder AppendGenericMethodConstraints (StringBuilder buf, MethodDefinition method)
- {
- if (method.GenericParameters.Count == 0)
- return buf;
- return AppendConstraints (buf, method.GenericParameters);
- }
-
- protected override string RefTypeModifier {
- get {return "";}
- }
-
- protected override string GetFinalizerName (MethodDefinition method)
- {
- return "~" + method.DeclaringType.Name + " ()";
- }
-
- protected override StringBuilder AppendVisibility (StringBuilder buf, MethodDefinition method)
- {
- if (method == null)
- return buf;
- if (method.IsPublic)
- return buf.Append ("public");
- if (method.IsFamily || method.IsFamilyOrAssembly)
- return buf.Append ("protected");
- return buf;
- }
-
- protected override StringBuilder AppendModifiers (StringBuilder buf, MethodDefinition method)
- {
- string modifiers = String.Empty;
- if (method.IsStatic) modifiers += " static";
- if (method.IsVirtual && !method.IsAbstract) {
- if ((method.Attributes & MethodAttributes.NewSlot) != 0) modifiers += " virtual";
- else modifiers += " override";
- }
- TypeDefinition declType = (TypeDefinition) method.DeclaringType;
- if (method.IsAbstract && !declType.IsInterface) modifiers += " abstract";
- if (method.IsFinal) modifiers += " sealed";
- if (modifiers == " virtual sealed") modifiers = "";
-
- return buf.Append (modifiers);
- }
-
- protected override StringBuilder AppendGenericMethod (StringBuilder buf, MethodDefinition method)
- {
- if (method.IsGenericMethod ()) {
- IList<GenericParameter> args = method.GenericParameters;
- if (args.Count > 0) {
- buf.Append ("<");
- buf.Append (args [0].Name);
- for (int i = 1; i < args.Count; ++i)
- buf.Append (",").Append (args [i].Name);
- buf.Append (">");
- }
- }
- return buf;
- }
-
- protected override StringBuilder AppendParameters (StringBuilder buf, MethodDefinition method, IList<ParameterDefinition> parameters)
- {
- return AppendParameters (buf, method, parameters, '(', ')');
- }
-
- private StringBuilder AppendParameters (StringBuilder buf, MethodDefinition method, IList<ParameterDefinition> parameters, char begin, char end)
- {
- buf.Append (begin);
-
- if (parameters.Count > 0) {
- if (DocUtils.IsExtensionMethod (method))
- buf.Append ("this ");
- AppendParameter (buf, parameters [0]);
- for (int i = 1; i < parameters.Count; ++i) {
- buf.Append (", ");
- AppendParameter (buf, parameters [i]);
- }
- }
-
- return buf.Append (end);
- }
-
- private StringBuilder AppendParameter (StringBuilder buf, ParameterDefinition parameter)
- {
- if (parameter.ParameterType is ByReferenceType) {
- if (parameter.IsOut)
- buf.Append ("out ");
- else
- buf.Append ("ref ");
- }
- buf.Append (GetTypeName (parameter.ParameterType, new DynamicParserContext (parameter))).Append (" ");
- buf.Append (parameter.Name);
- if (parameter.HasDefault && parameter.IsOptional && parameter.HasConstant) {
- buf.AppendFormat (" = {0}", MDocUpdater.MakeAttributesValueString (parameter.Constant, parameter.ParameterType));
- }
- return buf;
- }
-
- protected override string GetPropertyDeclaration (PropertyDefinition property)
- {
- MethodDefinition method;
-
- string get_visible = null;
- if ((method = property.GetMethod) != null &&
- (DocUtils.IsExplicitlyImplemented (method) ||
- (!method.IsPrivate && !method.IsAssembly && !method.IsFamilyAndAssembly)))
- get_visible = AppendVisibility (new StringBuilder (), method).ToString ();
- string set_visible = null;
- if ((method = property.SetMethod) != null &&
- (DocUtils.IsExplicitlyImplemented (method) ||
- (!method.IsPrivate && !method.IsAssembly && !method.IsFamilyAndAssembly)))
- set_visible = AppendVisibility (new StringBuilder (), method).ToString ();
-
- if ((set_visible == null) && (get_visible == null))
- return null;
-
- string visibility;
- StringBuilder buf = new StringBuilder ();
- if (get_visible != null && (set_visible == null || (set_visible != null && get_visible == set_visible)))
- buf.Append (visibility = get_visible);
- else if (set_visible != null && get_visible == null)
- buf.Append (visibility = set_visible);
- else
- buf.Append (visibility = "public");
-
- // Pick an accessor to use for static/virtual/override/etc. checks.
- method = property.SetMethod;
- if (method == null)
- method = property.GetMethod;
-
- string modifiers = String.Empty;
- if (method.IsStatic) modifiers += " static";
- if (method.IsVirtual && !method.IsAbstract) {
- if ((method.Attributes & MethodAttributes.NewSlot) != 0)
- modifiers += " virtual";
- else
- modifiers += " override";
- }
- TypeDefinition declDef = (TypeDefinition) method.DeclaringType;
- if (method.IsAbstract && !declDef.IsInterface)
- modifiers += " abstract";
- if (method.IsFinal)
- modifiers += " sealed";
- if (modifiers == " virtual sealed")
- modifiers = "";
- buf.Append (modifiers).Append (' ');
-
- buf.Append (GetTypeName (property.PropertyType, new DynamicParserContext (property))).Append (' ');
-
- IEnumerable<MemberReference> defs = property.DeclaringType.GetDefaultMembers ();
- string name = property.Name;
- foreach (MemberReference mi in defs) {
- if (mi == property) {
- name = "this";
- break;
- }
- }
- buf.Append (name == "this" ? name : DocUtils.GetPropertyName (property));
-
- if (property.Parameters.Count != 0) {
- AppendParameters (buf, method, property.Parameters, '[', ']');
- }
-
- buf.Append (" {");
- if (get_visible != null) {
- if (get_visible != visibility)
- buf.Append (' ').Append (get_visible);
- buf.Append (" get;");
- }
- if (set_visible != null) {
- if (set_visible != visibility)
- buf.Append (' ').Append (set_visible);
- buf.Append (" set;");
- }
- buf.Append (" }");
-
- return buf [0] != ' ' ? buf.ToString () : buf.ToString (1, buf.Length-1);
- }
-
- protected override string GetFieldDeclaration (FieldDefinition field)
- {
- TypeDefinition declType = (TypeDefinition) field.DeclaringType;
- if (declType.IsEnum && field.Name == "value__")
- return null; // This member of enums aren't documented.
-
- StringBuilder buf = new StringBuilder ();
- AppendFieldVisibility (buf, field);
- if (buf.Length == 0)
- return null;
-
- if (declType.IsEnum)
- return field.Name;
-
- if (field.IsStatic && !field.IsLiteral)
- buf.Append (" static");
- if (field.IsInitOnly)
- buf.Append (" readonly");
- if (field.IsLiteral)
- buf.Append (" const");
-
- buf.Append (' ').Append (GetTypeName (field.FieldType, new DynamicParserContext (field))).Append (' ');
- buf.Append (field.Name);
- AppendFieldValue (buf, field);
- buf.Append (';');
-
- return buf.ToString ();
- }
-
- static StringBuilder AppendFieldVisibility (StringBuilder buf, FieldDefinition field)
- {
- if (field.IsPublic)
- return buf.Append ("public");
- if (field.IsFamily || field.IsFamilyOrAssembly)
- return buf.Append ("protected");
- return buf;
- }
-
- static StringBuilder AppendFieldValue (StringBuilder buf, FieldDefinition field)
- {
- // enums have a value__ field, which we ignore
- if (((TypeDefinition ) field.DeclaringType).IsEnum ||
- field.DeclaringType.IsGenericType ())
- return buf;
- if (field.HasConstant && field.IsLiteral) {
- object val = null;
- try {
- val = field.Constant;
- } catch {
- return buf;
- }
- if (val == null)
- buf.Append (" = ").Append ("null");
- else if (val is Enum)
- buf.Append (" = ").Append (val.ToString ());
- else if (val is IFormattable) {
- string value = ((IFormattable)val).ToString(null, CultureInfo.InvariantCulture);
- if (val is string)
- value = "\"" + value + "\"";
- buf.Append (" = ").Append (value);
- }
- }
- return buf;
- }
-
- protected override string GetEventDeclaration (EventDefinition e)
- {
- StringBuilder buf = new StringBuilder ();
- if (AppendVisibility (buf, e.AddMethod).Length == 0) {
- return null;
- }
-
- AppendModifiers (buf, e.AddMethod);
-
- buf.Append (" event ");
- buf.Append (GetTypeName (e.EventType, new DynamicParserContext (e.AddMethod.Parameters [0]))).Append (' ');
- buf.Append (e.Name).Append (';');
-
- return buf.ToString ();
- }
-}
-
-class CSharpMemberFormatter : CSharpFullMemberFormatter {
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- return buf;
- }
-}
-
-class DocTypeFullMemberFormatter : MemberFormatter {
- public static readonly MemberFormatter Default = new DocTypeFullMemberFormatter ();
-
- protected override char NestedTypeSeparator {
- get {return '+';}
- }
-}
-
-class DocTypeMemberFormatter : DocTypeFullMemberFormatter {
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- return buf;
- }
-}
-
-class SlashDocMemberFormatter : MemberFormatter {
-
- protected override char[] GenericTypeContainer {
- get {return new char[]{'{', '}'};}
- }
-
- private bool AddTypeCount = true;
-
- private TypeReference genDeclType;
- private MethodReference genDeclMethod;
-
- protected override StringBuilder AppendTypeName (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (type is GenericParameter) {
- int l = buf.Length;
- if (genDeclType != null) {
- IList<GenericParameter> genArgs = genDeclType.GenericParameters;
- for (int i = 0; i < genArgs.Count; ++i) {
- if (genArgs [i].Name == type.Name) {
- buf.Append ('`').Append (i);
- break;
- }
- }
- }
- if (genDeclMethod != null) {
- IList<GenericParameter> genArgs = null;
- if (genDeclMethod.IsGenericMethod ()) {
- genArgs = genDeclMethod.GenericParameters;
- for (int i = 0; i < genArgs.Count; ++i) {
- if (genArgs [i].Name == type.Name) {
- buf.Append ("``").Append (i);
- break;
- }
- }
- }
- }
- if (genDeclType == null && genDeclMethod == null) {
- // Probably from within an explicitly implemented interface member,
- // where CSC uses parameter names instead of indices (why?), e.g.
- // MyList`2.Mono#DocTest#Generic#IFoo{A}#Method``1(`0,``0) instead of
- // MyList`2.Mono#DocTest#Generic#IFoo{`0}#Method``1(`0,``0).
- buf.Append (type.Name);
- }
- if (buf.Length == l) {
- throw new Exception (string.Format (
- "Unable to translate generic parameter {0}; genDeclType={1}, genDeclMethod={2}",
- type.Name, genDeclType, genDeclMethod));
- }
- }
- else {
- base.AppendTypeName (buf, type, context);
- if (AddTypeCount) {
- int numArgs = type.GenericParameters.Count;
- if (type.DeclaringType != null)
- numArgs -= type.GenericParameters.Count;
- if (numArgs > 0) {
- buf.Append ('`').Append (numArgs);
- }
- }
- }
- return buf;
- }
-
- protected override StringBuilder AppendArrayModifiers (StringBuilder buf, ArrayType array)
- {
- buf.Append (ArrayDelimeters [0]);
- int rank = array.Rank;
- if (rank > 1) {
- buf.Append ("0:");
- for (int i = 1; i < rank; ++i) {
- buf.Append (",0:");
- }
- }
- return buf.Append (ArrayDelimeters [1]);
- }
-
- protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- if (!AddTypeCount)
- base.AppendGenericType (buf, type, context);
- else
- AppendType (buf, type, context);
- return buf;
- }
-
- private StringBuilder AppendType (StringBuilder buf, TypeReference type, DynamicParserContext context)
- {
- List<TypeReference> decls = DocUtils.GetDeclaringTypes (type);
- bool insertNested = false;
- int prevParamCount = 0;
- foreach (var decl in decls) {
- if (insertNested)
- buf.Append (NestedTypeSeparator);
- insertNested = true;
- base.AppendTypeName (buf, decl, context);
- int argCount = DocUtils.GetGenericArgumentCount (decl);
- int numArgs = argCount - prevParamCount;
- prevParamCount = argCount;
- if (numArgs > 0)
- buf.Append ('`').Append (numArgs);
- }
- return buf;
- }
-
- protected override string GetConstructorName (MethodReference constructor)
- {
- return GetMethodDefinitionName (constructor, "#ctor");
- }
-
- protected override string GetMethodName (MethodReference method)
- {
- string name = null;
- MethodDefinition methodDef = method as MethodDefinition;
- if (methodDef == null || !DocUtils.IsExplicitlyImplemented (methodDef))
- name = method.Name;
- else {
- TypeReference iface;
- MethodReference ifaceMethod;
- DocUtils.GetInfoForExplicitlyImplementedMethod (methodDef, out iface, out ifaceMethod);
- AddTypeCount = false;
- name = GetTypeName (iface) + "." + ifaceMethod.Name;
- AddTypeCount = true;
- }
- return GetMethodDefinitionName (method, name);
- }
-
- private string GetMethodDefinitionName (MethodReference method, string name)
- {
- StringBuilder buf = new StringBuilder ();
- buf.Append (GetTypeName (method.DeclaringType));
- buf.Append ('.');
- buf.Append (name.Replace (".", "#"));
- if (method.IsGenericMethod ()) {
- IList<GenericParameter> genArgs = method.GenericParameters;
- if (genArgs.Count > 0)
- buf.Append ("``").Append (genArgs.Count);
- }
- IList<ParameterDefinition> parameters = method.Parameters;
- try {
- genDeclType = method.DeclaringType;
- genDeclMethod = method;
- AppendParameters (buf, method.DeclaringType.GenericParameters, parameters);
- }
- finally {
- genDeclType = null;
- genDeclMethod = null;
- }
- return buf.ToString ();
- }
-
- private StringBuilder AppendParameters (StringBuilder buf, IList<GenericParameter> genArgs, IList<ParameterDefinition> parameters)
- {
- if (parameters.Count == 0)
- return buf;
-
- buf.Append ('(');
-
- AppendParameter (buf, genArgs, parameters [0]);
- for (int i = 1; i < parameters.Count; ++i) {
- buf.Append (',');
- AppendParameter (buf, genArgs, parameters [i]);
- }
-
- return buf.Append (')');
- }
-
- private StringBuilder AppendParameter (StringBuilder buf, IList<GenericParameter> genArgs, ParameterDefinition parameter)
- {
- AddTypeCount = false;
- buf.Append (GetTypeName (parameter.ParameterType));
- AddTypeCount = true;
- return buf;
- }
-
- protected override string GetPropertyName (PropertyReference property)
- {
- string name = null;
-
- PropertyDefinition propertyDef = property as PropertyDefinition;
- MethodDefinition method = null;
- if (propertyDef != null)
- method = propertyDef.GetMethod ?? propertyDef.SetMethod;
- if (method != null && !DocUtils.IsExplicitlyImplemented (method))
- name = property.Name;
- else {
- TypeReference iface;
- MethodReference ifaceMethod;
- DocUtils.GetInfoForExplicitlyImplementedMethod (method, out iface, out ifaceMethod);
- AddTypeCount = false;
- name = string.Join ("#", new string[]{
- GetTypeName (iface).Replace (".", "#"),
- DocUtils.GetMember (property.Name)
- });
- AddTypeCount = true;
- }
-
- StringBuilder buf = new StringBuilder ();
- buf.Append (GetName (property.DeclaringType));
- buf.Append ('.');
- buf.Append (name);
- IList<ParameterDefinition> parameters = property.Parameters;
- if (parameters.Count > 0) {
- genDeclType = property.DeclaringType;
- buf.Append ('(');
- IList<GenericParameter> genArgs = property.DeclaringType.GenericParameters;
- AppendParameter (buf, genArgs, parameters [0]);
- for (int i = 1; i < parameters.Count; ++i) {
- buf.Append (',');
- AppendParameter (buf, genArgs, parameters [i]);
- }
- buf.Append (')');
- genDeclType = null;
- }
- return buf.ToString ();
- }
-
- protected override string GetFieldName (FieldReference field)
- {
- return string.Format ("{0}.{1}",
- GetName (field.DeclaringType), field.Name);
- }
-
- protected override string GetEventName (EventReference e)
- {
- return string.Format ("{0}.{1}",
- GetName (e.DeclaringType), e.Name);
- }
-
- protected override string GetTypeDeclaration (TypeDefinition type)
- {
- string name = GetName (type);
- if (type == null)
- return null;
- return "T:" + name;
- }
-
- protected override string GetConstructorDeclaration (MethodDefinition constructor)
- {
- string name = GetName (constructor);
- if (name == null)
- return null;
- return "M:" + name;
- }
-
- protected override string GetMethodDeclaration (MethodDefinition method)
- {
- string name = GetName (method);
- if (name == null)
- return null;
- if (method.Name == "op_Implicit" || method.Name == "op_Explicit") {
- genDeclType = method.DeclaringType;
- genDeclMethod = method;
- name += "~" + GetName (method.ReturnType);
- genDeclType = null;
- genDeclMethod = null;
- }
- return "M:" + name;
- }
-
- protected override string GetPropertyDeclaration (PropertyDefinition property)
- {
- string name = GetName (property);
- if (name == null)
- return null;
- return "P:" + name;
- }
-
- protected override string GetFieldDeclaration (FieldDefinition field)
- {
- string name = GetName (field);
- if (name == null)
- return null;
- return "F:" + name;
- }
-
- protected override string GetEventDeclaration (EventDefinition e)
- {
- string name = GetName (e);
- if (name == null)
- return null;
- return "E:" + name;
- }
-}
-
-class FileNameMemberFormatter : SlashDocMemberFormatter {
- protected override StringBuilder AppendNamespace (StringBuilder buf, TypeReference type)
- {
- return buf;
- }
-
- protected override char NestedTypeSeparator {
- get {return '+';}
- }
-}
-
-class ResolvedTypeInfo {
- TypeDefinition typeDef;
-
- public ResolvedTypeInfo (TypeReference value) {
- Reference = value;
- }
-
- public TypeReference Reference { get; private set; }
-
- public TypeDefinition Definition {
- get {
- if (typeDef == null) {
- typeDef = Reference.Resolve ();
- }
- return typeDef;
- }
- }
-}
-
-/// <summary>Formats attribute values. Should return true if it is able to format the value.</summary>
-class AttributeValueFormatter {
- public virtual bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue)
- {
- TypeReference valueType = type.Reference;
- if (v == null) {
- returnvalue = "null";
- return true;
- }
- if (valueType.FullName == "System.Type") {
- var vTypeRef = v as TypeReference;
- if (vTypeRef != null)
- returnvalue = "typeof(" + NativeTypeManager.GetTranslatedName (vTypeRef) + ")"; // TODO: drop NS handling
- else
- returnvalue = "typeof(" + v.ToString () + ")";
-
- return true;
- }
- if (valueType.FullName == "System.String") {
- returnvalue = "\"" + v.ToString () + "\"";
- return true;
- }
- if (valueType.FullName == "System.Char") {
- returnvalue = "'" + v.ToString () + "'";
- return true;
- }
- if (v is Boolean) {
- returnvalue = (bool)v ? "true" : "false";
- return true;
- }
-
- TypeDefinition valueDef = type.Definition;
- if (valueDef == null || !valueDef.IsEnum) {
- returnvalue = v.ToString ();
- return true;
- }
-
- string typename = MDocUpdater.GetDocTypeFullName (valueType);
- var values = MDocUpdater.GetEnumerationValues (valueDef);
- long c = MDocUpdater.ToInt64 (v);
- if (values.ContainsKey (c)) {
- returnvalue = typename + "." + values [c];
- return true;
- }
-
- returnvalue = null;
- return false;
- }
-}
-
-/// <summary>The final value formatter in the pipeline ... if no other formatter formats the value,
-/// then this one will serve as the default implementation.</summary>
-class DefaultAttributeValueFormatter : AttributeValueFormatter {
- public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue)
- {
- returnvalue = "(" + MDocUpdater.GetDocTypeFullName (type.Reference) + ") " + v.ToString ();
- return true;
- }
-}
-
-/// <summary>Flags enum formatter that assumes powers of two values.</summary>
-/// <remarks>As described here: https://msdn.microsoft.com/en-us/library/vstudio/ms229062(v=vs.100).aspx</remarks>
-class StandardFlagsEnumFormatter : AttributeValueFormatter {
- public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue)
- {
- TypeReference valueType = type.Reference;
- TypeDefinition valueDef = type.Definition;
- if (valueDef.CustomAttributes.Any (ca => ca.AttributeType.FullName == "System.FlagsAttribute")) {
-
- string typename = MDocUpdater.GetDocTypeFullName (valueType);
- var values = MDocUpdater.GetEnumerationValues (valueDef);
- long c = MDocUpdater.ToInt64 (v);
- returnvalue = string.Join (" | ",
- (from i in values.Keys
- where (c & i) == i && i != 0
- select typename + "." + values [i])
- .DefaultIfEmpty (c.ToString ()).ToArray ());
-
- return true;
- }
-
- returnvalue = null;
- return false;
- }
-}
-
-/// <summary>A custom formatter for the ObjCRuntime.Platform enumeration.</summary>
-class ApplePlatformEnumFormatter : AttributeValueFormatter {
- public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue)
- {
- TypeReference valueType = type.Reference;
- string typename = MDocUpdater.GetDocTypeFullName (valueType);
- TypeDefinition valueDef = type.Definition;
- if (typename.Contains ("ObjCRuntime.Platform") && valueDef.CustomAttributes.Any (ca => ca.AttributeType.FullName == "System.FlagsAttribute")) {
-
- var values = MDocUpdater.GetEnumerationValues (valueDef);
- long c = MDocUpdater.ToInt64 (v);
-
- returnvalue = Format (c, values, typename);
- return true;
- }
-
- returnvalue = null;
- return false;
- }
-
- string Format (long c, IDictionary<long, string> values, string typename)
- {
- int iosarch, iosmajor, iosminor, iossubminor;
- int macarch, macmajor, macminor, macsubminor;
- GetEncodingiOS (c, out iosarch, out iosmajor, out iosminor, out iossubminor);
- GetEncodingMac ((ulong)c, out macarch, out macmajor, out macminor, out macsubminor);
-
- if (iosmajor == 0 & iosminor == 0 && iossubminor == 0) {
- return FormatValues ("Mac", macarch, macmajor, macminor, macsubminor);
- }
-
- if (macmajor == 0 & macminor == 0 && macsubminor == 0) {
- return FormatValues ("iOS", iosarch, iosmajor, iosminor, iossubminor);
- }
-
- return string.Format ("(Platform){0}", c);
- }
-
- string FormatValues (string plat, int arch, int major, int minor, int subminor)
- {
- string archstring = "";
- switch (arch) {
- case 1:
- archstring = "32";
- break;
- case 2:
- archstring = "64";
- break;
- }
- return string.Format ("Platform.{4}_{0}_{1}{2} | Platform.{4}_Arch{3}",
- major,
- minor,
- subminor == 0 ? "" : "_" + subminor.ToString (),
- archstring,
- plat
- );
- }
-
- void GetEncodingiOS (long entireLong, out int archindex, out int major, out int minor, out int subminor)
- {
- long lowerBits = entireLong & 0xffffffff;
- int lowerBitsAsInt = (int) lowerBits;
- GetEncoding (lowerBitsAsInt, out archindex, out major, out minor, out subminor);
- }
-
- void GetEncodingMac (ulong entireLong, out int archindex, out int major, out int minor, out int subminor)
- {
- ulong higherBits = entireLong & 0xffffffff00000000;
- int higherBitsAsInt = (int) ((higherBits) >> 32);
- GetEncoding (higherBitsAsInt, out archindex, out major, out minor, out subminor);
- }
-
- void GetEncoding (Int32 encodedBits, out int archindex, out int major, out int minor, out int subminor)
- {
- // format is AAJJNNSS
- archindex = (int)((encodedBits & 0xFF000000) >> 24);
- major = (int)((encodedBits & 0x00FF0000) >> 16);
- minor = (int)((encodedBits & 0x0000FF00) >> 8);
- subminor = (int)((encodedBits & 0x000000FF) >> 0);
- }
-}
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-
-using Mono.Documentation;
-using Mono.Options;
-
-[assembly: AssemblyTitle("Monodocs-to-HTML")]
-[assembly: AssemblyCopyright("Copyright (c) 2004 Joshua Tauberer <tauberer@for.net>, released under the GPL.")]
-[assembly: AssemblyDescription("Convert Monodoc XML documentation to static HTML.")]
-
-namespace Mono.Documentation {
-
-class MDocToHtmlConverterOptions {
- public string dest;
- public string ext = "html";
- public string onlytype;
- public string template;
- public bool dumptemplate;
- public bool forceUpdate;
- public HashSet<string> versions = new HashSet<string> ();
-}
-
-class MDocToHtmlConverter : MDocCommand {
-
- static Dictionary<string, string[]> profiles = new Dictionary<string, string[]>() {
- // FxVersions----- VsVersions-----
- { "monotouch", new[]{"0.0.0.0", "2.0.5.0" } },
- { "net_1_0", new[]{"1.0.3300.0", "7.0.3300.0"} },
- { "net_1_1", new[]{"1.0.5000.0", "7.0.5000.0"} },
- { "net_2_0", new[]{"2.0.0.0", "8.0.0.0"} },
- { "net_3_0", new[]{"2.0.0.0", "3.0.0.0", "8.0.0.0"} },
- { "net_3_5", new[]{"2.0.0.0", "3.0.0.0", "3.5.0.0", "8.0.0.0"} },
- { "net_4_0", new[]{"4.0.0.0" } },
- { "silverlight", new[]{"2.0.5.0", "9.0.0.0"} },
- };
-
- public override void Run (IEnumerable<string> args)
- {
- opts = new MDocToHtmlConverterOptions ();
- var p = new OptionSet () {
- { "default-template",
- "Writes the default XSLT to stdout.",
- v => opts.dumptemplate = v != null },
- { "ext=",
- "The file {EXTENSION} to use for created files. "+
- "This defaults to \"html\".",
- v => opts.ext = v },
- { "force-update",
- "Always generate new files. If not specified, will only generate a " +
- "new file if the source .xml file is newer than the current output " +
- "file.",
- v => opts.forceUpdate = v != null },
- { "o|out=",
- "The {DIRECTORY} to place the generated files and directories.",
- v => opts.dest = v },
- { "template=",
- "An XSLT {FILE} to use to generate the created " +
- "files.If not specified, uses the template generated by " +
- "--default-template.",
- v => opts.template = v },
- { "with-profile=",
- "The .NET {PROFILE} to generate documentation for. This is " +
- "equivalent to using --with-version for all of the " +
- "versions that a profile uses. Valid profiles are:\n " +
- string.Join ("\n ", profiles.Keys.OrderBy (v => v).ToArray ()),
- v => {
- if (!profiles.ContainsKey (v))
- throw new ArgumentException (string.Format ("Unsupported profile '{0}'.", v));
- foreach (var ver in profiles [v.ToLowerInvariant ()])
- opts.versions.Add (ver);
- } },
- { "with-version=",
- "The assembly {VERSION} to generate documentation for. This allows " +
- "display of a subset of types/members that correspond to the given " +
- "assembly version. May be specified multiple times. " +
- "If not specified, all versions are displayed.",
- v => opts.versions.Add (v) }
- };
- List<string> extra = Parse (p, args, "export-html",
- "[OPTIONS]+ DIRECTORIES",
- "Export mdoc documentation within DIRECTORIES to HTML.");
- if (extra == null)
- return;
- if (opts.dumptemplate)
- DumpTemplate ();
- else
- ProcessDirectories (extra);
- opts.onlytype = "ignore"; // remove warning about unused member
- }
-
- static MDocToHtmlConverterOptions opts;
-
- void ProcessDirectories (List<string> sourceDirectories)
- {
- if (sourceDirectories.Count == 0 || opts.dest == null || opts.dest == "")
- throw new ApplicationException("The source and dest options must be specified.");
-
- Directory.CreateDirectory(opts.dest);
-
- // Load the stylesheets, overview.xml, and resolver
-
- XslCompiledTransform overviewxsl = LoadTransform("overview.xsl", sourceDirectories);
- XslCompiledTransform stylesheet = LoadTransform("stylesheet.xsl", sourceDirectories);
- XslCompiledTransform template;
- if (opts.template == null) {
- template = LoadTransform("defaulttemplate.xsl", sourceDirectories);
- } else {
- try {
- XmlDocument templatexsl = new XmlDocument();
- templatexsl.Load(opts.template);
- template = new XslCompiledTransform (DebugOutput);
- template.Load(templatexsl);
- } catch (Exception e) {
- throw new ApplicationException("There was an error loading " + opts.template, e);
- }
- }
-
- XmlDocument overview = GetOverview (sourceDirectories);
-
- ArrayList extensions = GetExtensionMethods (overview);
-
- // Create the master page
- XsltArgumentList overviewargs = new XsltArgumentList();
- overviewargs.AddParam("Index", "", overview.CreateNavigator ());
-
- var regenIndex = ShouldRegenIndexes (opts, overview, sourceDirectories);
- if (regenIndex) {
- overviewargs.AddParam("ext", "", opts.ext);
- overviewargs.AddParam("basepath", "", "./");
- Generate(overview, overviewxsl, overviewargs, opts.dest + "/index." + opts.ext, template, sourceDirectories);
- overviewargs.RemoveParam("basepath", "");
- }
- overviewargs.AddParam("basepath", "", "../");
-
- // Create the namespace & type pages
-
- XsltArgumentList typeargs = new XsltArgumentList();
- typeargs.AddParam("ext", "", opts.ext);
- typeargs.AddParam("basepath", "", "../");
- typeargs.AddParam("Index", "", overview.CreateNavigator ());
-
- foreach (XmlElement ns in overview.SelectNodes("Overview/Types/Namespace")) {
- string nsname = ns.GetAttribute("Name");
-
- if (opts.onlytype != null && !opts.onlytype.StartsWith(nsname + "."))
- continue;
-
- System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(opts.dest + "/" + nsname);
- if (!d.Exists) d.Create();
-
- // Create the NS page
- string nsDest = opts.dest + "/" + nsname + "/index." + opts.ext;
- if (regenIndex) {
- overviewargs.AddParam("namespace", "", nsname);
- Generate(overview, overviewxsl, overviewargs, nsDest, template, sourceDirectories);
- overviewargs.RemoveParam("namespace", "");
- }
-
- foreach (XmlElement ty in ns.SelectNodes("Type")) {
- string typename, typefile, destfile;
- GetTypePaths (opts, ty, out typename, out typefile, out destfile);
-
- if (DestinationIsNewer (typefile, destfile))
- // target already exists, and is newer. why regenerate?
- continue;
-
- XmlDocument typexml = new XmlDocument();
- typexml.Load(typefile);
- PreserveMembersInVersions (typexml);
- if (extensions != null) {
- DocLoader loader = CreateDocLoader (overview);
- XmlDocUtils.AddExtensionMethods (typexml, extensions, loader);
- }
-
- Console.WriteLine(nsname + "." + typename);
-
- Generate(typexml, stylesheet, typeargs, destfile, template, sourceDirectories);
- }
- }
- }
-
- private static ArrayList GetExtensionMethods (XmlDocument doc)
- {
- XmlNodeList extensions = doc.SelectNodes ("/Overview/ExtensionMethods/*");
- if (extensions.Count == 0)
- return null;
- ArrayList r = new ArrayList (extensions.Count);
- foreach (XmlNode n in extensions)
- r.Add (n);
- return r;
- }
-
- static bool ShouldRegenIndexes (MDocToHtmlConverterOptions opts, XmlDocument overview, List<string> sourceDirectories)
- {
- string overviewDest = opts.dest + "/index." + opts.ext;
- if (sourceDirectories.Any (
- d => !DestinationIsNewer (Path.Combine (d, "index.xml"), overviewDest)))
- return true;
-
- foreach (XmlElement type in overview.SelectNodes("Overview/Types/Namespace/Type")) {
- string _, srcfile, destfile;
- GetTypePaths (opts, type, out _, out srcfile, out destfile);
-
- if (srcfile == null || destfile == null)
- continue;
- if (DestinationIsNewer (srcfile, destfile))
- return true;
- }
-
- return false;
- }
-
- static void GetTypePaths (MDocToHtmlConverterOptions opts, XmlElement type, out string typename, out string srcfile, out string destfile)
- {
- srcfile = null;
- destfile = null;
-
- string nsname = type.ParentNode.Attributes ["Name"].Value;
- string typefilebase = type.GetAttribute("Name");
- string sourceDir = type.GetAttribute("SourceDirectory");
- typename = type.GetAttribute("DisplayName");
- if (typename.Length == 0)
- typename = typefilebase;
-
- if (opts.onlytype != null && !(nsname + "." + typename).StartsWith(opts.onlytype))
- return;
-
- srcfile = CombinePath (sourceDir, nsname, typefilebase + ".xml");
- if (srcfile == null)
- return;
-
- destfile = CombinePath (opts.dest, nsname, typefilebase + "." + opts.ext);
- }
-
- private static void DumpTemplate() {
- Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("defaulttemplate.xsl");
- Stream o = Console.OpenStandardOutput ();
- byte[] buf = new byte[1024];
- int r;
- while ((r = s.Read (buf, 0, buf.Length)) > 0) {
- o.Write (buf, 0, r);
- }
- }
-
- private static void Generate(XmlDocument source, XslCompiledTransform transform, XsltArgumentList args, string output, XslCompiledTransform template, List<string> sourceDirectories) {
- using (TextWriter textwriter = new StreamWriter(new FileStream(output, FileMode.Create))) {
- XmlTextWriter writer = new XmlTextWriter(textwriter);
- writer.Formatting = Formatting.Indented;
- writer.Indentation = 2;
- writer.IndentChar = ' ';
-
- try {
- var intermediate = new StringBuilder ();
- transform.Transform (
- new XmlNodeReader (source),
- args,
- XmlWriter.Create (intermediate, transform.OutputSettings),
- new ManifestResourceResolver(sourceDirectories.ToArray ()));
- template.Transform (
- XmlReader.Create (new StringReader (intermediate.ToString ())),
- new XsltArgumentList (),
- new XhtmlWriter (writer),
- null);
- } catch (Exception e) {
- throw new ApplicationException("An error occured while generating " + output, e);
- }
- }
- }
-
- private XslCompiledTransform LoadTransform(string name, List<string> sourceDirectories) {
- try {
- XmlDocument xsl = new XmlDocument();
- xsl.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream(name));
-
- if (name == "overview.xsl") {
- // bit of a hack. overview needs the templates in stylesheet
- // for doc formatting, and rather than write a resolver, I'll
- // just do the import for it.
-
- XmlNode importnode = xsl.DocumentElement.SelectSingleNode("*[name()='xsl:include']");
- xsl.DocumentElement.RemoveChild(importnode);
-
- XmlDocument xsl2 = new XmlDocument();
- xsl2.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("stylesheet.xsl"));
- foreach (XmlNode node in xsl2.DocumentElement.ChildNodes)
- xsl.DocumentElement.AppendChild(xsl.ImportNode(node, true));
- }
-
- XslCompiledTransform t = new XslCompiledTransform (DebugOutput);
- t.Load (
- xsl,
- XsltSettings.TrustedXslt,
- new ManifestResourceResolver (sourceDirectories.ToArray ()));
-
- return t;
- } catch (Exception e) {
- throw new ApplicationException("Error loading " + name + " from internal resource", e);
- }
- }
-
- private static DocLoader CreateDocLoader (XmlDocument overview)
- {
- Hashtable docs = new Hashtable ();
- DocLoader loader = delegate (string s) {
- XmlDocument d = null;
- if (!docs.ContainsKey (s)) {
- foreach (XmlNode n in overview.SelectNodes ("//Type")) {
- string ns = n.ParentNode.Attributes ["Name"].Value;
- string t = n.Attributes ["Name"].Value;
- string sd = n.Attributes ["SourceDirectory"].Value;
- if (s == ns + "." + t.Replace ("+", ".")) {
- string f = CombinePath (sd, ns, t + ".xml");
- if (File.Exists (f)) {
- d = new XmlDocument ();
- d.Load (f);
- }
- docs.Add (s, d);
- break;
- }
- }
- }
- else
- d = (XmlDocument) docs [s];
- return d;
- };
- return loader;
- }
-
- static string CombinePath (params string[] paths)
- {
- if (paths == null)
- return null;
- if (paths.Length == 1)
- return paths [0];
- var path = Path.Combine (paths [0], paths [1]);
- for (int i = 2; i < paths.Length; ++i)
- path = Path.Combine (path, paths [i]);
- return path;
- }
-
- private XmlDocument GetOverview (IEnumerable<string> directories)
- {
- var index = new XmlDocument ();
-
- var overview = index.CreateElement ("Overview");
- var assemblies= index.CreateElement ("Assemblies");
- var types = index.CreateElement ("Types");
- var ems = index.CreateElement ("ExtensionMethods");
-
- index.AppendChild (overview);
- overview.AppendChild (assemblies);
- overview.AppendChild (types);
- overview.AppendChild (ems);
-
- bool first = true;
-
- foreach (var dir in directories) {
- var indexFile = Path.Combine (dir, "index.xml");
- try {
- var doc = new XmlDocument ();
- doc.Load (indexFile);
- if (first) {
- var c = doc.SelectSingleNode ("/Overview/Copyright");
- var t = doc.SelectSingleNode ("/Overview/Title");
- var r = doc.SelectSingleNode ("/Overview/Remarks");
- if (c != null && t != null && r != null) {
- var e = index.CreateElement ("Copyright");
- e.InnerXml = c.InnerXml;
- overview.AppendChild (e);
-
- e = index.CreateElement ("Title");
- e.InnerXml = t.InnerXml;
- overview.AppendChild (e);
-
- e = index.CreateElement ("Remarks");
- e.InnerXml = r.InnerXml;
- overview.AppendChild (e);
-
- first = false;
- }
- }
- AddAssemblies (assemblies, doc);
- AddTypes (types, doc, dir);
- AddChildren (ems, doc, "/Overview/ExtensionMethods");
- }
- catch (Exception e) {
- Message (TraceLevel.Warning, "Could not load documentation index '{0}': {1}",
- indexFile, e.Message);
- }
- }
-
- return index;
- }
-
- static void AddChildren (XmlNode dest, XmlDocument source, string path)
- {
- var n = source.SelectSingleNode (path);
- if (n != null)
- foreach (XmlNode c in n.ChildNodes)
- dest.AppendChild (dest.OwnerDocument.ImportNode (c, true));
- }
-
- static void AddAssemblies (XmlNode dest, XmlDocument source)
- {
- foreach (XmlNode asm in source.SelectNodes ("/Overview/Assemblies/Assembly")) {
- var n = asm.Attributes ["Name"].Value;
- var v = asm.Attributes ["Version"].Value;
- if (dest.SelectSingleNode (string.Format ("Assembly[@Name='{0}'][@Value='{1}']", n, v)) == null) {
- dest.AppendChild (dest.OwnerDocument.ImportNode (asm, true));
- }
- }
- }
-
- static void AddTypes (XmlNode dest, XmlDocument source, string sourceDirectory)
- {
- var types = source.SelectSingleNode ("/Overview/Types");
- if (types == null)
- return;
- foreach (XmlNode ns in types.ChildNodes) {
- var n = ns.Attributes ["Name"].Value;
- var nsd = dest.SelectSingleNode (string.Format ("Namespace[@Name='{0}']", n));
- if (nsd == null) {
- nsd = dest.OwnerDocument.CreateElement ("Namespace");
- AddAttribute (nsd, "Name", n);
- dest.AppendChild (nsd);
- }
- foreach (XmlNode t in ns.ChildNodes) {
- if (!TypeInVersions (sourceDirectory, n, t))
- continue;
- var c = dest.OwnerDocument.ImportNode (t, true);
- AddAttribute (c, "SourceDirectory", sourceDirectory);
- nsd.AppendChild (c);
- }
- if (nsd.ChildNodes.Count == 0)
- dest.RemoveChild (nsd);
- }
- }
-
- static bool TypeInVersions (string sourceDirectory, string ns, XmlNode type)
- {
- if (opts.versions.Count == 0)
- return true;
- var file = Path.Combine (Path.Combine (sourceDirectory, ns), type.Attributes ["Name"].Value + ".xml");
- if (!File.Exists (file))
- return false;
- XPathDocument doc;
- using (var s = File.OpenText (file))
- doc = new XPathDocument (s);
- return MemberInVersions (doc.CreateNavigator ().SelectSingleNode ("/Type"));
- }
-
- static bool MemberInVersions (XPathNavigator nav)
- {
- return nav.Select ("AssemblyInfo/AssemblyVersion")
- .Cast<object> ()
- .Any (v => opts.versions.Contains (v.ToString ()));
- }
-
- static void AddAttribute (XmlNode self, string name, string value)
- {
- var a = self.OwnerDocument.CreateAttribute (name);
- a.Value = value;
- self.Attributes.Append (a);
- }
-
- private static bool DestinationIsNewer (string source, string dest)
- {
- return !opts.forceUpdate && File.Exists (dest) &&
- File.GetLastWriteTime (source) < File.GetLastWriteTime (dest);
- }
-
- private static void PreserveMembersInVersions (XmlDocument doc)
- {
- if (opts.versions.Count == 0)
- return;
- var remove = new List<XmlNode>();
- foreach (XmlNode m in doc.SelectNodes ("/Type/Members/Member")) {
- if (!MemberInVersions (m.CreateNavigator ()))
- remove.Add (m);
- }
- XmlNode members = doc.SelectSingleNode ("/Type/Members");
- foreach (var m in remove)
- members.RemoveChild (m);
- }
-}
-
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml;
-
-using Monodoc;
-using Mono.Options;
-
-namespace Mono.Documentation {
-public class MDocToMSXDocConverter : MDocCommand {
-
- public override void Run (IEnumerable<string> args)
- {
- string file = null;
- var p = new OptionSet () {
- { "o|out=",
- "The XML {FILE} to generate.\n" +
- "If not specified, will create a set of files in the curent directory " +
- "based on the //AssemblyInfo/AssemblyName values within the documentation.\n" +
- "Use '-' to write to standard output.",
- v => file = v },
- };
- List<string> directories = Parse (p, args, "export-slashdoc",
- "[OPTIONS]+ DIRECTORIES",
- "Export mdoc(5) documentation within DIRECTORIES into \n" +
- "Microsoft XML Documentation format files.");
- if (directories == null)
- return;
- Run (file, directories);
- }
-
- public static void Run (string file, IEnumerable<string> dirs)
- {
- Dictionary<string, XmlElement> outputfiles = new Dictionary<string, XmlElement> ();
-
- XmlDocument nsSummaries = new XmlDocument();
- nsSummaries.LoadXml("<namespaces/>");
-
- foreach (string dir in dirs)
- Process (dir, outputfiles, nsSummaries, file == null);
-
- if (outputfiles.Count > 0 && file != null) {
- List<string> files = new List<string> (outputfiles.Keys);
- files.Sort ();
- XmlDocument d = new XmlDocument ();
- d.AppendChild (d.CreateElement ("doc"));
- d.FirstChild.AppendChild (
- d.ImportNode (outputfiles [files [0]].SelectSingleNode ("/doc/assembly"), true));
- XmlElement members = d.CreateElement ("members");
- d.FirstChild.AppendChild (members);
- foreach (string f in files) {
- XmlElement from = (XmlElement) outputfiles [f];
- foreach (XmlNode n in from.SelectNodes ("/doc/members/*"))
- members.AppendChild (d.ImportNode (n, true));
- }
- using (TextWriter tw = file == "-" ? Console.Out : new StreamWriter (file))
- WriteXml (d.DocumentElement, tw);
- return;
- }
-
- // Write out each of the assembly documents
- foreach (string assemblyName in outputfiles.Keys) {
- XmlElement members = (XmlElement)outputfiles[assemblyName];
- Console.WriteLine(assemblyName + ".xml");
- using(StreamWriter sw = new StreamWriter(assemblyName + ".xml")) {
- WriteXml(members.OwnerDocument.DocumentElement, sw);
- }
- }
-
- // Write out a namespace summaries file.
- Console.WriteLine("NamespaceSummaries.xml");
- using(StreamWriter writer = new StreamWriter("NamespaceSummaries.xml")) {
- WriteXml(nsSummaries.DocumentElement, writer);
- }
- }
-
- private static void Process (string basepath, Dictionary<string, XmlElement> outputfiles, XmlDocument nsSummaries, bool implicitFiles)
- {
- if (System.Environment.CurrentDirectory == System.IO.Path.GetFullPath(basepath) && implicitFiles) {
- Console.WriteLine("Don't run this tool from your documentation directory, since some files could be accidentally overwritten.");
- return;
- }
-
- XmlDocument index_doc = new XmlDocument();
- index_doc.Load(Path.Combine(basepath, "index.xml"));
- XmlElement index = index_doc.DocumentElement;
-
- foreach (XmlElement assmbly in index.SelectNodes("Assemblies/Assembly")) {
- string assemblyName = assmbly.GetAttribute("Name");
- if (outputfiles.ContainsKey (assemblyName))
- continue;
- XmlDocument output = new XmlDocument();
- XmlElement output_root = output.CreateElement("doc");
- output.AppendChild(output_root);
-
- XmlElement output_assembly = output.CreateElement("assembly");
- output_root.AppendChild(output_assembly);
- XmlElement output_assembly_name = output.CreateElement("name");
- output_assembly.AppendChild(output_assembly_name);
- output_assembly_name.InnerText = assemblyName;
-
- XmlElement members = output.CreateElement("members");
- output_root.AppendChild(members);
-
- outputfiles.Add (assemblyName, members);
- }
-
- foreach (XmlElement nsnode in index.SelectNodes("Types/Namespace")) {
- string ns = nsnode.GetAttribute("Name");
- foreach (XmlElement typedoc in nsnode.SelectNodes("Type")) {
- string typename = typedoc.GetAttribute("Name");
- XmlDocument type = new XmlDocument();
- type.Load(Path.Combine(Path.Combine(basepath, ns), typename) + ".xml");
-
- string assemblyname = type.SelectSingleNode("Type/AssemblyInfo/AssemblyName").InnerText;
- XmlElement members = outputfiles [assemblyname];
- if (members == null) continue; // assembly is strangely not listed in the index
-
- CreateMember (GetCref (type.DocumentElement), type.DocumentElement, members);
-
- foreach (XmlElement memberdoc in type.SelectNodes("Type/Members/Member")) {
- string name = GetCref (memberdoc);
- CreateMember(name, memberdoc, members);
- }
- }
- }
- foreach (XmlElement nsnode in index.SelectNodes("Types/Namespace")) {
- AddNamespaceSummary(nsSummaries, basepath, nsnode.GetAttribute("Name"));
- }
- }
-
- static string GetCref (XmlElement member)
- {
- string typeName = XmlDocUtils.ToEscapedTypeName (member.SelectSingleNode("/Type/@FullName").InnerText);
- if (member.Name == "Type")
- return "T:" + typeName;
- string memberType = member.SelectSingleNode("MemberType").InnerText;
- switch (memberType) {
- case "Constructor":
- return "C:" + typeName + MakeArgs(member);
- case "Event":
- return "E:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
- case "Field":
- return "F:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
- case "Method": {
- string name = "M:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
- if (member.GetAttribute("MemberName") == "op_Implicit" || member.GetAttribute("MemberName") == "op_Explicit")
- name += "~" + XmlDocUtils.ToTypeName (member.SelectSingleNode("ReturnValue/ReturnType").InnerText, member);
- return name;
- }
- case "Property":
- return "P:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
- default:
- throw new NotSupportedException ("MemberType '" + memberType + "' is not supported.");
- }
- }
-
- static string MakeArgs (XmlElement member)
- {
- XmlNodeList parameters = member.SelectNodes ("Parameters/Parameter");
- if (parameters.Count == 0)
- return "";
- StringBuilder args = new StringBuilder ();
- args.Append ("(");
- args.Append (XmlDocUtils.ToTypeName (parameters [0].Attributes ["Type"].Value, member));
- for (int i = 1; i < parameters.Count; ++i) {
- args.Append (",");
- args.Append (XmlDocUtils.ToTypeName (parameters [i].Attributes ["Type"].Value, member));
- }
- args.Append (")");
- return args.ToString ();
- }
-
- private static void AddNamespaceSummary(XmlDocument nsSummaries, string basepath, string currentNs) {
- foreach (var filename in new [] {
- Path.Combine(basepath, currentNs + ".xml"),
- Path.Combine(basepath, "ns-" + currentNs + ".xml")}) {
- if (File.Exists(filename)) {
- XmlDocument nsSummary = new XmlDocument();
- nsSummary.Load(filename);
- XmlElement ns = nsSummaries.CreateElement("namespace");
- nsSummaries.DocumentElement.AppendChild(ns);
- ns.SetAttribute("name", currentNs);
- ns.InnerText = nsSummary.SelectSingleNode("/Namespace/Docs/summary").InnerText;
- }
- }
- }
-
- private static void CreateMember(string name, XmlElement input, XmlElement output) {
- XmlElement member = output.OwnerDocument.CreateElement("member");
- output.AppendChild(member);
-
- member.SetAttribute("name", name);
-
- foreach (XmlNode docnode in input.SelectSingleNode("Docs"))
- member.AppendChild(output.OwnerDocument.ImportNode(docnode, true));
- }
-
- private static void WriteXml(XmlElement element, System.IO.TextWriter output) {
- XmlTextWriter writer = new XmlTextWriter(output);
- writer.Formatting = Formatting.Indented;
- writer.Indentation = 4;
- writer.IndentChar = ' ';
- element.WriteTo(writer);
- output.WriteLine();
- }
-}
-
-}
+++ /dev/null
-//
-// msitomsx.cs: Microsoft Internal XML to Microsoft XML Documentation
-//
-// Arguably this doesn't belong in mdoc, but I'd rather not do some
-// stand-alone tool either, especially since the primary reason it exists is
-// to facilitate generating ECMA documentation via mdoc-update and
-// mdoc-update-ecma-xml...
-//
-// Author:
-// Jonathan Pryor <jpryor@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text;
-using System.Xml;
-using System.Xml.Linq;
-using System.Xml.Xsl;
-
-using Mono.Options;
-
-namespace Mono.Documentation {
-
- class MsidocToMsxdocConverter : MDocCommand {
-
- XslCompiledTransform msiToMsxTransform = new XslCompiledTransform ();
-
- public MsidocToMsxdocConverter ()
- {
- using (var r = XmlReader.Create (
- Assembly.GetExecutingAssembly ().GetManifestResourceStream ("msitomsx.xsl")))
- msiToMsxTransform.Load (r);
- }
-
- public override void Run (IEnumerable<string> args)
- {
- var types = new List<string> ();
- string outdir = null;
-
- var options = new OptionSet () {
- { "o|out=",
- "{DIRECTORY} to create Microsoft XML assembly.xml documentation files.",
- v => outdir = v },
- { "library=",
- "Ignored for compatibility with update-ecma-xml.",
- v => {} },
- { "type=",
- "The full {TYPE} name of a type to copy into the output file.",
- v => types.Add (v) },
- };
- var sources = Parse (options, args, "export-ecma-xml",
- "[OPTIONS]+ DIRECTORIES",
- "Convert Microsoft internal XML documentation within DIRECTORIES into\n" +
- "Microsoft XML documentation.\n" +
- "\n" +
- "Microsoft internal XML documentation is a custom XML dialect (yay) with\n" +
- "a specific directory structure:\n" +
- "\n" +
- "\tROOT/dotted.namespace/asset.xml\n" +
- "\n" +
- "where ROOT is a directory that can be passed as one of the DIRECTORIES\n" +
- "arguments to x-msitomsx, dotted.namespace is the lowercased namespace\n" +
- "in dotted form, e.g. 'system.threading', and asset.xml is the name of \n" +
- "the \"asset\" being documented. The asset.xml basename is a GUID, and\n" +
- "the file contains type/namespace/etc. documentation, one file per asset.\n" +
- "\n" +
- "There is no separation of assemblies in this format, only namespaces.\n" +
- "Types from all assemblies are intermixed with each other.\n" +
- "\n" +
- "The output of x-msitomsx will be a set of files in the --out directory,\n" +
- "one file per assembly (normal 'csc /doc' convention). For example,\n" +
- "\n" +
- "\tmdoc x-msitomsx -o docs import-root --type System.String\n" +
- "\n" +
- "will create the file 'docs/mscorlib.dll' which will contain the converted\n" +
- "documentation for the System.String type.");
- if (sources == null)
- return;
- if (sources.Count == 0)
- Error ("No directories specified.");
- if (outdir == null)
- Error ("No output directory specified. Please use --out=DIRECTORY.");
-
- types.Sort ();
-
- Dictionary<string, XDocument> docs = Convert (sources, types);
- foreach (KeyValuePair<string, XDocument> e in docs) {
- using (var o = CreateWriter (Path.Combine (outdir, e.Key + ".xml")))
- e.Value.WriteTo (o);
- }
- }
-
- private Dictionary<string, XDocument> Convert (List<string> sources, List<string> types)
- {
- var docs = new Dictionary<string, XDocument> ();
-
- foreach (var source in sources) {
- foreach (var dir in Directory.GetDirectories (source)) {
- foreach (var file in Directory.GetFiles (dir, "*.xml")) {
- ConvertDocs (docs, types, file);
- }
- }
- }
-
- return docs;
- }
-
- private void ConvertDocs (Dictionary<string, XDocument> docs, List<string> types, string file)
- {
- var doc = LoadFile (file);
- var type = doc.Root.Element ("members").Element ("member").Attribute ("name").Value;
-
- if (type.StartsWith ("N:"))
- return;
-
- if (!type.StartsWith ("T:"))
- throw new InvalidOperationException ("File '" + file + "' doesn't contain type documentation, it contains docs for: " + type);
-
- type = type.Substring (2);
- if (types.Count > 0 && types.BinarySearch (type) < 0)
- return;
-
- var assembly = doc.Root.Element ("assembly").Element ("name").Value;
- XDocument asmdocs;
- if (!docs.TryGetValue (assembly, out asmdocs)) {
- docs.Add (assembly,
- asmdocs = new XDocument (
- new XElement ("doc",
- new XElement ("assembly",
- new XElement ("name", assembly)),
- new XElement ("members"))));
- }
-
- var import = new XDocument ();
- msiToMsxTransform.Transform (doc.CreateReader (), import.CreateWriter ());
-
- asmdocs.Root.Element ("members").Add (import.Root.Element ("members").Elements ("member"));
- }
-
- static XDocument LoadFile (string file)
- {
- using (XmlReader r = XmlReader.Create (file))
- return XDocument.Load (r);
- }
-
- static XmlWriter CreateWriter (string file)
- {
- var settings = new XmlWriterSettings {
- Encoding = new UTF8Encoding (false),
- Indent = true,
- IndentChars = " ",
- NewLineChars = "\r\n",
- OmitXmlDeclaration = true,
- };
-
- return XmlWriter.Create (file, settings);
- }
- }
-}
-
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Xml;
-
-namespace Mono.Documentation {
- public class Normalizer {
-
- public static void Run (string [] args)
- {
- if (args == null) {
- Console.WriteLine ("normalize.exe <files>");
- Environment.Exit (0);
- }
-
- foreach (string arg in args) {
-
- XmlDocument document = new XmlDocument ();
- try {
- document.Load (arg);
- StreamWriter writer = new StreamWriter (arg, false, new UTF8Encoding (false));
- document.Save (writer);
- writer.Close ();
-
- } catch (XmlException e) {
- Console.WriteLine (arg + " is not a wellformed XML document.");
- Console.WriteLine (e.Message);
- }
- }
- }
- }
-}
+++ /dev/null
-// Command to preserve member documentation for types that are changing in a subsequent version
-// By Joel Martinez <joel.martinez@xamarin.com
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Mono.Options;
-
-namespace Mono.Documentation
-{
- [Obsolete ("This functionality is no longer supported.")]
- public class MDocPreserve : MDocCommand
- {
- MDocUpdater updater;
-
- public MDocPreserve ()
- {
- updater = new MDocUpdater ();
- }
-
- public override void Run (IEnumerable<string> args)
- {
- Message (System.Diagnostics.TraceLevel.Warning, "This functionality is no longer supported, and will be removed in a future release.");
-
- string preserveName = string.Empty;
- var p = new OptionSet () { { "name=",
- "Root {DIRECTORY} to generate/update documentation.",
- v => preserveName = v
- }
- };
-
- updater.PreserveTag = preserveName;
-
- updater.Run (args);
- }
- }
-}
-
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Reflection;
-using System.Xml;
-using System.Xml.Schema;
-
-using Mono.Options;
-
-namespace Mono.Documentation
-{
- public class MDocValidator : MDocCommand
- {
- XmlReaderSettings settings;
- long errors = 0;
-
- public override void Run (IEnumerable<string> args)
- {
- string[] validFormats = {
- "ecma",
- };
- string format = "ecma";
- var p = new OptionSet () {
- { "f|format=",
- "The documentation {0:FORMAT} used within PATHS. " +
- "Valid formats include:\n " +
- string.Join ("\n ", validFormats) + "\n" +
- "If no format provided, `ecma' is used.",
- v => format = v },
- };
- List<string> files = Parse (p, args, "validate",
- "[OPTIONS]+ PATHS",
- "Validate PATHS against the specified format schema.");
- if (files == null)
- return;
- if (Array.IndexOf (validFormats, format) < 0)
- Error ("Invalid documentation format: {0}.", format);
- Run (format, files);
- }
-
- public void Run (string format, IEnumerable<string> files)
- {
- Stream s = null;
-
- switch (format) {
- case "ecma":
- s = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("monodoc-ecma.xsd");
- break;
-
- default:
- throw new NotSupportedException (string.Format ("The format `{0}' is not suppoted.", format));
- }
-
- if (s == null)
- throw new NotSupportedException (string.Format ("The schema for `{0}' was not found.", format));
-
- settings = new XmlReaderSettings ();
- settings.Schemas.Add (XmlSchema.Read (s, null));
- settings.Schemas.Compile ();
- settings.ValidationType = ValidationType.Schema;
- settings.ValidationEventHandler += OnValidationEvent;
-
- // skip args[0] because it is the provider name
- foreach (string arg in files) {
- if (IsMonodocFile (arg))
- ValidateFile (arg);
-
- if (Directory.Exists (arg))
- {
- RecurseDirectory (arg);
- }
- }
-
- Message (errors == 0 ? TraceLevel.Info : TraceLevel.Error,
- "Total validation errors: {0}", errors);
- }
-
- void ValidateFile (string file)
- {
- try {
- using (var reader = XmlReader.Create (new XmlTextReader (file), settings)) {
- while (reader.Read ()) {
- // do nothing
- }
- }
- }
- catch (Exception e) {
- Message (TraceLevel.Error, "mdoc: {0}", e.ToString ());
- }
- }
-
- void RecurseDirectory (string dir)
- {
- string[] files = Directory.GetFiles (dir, "*.xml");
- foreach (string f in files)
- {
- if (IsMonodocFile (f))
- ValidateFile (f);
- }
-
- string[] dirs = Directory.GetDirectories (dir);
- foreach (string d in dirs)
- RecurseDirectory (d);
- }
-
- void OnValidationEvent (object sender, ValidationEventArgs a)
- {
- errors ++;
- Message (TraceLevel.Error, "mdoc: {0}", a.Message);
- }
-
- static bool IsMonodocFile (string file)
- {
- if (File.Exists (file) && Path.GetExtension (file).ToLower () == ".xml")
- return true;
- else
- return false;
-
- }
- }
-}
-
+++ /dev/null
-//
-// webdoc.cs
-//
-// Author:
-// Jonathan Pryor <jpryor@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Web;
-using System.Xml.Linq;
-
-using Monodoc;
-using Monodoc.Generators;
-using Monodoc.Caches;
-using Mono.Documentation;
-
-using Mono.Options;
-using Mono.Rocks;
-
-using ICSharpCode.SharpZipLib.Zip;
-
-namespace Mono.Documentation
-{
- public class MDocExportWebdocHtml : MDocCommand
- {
- class Options {
- public Dictionary<string, List<string>> Formats = new Dictionary<string, List<string>>();
- public List<string> Sources = new List<string>();
- public bool UseSystemSources = true;
- public bool ForceUpdate = false;
- public string OutputDirectory = null;
- }
-
- public override void Run (IEnumerable<string> args)
- {
- var opts = new Options ();
- var formatOptions = MDocAssembler.CreateFormatOptions (this, opts.Formats);
- var options = new OptionSet () {
- { "force-update",
- "Always generate new files. If not specified, will only generate " +
- "files if the write time of the output directory is older than the " +
- "write time of the source .tree/.zip files.",
- v => opts.ForceUpdate = v != null },
- formatOptions [0],
- formatOptions [1],
- { "o|out=",
- "The {PREFIX} to place the generated files and directories. " +
- "Default: \"`dirname FILE`/cache/\".\n" +
- "Underneath {PREFIX}, `basename FILE .tree` directories will be " +
- "created which will contain the pre-generated HTML content.",
- v => opts.OutputDirectory = v },
- { "r=",
- "A {SOURCE} file to use for reference purposes.\n" +
- "Extension methods are searched for among all {SOURCE}s which are referenced.\n" +
- "This option may be specified multiple times.",
- v => opts.Sources.Add (v) },
- { "use-system-sources",
- "Use the system-wide .source files for reference purposes. " +
- "Default is " + (opts.UseSystemSources ? "enabled" : "disabled") + ".",
- v => opts.UseSystemSources = v != null },
- };
- Parse (options, args, "export-html-webdoc",
- "[OPTIONS]+ FILES",
- "Export mdoc documentation within FILES to HTML for use by ASP.NET webdoc.\n\n" +
- "FILES are .tree or .zip files as produced by 'mdoc assemble', or .source files\n" +
- "which reference .tree and .zip files produced by 'mdoc assemble'.\n\n" +
- "See mdoc(5) or mdoc-assemble(1) for information about the .source file format.");
- if (opts.Formats.Values.All (files => files.Count == 0))
- Error ("No files specified.");
- ProcessSources (opts);
- foreach (var p in opts.Formats)
- ProcessFiles (opts, p.Key, p.Value);
- }
-
- void ProcessSources (Options opts)
- {
- foreach (var p in opts.Formats) {
- var files = p.Value;
- foreach (var f in files.Where (f => f.EndsWith (".source")).ToList ()) {
- files.Remove (f);
- foreach (var tfi in GetTreeFilesFromSource (f)) {
- List<string> treeFiles;
- if (!opts.Formats.TryGetValue (tfi.Key, out treeFiles))
- opts.Formats.Add (tfi.Key, treeFiles = new List<string> ());
- treeFiles.Add (tfi.Value);
- }
- }
- }
- }
-
- IEnumerable<KeyValuePair<string, string>> GetTreeFilesFromSource (string sourceFile)
- {
- try {
- var source = XElement.Load (sourceFile);
- return source.Descendants ("source")
- .Select (e => new KeyValuePair<string, string>(e.Attribute ("provider").Value,
- Path.Combine (Path.GetDirectoryName (sourceFile), e.Attribute ("basefile").Value + ".tree")));
- }
- catch (Exception e) {
- Message (TraceLevel.Error, "mdoc: error parsing file {0}: {1}", sourceFile, e.Message);
- return new KeyValuePair<string, string>[0];
- }
- }
-
- void ProcessFiles (Options opts, string format, List<string> files)
- {
- foreach (var basePath in
- files.Select (f =>
- Path.Combine (Path.GetDirectoryName (f), Path.GetFileNameWithoutExtension (f)))
- .Distinct ()) {
- string treeFile = basePath + ".tree";
- string zipFile = basePath + ".zip";
- if (!Exists (treeFile) || !Exists (zipFile))
- continue;
- string outDir = opts.OutputDirectory != null
- ? Path.Combine (opts.OutputDirectory, Path.GetFileName (basePath))
- : XmlDocUtils.GetCacheDirectory (basePath);
- if (!opts.ForceUpdate && Directory.Exists (outDir) &&
- MaxWriteTime (treeFile, zipFile) < Directory.GetLastWriteTime (outDir))
- continue;
- Message (TraceLevel.Warning, "Processing files: {0}, {1}", treeFile, zipFile);
- Directory.CreateDirectory (outDir);
- ExtractZipFile (zipFile, outDir);
- GenerateCache (opts, basePath, format, outDir);
- }
- }
-
- bool Exists (string file)
- {
- if (!File.Exists (file)) {
- Message (TraceLevel.Error,
- "mdoc: Could not find file: {0}", file);
- return false;
- }
- return true;
- }
-
- DateTime MaxWriteTime (params string[] files)
- {
- return files.Select (f => File.GetLastWriteTime (f)).Max ();
- }
-
- void ExtractZipFile (string zipFile, string outDir)
- {
- ZipInputStream zip = new ZipInputStream (File.OpenRead (zipFile));
-
- ZipEntry entry;
- while ((entry = zip.GetNextEntry ()) != null) {
- string file = Path.Combine (outDir, entry.Name);
- Directory.CreateDirectory (Path.GetDirectoryName (file));
- using (var output = File.OpenWrite (file))
- zip.WriteTo (output);
- }
- }
-
- void GenerateCache (Options opts, string basePath, string format, string outDir)
- {
- var hs = RootTree.GetHelpSource (format, basePath);
- if (hs == null) {
- Error ("Unable to find a HelpSource for provider '{0}' and file '{1}.tree'.", format, basePath);
- }
- var tree = hs.Tree;
- RootTree docRoot = null;
- if (!opts.UseSystemSources)
- docRoot = RootTree.LoadTree (null, null, opts.Sources);
- else {
- docRoot = RootTree.LoadTree ();
- foreach (var source in opts.Sources)
- docRoot.AddSourceFile (source);
- }
- hs.RootTree = docRoot;
- var generator = new HtmlGenerator (new NullCache ());
- foreach (Node node in tree.RootNode.TraverseDepthFirst<Node, Node> (t => t, t => t.ChildNodes)) {
- var url = node.PublicUrl;
- Message (TraceLevel.Info, "\tProcessing URL: {0}", url);
- if (string.IsNullOrEmpty (url))
- continue;
- var file = XmlDocUtils.GetCachedFileName (outDir, url);
- using (var o = File.AppendText (file)) {
- string contents = docRoot.RenderUrl (url, generator, hs);
- o.Write (contents);
- }
- }
- }
- }
-}
+++ /dev/null
-//
-// Object.cs: C# extension methods on object.
-//
-// Author:
-// Jonathan Pryor <jpryor@novell.com>
-// leppie (http://xacc.wordpress.com/)
-//
-// Copyright (c) 2008-2009 Novell, Inc. (http://www.novell.com)
-// Copyright (c) 2009 leppie (http://xacc.wordpress.com/)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-
-namespace Mono.Rocks {
-
- static class Check {
- public static void ChildrenSelector (object childrenSelector)
- {
- if (childrenSelector == null)
- throw new ArgumentNullException ("childrenSelector");
- }
-
- public static void Destination (object destination)
- {
- if (destination == null)
- throw new ArgumentNullException ("destination");
- }
-
- public static void Self (object self)
- {
- if (self == null)
- throw new ArgumentNullException ("self");
- }
-
- public static void ValueSelector (object valueSelector)
- {
- if (valueSelector == null)
- throw new ArgumentNullException ("valueSelector");
- }
- }
-
- public static class ObjectRocks {
-
- #region Tree Traversal Methods
-
- /*
- * Tree Traversal Methods courtesy of:
- * http://xacc.wordpress.com/2009/03/05/tree-traversal-extension-methods/
- */
-
- public static IEnumerable<TResult> TraverseDepthFirst<TSource, TResult>(
- this TSource self,
- Func<TSource, TResult> valueSelector,
- Func<TSource, IEnumerable<TSource>> childrenSelector)
- {
- return self.TraverseDepthFirstWithParent (valueSelector, childrenSelector)
- .Select(x => x.Value);
- }
-
- public static IEnumerable<KeyValuePair<TSource, TResult>> TraverseDepthFirstWithParent<TSource, TResult>(
- this TSource self,
- Func<TSource, TResult> valueSelector,
- Func<TSource, IEnumerable<TSource>> childrenSelector)
- {
- return self.TraverseDepthFirstWithParent (default (TSource), valueSelector, childrenSelector);
- }
-
- static IEnumerable<KeyValuePair<TSource, TResult>> TraverseDepthFirstWithParent<TSource, TResult>(
- this TSource self,
- TSource parent,
- Func<TSource, TResult> valueSelector,
- Func<TSource, IEnumerable<TSource>> childrenSelector)
- {
- Check.Self (self);
- Check.ValueSelector (valueSelector);
- Check.ChildrenSelector (childrenSelector);
-
- return CreateTraverseDepthFirstWithParentIterator (self, parent, valueSelector, childrenSelector);
- }
-
- static IEnumerable<KeyValuePair<TSource, TResult>> CreateTraverseDepthFirstWithParentIterator<TSource, TResult>(
- this TSource self,
- TSource parent,
- Func<TSource, TResult> valueSelector,
- Func<TSource, IEnumerable<TSource>> childrenSelector)
- {
- yield return new KeyValuePair<TSource, TResult>(parent, valueSelector (self));
-
- foreach (var c in childrenSelector (self))
- {
- foreach (var item in c.TraverseDepthFirstWithParent(c, valueSelector, childrenSelector))
- {
- yield return item;
- }
- }
- }
- #endregion
- }
-}
-
+++ /dev/null
-//
-// Stream.cs
-//
-// Authors:
-// Jonathan Pryor <jpryor@novell.com>
-// Bojan Rajkovic <bojanr@brandeis.edu>
-//
-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Mono.Rocks {
-
- public static class StreamRocks {
-
- public static void WriteTo (this Stream self, Stream destination)
- {
- Check.Self (self);
- Check.Destination (destination);
-
- int size = self.CanSeek
- ? (int) System.Math.Min (self.Length - self.Position, 4096)
- : 4096;
- byte[] buf = new byte [size];
- int r;
- while ((r = self.Read (buf, 0, buf.Length)) > 0)
- destination.Write (buf, 0, r);
- }
- }
-}
+++ /dev/null
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output
- encoding="UTF-8"
- indent="yes"
- method="xml"
- omit-xml-declaration="yes"
- />
-
- <xsl:template match="Page">
- <html>
- <head>
- <title>
- <xsl:value-of select="Title" />
- </title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <xsl:call-template name="create-default-style" />
- <xsl:call-template name="create-default-script" />
- </head>
- <body>
- <!-- HEADER -->
- <xsl:call-template name="create-default-collection-title" />
- <xsl:call-template name="create-index" />
- <xsl:call-template name="create-default-title" />
- <xsl:call-template name="create-default-summary" />
- <xsl:call-template name="create-default-signature" />
- <xsl:call-template name="create-default-remarks" />
- <xsl:call-template name="create-default-members" />
- <hr size="1" />
- <xsl:call-template name="create-default-copyright" />
- </body>
- </html>
- </xsl:template>
-
- <!-- IDENTITY TRANSFORMATION -->
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()" />
- </xsl:copy>
- </xsl:template>
-
- <xsl:template name="create-default-style">
- <style>
- a { text-decoration: none }
-
- div.SideBar {
- padding-left: 1em;
- padding-right: 1em;
- right: 0;
- float: right;
- border: thin solid black;
- background-color: #f2f2f2;
- }
-
- .CollectionTitle { font-weight: bold }
- .PageTitle { font-size: 150%; font-weight: bold }
-
- .Summary { }
- .Signature { }
- .Remarks { }
- .Members { }
- .Copyright { }
-
- .Section { font-size: 125%; font-weight: bold }
- p.Summary {
- margin-left: 1em;
- }
- .SectionBox { margin-left: 2em }
- .NamespaceName { font-size: 105%; font-weight: bold }
- .NamespaceSumary { }
- .MemberName { font-size: 115%; font-weight: bold; margin-top: 1em }
- .Subsection { font-size: 105%; font-weight: bold }
- .SubsectionBox { margin-left: 2em; margin-bottom: 1em }
-
- .CodeExampleTable { background-color: #f5f5dd; border: thin solid black; padding: .25em; }
-
- .TypesListing {
- border-collapse: collapse;
- }
-
- td {
- vertical-align: top;
- }
- th {
- text-align: left;
- }
-
- .TypesListing td {
- margin: 0px;
- padding: .25em;
- border: solid gray 1px;
- }
-
- .TypesListing th {
- margin: 0px;
- padding: .25em;
- background-color: #f2f2f2;
- border: solid gray 1px;
- }
-
- div.Footer {
- border-top: 1px solid gray;
- margin-top: 1.5em;
- padding-top: 0.6em;
- text-align: center;
- color: gray;
- }
-
- span.NotEntered /* Documentation for this section has not yet been entered */ {
- font-style: italic;
- color: red;
- }
-
- div.Header {
- background: #B0C4DE;
- border: double;
- border-color: white;
- border-width: 7px;
- padding: 0.5em;
- }
-
- div.Header * {
- font-size: smaller;
- }
-
- div.Note {
- }
-
- i.ParamRef {
- }
-
- i.subtitle {
- }
-
- ul.TypeMembersIndex {
- text-align: left;
- background: #F8F8F8;
- }
-
- ul.TypeMembersIndex li {
- display: inline;
- margin: 0.5em;
- }
-
- table.HeaderTable {
- }
-
- table.SignatureTable {
- }
-
- table.Documentation, table.Enumeration, table.TypeDocumentation {
- border-collapse: collapse;
- width: 100%;
- }
-
- table.Documentation tr th, table.TypeMembers tr th, table.Enumeration tr th, table.TypeDocumentation tr th {
- background: whitesmoke;
- padding: 0.8em;
- border: 1px solid gray;
- text-align: left;
- vertical-align: bottom;
- }
-
- table.Documentation tr td, table.TypeMembers tr td, table.Enumeration tr td, table.TypeDocumentation tr td {
- padding: 0.5em;
- border: 1px solid gray;
- text-align: left;
- vertical-align: top;
- }
-
- table.TypeMembers {
- border: 1px solid #C0C0C0;
- width: 100%;
- }
-
- table.TypeMembers tr td {
- background: #F8F8F8;
- border: white;
- }
-
- table.Documentation {
- }
-
- table.TypeMembers {
- }
-
- div.CodeExample {
- width: 100%;
- border: 1px solid #DDDDDD;
- background-color: #F8F8F8;
- }
-
- div.CodeExample p {
- margin: 0.5em;
- border-bottom: 1px solid #DDDDDD;
- }
-
- div.CodeExample div {
- margin: 0.5em;
- }
-
- h4 {
- margin-bottom: 0;
- }
-
- div.Signature {
- border: 1px solid #C0C0C0;
- background: #F2F2F2;
- padding: 1em;
- }
- </style>
- </xsl:template>
-
- <xsl:template name="create-default-script">
- <script type="text/JavaScript">
- function toggle_display (block) {
- var w = document.getElementById (block);
- var t = document.getElementById (block + ":toggle");
- if (w.style.display == "none") {
- w.style.display = "block";
- t.innerHTML = "⊟";
- } else {
- w.style.display = "none";
- t.innerHTML = "⊞";
- }
- }
- </script>
- </xsl:template>
-
- <xsl:template name="create-index">
- <xsl:if test="
- count(PageTitle/@id) > 0 and
- (count(Signature/@id) > 0 or count(Signature/div/@id) > 0) and
- count(Remarks/@id) > 0 and
- count(Members/@id) > 0
- ">
- <div class="SideBar">
- <p>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:value-of select="PageTitle/@id" />
- </xsl:attribute>
- <xsl:text>Overview</xsl:text>
- </a>
- </p>
- <p>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:value-of select="Signature/@id" />
- <xsl:value-of select="Signature/div/@id" />
- </xsl:attribute>
- <xsl:text>Signature</xsl:text>
- </a>
- </p>
- <p>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:value-of select="Remarks/@id" />
- </xsl:attribute>
- <xsl:text>Remarks</xsl:text>
- </a>
- </p>
- <p>
- <a href="#Members">Members</a>
- </p>
- <p>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:value-of select="Members/@id" />
- </xsl:attribute>
- <xsl:text>Member Details</xsl:text>
- </a>
- </p>
- </div>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="create-default-collection-title">
- <div class="CollectionTitle">
- <xsl:apply-templates select="CollectionTitle/node()" />
- </div>
- </xsl:template>
-
- <xsl:template name="create-default-title">
- <h1 class="PageTitle">
- <xsl:if test="count(PageTitle/@id) > 0">
- <xsl:attribute name="id">
- <xsl:value-of select="PageTitle/@id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="PageTitle/node()" />
- </h1>
- </xsl:template>
-
- <xsl:template name="create-default-summary">
- <p class="Summary">
- <xsl:if test="count(Summary/@id) > 0">
- <xsl:attribute name="id">
- <xsl:value-of select="Summary/@id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="Summary/node()" />
- </p>
- </xsl:template>
-
- <xsl:template name="create-default-signature">
- <div>
- <xsl:if test="count(Signature/@id) > 0">
- <xsl:attribute name="id">
- <xsl:value-of select="Signature/@id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="Signature/node()" />
- </div>
- </xsl:template>
-
- <xsl:template name="create-default-remarks">
- <div class="Remarks">
- <xsl:if test="count(Remarks/@id) > 0">
- <xsl:attribute name="id">
- <xsl:value-of select="Remarks/@id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="Remarks/node()" />
- </div>
- </xsl:template>
-
- <xsl:template name="create-default-members">
- <div class="Members">
- <xsl:if test="count(Members/@id) > 0">
- <xsl:attribute name="id">
- <xsl:value-of select="Members/@id" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="Members/node()" />
- </div>
- </xsl:template>
-
- <xsl:template name="create-default-copyright">
- <div class="Copyright">
- <xsl:apply-templates select="Copyright/node()" />
- </div>
- </xsl:template>
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Author: John Luke <john.luke@gmail.com>
-This is a (not very strict) schema for the monodoc
-ecma-provider format.
-TODO:
-make base type for summary, remarks, returns, etc
-alias duplicate attributes
-make stricter in order and occurance
-add masterdoc support?
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
- <!-- define attributes -->
- <xs:attribute name="preserve-mono" type="xs:string" />
- <xs:attribute name="license" type="xs:string" />
- <xs:attribute name="from" type="xs:string" />
- <xs:attribute name="modified" type="xs:boolean" />
- <xs:attribute name="argnames" type="xs:string" />
- <xs:attribute name="cref" type="xs:string" />
- <xs:attribute name="Deprecated" type="xs:boolean" />
- <xs:attribute name="FullName" type="xs:string" />
- <xs:attribute name="FullNameSP" type="xs:string" />
- <xs:attribute name="id" type="xs:string" />
- <xs:attribute name="inherited" type="xs:string" />
- <xs:attribute name="language" type="xs:string" />
- <xs:attribute name="Language" type="xs:string" />
- <xs:attribute name="lang" type="xs:string" />
- <xs:attribute name="langword" type="xs:string" />
- <xs:attribute name="Library" type="xs:string" />
- <xs:attribute name="location" type="xs:string" />
- <xs:attribute name="Maintainer" type="xs:string" />
- <xs:attribute name="MemberName" type="xs:string" />
- <xs:attribute name="name" type="xs:string" />
- <xs:attribute name="Name" type="xs:string" />
- <xs:attribute name="namespace" type="xs:string" />
- <xs:attribute name="propertytype" type="xs:string" />
- <xs:attribute name="qualify" type="xs:boolean" />
- <xs:attribute name="RefType" type="xs:string" />
- <xs:attribute name="returntype" type="xs:string" />
- <xs:attribute name="source" type="xs:string" />
- <xs:attribute name="src" type="xs:string" />
- <xs:attribute name="subset" type="xs:string" />
- <xs:attribute name="Value" type="xs:string" />
- <xs:attribute name="version" type="xs:string" />
- <xs:attribute name="tool" type="xs:string" />
- <xs:attribute name="type" type="xs:string" />
- <xs:attribute name="Type" type="xs:string" />
- <xs:attribute name="TypeParamName" type="xs:string" />
-
- <!-- define simple elements -->
- <xs:element name="AssemblyName" type="xs:string" />
- <xs:element name="AssemblyPublicKey" type="xs:string" />
- <xs:element name="AssemblyVersion" type="xs:string" />
- <xs:element name="AssemblyCulture" type="xs:string" />
- <xs:element name="AttributeName" type="xs:string" />
- <xs:element name="BaseTypeName" type="xs:string" />
- <xs:element name="Excluded" type="xs:string" />
- <xs:element name="ExcludedBaseTypeName" type="xs:string" />
- <xs:element name="ExcludedLibrary" type="xs:string" />
- <xs:element name="ExcludedLibraryName" type="xs:string" />
- <xs:element name="ExcludedTypeName" type="xs:string" />
- <xs:element name="i" type="xs:string" />
- <xs:element name="InterfaceName" type="xs:string" />
- <xs:element name="li" type="xs:string" />
- <xs:element name="MemberOfLibrary" type="xs:string" />
- <xs:element name="MemberType" type="xs:string" />
- <xs:element name="MemberValue" type="xs:string" />
- <xs:element name="onequarter" />
- <xs:element name="PRE" />
- <xs:element name="permille" />
- <xs:element name="pi" />
- <xs:element name="pre" />
- <xs:element name="ReturnType" type="xs:string" />
- <xs:element name="TypeExcluded" type="xs:string" />
-
- <!-- define complex elements -->
- <xs:element name="altcompliant">
- <xs:complexType>
- <xs:attribute ref="cref" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="altmember">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute ref="cref" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="AssemblyInfo">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="AssemblyName" minOccurs="0" />
- <xs:element ref="AssemblyPublicKey" minOccurs="0" />
- <xs:element ref="AssemblyVersion" minOccurs="0" maxOccurs="unbounded" />
- <xs:element ref="AssemblyCulture" minOccurs="0" />
- <xs:element ref="Attributes" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Attribute">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="AttributeName" />
- <xs:element ref="Excluded" minOccurs="0" />
- <xs:element ref="ExcludedTypeName" minOccurs="0" />
- <xs:element ref="ExcludedLibraryName" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Attributes">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Attribute" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Base">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="BaseTypeName" minOccurs="0" />
- <xs:element ref="BaseTypeArguments" minOccurs="0" />
- <xs:element ref="ExcludedBaseTypeName" minOccurs="0" />
- <xs:element ref="ExcludedLibraryName" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="BaseTypeArgument">
- <xs:complexType mixed="true">
- <xs:attribute ref="TypeParamName" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="BaseTypeArguments">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="BaseTypeArgument" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="block">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="code" />
- <xs:element ref="format" />
- <xs:element ref="list" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="subscript" />
- <xs:element ref="sup" />
- <xs:element ref="pi" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- <xs:attribute ref="subset" />
- <xs:attribute ref="type" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="c">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="code" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="class">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="constructor" />
- <xs:element ref="property" />
- <xs:element ref="method" />
- <xs:element ref="field" />
- <xs:element ref="operator" />
- <xs:element ref="event" />
- <xs:element ref="enum" />
- <xs:element ref="class" />
- <xs:element ref="struct" />
- <xs:element ref="interface" />
- <xs:element ref="delegate" />
- </xs:choice>
- <xs:attribute ref="name" />
- <xs:attribute ref="namespace" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="code">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute ref="lang" />
- <xs:attribute ref="language" />
- <xs:attribute ref="source" />
- <xs:attribute ref="src" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="constructor">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="argnames" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="delegate">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element ref="constructor" />
- <xs:element ref="method" />
- <xs:element ref="property" />
- <xs:element ref="operator" />
- </xs:choice>
- <xs:attribute ref="name" />
- <xs:attribute ref="namespace" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="description">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="c" />
- <xs:element ref="block" />
- <xs:element ref="geq" />
- <xs:element ref="leq" />
- <xs:element ref="paramref" />
- <xs:element ref="para" />
- <xs:element ref="permille" />
- <xs:element ref="plusminus" />
- <xs:element ref="SPAN" />
- <xs:element ref="see" />
- <xs:element ref="sub" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Docs">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="summary" />
- <xs:element ref="param" />
- <xs:element ref="exception" />
- <xs:element ref="returns" />
- <xs:element ref="remarks" />
- <xs:element ref="example" />
- <xs:element ref="value" />
- <xs:element ref="permission" />
- <xs:element ref="PermissionSet" />
- <xs:element ref="altmember" />
- <xs:element ref="altcompliant" />
- <xs:element ref="since" />
- <xs:element ref="threadsafe" />
- <xs:element ref="typeparam" />
- <xs:element ref="filterpriority" />
- <xs:element ref="related" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:simpleType name="relatedType">
- <xs:restriction base="xs:string">
- <!-- External code/application samples -->
- <xs:enumeration value="sample"/>
- <!-- e.g. ECMA, OPC, OData, ... specs -->
- <xs:enumeration value="specification"/>
- <!-- e.g. Apple/Android documentation -->
- <xs:enumeration value="externalDocumentation" />
- <!-- e.g. a more in-depth article at docs.xamarin.com -->
- <xs:enumeration value="article" />
- <!-- e.g. a small article describing succintly a feature -->
- <xs:enumeration value="recipe" />
- </xs:restriction>
- </xs:simpleType>
-
- <xs:element name="related">
- <xs:complexType mixed="true">
- <xs:attribute name="type" type="relatedType" />
- <xs:attribute name="href" type="xs:anyURI" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="enum">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="field" />
- <xs:element ref="method" />
- </xs:choice>
- <xs:attribute ref="name" />
- <xs:attribute ref="namespace" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="event">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="inherited" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="example">
- <xs:complexType mixed="true">
- <xs:choice maxOccurs="unbounded">
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="code" />
- <xs:element ref="codelink" />
- <xs:element ref="c" />
- <xs:element ref="list" />
- <xs:element ref="see" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="exception">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="format" />
- <xs:element ref="list" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="SPAN" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- <xs:attribute ref="cref" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="field">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="inherited" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="format">
- <xs:complexType>
- <xs:sequence>
- <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
- </xs:sequence>
- <xs:attribute ref="type" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="interface">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="constructor" />
- <xs:element ref="property" />
- <xs:element ref="method" />
- <xs:element ref="field" />
- <xs:element ref="event" />
- </xs:choice>
- <xs:attribute ref="name" />
- <xs:attribute ref="namespace" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Interface">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="InterfaceName" />
- <xs:element ref="Excluded" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Interfaces">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Interface" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="item">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="term" minOccurs="1" maxOccurs="1" />
- <xs:element ref="description" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="link">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute ref="location" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="list">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="listheader" minOccurs="0" maxOccurs="1" />
- <xs:element ref="item" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="type" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="listheader">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="term" />
- <xs:element ref="description" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="masterdoc">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="class" />
- <xs:element ref="delegate" />
- <xs:element ref="interface" />
- <xs:element ref="struct" />
- <xs:element ref="enum" />
- </xs:choice>
- <xs:attribute name="assembly" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="MemberSignature">
- <xs:complexType>
- <xs:attribute ref="Language" />
- <xs:attribute ref="Value" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Link">
- <xs:complexType>
- <xs:attribute ref="Type" use="required" />
- <xs:attribute name="Member" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Member">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="MemberSignature" minOccurs="1" maxOccurs="unbounded" />
- <xs:element ref="MemberType" maxOccurs="1" />
- <xs:element ref="AssemblyInfo" minOccurs="0" maxOccurs="1" />
- <xs:element ref="Attributes" minOccurs="0" maxOccurs="1" />
- <xs:element ref="ReturnValue" minOccurs="0" maxOccurs="1" />
- <xs:element ref="TypeParameters" minOccurs="0" maxOccurs="1" />
- <xs:element ref="Parameters" minOccurs="0" maxOccurs="1" />
- <xs:element ref="MemberValue" minOccurs="0" maxOccurs="1" />
- <xs:element ref="Docs" maxOccurs="1" />
- <xs:element ref="Excluded" minOccurs="0" maxOccurs="1" />
- <xs:element ref="ExcludedLibrary" minOccurs="0" maxOccurs="unbounded" />
- <xs:element ref="Link" minOccurs="0" maxOccurs="1" />
- </xs:sequence>
- <xs:attribute ref="MemberName" />
- <xs:attribute ref="Deprecated" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Members">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Member" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="method">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="argnames" />
- <xs:attribute ref="inherited" />
- <xs:attribute ref="returntype" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Namespace">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Docs" maxOccurs="1" />
- </xs:sequence>
- <xs:attribute ref="Name" />
- <xs:attribute ref="FullName" />
- <xs:attribute ref="FullNameSP" />
- <xs:attribute ref="Maintainer" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="operator">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="argnames" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="para">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="i" />
- <xs:element ref="format" />
- <xs:element ref="see" />
- <xs:element ref="geq" />
- <xs:element ref="leq" />
- <xs:element ref="list" />
- <xs:element ref="link" />
- <xs:element ref="ul" />
- <xs:element ref="paramref" />
- <xs:element ref="c" />
- <xs:element ref="onequarter" />
- <xs:element ref="sub" />
- <xs:element ref="superscript" />
- <xs:element ref="sup" />
- <xs:element ref="permille" />
- <xs:element ref="plusminus" />
- <xs:element ref="SPAN" />
- <xs:element ref="pi" />
- <xs:element ref="theta" />
- <xs:element ref="typeparamref" />
- <xs:element ref="whitespace" />
- <xs:element ref="img" />
- </xs:choice>
- <xs:attribute ref="id" />
- <xs:attribute ref="tool" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="img">
- <xs:complexType>
- <xs:attribute name="href" type="xs:string" use="required" />
- <xs:attribute name="class" type="xs:string" use="optional" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="param">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="c" />
- <xs:element ref="format" />
- <xs:element ref="see" />
- <xs:element ref="block" />
- <xs:element ref="geq" />
- <xs:element ref="leq" />
- <xs:element ref="paramref" />
- <xs:element ref="plusminus" />
- <xs:element ref="para" />
- <xs:element ref="SPAN" />
- <xs:element ref="typeparamref" />
- <xs:element ref="whitespace" />
- <xs:element ref="attribution" />
- </xs:choice>
- <xs:attribute ref="preserve-mono" />
- <xs:attribute ref="name" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="paramref">
- <xs:complexType>
- <xs:attribute ref="name" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Parameter">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Attributes" minOccurs="0" maxOccurs="1" />
- </xs:sequence>
- <xs:attribute ref="Name" />
- <xs:attribute ref="Type" />
- <xs:attribute ref="RefType" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Parameters">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="Parameter" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="permission">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- <xs:attribute ref="cref" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="property">
- <xs:complexType>
- <xs:attribute ref="name" />
- <xs:attribute ref="inherited" />
- <xs:attribute ref="propertytype" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="remarks">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="code" />
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="PRE" />
- <xs:element ref="pre" />
- <xs:element ref="see" />
- <xs:element ref="ul" />
- <xs:element ref="example" />
- <xs:element ref="list" />
- <xs:element ref="SPAN" />
- <xs:element ref="typeparamref" />
- <xs:element ref="attribution" />
- </xs:choice>
- <xs:attribute ref="preserve-mono" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="attribution">
- <xs:complexType mixed="true">
- <xs:attribute ref="license" />
- <xs:attribute ref="from" />
- <xs:attribute ref="modified" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="returns">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="c" />
- <xs:element ref="format" />
- <xs:element ref="geq" />
- <xs:element ref="leq" />
- <xs:element ref="list" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="pi" />
- <xs:element ref="see" />
- <xs:element ref="theta" />
- <xs:element ref="typeparamref" />
- <xs:element ref="ul" />
- <xs:element ref="whitespace" />
- <xs:element ref="attribution" />
- </xs:choice>
- <xs:attribute ref="preserve-mono" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ReturnValue">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="ReturnType" minOccurs="0" maxOccurs="1" />
- <xs:element ref="Attributes" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="see">
- <xs:complexType>
- <xs:attribute ref="cref" />
- <xs:attribute ref="langword" />
- <xs:attribute ref="qualify" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="since">
- <xs:complexType>
- <xs:attribute ref="version" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="SPAN">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="SPAN" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- <xs:attribute ref="version" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="struct">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="constructor" />
- <xs:element ref="property" />
- <xs:element ref="method" />
- <xs:element ref="field" />
- <xs:element ref="operator" />
- <xs:element ref="struct" />
- <xs:element ref="class" />
- </xs:choice>
- <xs:attribute ref="name" />
- <xs:attribute ref="namespace" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="sub">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="paramref" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="subscript">
- <xs:complexType>
- <xs:attribute name="term" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="summary">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- <xs:element ref="ul" />
- <xs:element ref="list" />
- <xs:element ref="attribution" />
- </xs:choice>
- <xs:attribute ref="preserve-mono" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="sup">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="i" />
- <xs:element ref="paramref" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="superscript">
- <xs:complexType>
- <xs:attribute name="term" type="xs:string" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="term">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="format" />
- <xs:element ref="geq" />
- <xs:element ref="leq" />
- <xs:element ref="see" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="pi" />
- <xs:element ref="plusminus" />
- <xs:element ref="sup" />
- <xs:element ref="theta" />
- <xs:element ref="typeparamref" />
- <xs:element ref="whitespace" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="theta" />
-
- <xs:element name="threadsafe">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="para" minOccurs="1" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ThreadingSafetyStatement">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:element ref="link" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ThreadSafetyStatement">
- <xs:complexType mixed="true">
- <xs:sequence>
- <xs:element ref="link" minOccurs="0" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Type">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element ref="TypeSignature" minOccurs="1" />
- <xs:element ref="MemberOfLibrary" minOccurs="0" />
- <xs:element ref="AssemblyInfo" minOccurs="1" />
- <xs:element ref="TypeParameters" minOccurs="0" maxOccurs="1" />
- <xs:element ref="ThreadingSafetyStatement" minOccurs="0" />
- <xs:element ref="ThreadSafetyStatement" minOccurs="0" />
- <xs:element ref="Docs" minOccurs="1" />
- <xs:element ref="Base" minOccurs="1" />
- <xs:element ref="Interfaces" minOccurs="1" />
- <xs:element ref="Attributes" minOccurs="1" />
- <xs:element ref="Members" minOccurs="1" />
- <xs:element ref="Parameters" minOccurs="0" />
- <xs:element ref="ReturnValue" minOccurs="0" />
- <xs:element ref="TypeExcluded" minOccurs="0" />
- </xs:choice>
- <xs:attribute ref="Name" use="required" />
- <xs:attribute ref="FullName" use="required" />
- <xs:attribute ref="FullNameSP" />
- <xs:attribute ref="Maintainer" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Types">
- <xs:complexType>
- <xs:choice minOccurs="1" maxOccurs="unbounded">
- <xs:element ref="Type" />
- </xs:choice>
- <xs:attribute ref="Library" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="typeparam">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="format" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- </xs:choice>
- <xs:attribute ref="name" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="typeparamref">
- <xs:complexType>
- <xs:attribute ref="name" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="TypeParameters">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element ref="TypeParameter" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="TypeParameter">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="Attributes" />
- <xs:element ref="Constraints" />
- </xs:choice>
- <xs:attribute ref="Name" use="required" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Constraints">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="ParameterAttribute" type="xs:string" />
- <xs:element ref="BaseTypeName" />
- <xs:element ref="InterfaceName" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="TypeSignature">
- <xs:complexType>
- <xs:attribute ref="Language" use="required" />
- <xs:attribute ref="Value" use="required" />
- <xs:attribute ref="Maintainer" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ul">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="li" minOccurs="1" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="value">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="c" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- <xs:element ref="ul" />
- <xs:element ref="example" />
- <xs:element ref="list" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <!--
- index.xml & namespace-name.xml support
- -->
-
- <!-- define attributes -->
- <xs:attribute name="Version" type="xs:string" />
- <xs:attribute name="DisplayName" type="xs:string" />
- <xs:attribute name="Kind" type="xs:string" />
-
- <!-- define simple elements -->
- <xs:element name="Title" type="xs:string" />
-
- <!-- define complex elements -->
- <xs:element name="Assemblies">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="Assembly" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Assembly">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="AssemblyPublicKey" />
- <xs:element ref="AssemblyCulture" />
- <xs:element ref="Attributes" />
- </xs:choice>
- <xs:attribute ref="Name" />
- <xs:attribute ref="Version" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Copyright">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="code" />
- <xs:element ref="example" />
- <xs:element ref="list" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="see" />
- <xs:element ref="typeparamref" />
- <xs:element ref="ul" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ExtensionMethods">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="ExtensionMethod" minOccurs="0" maxOccurs="unbounded" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="ExtensionMethod">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Targets" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:choice minOccurs="1" maxOccurs="unbounded">
- <xs:element name="Target">
- <xs:complexType>
- <xs:attribute ref="Type" use="required" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <xs:element ref="Member" minOccurs="1" maxOccurs="1" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Overview">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="Assemblies" />
- <xs:element ref="Copyright" />
- <xs:element ref="Remarks" />
- <xs:element ref="Title" />
- <xs:element name="Types">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Namespace">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Type">
- <xs:complexType>
- <xs:attribute ref="Name" use="required" />
- <xs:attribute ref="DisplayName" />
- <xs:attribute ref="Kind" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- <xs:attribute ref="Name" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <xs:element ref="ExtensionMethods" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="Remarks">
- <xs:complexType mixed="true">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="block" />
- <xs:element ref="code" />
- <xs:element ref="example" />
- <xs:element ref="list" />
- <xs:element ref="para" />
- <xs:element ref="paramref" />
- <xs:element ref="typeparamref" />
- <xs:element ref="see" />
- <xs:element ref="ul" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <!--
- ECMA 335 CLILibraryTypes.xml support
- -->
-
- <xs:element name="Libraries">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="Types" minOccurs = "1" maxOccurs="unbounded" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="codelink">
- <xs:complexType>
- <xs:attribute name="SampleID" type="xs:string" />
- <xs:attribute name="SnippedID" type="xs:string" />
- </xs:complexType>
- </xs:element>
-
- <xs:element name="filterpriority" type="xs:string" />
-
- <xs:element name="geq" />
- <xs:element name="leq" />
- <xs:element name="plusminus" />
- <xs:element name="whitespace" />
-
- <xs:element name="PermissionSet">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="IPermission">
- <xs:complexType>
- <xs:attribute name="class" type="xs:string" />
- <xs:attribute name="Flags" type="xs:string" />
- <xs:attribute name="Name" type="xs:string" />
- <xs:attribute name="PathDiscovery" type="xs:string" />
- <xs:attribute name="PublicKeyBlob" type="xs:string" />
- <xs:attribute name="Read" type="xs:string" />
- <xs:attribute name="Unrestricted" type="xs:string" />
- <xs:attribute name="version" type="xs:string" />
- <xs:attribute name="Window" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- </xs:element>
-
- <!--
- ECMA 334 Annex E Documentation Comments support.
- -->
-
- <xs:element name="seealso">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute ref="cref" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="doc">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="assembly">
- <xs:complexType>
- <xs:choice>
- <xs:element name="name" type="xs:string" />
- </xs:choice>
- </xs:complexType>
- </xs:element>
- <xs:element name="members">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="member">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="seealso" />
- <xs:element ref="example" />
- <xs:element ref="exception" />
- <xs:element ref="param" />
- <xs:element ref="permission" />
- <xs:element ref="PermissionSet" />
- <xs:element ref="remarks" />
- <xs:element ref="returns" />
- <xs:element ref="summary" />
- <xs:element ref="threadsafe" />
- <xs:element ref="typeparam" />
- <xs:element ref="value" />
- </xs:choice>
- <xs:attribute name="name" type="xs:string" />
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
-
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- Converts the "Microsoft Internal XML Documentation Format" into the
- "Microsoft XML Documentation Format".
-
- The "Microsoft Internal XML Documentation Format" (msidoc) is whatever XML
- format is used within Microsoft to document the BCL, as deduced from reading
- their ECMA documentation dump.
-
- The "Microsoft XML Documentation Format" (msxdoc) is what 'gmcs /doc'
- produces, and is documented in ECMA 334 §E.
-
- msidoc is similar, but not identical to, msxdoc. For example, where msxdoc
- uses <see cref="FOO"/>, msidoc uses
- <codeEntityReference>FOO</codeEntityReference>. They also introduce
- additional "wrapping" elements in various places (e.g. <content/>), useful
- extensions (such as documenting method overload lists), and other oddities.
- -->
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- xmlns:authoring="http://ddue.schemas.microsoft.com/authoring/2003/5"
- exclude-result-prefixes="msxsl authoring"
- >
-
- <xsl:output omit-xml-declaration="yes" />
-
- <xsl:template match="assembly" />
- <xsl:template match="authoring:changeHistory" />
- <xsl:template match="authoring:clsCompliantAlternative" />
- <xsl:template match="authoring:internalOnly" />
- <xsl:template match="authoring:notesForCallers" />
- <xsl:template match="authoring:notesForImplementers" />
- <xsl:template match="authoring:notesForInheritors" />
- <xsl:template match="authoring:overload" />
- <xsl:template match="authoring:platformNotes" />
- <xsl:template match="authoring:relatedTopics" />
- <xsl:template match="authoring:sections" />
-
- <xsl:template match="member">
- <!-- skip Overload: members, as these have no msxdoc equivalent. -->
- <xsl:if test="not (starts-with (@name, 'Overload:'))">
- <member name="{@name}">
- <xsl:apply-templates />
- </member>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="authoring:remarks">
- <remarks>
- <xsl:apply-templates />
- <xsl:for-each select="../authoring:notesForInheritors">
- <block subset="none" type="overrides">
- <xsl:apply-templates />
- </block>
- </xsl:for-each>
- <xsl:for-each select="../authoring:notesForImplementers">
- <block subset="none" type="behaviors">
- <xsl:apply-templates />
- </block>
- </xsl:for-each>
- <xsl:for-each select="../authoring:notesForCallers">
- <block subset="none" type="usage">
- <xsl:apply-templates />
- </block>
- </xsl:for-each>
- </remarks>
- </xsl:template>
-
- <xsl:template match="authoring:dduexml" >
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:codeEntityReference">
- <see cref="{.}" />
- </xsl:template>
-
- <xsl:template match="authoring:equivalentCodeEntity">
- <seealso cref="{authoring:codeEntityReference}" />
- </xsl:template>
-
- <xsl:template match="authoring:codeInline">
- <c>
- <xsl:apply-templates />
- </c>
- </xsl:template>
-
- <xsl:template match="authoring:codeReference">
- <code src="{.}" />
- </xsl:template>
-
- <xsl:template match="authoring:parameters">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:parameter">
- <param name="{authoring:parameterReference}">
- <xsl:for-each select="*">
- <xsl:if test="not (position () = 1)">
- <xsl:apply-templates />
- </xsl:if>
- </xsl:for-each>
- </param>
- </xsl:template>
-
- <xsl:template match="authoring:genericParameters">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:genericParameter">
- <typeparam name="{authoring:parameterReference}">
- <xsl:for-each select="*">
- <xsl:if test="not (position () = 1)">
- <xsl:apply-templates />
- </xsl:if>
- </xsl:for-each>
- </typeparam>
- </xsl:template>
-
- <xsl:template match="authoring:parameterReference">
- <paramref name="{.}" />
- </xsl:template>
-
- <xsl:template match="authoring:returnValue">
- <returns>
- <xsl:apply-templates />
- </returns>
- </xsl:template>
-
- <xsl:template match="authoring:exceptions">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:exception">
- <exception cref="{authoring:codeEntityReference}">
- <xsl:apply-templates select="authoring:content" />
- </exception>
- </xsl:template>
-
- <xsl:template match="authoring:codeExamples">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:codeExample">
- <xsl:choose>
- <xsl:when test="count(authoring:legacy) > 0">
- </xsl:when>
- <xsl:otherwise>
- <example>
- <xsl:apply-templates select="authoring:description/authoring:content" />
- <xsl:apply-templates select="authoring:codeReference" />
- </example>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="authoring:content">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:languageKeyword">
- <see langword="{.}" />
- </xsl:template>
-
- <xsl:template match="authoring:table">
- <list type="table">
- <xsl:apply-templates />
- </list>
- </xsl:template>
-
- <xsl:template match="authoring:tableHeader">
- <listheader>
- <xsl:for-each select="authoring:row/authoring:entry">
- <xsl:choose>
- <xsl:when test="position() = 1">
- <term>
- <xsl:apply-templates />
- </term>
- </xsl:when>
- <xsl:otherwise>
- <description>
- <xsl:apply-templates />
- </description>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </listheader>
- </xsl:template>
-
- <xsl:template match="authoring:row">
- <item>
- <xsl:for-each select="authoring:entry">
- <xsl:choose>
- <xsl:when test="position() = 1">
- <term>
- <xsl:apply-templates />
- </term>
- </xsl:when>
- <xsl:otherwise>
- <description>
- <xsl:apply-templates />
- </description>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </item>
- </xsl:template>
-
- <xsl:template match="authoring:list">
- <list type="{@class}">
- <xsl:apply-templates />
- </list>
- </xsl:template>
-
- <xsl:template match="authoring:listItem">
- <item><term>
- <xsl:apply-templates />
- </term></item>
- </xsl:template>
-
- <xsl:template match="authoring:alert">
- <block subset="none" type="note">
- <xsl:apply-templates />
- </block>
- </xsl:template>
-
- <xsl:template match="authoring:permissions">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="authoring:permission">
- <permission cref="{authoring:codeEntityReference}">
- <xsl:apply-templates select="authoring:content" />
- </permission>
- </xsl:template>
-
- <xsl:template match="authoring:threadSafety">
- <threadsafe>
- <xsl:apply-templates />
- </threadsafe>
- </xsl:template>
-
- <xsl:template match="authoring:embeddedLabel">
- <i>
- <xsl:value-of select="." />
- <xsl:text>:</xsl:text>
- </i>
- </xsl:template>
-
- <xsl:template match="authoring:externalLink">
- <format type="text/html">
- <a href="{authoring:linkUri}">
- <xsl:value-of select="authoring:linkText" />
- </a>
- </format>
- </xsl:template>
-
- <xsl:template match="authoring:legacyLink">
- <i>
- <xsl:value-of select="." />
- </i>
- </xsl:template>
-
- <xsl:template match="authoring:legacyItalic">
- <i>
- <xsl:value-of select="." />
- </i>
- </xsl:template>
-
- <xsl:template match="authoring:token">
- <xsl:choose>
- <xsl:when test=". = 'compact_v20_long'">
- <xsl:text>.NET Compact Framework version 2.0</xsl:text>
- </xsl:when>
- <xsl:when test=". = 'compact_v35_long'">
- <xsl:text>.NET Compact Framework version 3.5</xsl:text>
- </xsl:when>
- <xsl:when test=". = 'dnprdnext'">
- <xsl:text>.NET Framework version 2.0</xsl:text>
- </xsl:when>
- <xsl:when test=". = 'vbprvbext'">
- <xsl:text>Microsoft Visual Basic 2005</xsl:text>
- </xsl:when>
- <xsl:when test=". = 'vbprvblong'">
- <xsl:text>Visual Basic 2005</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>UNKNOWN_TOKEN(</xsl:text>
- <xsl:value-of select="." />
- <xsl:text>)</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- cute trick to remove the xmlns attributes on copied nodes. -->
- <xsl:template match="*">
- <xsl:element name="{local-name()}">
- <xsl:apply-templates />
- </xsl:element>
- </xsl:template>
-</xsl:stylesheet>
-
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- Based on Mono's /monodoc/browser/mono-ecma.xsl file.
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="msxsl"
- >
-
- <xsl:output omit-xml-declaration="yes" />
-
- <xsl:include href="stylesheet.xsl"/>
-
- <xsl:param name="namespace" select="''"/>
-
- <xsl:variable name="max-types">50</xsl:variable>
-
- <xsl:template match="Overview">
- <Page>
-
- <Title>
- <xsl:value-of select="Title"/>
- <xsl:if test="not($namespace='' or $namespace='all' or count(Types/Namespace)=1)">
- <xsl:value-of select="': '"/>
- <xsl:value-of select="$namespace"/>
- </xsl:if>
- </Title>
-
- <CollectionTitle>
- <xsl:if test="not($namespace='' or $namespace='all')">
- <a href="../index.{$ext}"><xsl:value-of select="Title"/></a>
- </xsl:if>
- </CollectionTitle>
-
- <PageTitle>
- <xsl:choose>
- <xsl:when test="not($namespace='' or $namespace='all')">
- <xsl:call-template name="GetNamespaceName">
- <xsl:with-param name="ns" select="$namespace" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="Title"/>
- </xsl:otherwise>
- </xsl:choose>
- </PageTitle>
-
- <!--
- <SideBar>
- <xsl:if test="not($namespace='')">
- <p style="font-weight: bold; border-bottom: thin solid black"><a href="../index.{$ext}"><xsl:value-of select="Assembly"/></a></p>
- <xsl:for-each select="Types/Namespace">
- <xsl:sort select="@Name"/>
- <div>
- <a href="../{@Name}/index.{$ext}">
- <xsl:value-of select="@Name"/>
- </a>
- </div>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="$namespace=''">
- <div class="AssemblyRemarks" style="margin-top: 1em; margin-bottom: 1em">
- <xsl:apply-templates select="Remarks" mode="notoppara"/>
- </div>
- </xsl:if>
- </SideBar>
- -->
-
- <Summary>
- <xsl:if test="$namespace=''">
- <div class="AssemblyRemarks" style="margin-top: 1em; margin-bottom: 1em">
- <xsl:apply-templates select="Remarks" mode="notoppara"/>
- </div>
- </xsl:if>
- </Summary>
-
- <Signature>
- </Signature>
-
- <Remarks>
- <xsl:choose>
- <xsl:when test="Types/Namespace[@Name=$namespace][count(Type)>0] and $namespace != ''">
- <!-- show all types within namespace -->
- <h2 class="Section"><xsl:call-template name="GetNamespaceName" /></h2>
- <xsl:call-template name="CreateNamespaceDetails">
- <xsl:with-param name="ns" select="Types/Namespace[@Name=$namespace]" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="count(Types//Type) < $max-types">
- <!-- index; show all types -->
- <xsl:for-each select="Types/Namespace">
- <xsl:sort select="@Name"/>
- <h2 class="Section"><xsl:call-template name="CreateNamespaceLink" /></h2>
- <xsl:call-template name="CreateNamespaceDetails">
- <xsl:with-param name="ns" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <!-- index; show only namespaces -->
- <xsl:for-each select="Types/Namespace">
- <xsl:sort select="@Name"/>
- <h2 class="Section"><xsl:call-template name="CreateNamespaceLink" /></h2>
- <p><xsl:apply-templates select="document(concat('ns-',@Name,'.xml'), .)/Namespace/Docs/summary" mode="notoppara"/></p>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
-
- </Remarks>
-
- <Members>
- </Members>
-
- <xsl:copy-of select="Copyright"/>
-
- </Page>
-
- </xsl:template>
- <xsl:template name="CreateNamespaceDetails">
- <xsl:param name="ns" />
- <p><xsl:apply-templates select="document(concat('ns-',$ns/@Name,'.xml'), .)/Namespace/Docs/remarks" mode="notoppara"/></p>
-
- <table class="TypesListing" style="margin-top: 1em">
-
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
-
- <xsl:for-each select="$ns/Type">
- <xsl:sort select="@Name"/>
- <tr valign="top">
- <td>
- <xsl:variable name="path">
- <xsl:choose>
- <xsl:when test="$namespace=parent::Namespace/@Name">.</xsl:when>
- <xsl:otherwise><xsl:value-of select="parent::Namespace/@Name"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <a href="{$path}/{@Name}.{$ext}">
- <xsl:choose>
- <xsl:when test="@DisplayName != ''">
- <xsl:value-of select="translate (@DisplayName, '+', '.')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate (@Name, '+', '.')"/>
- </xsl:otherwise>
- </xsl:choose>
- </a>
- </td>
- <td>
- <xsl:variable name="docdir">
- <xsl:choose>
- <xsl:when test="parent::Namespace/@Name = ''">.</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="parent::Namespace/@Name" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:apply-templates select="document(concat($docdir, '/', @Name, '.xml'), .)/Type/Docs/summary" mode="notoppara"/>
- </td>
- </tr>
- </xsl:for-each>
-
- </table>
- </xsl:template>
-
- <xsl:template name="GetNamespaceName">
- <xsl:param name="ns" select="@Name" />
- <xsl:choose>
- <xsl:when test="$ns = ''">
- <xsl:text>Root</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ns" />
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> Namespace</xsl:text>
- </xsl:template>
-
- <xsl:template name="CreateNamespaceLink">
- <xsl:choose>
- <xsl:when test="@Name =''">
- <xsl:call-template name="GetNamespaceName" />
- </xsl:when>
- <xsl:otherwise>
- <a href="{@Name}/index.{$ext}"><xsl:call-template name="GetNamespaceName" /></a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-</xsl:stylesheet>
-
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- Based on Mono's /monodoc/browser/mono-ecma.xsl file.
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="msxsl"
- >
- <xsl:include href="mdoc-html-utils.xsl" />
- <xsl:include href="mdoc-sections-css.xsl" />
-
- <!-- TEMPLATE PARAMETERS -->
-
- <xsl:param name="ext" select="'xml'"/>
- <xsl:param name="basepath" select="'./'"/>
-
- <xsl:param name="Index" />
-
- <!-- The namespace that the current type belongs to. -->
- <xsl:variable name="mono-docs">http://www.go-mono.com/docs/monodoc.ashx?link=</xsl:variable>
-
- <!-- THE MAIN RENDERING TEMPLATE -->
-
- <xsl:template match="Type">
- <xsl:variable name="cref">
- <xsl:text>T:</xsl:text>
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename" select="@FullName" />
- </xsl:call-template>
- </xsl:variable>
-
- <Page>
-
- <Title>
- <xsl:value-of select="translate (@FullName, '+', '.')" />
- </Title>
-
- <CollectionTitle>
- <xsl:variable name="namespace" select="substring-before (@FullName, @Name)" />
- <a>
- <xsl:attribute name="href">
- <xsl:if test="string-length($namespace)">
- <xsl:value-of select="$basepath" />
- </xsl:if>
- <xsl:text>index.</xsl:text>
- <xsl:value-of select="$ext" />
- </xsl:attribute>
- <xsl:value-of select="AssemblyInfo/AssemblyName" />
- </a>
- <xsl:text> : </xsl:text>
- <a href="index.{$ext}"><xsl:value-of select="$TypeNamespace"/> Namespace</a>
- </CollectionTitle>
-
- <PageTitle>
- <xsl:attribute name="id">
- <xsl:value-of select="$cref" />
- </xsl:attribute>
- <xsl:value-of select="translate (@Name, '+', '.')"/>
- <xsl:text xml:space="preserve"> </xsl:text>
- <xsl:if test="count(Docs/typeparam) > 0">Generic</xsl:if>
- <xsl:text xml:space="preserve"> </xsl:text>
- <xsl:call-template name="GetTypeDescription" />
- </PageTitle>
-
- <!--
- <SideBar>
- <p style="font-weight: bold; border-bottom: thin solid black"><a href="index.{$ext}"><xsl:value-of select="$TypeNamespace"/></a></p>
-
- <xsl:for-each select="document('index.xml',.)/Overview/Types/Namespace[@Name=$TypeNamespace]/Type">
- <xsl:sort select="@Name"/>
- <div>
- <a href="../{parent::Namespace/@Name}/{@Name}.{$ext}">
- <xsl:value-of select="@Name"/>
- </a>
- </div>
- </xsl:for-each>
- </SideBar>
- -->
-
- <!-- TYPE OVERVIEW -->
-
- <Summary id="Summary">
- <xsl:attribute name="id">
- <xsl:value-of select="concat ($cref, ':Summary')" />
- </xsl:attribute>
- <!-- summary -->
- <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
- </Summary>
-
- <Signature>
- <xsl:call-template name="CreateTypeSignature" />
- </Signature>
-
- <Remarks>
- <xsl:attribute name="id">
- <xsl:value-of select="concat ($cref, ':Docs')" />
- </xsl:attribute>
- <xsl:call-template name="DisplayDocsInformation">
- <xsl:with-param name="linkid" select="concat ($cref, ':Docs')" />
- </xsl:call-template>
-
- <!-- MEMBER LISTING -->
- <xsl:if test="not(Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate' or Base/BaseTypeName='System.Enum')">
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Members'"/>
- <xsl:with-param name="id" select="'Members'"/>
- <xsl:with-param name="child-id" select="'_Members'"/>
- <xsl:with-param name="content">
- <xsl:if test="Base/BaseTypeName">
- <p>
- See Also: Inherited members from
- <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
- </p>
- </xsl:if>
-
- <!-- list each type of member (public, then protected) -->
-
- <xsl:call-template name="ListAllMembers">
- <xsl:with-param name="html-anchor" select="true()" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- </Remarks>
-
- <Members>
- <!-- MEMBER DETAILS -->
- <xsl:attribute name="id">
- <xsl:value-of select="concat ($cref, ':Members')" />
- </xsl:attribute>
- <xsl:if test="not(Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate' or Base/BaseTypeName='System.Enum')">
- <xsl:variable name="Type" select="."/>
-
- <xsl:call-template name="CreateH2Section">
- <xsl:with-param name="name" select="'Member Details'"/>
- <xsl:with-param name="id" select="'MemberDetails'"/>
- <xsl:with-param name="child-id" select="'_MemberDetails'"/>
- <xsl:with-param name="content">
- <xsl:for-each select="Members/Member[MemberType != 'ExtensionMethod']">
-
- <xsl:variable name="linkid">
- <xsl:call-template name="GetLinkId">
- <xsl:with-param name="type" select="../.." />
- <xsl:with-param name="member" select="." />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="CreateH3Section">
- <xsl:with-param name="id" select="$linkid" />
- <xsl:with-param name="child-id" select="concat($linkid, ':member')" />
- <xsl:with-param name="class" select="MemberName" />
- <xsl:with-param name="name">
- <xsl:choose>
- <xsl:when test="MemberType='Constructor'">
- <xsl:call-template name="GetConstructorName">
- <xsl:with-param name="type" select="../.." />
- <xsl:with-param name="ctor" select="." />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
- <xsl:text>Conversion</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@MemberName"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text xml:space="preserve"> </xsl:text>
- <xsl:if test="count(Docs/typeparam) > 0">
- <xsl:text>Generic </xsl:text>
- </xsl:if>
- <xsl:value-of select="MemberType" />
- </xsl:with-param>
- <xsl:with-param name="ref" select="." />
- <xsl:with-param name="content">
- <xsl:call-template name="CreateMemberOverview" />
- <xsl:call-template name="CreateMemberSignature">
- <xsl:with-param name="linkid" select="$linkid" />
- </xsl:call-template>
- <xsl:call-template name="DisplayDocsInformation">
- <xsl:with-param name="linkid" select="$linkid" />
- </xsl:call-template>
- <hr size="1"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- </Members>
-
- <Copyright>
- </Copyright>
-
- </Page>
- </xsl:template>
-
- <xsl:template name="GetLinkTarget">
- <xsl:param name="type" />
- <xsl:param name="cref" />
- <xsl:param name="xmltarget" select="false()"/>
- <!-- Search for type in the index.xml file. -->
- <xsl:variable name="typeentry-rtf">
- <xsl:call-template name="FindTypeInIndex">
- <xsl:with-param name="type" select="$type" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="typeentry" select="msxsl:node-set($typeentry-rtf)" />
-
- <xsl:choose>
- <xsl:when test="$xmltarget and count($typeentry/Type)">
- <xsl:value-of select="concat($typeentry/Type/@Namespace, '/', $typeentry/Type/@Name, '.xml')" />
- </xsl:when>
- <xsl:when test="$xmltarget" />
- <xsl:when test="starts-with ($cref, 'N:')">
- <xsl:variable name="namespace">
- <xsl:call-template name="FindNamespaceInIndex">
- <xsl:with-param name="namespace" select="substring-after ($cref, 'N:')" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="string($namespace) != ''">
- <xsl:if test="$TypeNamespace != ''">
- <xsl:value-of select="$basepath" />
- </xsl:if>
- <xsl:value-of select="concat ($namespace, '/index.', $ext)" />
- </xsl:if>
- </xsl:when>
- <xsl:when test="count($typeentry/Type)">
- <xsl:if test="string-length ($typeentry/Type/@Namespace)">
- <xsl:value-of select="$basepath" />
- <xsl:value-of select="$typeentry/Type/@Namespace" />
- <xsl:text>/</xsl:text>
- </xsl:if>
- <xsl:value-of select="$typeentry/Type/@Name"/>
- <xsl:text>.</xsl:text>
- <xsl:value-of select="$ext" />
- <xsl:if test="string-length ($cref) > 0 and substring ($cref, 1, 2) != 'T:'">
- <xsl:text>#</xsl:text>
- <xsl:call-template name="GetActualCref">
- <xsl:with-param name="cref" select="$cref" />
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
-
- <xsl:when test="starts-with($type, 'System.') or
- starts-with($type, 'Cairo.') or starts-with ($type, 'Commons.Xml.') or
- starts-with($type, 'Mono.GetOptions.') or starts-with($type,'Mono.Math.') or
- starts-with($type, 'Mono.Posix.') or starts-with($type, 'Mono.Remoting.') or
- starts-with($type, 'Mono.Security.') or starts-with($type, 'Mono.Unix.') or
- starts-with($type, 'Mono.Xml.')">
- <xsl:value-of select="$mono-docs" />
- <xsl:value-of select="$cref" />
- </xsl:when>
- <!--<xsl:otherwise>javascript:alert("Documentation not found for <xsl:value-of select="$type"/>.")</xsl:otherwise>-->
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="FindTypeInIndex">
- <xsl:param name="type" />
-
- <xsl:for-each select="$Index//Type">
- <xsl:variable name="nsp">
- <xsl:choose>
- <xsl:when test="string-length (parent::Namespace/@Name) = 0" />
- <xsl:otherwise>
- <xsl:value-of select="parent::Namespace/@Name" />
- <xsl:text>.</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="concat($nsp, translate(@Name, '+', '.')) = $type">
- <Type Name="{@Name}" Namespace="{parent::Namespace/@Name}" />
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="FindNamespaceInIndex">
- <xsl:param name="namespace" />
-
- <xsl:for-each select="$Index//Namespace">
- <xsl:if test="@Name = $namespace">
- <xsl:value-of select="@Name" />
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="GetActualCref">
- <xsl:param name="cref" />
-
- <xsl:variable name="fullname">
- <xsl:choose>
- <xsl:when test="starts-with($cref, 'C:') or starts-with($cref, 'T:')">
- <xsl:choose>
- <xsl:when test="contains($cref, '(')">
- <xsl:value-of select="substring (substring-before ($cref, '('), 3)" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring($cref, 3)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="GetTypeName">
- <xsl:with-param name="type" select="substring($cref, 3)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="escaped-type">
- <xsl:call-template name="GetEscapedTypeName">
- <xsl:with-param name="typename">
- <xsl:call-template name="ToBrackets">
- <xsl:with-param name="s" select="$fullname" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:value-of select="substring ($cref, 1, 2)" />
- <xsl:value-of select="$escaped-type" />
- <xsl:value-of select="substring-after ($cref, $fullname)" />
- </xsl:template>
-
- <xsl:template name="CreateCodeBlock">
- <xsl:param name="language" />
- <xsl:param name="content" />
- <table class="CodeExampleTable">
- <tr><td><b><font size="-1"><xsl:value-of select="$language"/> Example</font></b></td></tr>
- <tr><td>
- <pre>
- <xsl:attribute name="class">
- <xsl:call-template name="GetCodeClass">
- <xsl:with-param name="lang" select="$language" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:value-of select="$content" />
- </pre>
- </td></tr>
- </table>
- </xsl:template>
-
- <xsl:template name="CreateEditLink">
- <!-- ignore -->
- </xsl:template>
-
- <xsl:template name="CreateExpandedToggle">
- <xsl:text>⊟</xsl:text>
- </xsl:template>
-
- <xsl:template name="GetCodeClass">
- <xsl:param name="lang" />
-
- <xsl:choose>
- <xsl:when test="$lang = 'C#' or $lang = 'csharp'">
- <xsl:text>code-csharp</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
-</xsl:stylesheet>
-mdoc: The element 'Docs' has invalid child element 'extra'. List of possible elements expected: 'summary, param, exception, returns, remarks, example, value, permission, PermissionSet, altmember, altcompliant, since, threadsafe, typeparam, filterpriority, related'.
+mdoc: The element 'Docs' has invalid child element 'extra'. List of possible elements expected: 'summary, param, exception, returns, remarks, example, value, permission, PermissionSet, altmember, altcompliant, since, threadsafe, typeparam, filterpriority, related, forInternalUseOnly'.
Total validation errors: 1
--- /dev/null
+namespace Mono.Cecil
+{
+ static partial class Mixin {
+
+ public static bool IsTypeSpecification (this TypeReference type)
+ {
+ return type is GenericParameter || type is TypeSpecification;
+ }
+ }
+}
\ No newline at end of file
../../build/common/Consts.cs
../../class/Mono.Options/Mono.Options/Options.cs
-Mono.Documentation/assembler.cs
-Mono.Documentation/dump.cs
-Mono.Documentation/ecmadoc.cs
-Mono.Documentation/exceptions.cs
-Mono.Documentation/index.cs
-Mono.Documentation/mdoc.cs
-Mono.Documentation/MdocFile.cs
-Mono.Documentation/monodocer.cs
-Mono.Documentation/monodocs2html.cs
-Mono.Documentation/monodocs2slashdoc.cs
-Mono.Documentation/msitomsx.cs
-Mono.Documentation/normalize.cs
-Mono.Documentation/validate.cs
-Mono.Documentation/webdoc.cs
-Mono.Documentation/XhtmlWriter.cs
-Mono.Documentation/preserver.cs
-Mono.Rocks/ObjectRocks.cs
-Mono.Rocks/StreamRocks.cs
+
+../../../external/cecil/rocks/Mono.Cecil.Rocks/DocCommentId.cs
+
+../../../external/api-doc-tools/mdoc/Mono.Documentation/assembler.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/dump.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/ecmadoc.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/exceptions.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/index.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/frameworksbootstrapper.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/mdoc.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/MdocFile.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/monodocer.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/monodocs2html.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/monodocs2slashdoc.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/msitomsx.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/normalize.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/validate.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/webdoc.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/XhtmlWriter.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/Frameworks/AssemblySet.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/Frameworks/FrameworkEntry.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/Frameworks/FrameworkIndex.cs
+../../../external/api-doc-tools/mdoc/Mono.Documentation/Frameworks/FrameworkTypeEntry.cs
+
+../../../external/api-doc-tools/mdoc/Mono.Rocks/ObjectRocks.cs
+../../../external/api-doc-tools/mdoc/Mono.Rocks/StreamRocks.cs
+
+cecil.mixin.cs
\ No newline at end of file