本文整理汇总了C#中Monodoc.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于Monodoc命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetHtml
public static string GetHtml (string url, HelpSource helpSource, out Node match)
{
string htmlContent = null;
match = null;
if (helpSource != null)
htmlContent = AppDelegate.Root.RenderUrl (url, generator, out match, helpSource);
if (htmlContent == null) {
// the displayed url have a lower case type code (e.g. t: instead of T:) which confuse monodoc
if (url.Length > 2 && url[1] == ':')
url = char.ToUpperInvariant (url[0]) + url.Substring (1);
// It may also be url encoded so decode it
url = Uri.UnescapeDataString (url);
htmlContent = AppDelegate.Root.RenderUrl (url, generator, out match, helpSource);
if (htmlContent != null && match != null && match.Tree != null)
helpSource = match.Tree.HelpSource;
}
if (htmlContent == null)
return null;
var html = new StringWriter ();
html.Write ("<html>\n<head><title>{0}</title>", url);
if (helpSource != null) {
if (HtmlGenerator.InlineCss != null)
html.Write (" <style type=\"text/css\">{0}</style>\n", HtmlGenerator.InlineCss);
/*if (helpSource.InlineJavaScript != null)
html.Write ("<script type=\"text/JavaScript\">{0}</script>\n", helpSource.InlineJavaScript);*/
}
html.Write ("</head><body>");
html.Write (htmlContent);
html.Write ("</body></html>\n");
return html.ToString ();
}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:35,代码来源:DocTools.cs
示例2: Tree
/// <summary>
/// Load from file constructor
/// </summary>
public Tree (HelpSource hs, string filename)
{
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 version information
if (InputReader.ReadInt32 () == -(int)'v')
VersionNumber = InputReader.ReadInt64 ();
else
InputStream.Position -= 4;
var position = InputReader.ReadInt32 ();
rootNode = new Node (this, position);
InflateNode (rootNode);
}
开发者ID:somnathpanja,项目名称:mono,代码行数:30,代码来源:Tree.cs
示例3: GetText
public override string GetText (string url, out Node match_node)
{
match_node = null;
string c = GetCachedText (url);
if (c != null)
return c;
if (url.IndexOf (MAN_PREFIX) > -1)
return GetTextFromUrl (url);
if (url == "root:") {
// display an index of sub-nodes.
StringBuilder buf = new StringBuilder ();
buf.Append ("<table bgcolor=\"#b0c4de\" width=\"100%\" cellpadding=\"5\"><tr><td><h3>Mono Documentation Library</h3></td></tr></table>");
buf.Append ("<p>Available man pages:</p>").Append ("<blockquote>");
foreach (Node n in Tree.Nodes) {
buf.Append ("<a href=\"").Append (n.Element).Append ("\">")
.Append (n.Caption).Append ("</a><br/>");
}
buf.Append ("</blockquote>");
return buf.ToString ();
}
return null;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:25,代码来源:man-provider.cs
示例4: GetHtml
public static string GetHtml (string url, HelpSource helpSource, out Node match)
{
string htmlContent = null;
match = null;
if (helpSource != null)
htmlContent = helpSource.GetText (url, out match);
if (htmlContent == null){
htmlContent = AppDelegate.Root.RenderUrl (url, out match);
if (htmlContent != null && match != null && match.tree != null){
helpSource = match.tree.HelpSource;
}
}
if (htmlContent == null)
return null;
var html = new StringWriter ();
html.Write ("<html>\n<head><title>{0}</title>", url);
if (helpSource != null){
if (helpSource.InlineCss != null)
html.Write (" <style type=\"text/css\">{0}</style>\n", helpSource.InlineCss);
if (helpSource.InlineJavaScript != null)
html.Write ("<script type=\"text/JavaScript\">{0}</script>\n", helpSource.InlineJavaScript);
}
html.Write ("</head><body>");
html.Write (htmlContent);
html.Write ("</body></html>\n");
return html.ToString ();
}
开发者ID:kangaroo,项目名称:monomac,代码行数:31,代码来源:DocTools.cs
示例5: GetText
public override string GetText (string url, out Node match_node)
{
string ret = null;
match_node = null;
if (url.StartsWith ("ecmaspec:")) {
match_node = MatchNode (Tree, url);
ret = GetTextFromUrl (url);
}
if (url == "root:") {
if (use_css)
ret = "<div id=\"ecmaspec\" class=\"header\"><div class=\"title\">C# Language Specification</div></div>";
else
ret = "<table width=\"100%\" bgcolor=\"#b0c4de\" cellpadding=\"5\"><tr><td><h3>C# Language Specification</h3></tr></td></table>";
match_node = Tree;
}
if (ret != null && match_node != null && match_node.Nodes != null && match_node.Nodes.Count > 0) {
ret += "<p>In This Section:</p><ul>\n";
foreach (Node child in match_node.Nodes) {
ret += "<li><a href=\"" + child.URL + "\">" + child.Caption + "</a></li>\n";
}
ret += "</ul>\n";
}
if (ret != null)
return BuildHtml (css_ecmaspec_code, ret);
else
return null;
}
开发者ID:carrie901,项目名称:mono,代码行数:31,代码来源:ecmaspec-provider.cs
示例6: GetText
public override string GetText (string url, out Node match_node)
{
match_node = null;
string c = GetCachedText (url);
if (c != null)
return c;
if (url == "root:") {
StringBuilder sb = new StringBuilder ();
sb.Append ("<table width=\"100%\" bgcolor=\"#b0c4de\" cellpadding=\"5\"><tr><td><h3>Mono Handbook</h3></tr></td></table>");
foreach (Node n in Tree.Nodes) {
if (n.IsLeaf) {
sb.AppendFormat ("<a href='{0}'>{1}</a><br/>",
n.Element.Replace ("source-id:NNN", "source-id:" + SourceID),
n.Caption);
} else {
sb.AppendFormat ("<h2>{0}</h2>", n.Caption);
foreach (Node subNode in n.Nodes) {
sb.AppendFormat ("<a href='{0}'>{1}</a><br/>",
subNode.Element.Replace ("source-id:NNN", "source-id:" + SourceID),
subNode.Caption);
}
}
}
return sb.ToString ();
}
if (url.IndexOf (XHTML_PREFIX) > -1)
return GetTextFromUrl (url);
return null;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:34,代码来源:xhtml-provider.cs
示例7: PopulateNode
void PopulateNode (XPathNodeIterator nodes, Node treeNode)
{
while (nodes.MoveNext ()) {
XPathNavigator n = nodes.Current;
string secNumber = n.GetAttribute ("number", ""),
secName = n.GetAttribute ("name", "");
treeNode.tree.HelpSource.Message (TraceLevel.Info, "\tSection: " + secNumber);
treeNode.tree.HelpSource.PackFile (Path.Combine (basedir, secNumber + ".xml"), secNumber);
Node thisNode = treeNode.LookupNode (secNumber + ": " + secName, "ecmaspec:" + secNumber);
if (n.HasChildren)
PopulateNode (n.SelectChildren ("node", ""), thisNode);
}
}
开发者ID:carrie901,项目名称:mono,代码行数:15,代码来源:ecmaspec-provider.cs
示例8: GetImageKeyFromNode
internal static string GetImageKeyFromNode(Node node)
{
if (node.Caption.EndsWith (" Class"))
return "class.png";
if (node.Caption.EndsWith (" Interface"))
return "interface.png";
if (node.Caption.EndsWith (" Structure"))
return "structure.png";
if (node.Caption.EndsWith (" Enumeration"))
return "enumeration.png";
if (node.Caption.EndsWith (" Delegate"))
return "delegate.png";
var url = node.PublicUrl;
if (!string.IsNullOrEmpty (url) && url.StartsWith ("N:"))
return "namespace.png";
return null;
}
开发者ID:alfredodev,项目名称:mono-tools,代码行数:17,代码来源:UIUtils.cs
示例9: GetParentImageKeyFromNode
internal static string GetParentImageKeyFromNode(Node node)
{
switch (node.Caption) {
case "Methods":
case "Constructors":
return "method.png";
case "Properties":
return "property.png";
case "Events":
return "event.png";
case "Members":
return "members.png";
case "Fields":
return "field.png";
}
return null;
}
开发者ID:alfredodev,项目名称:mono-tools,代码行数:18,代码来源:UIUtils.cs
示例10: Tree
/// <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);
}
开发者ID:nlhepler,项目名称:mono,代码行数:45,代码来源:Tree.cs
示例11: GetHtml
public static string GetHtml (string url, HelpSource helpSource, out Node match)
{
Console.WriteLine ("Calling URL {0} with HelpSource {1}", url, helpSource == null ? "(null)" : helpSource.Name);
string htmlContent = null;
match = null;
if (helpSource != null)
htmlContent = helpSource.GetText (url, out match);
if (htmlContent == null){
// the displayed url have a lower case type code (e.g. t: instead of T:) which confuse monodoc
if (url.Length > 2 && url[1] == ':')
url = char.ToUpperInvariant (url[0]) + url.Substring (1);
// It may also be url encoded so decode it
url = Uri.UnescapeDataString (url);
htmlContent = Program.Root.RenderUrl (url, out match);
if (htmlContent != null && match != null && match.tree != null){
helpSource = match.tree.HelpSource;
}
}
if (htmlContent == null)
return null;
var html = new StringWriter ();
html.Write ("<html>\n<head><title>{0}</title>", url);
if (helpSource != null){
if (helpSource.InlineCss != null)
html.Write (" <style type=\"text/css\">{0}</style>\n", helpSource.InlineCss);
if (helpSource.InlineJavaScript != null)
html.Write ("<script type=\"text/JavaScript\">{0}</script>\n", helpSource.InlineJavaScript);
}
html.Write ("</head><body>");
html.Write (htmlContent);
html.Write ("</body></html>\n");
return html.ToString ();
}
开发者ID:remobjects,项目名称:mono-tools,代码行数:38,代码来源:DocTools.cs
示例12: PopulateDir
#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);
}
}
开发者ID:emtees,项目名称:old-code,代码行数:25,代码来源:simple-provider.cs
示例13: GetText
public override string GetText (string url, out Node match_node) {
if (url == "root:") {
match_node = null;
//load index.xml
XmlDocument index = new XmlDocument ();
index.Load (Path.Combine (basedir.FullName, "index.xml"));
XmlNodeList nodes = index.SelectNodes ("/Overview/Types/Namespace");
//recreate masteroverview.xml
XmlDocument summary = new XmlDocument ();
XmlElement elements = summary.CreateElement ("elements");
foreach (XmlNode node in nodes) {
XmlElement ns = summary.CreateElement ("namespace");
XmlAttribute attr = summary.CreateAttribute ("ns");
attr.Value = EcmaDoc.GetDisplayName (node);
ns.Attributes.Append (attr);
elements.AppendChild (ns);
}
summary.AppendChild (elements);
XmlReader reader = new XmlTextReader (new StringReader (summary.OuterXml));
//transform the recently created masteroverview.xml
XsltArgumentList args = new XsltArgumentList();
args.AddExtensionObject("monodoc:///extensions", ExtObject);
args.AddParam("show", "", "masteroverview");
string s = Htmlize(reader, args);
return BuildHtml (css_ecma_code, js_code, s);
}
return base.GetText(url, out match_node);
}
开发者ID:RAOF,项目名称:mono,代码行数:32,代码来源:ecma-provider.cs
示例14: LargeName
//
// Extract a large name for the Node
// (copied from mono-tools/docbrowser/browser.Render()
static string LargeName (Node matched_node)
{
string[] parts = matched_node.URL.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;
}
}
开发者ID:RAOF,项目名称:mono,代码行数:14,代码来源:ecma-provider.cs
示例15: ShowNode
internal void ShowNode (Node n)
{
if (n == null)
return;
if (!nodeToWrapper.ContainsKey (n))
ShowNode (n.Parent);
// If the dictionary still doesn't contain anything about us, time to leave
if (!nodeToWrapper.ContainsKey (n))
return;
var item = nodeToWrapper [n];
outlineView.ExpandItem (item);
// Focus the last child, then this child to ensure we show as much as possible
if (n.Nodes.Count > 0)
ScrollToVisible ((Node) n.Nodes [n.Nodes.Count-1]);
var row = ScrollToVisible (n);
ignoreSelect = true;
outlineView.SelectRows (new NSIndexSet (row), false);
ignoreSelect = false;
}
开发者ID:roblillack,项目名称:monomac,代码行数:22,代码来源:MyDocument.cs
示例16: RenderTypeLookup
//
// This routine has to perform a lookup on a type.
//
// Example: T:System.Text.StringBuilder
//
// The prefix is the kind of opereation being requested (T:, E:, M: etc)
// ns is the namespace being looked up
// type is the type being requested
//
// This has to walk our toplevel (which is always a namespace)
// And then the type space, and then walk further down depending on the request
//
public override string RenderTypeLookup (string prefix, string ns, string type, string member, out Node match_node)
{
string url = GetUrlForType (prefix, ns, type, member, out match_node);
if (url == null) return null;
return GetTextFromUrl (url);
}
开发者ID:RAOF,项目名称:mono,代码行数:18,代码来源:ecma-provider.cs
示例17: PopulateClass
void PopulateClass (Tree tree, string ns, Node ns_node, string file)
{
XmlDocument doc = new XmlDocument ();
doc.Load (file);
string name = EcmaDoc.GetClassName (doc);
string assembly = EcmaDoc.GetClassAssembly (doc);
string kind = EcmaDoc.GetTypeKind (doc);
string full = EcmaDoc.GetFullClassName (doc);
Node class_node;
string file_code = ns_node.tree.HelpSource.PackFile (file);
XmlNode class_summary = detached.ImportNode (doc.SelectSingleNode ("/Type/Docs/summary"), true);
ArrayList l = (ArrayList) class_summaries [ns];
if (l == null){
l = new ArrayList ();
class_summaries [ns] = (object) l;
}
l.Add (new TypeInfo (kind, assembly, full, name, class_summary));
class_node = ns_node.LookupNode (String.Format ("{0} {1}", name, kind), "ecma:" + file_code + "#" + name + "/");
if (kind == "Delegate") {
if (doc.SelectSingleNode("/Type/ReturnValue") == null)
tree.HelpSource.Message (TraceLevel.Error, "Delegate " + name + " does not have a ReturnValue node. See the ECMA-style updates.");
}
if (kind == "Enumeration")
return;
if (kind == "Delegate")
return;
//
// Always add the Members node
//
class_node.CreateNode ("Members", "*");
PopulateMember (doc, name, class_node, "Constructor", "Constructors");
PopulateMember (doc, name, class_node, "Method", "Methods");
PopulateMember (doc, name, class_node, "Property", "Properties");
PopulateMember (doc, name, class_node, "Field", "Fields");
PopulateMember (doc, name, class_node, "Event", "Events");
PopulateMember (doc, name, class_node, "Operator", "Operators");
}
开发者ID:RAOF,项目名称:mono,代码行数:46,代码来源:ecma-provider.cs
示例18: PopulateMember
//
// Performs an XPath query on the document to extract the nodes for the various members
// we also use some extra text to pluralize the caption
//
void PopulateMember (XmlDocument doc, string typename, Node node, string type, string caption)
{
string select = type;
if (select == "Operator") select = "Method";
XmlNodeList list1 = doc.SelectNodes (String.Format ("/Type/Members/Member[MemberType=\"{0}\"]", select));
ArrayList list = new ArrayList();
int i = 0;
foreach (XmlElement n in list1) {
n.SetAttribute("assembler_index", (i++).ToString());
if (type == "Method" && GetMemberName(n).StartsWith("op_")) continue;
if (type == "Operator" && !GetMemberName(n).StartsWith("op_")) continue;
list.Add(n);
}
int count = list.Count;
if (count == 0)
return;
Node nodes_node;
string key = type.Substring (0, 1);
nodes_node = node.CreateNode (caption, key);
switch (type) {
case "Event":
case "Field":
foreach (XmlElement n in list)
nodes_node.CreateNode (GetMemberName (n), n.GetAttribute("assembler_index"));
break;
case "Constructor":
foreach (XmlElement n in list)
nodes_node.CreateNode (EcmaHelpSource.MakeSignature(n, typename), n.GetAttribute("assembler_index"));
break;
case "Property": // properties with indexers can be overloaded too
case "Method":
case "Operator":
foreach (XmlElement n in list) {
bool multiple = false;
foreach (XmlNode nn in list) {
if (n != nn && GetMemberName(n) == nn.Attributes ["MemberName"].InnerText) {
multiple = true;
break;
}
}
string group, name, sig;
if (type != "Operator") {
name = GetMemberName(n);
sig = EcmaHelpSource.MakeSignature(n, null);
group = name;
} else {
EcmaHelpSource.MakeOperatorSignature(n, out name, out sig);
group = name;
}
if (multiple) {
nodes_node.LookupNode (group, group)
.CreateNode (sig, n.GetAttribute("assembler_index"));
} else {
nodes_node.CreateNode (name, n.GetAttribute("assembler_index"));
}
}
foreach (Node n in nodes_node.Nodes) {
if (!n.IsLeaf)
n.Sort ();
}
break;
default:
throw new InvalidOperationException();
}
nodes_node.Sort ();
}
开发者ID:RAOF,项目名称:mono,代码行数:83,代码来源:ecma-provider.cs
示例19: Tree
public Tree (HelpSource hs, Node parent, string caption, string element) : base (parent, caption, element)
{
HelpSource = hs;
}
开发者ID:wamiq,项目名称:debian-mono,代码行数:4,代码来源:provider.cs
示例20: RenderMemberLookup
string RenderMemberLookup (string typename, string member, ref Node type_node)
{
if (type_node.Nodes == null)
return null;
string membername = member;
string[] argtypes = null;
if (member.IndexOf("(") > 0) {
membername = membername.Substring(0, member.IndexOf("("));
member = member.Replace("@", "&");
// reform the member signature with CTS names
string x = member.Substring(member.IndexOf("(")+1);
argtypes = x.Substring(0, x.Length-1).Split(',', ':'); // operator signatures have colons
if (membername == ".ctor")
membername = typename;
member = membername + "(";
for (int i = 0; i < argtypes.Length; i++) {
argtypes[i] = EcmaDoc.ConvertCTSName(argtypes[i]);
if (i > 0) member += ",";
member += argtypes[i];
}
member += ")";
}
// Check if a node caption matches exactly
bool isoperator = false;
if ((membername == "op_Implicit" || membername == "op_Explicit") && argtypes.Length == 2) {
isoperator = true;
membername = "Conversion";
member = argtypes[0] + " to " + argtypes[1];
} else if (membername.StartsWith("op_")) {
isoperator = true;
membername = membername.Substring(3);
}
foreach (Node x in type_node.Nodes){
if (x.Nodes == null)
continue;
if (isoperator && x.Caption != "Operators")
continue;
foreach (Node m in x.Nodes) {
string caption = m.Caption;
string ecaption = ToEscapedMemberName (caption);
if (m.IsLeaf) {
// No overloading (usually), is just the member name. The whole thing for constructors.
if (caption == membername || caption == member ||
ecaption == membername || ecaption == member) {
type_node = m;
return GetTextFromUrl (m.URL);
}
} else if (caption == member || ecaption == member) {
// Though there are overloads, no arguments are in the url, so use this base node
type_node = m;
return GetTextFromUrl (m.URL);
} else {
// Check subnodes which are the overloads -- must match signature
foreach (Node mm in m.Nodes) {
ecaption = ToEscapedTypeName (mm.Caption);
if (mm.Caption == member || ecaption == member) {
type_node = mm;
return GetTextFromUrl (mm.URL);
}
}
}
}
}
return null;
}
开发者ID:RAOF,项目名称:mono,代码行数:76,代码来源:ecma-provider.cs
注:本文中的Monodoc.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论