本文整理汇总了C#中Monodoc.Tree类的典型用法代码示例。如果您正苦于以下问题:C# Tree类的具体用法?C# Tree怎么用?C# Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于Monodoc命名空间,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateTree
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;
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))
nodeToAddChildrenTo.tree.HelpSource.PackFile (page.Value, name.Value);
}
}
}
示例2: PopulateTree
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);
}
示例3: TestTreeLoading
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);
}
示例4: PopulateTree
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);
}
}
示例5: Main
static int Main (string [] args)
{
int argc = args.Length;
Tree t = null;
for (int i = 0; i < argc; i++){
string arg = args [i];
switch (arg){
default:
if (t == null)
t = new Tree (null, arg);
break;
}
}
if (t != null)
Node.PrintTree (t);
return 0;
}
示例6: PopulateTree
public override void PopulateTree (Tree tree)
{
string fileId = tree.tree.HelpSource.PackFile (file);
XmlDocument doc = new XmlDocument ();
doc.Load (file);
foreach (XmlElement addin in doc.SelectNodes ("Addins/Addin")) {
string addinId = addin.GetAttribute ("fullId");
Node newNode = tree.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);
}
}
}
}
示例7: Run
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);
}
}
}
示例8: HelpSource
public HelpSource (string base_filename, bool create)
{
this.name = Path.GetFileName (base_filename);
tree_filename = base_filename + ".tree";
zip_filename = base_filename + ".zip";
if (create)
SetupForOutput ();
else
Tree = new Tree (this, tree_filename);
source_id = id++;
try {
FileInfo fi = new FileInfo (zip_filename);
zipFileWriteTime = fi.LastWriteTime;
} catch {
zipFileWriteTime = DateTime.Now;
}
}
示例9: AddImageFiles
void AddImageFiles (HelpSource hs, Tree tree)
{
foreach (string asm in asm_dirs) {
string path = Path.Combine (asm, "_images");
if (!Directory.Exists (path))
return;
#if NET_2_0
foreach (var img in Directory.GetFiles (path))
#else
foreach (var img in Directory.EnumerateFiles (path))
#endif
hs.PackFile (img, Path.GetFileName (img));
}
}
示例10: CloseTree
//
// Packs a file with the summary data
//
public override void CloseTree (HelpSource hs, Tree tree)
{
foreach (DictionaryEntry de in class_summaries){
XmlDocument doc = new XmlDocument ();
string ns = (string) de.Key;
ArrayList list = (ArrayList) de.Value;
list.Sort();
XmlElement elements = doc.CreateElement ("elements");
doc.AppendChild (elements);
if (namespace_summaries [ns] != null)
elements.AppendChild (doc.ImportNode ((XmlNode)namespace_summaries [ns],true));
else
elements.AppendChild (doc.CreateElement("summary"));
if (namespace_remarks [ns] != null)
elements.AppendChild (doc.ImportNode ((XmlNode)namespace_remarks [ns],true));
else
elements.AppendChild (doc.CreateElement("remarks"));
hs.Message (TraceLevel.Info, "Have {0} elements in the {1}", list.Count, ns);
foreach (TypeInfo p in list){
XmlElement e = null;
switch (p.type_kind){
case "Class":
e = doc.CreateElement ("class");
break;
case "Enumeration":
e = doc.CreateElement ("enum");
break;
case "Structure":
e = doc.CreateElement ("struct");
break;
case "Delegate":
e = doc.CreateElement ("delegate");
break;
case "Interface":
e = doc.CreateElement ("interface");
break;
}
e.SetAttribute ("name", p.type_name);
e.SetAttribute ("fullname", p.type_full);
e.SetAttribute ("assembly", p.type_assembly);
XmlNode copy = doc.ImportNode (p.type_doc, true);
e.AppendChild (copy);
elements.AppendChild (e);
}
hs.PackXml ("xml.summary." + ns, doc,(string) namespace_realpath[ns]);
}
XmlDocument nsSummary = new XmlDocument ();
XmlElement root = nsSummary.CreateElement ("elements");
nsSummary.AppendChild (root);
foreach (DictionaryEntry de in namespace_summaries) {
XmlNode n = (XmlNode)de.Value;
XmlElement summary = nsSummary.CreateElement ("namespace");
summary.SetAttribute ("ns", (string)de.Key);
root.AppendChild (summary);
if (n != null)
summary.AppendChild (nsSummary.ImportNode (n,true));
else
summary.AppendChild (nsSummary.CreateElement("summary"));
}
tree.HelpSource.PackXml ("mastersummary.xml", nsSummary, null);
AddExtensionMethods (tree);
AddImageFiles (hs, tree);
}
示例11: CloseTree
public override void CloseTree (HelpSource hs, Tree tree)
{
Hashtable entries = config.Compile ();
MemoryStream ms = new MemoryStream ();
XmlSerializer writer = new XmlSerializer (typeof (ErrorDocumentation));
foreach (DictionaryEntry de in entries) {
ErrorDocumentation d = (ErrorDocumentation)de.Value;
string s = (string)de.Key;
tree.LookupNode (s, "error:" + s);
writer.Serialize (ms, d);
ms.Position = 0;
hs.PackStream (ms, s);
ms.SetLength (0);
}
tree.Sort ();
}
示例12: CloseTree
//
// 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);
示例13: SetupForOutput
void SetupForOutput ()
{
Tree = new Tree (this, "", "");
FileStream stream = File.Create (zip_filename);
zip_output = new ZipOutputStream (stream);
zip_output.SetLevel (9);
buffer = new byte [buffer_size];
}
示例14: PrintTree
public static void PrintTree (Tree t)
{
TreeDumper.PrintTree (t.RootNode);
}
示例15: HelpSource
public HelpSource (string base_filename, bool create)
{
this.name = Path.GetFileName (base_filename);
tree_filename = base_filename + ".tree";
zip_filename = base_filename + ".zip";
base_dir = XmlDocUtils.GetCacheDirectory (base_filename);
if (UseWebdocCache && !create && Directory.Exists (base_dir)) {
nozip = true;
}
if (create)
SetupForOutput ();
else
Tree = new Tree (this, tree_filename);
source_id = id++;
try {
FileInfo fi = new FileInfo (zip_filename);
zipFileWriteTime = fi.LastWriteTime;
} catch {
zipFileWriteTime = DateTime.Now;
}
}