当前位置: 首页>>代码示例>>C#>>正文


C# Monodoc.Node类代码示例

本文整理汇总了C#中Monodoc.Node的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于Monodoc命名空间,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Monodoc.Node类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。